Skip to content
AdminKit

A security gateway for MCP servers: what it does and when you need one

AdminKit explains what a security gateway for MCP servers does: it's a proxy placed in front of one or more Model Context Protocol servers that enforces OAuth authorization, limits which tools a caller can invoke, and logs every call — centralizing controls that matter most once you run more than one MCP server or front one you don't control.

By AdminKit team, Netbase JSC · Updated

Key takeaways

  • A security gateway for MCP servers is a proxy in front of one or more servers. It checks each caller’s OAuth token, enforces a tool allowlist and rate limits, screens tool responses, and logs every call in one place.
  • It adds centralization, not a stronger mechanism. The OAuth rules it enforces are the ones in the MCP authorization specification, including the audience check and the ban on token passthrough.
  • A gateway pays off when you run several MCP servers, front one whose code you don’t control, or need one audit trail across all of them.
  • It only sees traffic routed through it. The direct path to each server behind it has to be closed as well.
  • AdminKit’s MCP & Agent Gateway is delivered by Netbase as a custom engagement. The free mcp-check tool and the open-source adminkit-mcp probe check your exposure first.

Why isn’t “add OAuth” always where the conversation ends?

Model Context Protocol (MCP) servers give an AI agent the ability to call real tools — reading files, querying a database, hitting an internal API — and the MCP specification (read 2026-10-27) is explicit that authorization itself is optional: HTTP-transport implementations “SHOULD” support it, which is not the same as “MUST.” Our guide to securing an MCP server covers implementing that OAuth flow, a tool allowlist, and defenses against prompt injection in tool responses directly in your own server’s code. This guide covers a different question that comes up once you’re past a single server you fully control: what does a dedicated security gateway add, what does it actually do under the hood, and when does putting one in front of your MCP server make more sense than building everything into the server itself.

What does exposure look like without either one?

The usual way it happens: a server stood up quickly during a prototype, left reachable on the public internet, with no authorization layer ever added before anyone noticed it was there. Once that server accepts an unauthenticated initialize call, anything that can reach it can typically enumerate its tools with tools/list and start calling them — file access, database queries, or shell commands, depending on what the server exposes. A second, separate risk sits in the other direction: if a tool returns content from an untrusted source, that content can carry text crafted to look like instructions, a pattern OWASP’s Top 10 for LLM Applications (read 2026-10-27) lists as its top risk, LLM01: Prompt Injection. Neither risk is specific to having “no gateway” — both exist whether you’re running one server or ten, with or without a proxy in front of it. What changes with scale is how practical it is to address both consistently.

What does a security gateway actually do?

Strip away the marketing and a gateway for MCP servers is doing five concrete jobs, each one a control you could otherwise implement directly inside a server’s own code:

  • Authorization enforcement. The gateway sits between the caller and the MCP server, checking an OAuth token against the flow defined in the MCP Authorization specification (read 2026-10-27) before forwarding anything. A call without a valid token never reaches the server behind it. The token has to name the gateway itself as its audience, which is what the resource parameter of RFC 8707 is for, and the gateway must not forward that token to the server behind it.
  • Tool allowlisting. Authentication answers who’s calling; a tool allowlist answers what they’re allowed to call. A gateway can maintain that list once, centrally, rather than requiring every server behind it to implement its own allowlist logic.
  • Audit logging. Every call that passes through the gateway — who called it, which tool, when, and what came back — lands in one place, which matters when you’re trying to reconstruct what an agent actually did after the fact, across however many servers sit behind the gateway. A gateway design can also record any progress notifications a long-running call emits along the way, so a stalled job is visible before its final response ever arrives. If a caller decides it no longer needs the result, MCP’s cancellation notification lets it say so explicitly, which a gateway’s audit log can also capture, rather than the caller simply dropping the connection and leaving the server to find out on its own.
  • Response screening. Tool responses coming back through the gateway can be checked for obviously malicious content before they reach the calling agent, as one layer among several, not a complete defense against prompt injection on its own. The same idea can extend to a server’s elicitation requests too, since those are also server-authored text shown to the user mid-task, not just tool responses.
  • Rate limiting. A gateway is a natural place to cap how many calls a given client or token can make in a given window, which protects the MCP server behind it from being overwhelmed by a misbehaving client or a credential being used far more aggressively than it should be — independent of whether that traffic is malicious or just a bug in a calling agent’s retry logic.

