What Code Access Security Means for MCP Proxy Layers
A mandatory proxy is the only place MCP access rules can bind.

Code access security for MCP means controlling which tools an agent can use and which data it can reach. Real-time AI agent observability belongs at a proxy between the agent host and every MCP server, where each tool call can be checked, recorded, and flagged as it happens. Because MCP leaves authentication optional and defines no role-based access control model, that proxy is the only reliable architectural chokepoint for enforcing access rules.
Why MCP's protocol design makes the proxy layer the only reliable enforcement point
The NSA's Cybersecurity Information Sheet states that MCP does not define a role-based access control model, require authentication, or specify how a session maps to a verifiable enterprise identity. Those decisions fall to implementers. A working connection therefore provides no protocol-level guarantee that the person behind an agent has been identified or that their role limits what the agent can do. Governance is not a setting waiting to be enabled.
The protocol also changes the familiar client-server relationship. MCP servers do more than serve data: they query and sometimes carry out actions for connected clients. The CSA Agentic MCP Security Best Practices guide identifies three separate trust boundaries, namely LLM-to-client, client-to-server, and server-to-downstream-system. A failure at one can cascade through the pipeline. Even when the connection is protected, the action it leads to still needs to be checked.
That distinction becomes concrete when a server has broad permissions. An agent with delete_repository capability can delete repositories, because MCP exposes what its servers are configured to provide without built-in least-privilege enforcement. The November 2025 specification formalized OAuth 2.1 as the authentication standard for remote servers. Authentication establishes who connects, while authorization determines what that identity may do.
What the real-world attack surface looks like when that design meets production
The CSA guide reports that, by early 2026, researchers had catalogued thousands of internet-exposed MCP servers, roughly half without authentication controls. The exposure extends beyond those open connections. CVE-2025-6514 affected the widely used mcp-remote proxy package, which was installed in more than 437,000 environments. CVE-2026-23744 exposed remote code execution in MCPJam Inspector and was published in January 2026. Security infrastructure itself is part of the attack surface.
Documented 2025 incidents included cross-tenant data exposure at Asana, prompt injection against the GitHub MCP server, and unauthenticated remote code execution in Anthropic's MCP Inspector developer tool. Malicious npm packages also enabled supply chain compromises. By February 2026, the Sandworm_Mode campaign was using npm typosquatting to target AI coding assistants. Packages mimicking popular utilities installed rogue MCP servers, which used prompt injection to exfiltrate SSH keys, AWS credentials, and npm tokens.
Shared credentials create another, less conspicuous route to overreach. Default MCP implementations connect agents to data sources through a service account or API key, giving the AI access to everything that account can reach without per-user authorization. The requesting user can disappear from the access decision. When everyone uses the same account through the agent, one user's reachable resource can effectively become everyone's reachable resource.
OX Security's April 2026 disclosure showed how a flaw in the design allowed remote code execution against six live production platforms and could leave hundreds of thousands of instances vulnerable. Anthropic formally declined to fix that flaw at the protocol level. Meanwhile, an approved server can make incremental background changes and later reach sensitive resources without a fresh review. These exposures demand ongoing oversight of approved services alongside repairs to individual libraries.
Why patching individual servers does not close the structural gap
Patching known vulnerabilities is necessary, but it cannot supply an enforcement layer that the architecture leaves undefined. A repaired library still does not decide which agents may operate autonomously, who is accountable for them, or what conditions require their suspension. Those are governance decisions. They also require evidence that the decisions were enforced during execution.
The July 28, 2026 protocol revision moved MCP to a stateless core, removing the anchor for session-scoped monitoring and rate limiting. Each request must include its own identity and version metadata and be authorized on its own merits. As the protocol matures, the work of enforcement still has to be done. It moves more clearly toward the individual operation, where the requesting identity and proposed action can be evaluated together.
Developers can deploy servers unknown to IT, using credentials IT cannot rotate and receiving no security updates. Patching the inventory does nothing for servers outside it. A security model therefore needs both a known set of servers and a mandatory route through which agents reach them.
What a proxy layer actually does and why its position in the architecture matters
A centralized MCP gateway sits between the agent host and all MCP servers as a reverse proxy or middleware layer. It centralizes authentication enforcement, rate limiting, circuit breaking, audit logging, and access policy. Its position is the source of its leverage. The organization applies those controls in the traffic path, so it need not trust every server author to put the same controls in place correctly.
That architecture works only if the gateway is mandatory. New servers must route through the gateway, and third-party STDIO connections need proxy wrapping for inspection. The gateway also supplies a single chokepoint for network egress, allowing restrictions on where server calls can reach. Independent outbound connections cannot provide that same centralized control.
The CSA guide treats this as defense in depth, combining authentication, tool integrity, session management, supply chain validation, execution isolation, and behavioral monitoring. The proxy makes uniform enforcement possible. It does not make the other controls unnecessary. Hidden instructions in a tool description may be visible to the model but not to the person reviewing the configuration. Schema validation at the proxy can take place before that description reaches the model.
Per-operation authorization versus per-session authorization, and why the difference determines actual least-privilege enforcement

