Est.

Why Direct Agent-to-Server MCP Connections Fail Security Review and What an MCP Gateway Replaces

A single gateway path gives agents governed identity, credentials, and audit.

· 8 min read
Cover illustration for “Why Direct Agent-to-Server MCP Connections Fail Security Review and What an MCP Gateway Replaces”
Threat Intelligence · December 1, 2026 · 8 min read · 1,823 words

An MCP gateway sits between AI agents and MCP servers, governing tool calls through a single path for identity, access policy, credentials, and audit. Direct agent-to-server connections fail enterprise security review when each connection handles those controls independently. The gateway replaces that ungoverned mesh while retaining the enterprise’s existing security systems and the need to secure downstream tools.

Why direct agent-to-server MCP connections create a structural governance gap

Direct connections have a practical attraction for getting an agent working with a tool. An agent authenticates to a server and calls what it needs, without a separate mediation layer. MCP lets agents use tools outside the agent through servers that may hold OAuth tokens, database credentials, or cloud access. The protocol itself is not the weak link.

Each new agent needs an authenticated relationship with every server it reaches, creating the N×M mesh of agents and servers. Identity checks, policies, and records then depend on what each connection implements, with no common point through which all calls must pass. Traffic that bypasses the standard enterprise security stack also bypasses its monitoring. This is an architectural gap, and correcting one server’s configuration does not establish governance across the rest.

How credential handling in direct connections exposes the enterprise from day one

MCP’s authorization specification tells stdio servers to retrieve credentials from the environment. In a direct deployment, that can mean static API keys supplied through the host’s configuration, within the agent’s reach. Consider a coding agent connected to GitHub, a Postgres replica, and Jira. That arrangement can leave three credentials, scoped for convenience, in a JSON configuration on a laptop. Nothing has to be attacked for the exposure to exist.

Credential sprawl also makes it easier to confuse possession with permission. A server acting as a confused deputy uses its own elevated credentials to access downstream systems on behalf of an agent whose authorization does not justify that access. Broad service accounts make this worse. Granting permissions “because the agent might need it” violates least privilege and expands what a compromised server or agent could reach.

Token passthrough creates a separate problem in non-compliant implementations. MCP explicitly forbids passing an end-user’s OAuth token through to downstream services in this way. Yet an implementation that does so can expose data the user is authorized to see but should not access through an AI agent. User permission and agent permission are not interchangeable.

What happens when a trusted MCP server changes behavior after approval

Server approval records a decision about something that can change. Servers get updates, packages change hands, and tool descriptions can change at runtime. A rug-pull attack exploits that difference by presenting benign descriptions during approval and replacing them after consent. Pillar Security found a live campaign in August 2026, called Deadbugz, whose server stayed harmless for its first three tool calls before directing the agent to collect SSH keys and cloud credentials.

Prompt injection through tool results takes a different route. An MCP tool retrieves external data, and that content enters the model’s context window. If it contains injected instructions, the model may follow them. The attacker needs access only to the queried source. Pinning a tool description would address description changes, but would not by itself make every returned document trustworthy.

Dolt MCP versions 0.3.1 to 0.3.6 returned a 401 response for invalid tokens but continued processing because of a missing return statement, allowing unauthenticated callers to run database tools with the server’s credentials. Version 0.3.7 fixed the flaw. Grafana MCP session spoofing, fixed in mcp-grafana 1.1.0, likewise let callers list and run tools using the server’s Grafana service account. These distinct failures show why controls on subsequent calls remain necessary after a server is trusted.

Why zero observability in direct connections makes incident response impossible

When a database receives every query under a shared service account, its records identify that account rather than the agent, user, or task behind a query. A dropped table traces back to the service user and stops there. The account name is not an explanation. Security teams need to know who invoked which tool, with which arguments, and on whose behalf.

Direct deployments may have logs, but not a coherent audit trail. Records can sit separately inside agents, SDKs, and MCP servers without a shared way to correlate activity. Shadow MCP servers deepen the gap when teams deploy them outside the enterprise service catalog, sometimes on ephemeral compute that traditional asset management struggles to track. An inventory cannot account for what it never sees. Unregistered, unmonitored servers therefore leave room for compromise and data exfiltration to go undetected.

Without circuit breakers on the connection path, an agent loop can repeatedly hit paid APIs or write garbage into production databases unchecked. Reconstructing the sequence later is harder when each system retains only its fragment. With no usable signal, reconstruction becomes impossible. The organizing failure is accountability, because the organization cannot reliably connect an agent’s actions to the human who initiated the workflow.

What is an MCP gateway, and what does it replace?

An MCP gateway replaces separate agent-to-server access paths with a path through the gateway for tool discovery and execution. For a team connecting Claude or another model to internal tools through a single MCP endpoint, the architectural target is an endpoint exposing approved tools from the servers behind it. The endpoint serves as the entrance, with its value coming from enforcing identity, policy, and audit as requests pass through.

An AI gateway, also called an LLM gateway, serves a different purpose. It governs traffic between applications and model providers, while an MCP gateway governs the tool calls that follow a model’s decision to act. The layers are complementary. An MCP gateway also does not see an agent’s direct API calls or the prompt behind a request by default.