None of these five is a new security primitive invented for MCP specifically — OAuth enforcement, allowlisting, centralized logging, content filtering and rate limiting are all established patterns applied to a new transport. What’s specific to MCP is that the spec leaves authorization optional and tool permissioning unaddressed entirely, which is exactly the gap a gateway is built to close without requiring every MCP server behind it to close that gap independently.

A single tool call through a gateway passes the checks in a fixed order. This is the order AdminKit’s gateway uses:

agent ──tools/call + bearer token──▶ gateway
                                       1. token valid and issued for the gateway?   no → refused
                                       2. tool on the allowlist?                    no → refused, logged
                                       3. caller within its rate limit?             no → refused, logged
                                       4. forward with the gateway's own credential (caller's token stays behind)
                                     ▼
                                   MCP server ──tool result──▶ gateway
                                       5. screen response text for known injection patterns, redact matches
                                       6. write the audit record
agent ◀──────────── result ───────── gateway

That gap matters more as the number of MCP servers an organization runs grows. A single internal server built and maintained by one team is a reasonable candidate for implementing OAuth directly in its own code, with no proxy in between. An organization running a dozen MCP servers across different teams — some internal, some wrapping third-party APIs, some inherited from an acquisition — is a much harder case to keep consistent server by server, which is precisely the scenario a centralized gateway is built to address.

Why does a gateway have to stop token passthrough?

A gateway is itself an intermediary, so it can fall into the confused-deputy trap it is meant to prevent. The MCP security best practices list “security control circumvention” as the first risk of token passthrough: controls such as rate limiting or monitoring that depend on the token’s audience are bypassed if clients can use tokens directly with the services behind. A gateway that accepted any token and forwarded it would add a hop without adding a control. The rule is the same as for a single server: accept only tokens issued for the gateway, and use a separate credential for the next hop. See the MCP confused-deputy problem and token passthrough for the full explanation.

Gateway versus building it into the server: when does each make sense?

Implementing OAuth directly inside a server you control, as covered in our guide to securing an MCP server, is the more defense-in-depth choice when you have the access and the time: the control lives as close to the resource as possible, with no dependency on traffic actually routing through an intermediate proxy. A gateway earns its place in a few specific situations instead:

  • You’re running more than one MCP server and want one consistent authorization and logging policy instead of implementing and maintaining the same logic in each server’s codebase separately.
  • You’re fronting a third-party or vendor-supplied MCP server whose code you don’t control, where adding OAuth directly isn’t an option at all. Vet that server before connecting it to an AI agent first, so you know which gaps the gateway has to cover.
  • You want a single audit trail across every MCP server an organization runs, rather than reconciling separate logs from each one after an incident.
  • You’re prototyping quickly and want authorization enforced without carrying a full OAuth implementation inside the prototype itself, with the intent to harden the server directly later.

These aren’t mutually exclusive — a server can implement its own OAuth checks and sit behind a gateway, which is the more defended configuration of the two, since a gap in one layer doesn’t leave the resource completely open.

ControlBuilt into each serverIn a gateway in front
OAuth and audience checkImplemented and maintained per serverImplemented once, applied to every server behind it
Tool allowlistOne list per codebaseOne place to review and change
Audit trailSeparate logs to reconcile after an incidentOne log across all servers
Third-party server you can’t modifyNot possiblePossible
Calls that skip the proxyStill protectedNot protected: close the direct path

What can’t a gateway do?

A gateway only ever sees the traffic that’s actually routed through it. If a client — or an attacker who finds the server’s direct address — connects straight to the MCP server, bypassing the gateway entirely, the gateway has zero visibility into that call and enforces nothing on it. This is the same limitation every reverse-proxy security control shares, not something unique to MCP: putting a gateway in front of a server doesn’t retroactively close a server’s direct, un-proxied listener. If the underlying server is still reachable on its own address, it carries exactly the exposure it had before the gateway was added, and closing that direct path (network-level restriction, or simply not exposing the server’s own port) is a separate, necessary step.

