Skip to main content

Examples

Ready-to-run commands for the most common MCP servers.

In every example you need two terminals:

  1. Terminal A — runs the MCP server (HTTP-exposed).
  2. Terminal B — runs mcp-gw create to open the tunnel and forward to it.

The first mcp-gw create registers your account automatically and stores credentials in ~/.mcp-gateway/credentials.json. The tunnel's public URL is printed once it connects — that's the <TUNNEL_ID> used below.


Why supergateway?

Most reference MCP servers (memory, filesystem, github, etc.) speak the stdio transport — they read JSON-RPC frames from stdin and write responses to stdout. They have no HTTP server inside them.

MCP Gateway, on the other hand, can only tunnel HTTP traffic — that's the whole point of giving you a public HTTPS URL.

supergateway bridges the gap. It launches a stdio MCP server as a subprocess, then exposes it over HTTP (streamable-HTTP or SSE). Pipeline:

MCP client ──HTTPS──► mcp-gateway.info
│ (WebSocket tunnel)

mcp-gw agent ──HTTP──► supergateway ──stdio──► docker run mcp/memory
(localhost) (localhost:8080) (subprocess)

So the command:

npx -y supergateway \
--stdio "docker run -i --rm -v mcp-memory:/app/dist mcp/memory" \
--outputTransport streamableHttp \
--port 8080

means:

FlagWhat it does
npx -y supergatewayRun supergateway from npm without installing it globally (-y auto-confirms install).
--stdio "docker run -i --rm ..."The actual MCP server. -i keeps stdin open (stdio transport needs it). --rm cleans up.
-v mcp-memory:/app/distPersistent Docker volume so the memory server doesn't lose state between restarts.
mcp/memoryOfficial MCP memory server image.
--outputTransport streamableHttpWrap stdio into MCP streamable-HTTP transport (the modern HTTP transport for MCP).
--port 8080Expose that HTTP server on localhost:8080 so mcp-gw can forward into it.

Without supergateway you'd have nothing for mcp-gw create --target http://localhost:8080 to talk to — mcp/memory alone has no HTTP listener.


Memory server

A persistent key/value memory MCP server, exposed publicly.

Terminal A — start the MCP server (stdio → HTTP):

npx -y supergateway \
--stdio "docker run -i --rm -v mcp-memory:/app/dist mcp/memory" \
--outputTransport streamableHttp \
--port 8080

Terminal B — open the tunnel:

mcp-gw create --target http://localhost:8080 --label memory

Public URL: https://<TUNNEL_ID>.mcp-gateway.info/mcp


Filesystem server

Expose a local directory as an MCP filesystem server.

Terminal A:

npx -y supergateway \
--stdio "npx -y @modelcontextprotocol/server-filesystem /Users/me/projects" \
--outputTransport streamableHttp \
--port 8080

Terminal B:

mcp-gw create --target http://localhost:8080 --label filesystem

⚠️ The filesystem server gives read/write access to that directory to anyone with your tunnel URL. Don't expose ~/ or anything sensitive.


GitHub server

export GITHUB_PERSONAL_ACCESS_TOKEN=ghp_xxx

npx -y supergateway \
--stdio "npx -y @modelcontextprotocol/server-github" \
--outputTransport streamableHttp \
--port 8080
mcp-gw create --target http://localhost:8080 --label github

A native HTTP MCP server

If your MCP server already speaks HTTP (e.g. you wrote it yourself with @modelcontextprotocol/sdk and the StreamableHTTPServerTransport), you don't need supergateway at all:

Terminal A:

node my-mcp-server.js # listens on http://localhost:3333

Terminal B:

mcp-gw create --target http://localhost:3333 --label my-server

Reconnecting later

Tunnels persist. Next time, run mcp-gw create and pick the tunnel from the menu, or reconnect a specific one directly:

mcp-gw create --id <TUNNEL_ID> # reuses the saved target
mcp-gw list # see all your tunnels

See Quickstart → Managing multiple tunnels.


Connect from a client

In Claude Desktop / Cursor config, add:

{
"mcpServers": {
"my-tunnel": {
"url": "https://<TUNNEL_ID>.mcp-gateway.info/mcp"
}
}
}

Restart the client and your MCP tools will appear.