By holding server credentials, the gateway concentrates secrets, so secrets management must sit behind and around it from the start. The July 2026 MCP revision supplies Mcp-Method and Mcp-Name headers that let conventional API gateways route or rate-limit by tool name. Those features do not give a conventional gateway the ability to front stdio servers, filter tools/list by identity, or associate a sequence of calls with both an agent and a person.

The four governance capabilities a gateway puts at a single control point

Identity and access management gives each agent its own independently scoped, revocable identity through the enterprise’s existing identity provider. Outbound access uses short-lived, task-scoped credentials resolved at runtime from a centralized credential provider. The agent’s code need not hold an IAM key, OAuth client secret, or database password. Revocation then has a specific target to act on. The identity model must also connect the agent’s work to the person who authorized it, rather than replacing one shared account with another.

Per-identity tool filtering controls what an agent can discover as well as what it can invoke. A tools/list response exposes only the tools allowed for that identity, reducing both attack surface and context window pollution. A triage agent and a release agent can share a server while only the release agent sees write tools. A setting for a whole server cannot make that distinction across a fleet.

A gateway can inspect JSON-RPC payloads so that an agent summarizing public documentation cannot reach a tool querying customer PII. Server allowlists and hash-pinned descriptions help guard against tool poisoning and rug pulls by spotting changes to what was approved. Returned content remains a distinct injection risk. Rate limits and circuit breakers add bounds on execution, preventing loops from reaching paid APIs or production databases unchecked.

Audit and observability record tools/list and call_tool invocations with agent identity, user context, arguments, response status, and latency. Prometheus metrics and OpenTelemetry traces feed that activity into the monitoring and distributed tracing systems already in place. Tamper evidence is a separate requirement from visibility. Some platforms distinguish cryptographically authenticated administrative audit logs from runtime request logs and traces, so procurement must examine what each record actually protects. The enterprise bar is an identity-scoped, tamper-evident record of every tool call.

How gateway platforms deliver these controls in practice

Speakeasy is one enterprise MCP gateway option that centralizes connectors, authentication, credentials, tool curation, access policies, and audit, with Virtual MCPs bundling approved tool surfaces behind governed endpoints for teams, roles, use cases, or agents. Its Agent Gateway extends independently scoped, revocable identities through the existing identity provider, uses groups managed through an identity provisioning protocol for access, and sends decisions into the customer’s observability stack.

That combination addresses the gaps in the direct-connection model. Curated endpoints take the place of separate connector setups, identity-based access takes the place of shared assumptions about permission, and exported decisions leave a trail of who was allowed to do what. A gateway that creates a parallel identity system or an isolated audit store risks relocating fragmentation.

IBM ContextForge is an open-source option for teams that want control over the gateway layer without having to rely on a managed service. Its official documentation describes OpenTelemetry traces exported to OTLP backends including Jaeger, Zipkin, and Phoenix. Existing observability tooling therefore remains part of the design. Traefik Hub MCP Gateway and Microsoft Azure MCP Solutions are also options to evaluate against the same identity, filtering, policy, and audit criteria.

AWS AgentCore Gateway converts APIs, Lambda functions, Smithy models, and OpenAPI specs into MCP-compatible tools, and aggregates remote MCP servers behind a virtual MCP server. It manages inbound agent authentication and outbound authentication to targets. AgentCore Runtime associates deployed agents with workload identity ARNs usable in IAM policies. These concrete integration capabilities still require evaluation against governance requirements across the complete path from agent identity to authorized tool call to attributable record.

The phased path from an ungoverned mesh to a fully governed gateway architecture

Diagram: From Ungoverned Mesh to Gateway: Three Phases. Visualizes: Show a three-phase progression from a direct agent-to-server mesh to a fully governed gateway architecture.

Teams can start practically by inventorying existing agent workflows and MCP connections. That inventory should show which connections can reach sensitive internal data and which credentials each one uses. The official service catalog is not enough. Developers and non-developers can add servers through the configurations in Claude Code, Cursor, VS Code, and Claude Desktop without a review. The search therefore needs to cover non-standard protocol traffic as well as infrastructure that has been registered.

The next phase puts the gateway in front of the highest-risk integrations as a transparent proxy. This lets teams collect telemetry and introduce authentication requirements while preserving running workflows. Migration need not happen in one move. As connections move onto the governed path, the next phase extends per-identity tool filtering, hash-pinned descriptions, rate limits, and circuit breakers across the fleet.

The resulting allowlist needs approved server names along with version and behavior checks. Existing enterprise systems should remain the foundation. Identity should come from the company’s identity provider, observability data should go to its monitoring stack, and compliance records should go to its audit system. Governance built into the path itself is what makes an expanding AI rollout sustainable at scale.

Sources

  1. Agentic MCP Security Best Practices Guide
  2. Model Context Protocol (MCP) Security
  3. MCP-DPT: A Defense-Placement Taxonomy and Coverage Analysis for Model Context Protocol Security

More in Threat Intelligence