Pattern-based response screening has limits of its own. It catches known phrasings, such as instructions to ignore previous instructions, not every way an injected instruction can be worded, which is why it sits alongside the allowlist, user confirmation and the audit log rather than replacing them.

How do you check your own exposure first?

Before deciding whether you need a gateway, implementing OAuth directly, or both, find out what you’ve actually got exposed. AdminKit’s MCP endpoint check tests whether an MCP server accepts an unauthenticated initialize call and, if so, what tools/list then reveals. Two free connectors run the same check outside the browser:

  • AdminKit’s adminkit-mcp probe is public and MIT-licensed today: uvx adminkit-mcp probe https://mcp.example.com/mcp runs the same endpoint-exposure check and prints JSON, no server process required. See connect an AI agent to AdminKit’s MCP server for the full setup.
  • AdminKit’s GitHub Action, which runs the identical probe on every push or a weekly schedule and fails the build on a high-severity finding, is shared by Netbase on request — see scan an MCP endpoint in CI for the workflow configuration.
# One-shot probe from your shell (replace the URL with your own server)
uvx adminkit-mcp probe https://mcp.example.com/mcp

The only JSON-RPC calls these checks make are initialize and tools/list, plus read-only requests such as the server’s OAuth metadata. They never send tools/call, so they’re safe to point at a server already in production use.

How is adminkit-mcp different from the MCP & Agent Gateway?

These two are easy to conflate by name alone, so it’s worth being precise about which is which, since they solve opposite-facing problems. adminkit-mcp is AdminKit’s own MCP server — a free connector, public and MIT-licensed on GitHub and PyPI (uvx adminkit-mcp) — that gives an agent outward-facing tools like check_mcp_endpoint and check_ip. It’s something an agent calls outward, toward AdminKit. AdminKit’s MCP & Agent Gateway is the inward-facing piece: a proxy meant to sit in front of your MCP server, applying the OAuth enforcement, tool allowlisting, and audit logging described above to calls arriving at your server from the outside. They are delivered differently too: adminkit-mcp is a free, installable connector, while Netbase deploys and runs the Gateway for you as a custom engagement. A team building an agent that needs to assess an unfamiliar MCP endpoint’s exposure before calling it can install adminkit-mcp’s tools now; a team that wants a managed proxy in front of the MCP server it’s publishing is the audience for the Gateway — talk to our team.

adminkit-mcpMCP & Agent Gateway
What it isAn MCP server with check toolsA proxy in front of your MCP server
DirectionYour agent calls out to AdminKit’s checksCallers reach your server through it
How you get itFree and open source (MIT): uvx adminkit-mcpNetbase deploys and runs it as a custom engagement
Typical userAgent builders, CI pipelinesTeams publishing MCP servers

Where does AdminKit’s MCP & Agent Gateway fit?

AdminKit’s MCP & Agent Gateway covers the five jobs described above as a proxy that Netbase deploys and runs for you: OAuth checks per the MCP authorization spec with no token passthrough, a per-tool allowlist, per-caller rate limits, redaction of tool-response text that matches a documented list of known prompt-injection patterns, and an audit log of every call, so a developer publishing an MCP server gets authorization and logging without implementing either from scratch. It is built on FastMCP’s proxy support. Talk to our team to scope it; if you’d rather keep it in-house, implementing the OAuth flow directly in your server’s own code — or, where that’s not practical, evaluating a different hosted gateway — is the alternative. AdminKit’s Agent Trust API addresses the client side of the same picture: one GET request scores an unfamiliar MCP endpoint 0-100 with a verdict and the evidence behind it before an agent calls it, rather than a gateway protecting the server side after the call arrives.

In more detail, here is how each job works in AdminKit’s gateway:

JobHow AdminKit’s gateway does it
OAuthThe bearer token must carry the gateway’s own identifier as its audience; the caller’s headers are not forwarded to your server, and any credential your server needs is the gateway’s own
Tool allowlistApplies to tools/list and tools/call: tools not on the list are neither advertised nor callable
Rate limitsPer caller, keyed to the verified identity, so one agent can’t exhaust the server for others
Response screeningText and structured content in tool responses that match a known injection pattern are replaced with a redaction marker
Audit logOne record per tool call: caller, tool, decision and time, written as append-only JSON Lines

