Technical Guide

How to Detect Unauthorized MCP Server Connections

Detecting unauthorized MCP server connections requires capturing full session handshake metadata (server identity, transport type, declared capabilities), comparing it against an approved server inventory, instrumenting host-level process activity for stdio transports, inspecting network and authorization data for HTTP/SSE transports, and diffing capability manifests across sessions to catch post-approval changes.

Why Unauthorized MCP Connections Are Hard to See

The Model Context Protocol defines a client-host-server architecture in which an AI application (the host) manages client connections to servers exposing tools, resources, and prompts over JSON-RPC 2.0. This design gives agents flexibility to connect to a growing number of external servers, but it also creates a visibility gap for security teams. The protocol itself does not mandate centralized registration of servers, and it does not enforce a single authentication scheme across all transport types. As a result, an agent can initiate a connection to a server that was never reviewed or approved, and in many deployments no system of record captures that event.

This gap matters because MCP server identity is typically self-declared. A server presents a name, description, and version during the initialization handshake, and the client is expected to trust that declaration. There is no default cryptographic binding between the declared identity and the actual endpoint. This creates conditions for server impersonation, where a malicious server presents a name or description similar to a legitimate, previously authorized one, inducing a host to connect to the wrong endpoint.

Two Transport Types, Two Threat Models

MCP supports multiple transport mechanisms, most commonly stdio for local process communication and HTTP with Server-Sent Events for remote communication. These transports have fundamentally different exposure characteristics and require separate detection instrumentation.

Stdio-based servers run as local subprocesses. There is no network traffic to inspect, so detection depends on host-based telemetry: process spawning events, parent-child process relationships, executable paths, and command-line arguments. A security team relying solely on network monitoring will have no visibility into unauthorized stdio server connections, regardless of how comprehensive that network monitoring is.

Remote MCP servers using HTTP or SSE transports are observable at the network layer. Recent specification revisions document support for OAuth 2.1-based authorization for these remote connections, which gives security teams a basis for inspecting authorization headers, TLS certificates, and endpoint URLs through a proxy or gateway. Because authentication support varies across MCP implementations and specification versions, teams should not assume every remote server enforces strong authentication by default.

Detection signals by transport type
Signal source What it detects
Stdio (local) servers Host-level process creation events, executable paths, and command-line arguments, since no network telemetry exists.
HTTP/SSE (remote) servers Proxy or gateway inspection of endpoint URLs, TLS certificates, and authorization headers.
Capability manifests Diffing across sessions to detect unauthorized changes to previously approved tool and resource declarations.

Capability Negotiation as a Detection Surface

When an MCP client connects to a server, the server advertises its capabilities, meaning the tools, resources, and prompts it exposes, during an initialization handshake. Clients are expected to invoke only capabilities that were explicitly declared during this negotiation. This handshake is a natural point to capture detection-relevant metadata: server name, version, full capability list, and transport details.

Capturing this handshake once is not sufficient. Security researchers have documented rug-pull risks in MCP, where a server's tool definitions change after initial approval. A server that was reviewed and authorized at one point in time can later begin advertising new or altered tools without any corresponding change-control event on the client side. Detection logic therefore needs to diff capability manifests across sessions for the same server identity, not just validate identity at first connection.

Where to Place Enforcement

Detection and enforcement controls should sit at the MCP client or host layer, where connections are initiated, rather than relying only on downstream tool-execution logging. Placing controls upstream of capability negotiation allows unauthorized connections to be flagged or blocked before an agent has the chance to invoke any tool.

A gateway or broker pattern positioned between agent hosts and all server connections centralizes allowlist enforcement, authentication checks, and logging, rather than distributing these controls separately across individual agent deployments. This is particularly relevant given that stdio and HTTP/SSE connections represent distinct threat models requiring different instrumentation; a centralized enforcement point can normalize detection logic across both.

Where supported, identity verification should go beyond self-declared name and description fields. TLS certificate pinning for remote servers and signed binaries for local servers provide stronger assurance than trusting handshake metadata alone. Correlating MCP session logs with existing SIEM or XDR pipelines allows unauthorized connection attempts to be evaluated alongside broader identity and network telemetry rather than in isolation.

Governance Gaps to Close Before Deployment

No government agency or standards body has published MCP-specific security guidance, and no MCP-specific regulatory mandate currently exists. Current governance practices for MCP connections are derived from general frameworks: OWASP's guidance on agentic and LLM application security recommends maintaining an allowlist of approved tools and monitoring for invocation outside that allowlist, and NIST's AI Risk Management Framework calls for continuous monitoring and logging of third-party component interactions as part of its Measure and Manage functions.

Because MCP does not enforce centralized registration, organizations need an internal approval process for MCP servers before production use. This process should not be one-time. Given documented rug-pull risk, previously authorized servers require periodic re-review rather than a single approval event. Audit trail requirements, including retention of connection logs, capability manifests, and tool-call records, should be defined explicitly, since the protocol itself specifies no logging or retention behavior.

Evaluation Criteria for Detection Controls

Use the following criteria to assess whether a detection or enforcement approach provides adequate coverage across both transport types and across the lifetime of a server connection.

  • Confirm coverage of both stdio (host-based) and HTTP/SSE (network-based) telemetry sources, since neither alone provides full visibility.
  • Verify the ability to maintain and enforce a server allowlist with alerting on unrecognized endpoints.
  • Confirm capability-manifest diffing across sessions to catch post-approval changes to a server's declared tools.
  • Assess how server identity is verified beyond self-declared name and description metadata.
  • Confirm detection events can be correlated with existing SIEM or XDR and identity infrastructure for unified investigation.

Bring Runtime Visibility to MCP Connections

Trussed AI provides runtime governance for enterprise AI agents, including MCP security controls that support agent identity verification, tool approval workflows, least-privilege enforcement, and audit logging for agent-to-server connections.

Explore Runtime Governance