Skip to main content
MCP Gateway puts the MCP servers your team uses behind one URL, https://mcp.ngrok.ai, and the same AI Gateway access key your agents already send for models. The gateway holds each server’s upstream credentials, hides tools a key is not allowed to call, and records every MCP call in Activity. It is available on every AI Gateway account and bills per operation.
This page covers MCP servers that AI Gateway fronts for your agents. To give one MCP server of your own a public HTTPS URL with an ngrok endpoint and Traffic Policy, see Use ngrok as an MCP Gateway.

How it works

  1. You register each upstream MCP server with a label, such as docs, its HTTPS URL, and how the gateway authenticates to it.
  2. The gateway syncs each server’s tool catalog.
  3. Your agent connects to https://mcp.ngrok.ai with an access key. It sees the tools of every server the key may reach, named <label>__<tool>, such as docs__search.
  4. On each tools/call, the gateway checks the key’s access configuration, removes the client’s ngrok key, adds the upstream credential, and forwards the call.
Every server also has its own URL, https://mcp.ngrok.ai/<route>, shown on the server in the dashboard and in the API url field. Use it when a client should see only that server’s tools, without the <label>__ prefix.

Set up an MCP gateway

You need an MCP server with a public HTTPS URL.
1

Register a server

  1. Open app.ngrok.ai → MCP Gateway → Servers and click Register server.
  2. Set a Label, such as docs. A label is 1 to 64 lowercase letters, digits, -, or _, starts with a letter or digit, and can’t contain __. ngrok-gateway is reserved.
  3. Set the Upstream URL.
  4. Choose an upstream auth Mode. See Upstream authentication.
  5. Save the server and turn it on. The server’s status shows ready once its catalog syncs.
2

Choose the tools a key can call

  1. Open Keys → Configurations and create an access key configuration.
  2. Under MCP tools, allow docs/search.
  3. Create an access key that uses the configuration.
3

Connect your agent

Export the key, then add the gateway to your client. For Claude Code:
The MCP Gateway page in the dashboard has the same step for Codex, Cursor, VS Code, Windsurf, Amp, and more clients.Run /mcp in Claude Code. The tool list shows docs__search and ngrok-gateway__list_servers, and no other tools from docs.
4

Confirm the call

Ask your agent to search the docs. Open Activity, select MCP calls, and find the request. It shows the key, the server, the tool, and the outcome.

Control tool access

An access key configuration has two optional MCP lists:
  • A key with no access configuration, or a configuration with no MCP lists, reaches every server and tool on the account.
  • An empty list denies everything in that list.
  • When both lists are set, a call must pass both.
  • MCP lists are separate from the provider and model lists. A key restricted to one model is not restricted for MCP.
  • A server can also have its own allowed tools list. A tool outside it is hidden from every key.
The gateway removes tools a key can’t call from tools/list. A call to one returns JSON-RPC error -32003 with the message tool not allowed for this key, and the gateway never contacts the upstream. A call to a server the key can’t reach returns -32003 with mcp server not allowed for this key.

Built-in tools

The gateway adds its own tools under the ngrok-gateway label: Search is off by default. Turn it on in the access key configuration, or set mcpSearchEnabled with the API.

Upstream authentication

Your agent never sends upstream credentials. The gateway strips the client’s ngrok key before it calls the upstream, and it refuses an ngrok key or personal access token as an upstream credential.

Captures

Each server has a capture level: off, metadata, or full. At full, the gateway stores request and response bodies when captures are on for the account, except for tools in the server’s exclusion list. Read captures from the request in Activity.

Pricing

MCP Gateway costs **$10 per 1 million billable operations** ($0.00001 each), paid from credits.
  • A completed tools/call is one operation, including a result with isError, because the upstream answered.
  • A successful ngrok-gateway__search_tools call is one operation.
  • initialize, tools/list, list_servers, and describe_tools are free.
  • A denied call, an upstream failure, a timeout, or a call the client cancels is not billed.
An account with no credits can still list its tools. A billable call is refused before it reaches the upstream, and Activity shows it as No credits.

Limits

Manage servers with the API

The AI Gateway API at https://api.ngrok.ai manages servers:
An update sends the server’s current revision and fails if the server changed since you read it. A personal access token calls https://mcp.ngrok.ai only when it has the ai-gateway:mcp:request scope. A server binding a provider key also needs ai-gateway:providers:read. The ngrok MCP server has AI Gateway tools that manage MCP servers and access key configurations from your agent.