Each audit record carries one of four decisions: allowed, allowed_filtered (a pattern matched and text was redacted), blocked_allowlist or blocked_rate_limit. The lines below are illustrative, with made-up client names and times:

{"principal": "agent-client-01", "tool": "search_docs", "decision": "allowed", "timestamp": "2026-11-10T09:15:02.118204+00:00", "detail": ""}
{"principal": "agent-client-01", "tool": "delete_ticket", "decision": "blocked_allowlist", "timestamp": "2026-11-10T09:15:09.402771+00:00", "detail": "tool is not on the allowlist"}
{"principal": "agent-client-02", "tool": "search_docs", "decision": "blocked_rate_limit", "timestamp": "2026-11-10T09:16:44.050913+00:00", "detail": "limit=60"}

Defensive use only

The exposure checks this guide links to — mcp-check, the adminkit-mcp probe, and the GitHub Action — are for MCP servers you own or are explicitly authorized to test. None of them call a tool the server exposes; all three stop at initialize, tools/list and read-only metadata requests. See our Disclaimer and Acceptable Use Policy for the full terms.

This guide is general information, not a security audit of your specific network — see our disclaimer for what AdminKit's guidance does and does not commit to.

Frequently asked questions

What does a gateway add that implementing OAuth myself doesn't?

Centralization, not a stronger mechanism. The underlying OAuth flow a gateway enforces is the same one described in the MCP Authorization specification. What a gateway adds is one place to enforce it, allowlist tools, and review logs across every MCP server behind it, instead of implementing and maintaining that logic separately inside each server's own code.

Is a gateway a replacement for implementing OAuth in my MCP server's own code?

Not necessarily, but it's a reasonable substitute when modifying the server isn't practical — a third-party or vendor-supplied MCP server you don't control the source of, or a quick prototype you don't want to carry a full OAuth implementation. If you do control the server's code, implementing the spec's OAuth flow directly is still the more defense-in-depth option; a gateway in front of it adds a second layer rather than replacing the first.

How do I get AdminKit's MCP & Agent Gateway?

Netbase deploys and runs it in front of your MCP server as a custom engagement — talk to our team at /contact/. To check whether your MCP server is reachable and whether it demands authentication first, use the free, live mcp-check tool; AdminKit's free, public adminkit-mcp probe does the same check from your own CI or shell, covered below.

What is adminkit-mcp, and is it the same thing as the MCP Gateway?

No — they're different pieces. adminkit-mcp is AdminKit's own free MCP server connector — public and MIT-licensed on GitHub and PyPI, install with `uvx adminkit-mcp` — that gives an agent outward-facing check tools like check_mcp_endpoint. The MCP & Agent Gateway is a separate, inward-facing proxy that Netbase deploys in front of your MCP server as a custom engagement. One is a server an agent calls; the other is a proxy a server sits behind.

Can a gateway stop prompt injection delivered through a tool response?

No single layer can guarantee that. A gateway can screen obviously malicious content out of tool responses as one mitigation, alongside treating all tool output as untrusted data and requiring confirmation before acting on anything it suggests — not as a complete fix on its own. See OWASP's LLM01 prompt injection entry for why this category of risk has no single complete solution.

What's the simplest way to check if I even need one today?

Run AdminKit's free, live mcp-check tool, or install AdminKit's public adminkit-mcp probe (`uvx adminkit-mcp probe <url>`) today — or ask our team for the GitHub Action — and run one against your own MCP server. If it's reachable with no authentication and exposes tools you didn't mean to make public, that result is itself the argument for either implementing OAuth directly or putting a gateway in front of it — before deciding which approach fits your setup.

Want AdminKit to watch this for you?

Free checks tell you the state today. Protective DNS and monitoring tell you when it changes.

Huy Nguyen (David), Founder and CEO of Netbase JSC

Talk to an expert

Huy Nguyen (David), Founder & CEO, Netbase JSC

Ask whether this fix applies to your setup, or get a second pair of eyes on your DNS and mail records.