MCP gateway

An MCP gateway: MCP tools on any model, only on servers you approve

Agents that use MCP servers usually connect to each one directly, with no shared list of what's allowed and no record of what was called. Leanroute puts one gateway in between: add mcp_servers to a normal chat-completion request, and the gateway checks the servers, runs the tools and logs every call.

Any model, same tools

The gateway runs the MCP tool loop itself, so MCP tools work on any model with function calling: GPT, Gemini, DeepSeek, Groq, Claude. Swap the model, keep the tools.

Only servers you approve

Every MCP server must be on your organization's allowlist. A request naming any other server is refused with 403 before anything is called.

Every tool call on record

Each call is logged with the tool, the server, success or failure and how long it took, grouped by agent run. Arguments and results are never stored.

Costs and limits included

The whole loop counts toward your spend caps and rate limits, and the response reports total tokens across every turn, so the bill matches what you see.

How it works

One request, any model. The gateway does the tool loop before it answers:

  1. Checks every server in mcp_servers against your allowlist.
  2. Lists each server's tools and offers them to the model as ordinary functions.
  3. Runs the tools the model asks for, feeds the results back, and repeats.
  4. Returns one normal chat-completion response when the model is done.
curl https://api.leanroute.dev/v1/chat/completions \
  -H "Authorization: Bearer $LEANROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemini-3.6-flash",
    "messages": [{"role": "user", "content": "Summarise my open GitHub issues"}],
    "mcp_servers": [{
      "type": "url",
      "name": "github",
      "url": "https://mcp.example.com/github",
      "authorization_token": "..."
    }],
    "max_tokens": 2048
  }'

Response headers report the loop: tools discovered, tool calls made, model round trips, and whether it hit the 10-round safety cap. Agents can also ask which servers they may use with GET /v1/mcp/servers. Full reference in the MCP docs.

Why at the gateway

  • One allowlist instead of a server list in every agent's config. Approve a server once; revoke it once.
  • No per-provider MCP support to wait for. Tools reach the model as plain functions, so a new model works with your tools the day you can call it.
  • One record. Tool calls sit next to the model calls and costs of the same agent run, so you can see which tools a costly run used.
  • The same limits. Spend caps, rate limits and guardrails apply to tool-using requests like any other.

Not there yet

  • Allowlists per API key or per agent; the allowlist is per organization today
  • Streaming responses on requests with mcp_servers
  • Guardrails on tool arguments and tool results (prompts and answers are checked)
  • Local stdio servers: a hosted gateway can only reach servers over Streamable HTTP

Questions

What is an MCP gateway?
A single place between your AI agents and the MCP servers they use. It decides which servers agents may reach, runs or forwards the tool calls, and records what happened, instead of every agent connecting to every server on its own.
Do I need Claude to use MCP tools?
No. Leanroute runs the MCP tool loop at the gateway and gives the tools to the model as ordinary function calls, so any model with function calling can use them: GPT, Gemini, DeepSeek, Groq and Claude.
Which MCP servers can I connect?
Any remote server that speaks the Streamable HTTP transport over https, once you add it to your organization's allowlist. Local stdio servers can't be reached by a hosted gateway.
How is this different from the Leanroute MCP server?
The MCP gateway lets your agents use other MCP servers through Leanroute. The Leanroute MCP server is the other direction: a server that lets tools like Claude Code or Cursor manage your Leanroute account.

Add a server to your allowlist and make your first tool-using call in a few minutes.