mcp-gate
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
mcp-gate
An MCP server for MCP servers. It connects to other MCP servers and shows its client only the tools it has decided to enable.
Every MCP server you connect adds its whole tool list to the model's context, whether the task needs it or not. With a few servers that is hundreds of tool definitions, most of them noise, and a model with that much choice picks worse. mcp-gate sits in front: it connects to your servers, keeps their catalog to itself, and exposes tools one task at a time.
┌────────────┐ 6 gate_* tools + ┌──────────┐ all tools ┌──────────────────┐
│ MCP client │ ◄─ whatever is enabled ─┤ mcp-gate │ ◄────────────►│ MCP server(s) │
│ (the model)│ ── call files__read ──► │ │ ── forwards ─►│ files, github … │
└────────────┘ └──────────┘ └──────────────────┘At first a client sees only six gate_* tools. Tools of the downstream servers appear, named <server>__<tool>, once the gate enables them, and the gate sends notifications/tools/list_changed so the client re-lists.
How the gate decides
Tool | What it does |
| Ranks the allowed tools for a task and enables the best few that clear a score floor. Returns nothing when no tool fits, which means "use what you have". |
| Searches names and descriptions. Returns names and one-line descriptions, never schemas, and enables nothing. |
| Enables tools by name or |
| Switches tools off again, so the tool list stays short. |
| Which servers are connected, and how many tools each offers. |
| What is enabled for you right now, how often each tool was used, and the limits. |
The decision rests on rules you set, not on a model:
Policy per server:
allow,denyandconfirmlists of tool names (*wildcard).denyalways wins. Aconfirmtool is enabled only when the caller passesconfirm: true. A denied tool is never listed, searched, enabled or callable, even through a wildcard.Capacity: at most
maxEnabledtools at once. Anything over the limit is reported, not silently dropped.Idleness: tools unused for
idleTtlSecare switched off again.Always-on:
autoEnablelists tools every session starts with.Routing is lexical (names weigh three times descriptions, rarer words weigh more), deterministic, with no model call and no network. It scores only metadata, never schemas, and the floor makes "no match" a real answer. A router that always names a best guess applies tools to tasks they were never meant for.
Related MCP server: mcpgateway
Quick start
Requires Node 20 or later.
npm install
npm run build
cp mcp-gate.config.example.json mcp-gate.config.json # then edit it
node dist/index.js --check # connects to every server and prints what it foundAs a stdio server (Claude Code, Claude Desktop, any host that spawns it)
claude mcp add mcp-gate -- node /absolute/path/to/mcp-gate/dist/index.js --config /absolute/path/to/mcp-gate.config.jsonAs a Streamable HTTP server
node dist/index.js --http # http://127.0.0.1:3737/mcp
claude mcp add --transport http mcp-gate http://127.0.0.1:3737/mcp--port and --host change the address (MCP_GATE_PORT, MCP_GATE_HOST). /healthz answers health checks.
Configuration
One JSON file (--config, MCP_GATE_CONFIG, or ./mcp-gate.config.json). See mcp-gate.config.example.json.
{
"servers": {
// A server the gate starts itself (stdio) …
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/folder"],
"policy": { "deny": ["write_*", "edit_*", "move_*"] }
},
// … or one it reaches over Streamable HTTP.
"github": {
"url": "https://example.com/mcp",
"headers": { "Authorization": "Bearer ${GITHUB_MCP_TOKEN}" },
"policy": { "allow": ["get_*", "list_*", "create_issue"], "confirm": ["create_issue"] }
}
},
"gate": {
"maxEnabled": 25, // most tools enabled at once, per session
"idleTtlSec": 900, // switch off tools unused this long (0 = never)
"routeFloor": 1, // minimum score for gate_route to enable a tool
"routeTopK": 5, // most tools gate_route enables for one task
"autoEnable": [] // tools every session starts with, e.g. ["filesystem__read_file"]
}
}Server names are lowercase letters, digits and single hyphens. They become the tool prefix.
${NAME}in any string is replaced from the environment, so secrets stay out of the file. A missing variable is an error that names the variable, never a value.A server that cannot connect is reported (
gate_list_servers,--check) and skipped. It never stops the gate.
Two transports, and what each means for state
Which tools are enabled is state, so how a client is recognised matters.
Transport | A client is | Change notification |
stdio | the process: one process, one session |
|
Streamable HTTP, 2025-era client | its |
|
Streamable HTTP, 2026-07-28 client | stateless, so a scope: the authenticated client id, else the | delivered to clients that opened a |
The HTTP endpoint serves both eras on one URL. Without a scope header or authentication, all stateless clients share one set of enabled tools. That suits a single user on loopback. When several clients share an endpoint, give each its own x-mcp-gate-scope or put authentication in front.
Security
The HTTP endpoint binds to
127.0.0.1and validates theHostandOriginheaders (DNS-rebinding protection). Name extra hosts withMCP_GATE_ALLOWED_HOSTSwhen a reverse proxy fronts it.MCP_GATE_TOKENmakes every request carryAuthorization: Bearer <token>(compared in constant time).The gate forwards a tool call only for a tool that is enabled in the caller's session and still allowed by policy.
Policy limits what a client can enable. It does not sandbox a downstream server: a tool you allow runs with that server's own permissions. Deny what you would not want a model to call.
Diagnostics go to stderr only, because on stdio stdout is the protocol channel. Configuration values are never logged.
What this does not do
Routing is not understanding. Lexical ranking finds tools whose words match the task. A paraphrase with no shared words matches nothing, and the answer is then "none", not a guess. Use
gate_search_toolsor enable by name.A client must honour
tools/list_changed. A client that ignores the notification keeps its old tool list until it re-lists on its own.Tool calls are passed through. The gate does not validate arguments, it forwards them and returns the downstream result as is.
No resources or prompts yet. Only tools are proxied.
Development
npm test # 42 tests; in-memory downstream servers, one real stdio process end to end
npm run typecheck
npm run dev -- --checkBuilt on the MCP TypeScript SDK 2.x (@modelcontextprotocol/server, client, node).
Path | Role |
|
|
| The MCP server a client talks to: |
| Connections to the downstream servers (stdio and Streamable HTTP) |
| The two serving transports |
| Policy, search ranking, configuration, wildcards |
| Unit tests, gate behaviour, transports |
License
MIT. See LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Toolstile is a managed MCP gateway that connects remote MCP servers behind one endpoint, with per-agent permissions, shared accounts and activity logs. Connect at https://mcp.toolstile.com/mcp over Streamable HTTP with OAuth; sign in at https://toolstile.com, select a workspace and connect your upstream servers. Available tools, resources and prompts depend on that workspace and the agent's granted access.
MCP federation gateway: route, govern and observe agent tools across clouds and MCP servers.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
MCP server for progressive tool usage at any scale (see https://klavis.ai)
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProxy-style MCP tool multiplexer that aggregates multiple downstream stdio MCP servers into one, offering meta-tools for status, search, call, parallel, batch, and pipeline operations with concurrency control and caching.MIT
- AlicenseNot gradedqualityBmaintenanceFronts many downstream MCP servers through one session, presenting a unified tool namespace with collision resolution, fleet-wide allow/deny/hide policy, per-tool rate limits, centralized audit logging, Prometheus metrics, and bearer-key auth at the edge. Supports both stdio drop-in and Streamable HTTP deployment so agents point at a single endpoint instead of N servers.MIT
- AlicenseNot gradedqualityBmaintenanceExposes any number of upstream MCP servers (stdio subprocesses or Streamable HTTP endpoints) as one MCP server for LLM agents, with namespaced tool names so servers cannot shadow each other. Every tool call passes centralized OAuth 2.1 bearer validation, per-client tool RBAC, rate limits, JSON Schema argument checks, a hash-chained audit log, and tool-definition pinning that quarantines changed tools until an operator approves them.MIT
- AlicenseNot gradedqualityCmaintenanceEnables clients to access tools from multiple upstream MCP servers through a single namespaced endpoint, enforcing per-client allow/deny globs, timeouts, result-size limits, and sanitised errors.MIT