Session-level authorization asks whether an agent may connect to a system. Per-operation authorization asks whether the requesting user may invoke this tool, on this resource, at this privilege level. The distinction is not a technical nicety. A session can be legitimate while an action within it is forbidden, so accepting the connection cannot stand in for evaluating the action.
Once inside, an agent can invoke whatever tools the session scope permits without another check against the person asking. Shared service accounts widen that window across users. The gateway must therefore evaluate each operation before it reaches the MCP server, rather than treating the account's permissions as proof of the user's entitlement.
Tool-level role-based access control is a way to start that check. Allowlists and blocklists can permit read access for analysts and write access for engineers while preventing role-inappropriate deletion or privilege escalation. But the tool name is not the whole decision. Least privilege also requires checking the resource and requested privilege level, because permission to use a tool does not mean permission to use it against every reachable resource.
Zero-trust architecture rejects implicit trust after authentication for this reason. Every request must be checked against the requesting identity, action, and data as well as the credentials that opened the connection. An agent that authenticates once and keeps working can keep access it should no longer have unless authorization is checked again as it works.
How do you monitor MCP data access in real time rather than after an incident?
Real-time monitoring starts with the same unit as authorization, the individual tool call. Session logs establish that an agent connected, but cannot provide the per-operation record of what it touched. The proxy must make those operations visible as they happen. That record links enforcement to accountability, rather than leaving incident responders to infer access from a successful login.
The NSA sheet warns that implementations without logging controls make incident response and accountability significantly harder, especially in multi-tenant environments. Retrospective logs still support investigation, but they cannot provide a live safety net. A weekly review will miss the moment when an approved service starts reaching sensitive resources after incremental changes. Real-time alerts on anomalous tool invocations make that change actionable while it is unfolding.
Behavioral monitoring also looks beyond what static permissions allow. An unusual order of tools or an amount of data that does not fit the declared task can point to trouble even when each call fits an access rule. Permission alone does not explain the pattern. Visibility and enforcement therefore need to work together, with per-operation records that support both live alerts and scrutiny after the event.
That scrutiny increasingly has a legal context. California CCPA/CPRA regulations effective January 1, 2026, require comprehensive privacy risk assessments before processing that presents a “significant risk” to consumer privacy, including automated decision-making technology used for significant decisions. MCP-driven workflows used for those purposes bring agent access into that assessment. A connection log cannot show whether access stayed within the limits set out in the assessment.
Connecticut CTDPA amendments effective July 1, 2026, require privacy notices to state whether personal data is used to train large language models. Controllers using profiling for significant decisions must also conduct dedicated impact assessments for processing activities created or generated on or after August 1, 2026. Twelve U.S. states require support for Global Privacy Control signals. Policies at the proxy layer can apply those choices in the same way each time an agent interacts with a tool.
A gateway supplies operational controls and evidence to support these distinct obligations and their required assessments or notices. California's record-setting CCPA settlement signals scrutiny of whether data practices fit consumers' reasonable expectations as well as whether disclosures exist. Boards and regulators need to ask whether the evidence shows that an agent stayed within the bounds of governance. Per-operation records can support that answer in a way session-level connection logs cannot.
How to build a proxy layer that actually closes the gap rather than adding theater
The implementation requirement is a mandatory gateway with controls that extend beyond login. Organizations should enforce OAuth 2.1 for remote-server session establishment, then check the user, action, resource, and privilege level for every tool call. Tool-level role rules should limit both what users see and what agents can invoke. Agents that keep running also need re-authorization at set intervals or when they carry out privilege-escalating operations. A successful login is only the beginning.
Tool integrity needs its own approval boundary. Organizations should record schema hashes when trust is first established and require review of subsequent description changes before re-authorizing a tool. Configurations from uncontrolled repositories must be treated as untrusted artifacts, with proxy wrapping applied to all third-party STDIO connections. Every MCP server must also be listed in a registry. Without that inventory, credential oversight and update coverage remain incomplete.
Monitoring should produce per-operation audit records and live alerts for unusual tool sequences or data volumes outside the declared task scope. A full record helps establish who is accountable, while behavioral detection shows suspicious activity in time to respond. The CSA guide's four-level MCP Security Maturity Model helps teams map the controls they have and plan what to put in place next, without trying to add every control at once.
Products should be judged by how well they meet those requirements. MCP Manager, the AI data-access governance product from the Usercentrics privacy compliance suite, places gateway controls, RBAC enforcement, and real-time visibility between agents and tools. IBM ContextForge provides an admin interface, telemetry-based observability, in-memory data store-backed caching, multi-cluster federation, A2A support, and plugin extensibility. Their stated capabilities offer different evaluation criteria. The former emphasizes governed data access, while the latter provides orchestration and observability across MCP components.
Governed deployment must also be easier than shadow deployment. A centrally maintained allowlist with a self-service addition process lets developers propose servers through a lightweight security review while IT retains inventory and credential oversight. Sandbox profiles should keep out production data and write permissions and provide session-level isolation, while production uses the full control profile. Mixing those environments defeats the separation. Federated governance means teams can keep building without making each developer responsible for inventing the organization's security boundary.


