---
title: "Self-hosted MCP gateway: options and what it takes"
description: Docker MCP Gateway and IBM’s ContextForge are the main open source MCP gateways you can self-host. What each covers, and the auth, secrets and logging left to you.
canonical: https://mcp1.com/blog/self-hosted-mcp-gateway
last-updated: 2026-11-19
---

# Self-hosted MCP gateway: options and what it takes

Docker MCP Gateway and IBM’s ContextForge are the main open source MCP gateways you can self-host. What each covers, and the auth, secrets and logging left to you.

![](https://avatars.githubusercontent.com/u/1297371?s=96&v=4)Eldad FuxFounder and CEO, Appwrite

$ docker mcp gateway run \--transport streaming

- Proxy tools/list and tools/call
- OAuth sign-in for every client
- Encrypted upstream tokens
- Per-person tool rules
- Audit log of every call

$ docker mcp gateway run \--transport streaming

- Proxy tools/list and tools/call
- OAuth sign-in for every client
- Encrypted upstream tokens
- Per-person tool rules
- Audit log of every call

You can self-host an MCP gateway with open source projects such as Docker MCP Gateway (MIT) and IBM’s ContextForge (Apache 2.0), or put single servers behind a transport bridge like mcp-proxy. Getting one running takes an afternoon. The ongoing work is around it: signing people in with OAuth, holding each service’s credentials, filtering tools per person, logging every call and keeping a public HTTPS endpoint up.

## What are the open source options?

Three projects cover most self-hosted setups, and they solve different problems:

ProjectWhat it is

Docker MCP Gateway

A Docker CLI plugin, docker mcp, behind Docker Desktop’s MCP Toolkit. Runs each server from Docker’s catalog in its own container, groups servers into profiles, keeps secrets in Docker Desktop, runs OAuth flows to upstream services, and turns single tools on or off per profile.

ContextForge

A Python registry and proxy from IBM that federates MCP servers, A2A agents and REST or gRPC APIs. Bundles tools into virtual servers, has an admin UI, JWT and Basic auth, user-scoped OAuth tokens, rate limiting and OpenTelemetry tracing. Runs from PyPI or containers, with PostgreSQL and Redis for a full stack.

mcp-proxy

A transport bridge: exposes a stdio server over SSE or Streamable HTTP, or the reverse. Not a gateway on its own; its README warns that host checks and CORS don’t authenticate callers by default.

## How do I run Docker MCP Gateway?

Create a profile with the servers you want, then start the gateway with a network transport so more than one client can connect:

Terminal

```
docker mcp profile create --name dev-tools \
  --server catalog://mcp/docker-mcp-catalog/github

docker mcp gateway run --profile dev-tools --port 8080 --transport streaming
```

Clients connect to that port, or `docker mcp client connect claude-code --profile dev-tools` writes a client’s config for you. It needs Docker Desktop 4.59 or later with the MCP Toolkit on; on Docker CE or WSL2, set `DOCKER_MCP_IN_CONTAINER=1` and enable profiles with `docker mcp feature enable profiles`. This is the best fit for one developer, or a team that wants local stdio servers run in containers instead of straight from `npx`.

## How do I run ContextForge?

Generate its two required secrets, then start it. It won’t start without them, even locally:

Terminal

```
python3 -m mcpgateway.scripts.init_secrets   # writes JWT_SECRET_KEY and AUTH_ENCRYPTION_SECRET
MCPGATEWAY_UI_ENABLED=true MCPGATEWAY_ADMIN_API_ENABLED=true \
  uvx --from mcp-contextforge-gateway mcpgateway --host 0.0.0.0 --port 4444
```

You register upstream servers through its admin API or UI, combine their tools into a virtual server, and clients connect to `/servers/<id>/mcp` with a bearer token. It does more than Docker’s gateway, and it asks more of you: PostgreSQL and Redis for a production stack, an admin API to secure, and a release to track.

## What does a team gateway have to do beyond proxying?

Forwarding `tools/list` and `tools/call` is the easy part. A gateway that a whole team uses has to handle these, whichever project you start from:

1. 1Sign people in. Claude, ChatGPT, Cursor and Claude Code expect MCP’s OAuth flow: protected resource metadata, an authorization server tied to your identity provider, and client registration for clients you’ve never seen. A static bearer token works for CI, but handing one to every person brings back the shared key you were replacing.
2. 2Hold the upstream credentials. Either one service token per server, ideally with a read-only variant, or each person’s own OAuth grant to Linear, Notion or Stripe, encrypted and refreshed before it expires.
3. 3Decide per person. List only the tools someone may use, and check again on every call, since a hidden tool can still be called by name. See [how to stop agents from running destructive MCP tools](https://mcp1.com/blog/stop-destructive-mcp-tools).
4. 4Record every call: who, which client, which tool, the arguments, the result and the latency, with secrets masked. See [MCP audit logging](https://mcp1.com/blog/mcp-audit-logging).
5. 5Keep up with the spec. MCP’s authorization rules have changed with several spec revisions, and clients adopt the new ones. A gateway that falls behind can stop working with a client after that client updates.

## Can Claude and ChatGPT reach a self-hosted gateway?

Only if it’s on the public internet. Hosted clients connect from their vendor’s servers, not from your laptop. Anthropic’s help center says a custom connector’s connection comes from Anthropic’s IP ranges, so a server behind a VPN or a corporate firewall won’t connect even if you can reach it yourself. Your options are a public HTTPS endpoint, an allowlist of Anthropic’s published addresses, or Anthropic’s MCP tunnels.

Use port 443

Anthropic’s docs also say Claude can’t connect to a URL with a custom port, so a gateway on `:8080` or `:4444` needs a reverse proxy on 443 in front of it. Claude Code and Cursor run on the laptop, so they can reach a gateway on your private network.

## When does self-hosting make sense?

IfThen

Servers must run next to private data, or the network is air-gapped

Self-host. Nothing outside can reach it, by design.

Your servers are local stdio processes you want contained

Docker MCP Gateway runs each one in its own container.

You also need A2A agents or REST and gRPC APIs behind one endpoint

ContextForge covers those as well as MCP.

Your servers are remote SaaS ones, like GitHub, Linear, Sentry or Stripe

A hosted gateway saves running auth, secrets and the log yourself.

People use Claude or ChatGPT on the web

Either works, as long as the endpoint is public on 443.

Count the people time as well as the servers. Someone owns upgrades, the identity integration, token encryption keys, log retention and the on-call page when the gateway is down and every agent loses its tools at once.

## A hosted gateway instead

MCP1 is the hosted option, made by Appwrite. It can’t be self-hosted: it runs in Frankfurt and connects to remote MCP servers, from its catalog or any URL that speaks Streamable HTTP or SSE. It doesn’t run stdio servers, so a local one needs a bridge with authentication in front of it first; see [remote vs local MCP servers](https://mcp1.com/blog/remote-vs-local-mcp-servers). What it handles is the list above: OAuth 2.1 sign-in with dynamic client registration for every client, server tokens kept encrypted and refreshed, groups with full or read-only access, rules by tool name, an audit log of every call, and API keys scoped to one gateway for CI. The Individual plan is free and Team is $12 per member a month; the [docs](https://mcp1.com/docs) cover setup, or [sign up](https://mcp1.com/signup) and connect a client in a few minutes.

## Common questions

### Is Docker MCP Gateway free?

Yes. It is MIT-licensed open source, shipped as the docker mcp CLI plugin. It is built into Docker Desktop’s MCP Toolkit and can also run on Docker CE.

### Is an MCP proxy the same as an MCP gateway?

No. A proxy like mcp-proxy forwards one server’s traffic, usually to change its transport. A gateway sits in front of many servers and adds sign-in, per-person tool access and a record of every call.

### Can ChatGPT or Claude on the web use a gateway behind our VPN?

Not directly. Hosted clients connect from their vendor’s servers, so the gateway needs a public HTTPS endpoint on port 443, an allowlist of the vendor’s IP ranges, or a tunnel such as Anthropic’s MCP tunnels.

### Can I self-host MCP1?

No. MCP1 is a hosted service, with workspace data in Frankfurt. Enterprise workspaces can limit gateway calls to listed IP addresses.

Give your team one URL

Create a workspace, install your servers and share a gateway with a group. Free for individuals.

[Start with MCP1](https://mcp1.com/signup)[Read the docs](https://mcp1.com/docs)

## More from the blog

[ Terminal$ claude mcp add --transport http github api.githubcopilot.com/mcp/githubConnectedHow to connect GitHub MCP to Claude CodeRun claude mcp add with https://api.githubcopilot.com/mcp/ and a fine-grained token. Read-only mode, toolsets, permission rules and team setup.![](https://avatars.githubusercontent.com/u/1297371?s=96&v=4)Eldad FuxFounder and CEO, Appwrite](https://mcp1.com/blog/github-mcp-claude-code)[ SupportIntercomRead-onlyLinearRead-onlyNotionRead-onlyStripeRead-onlyMCP servers for support teams: what to connect firstStart with your helpdesk, Linear, Notion and Stripe, read-only first. What they answer together, which writes to hold back and a shared setup.![](https://avatars.githubusercontent.com/u/1297371?s=96&v=4)Eldad FuxFounder and CEO, Appwrite](https://mcp1.com/blog/mcp-servers-for-support-teams)

---

This is the markdown copy of https://mcp1.com/blog/self-hosted-mcp-gateway. Site index for agents: https://mcp1.com/llms.txt
