Most Model Context Protocol (MCP) security advice is written for server builders, which leaves the teams that run MCP hosts and clients (desktop assistants, IDE plugins, coding agents, agent platforms) without a clear list of what they own. The MCP specification splits normative duties between hosts, clients, servers and authorisation servers, and several of the most damaging failures seen so far happened on the client side of that line. This guide maps each control to its owner, explains where the trust boundaries sit, separates tool poisoning from server compromise, and gives an implementation order for each side. It is written for platform engineers, AppSec teams and identity architects who need to agree who does what before MCP use spreads further. It is a concept guide, not a product comparison, and it is based on the MCP specification version 2025-11-25 as published when checked in November 2026.
Key takeaways
- The host is the security enforcement point. The specification makes the host responsible for consent, user authorisation decisions and isolation between servers; a server cannot enforce any of these for you.
- The client owns most of the authorisation flow hygiene. PKCE with S256, the RFC 8707 resource parameter, redirect URI registration, authorisation URL scheme checks and SSRF protection during discovery are client duties.
- The server owns token validation and tool safety. Audience checks, refusal of token passthrough, input validation, rate limiting, output sanitisation and secure session handling sit with the server operator.
- Tool poisoning and server compromise need different owners. Poisoned descriptions are caught at the client by treating metadata as untrusted and pinning definitions; a compromised server is caught by the server operator and the organisation's supply chain controls.
- Some controls belong to the organisation, not either side. Inventory, approved server lists, credential issuance and logging aggregation need a named platform owner, often via a gateway or registry.
The roles the specification defines
MCP uses a client-host-server architecture. A host application creates and manages several client instances, and each client holds one stateful session with one server. The specification gives each role distinct duties, which is the basis for any responsibility split. Authorisation adds a fourth party: the OAuth 2.1 authorisation server that issues tokens for remote servers.
| Role | Typical examples | Specification duties (summary) | Who usually operates it |
|---|---|---|---|
| Host | Desktop assistant, IDE, coding agent CLI, agent platform runtime | Creates clients, controls connection permissions and lifecycle, enforces security policies and consent, handles user authorisation decisions, coordinates sampling, aggregates context, enforces boundaries between servers | Application vendor for the code; the deploying organisation for configuration and policy |
| Client | The MCP connector inside the host | One session per server, protocol and capability negotiation, OAuth flow on HTTP transports, token storage, roots exposure, elicitation and sampling handling | Same as host |
| Server | Local STDIO process or remote Streamable HTTP service exposing tools, resources and prompts | Validate inputs, enforce access control, rate limit, sanitise outputs, validate tokens as an OAuth resource server, publish Protected Resource Metadata, manage sessions securely | Server publisher for code; whoever runs the process or service for operations |
| Authorisation server | Enterprise identity provider or a dedicated OAuth server | Implement OAuth 2.1, validate exact redirect URIs, require PKCE, issue short-lived and audience-bound tokens, rotate refresh tokens for public clients | Identity team |
For the protocol walk-through itself, see the MCP Security Guide and the MCP Authorisation Specification Guide. This page does not repeat them; it assigns ownership.
Where the trust boundaries sit
Responsibility follows the boundaries data and authority cross. There are five that matter in practice.
- User to host: the user's intent becomes model actions. The host must show what will run and obtain consent. The specification states that hosts must obtain explicit user consent before invoking any tool and before exposing user data to servers.
- Host to server (data in): everything a server returns, including tool descriptions, annotations, tool results and resource content, enters the model context. The specification says clients must treat tool annotations as untrusted unless they come from trusted servers.
- Host to server (authority out): tool arguments, roots and tokens leave the host. Roots must be exposed only with appropriate permissions, and tokens must only go to the server they were issued for.
- Server to upstream API: the server acts as its own OAuth client to downstream services. The token it received from the MCP client must not be passed through.
- Server to server, through the host: the host holds the full conversation and controls cross-server interactions. Output from one server reaching another server's tool arguments is a host decision, not a server one.
A useful test: if the control depends on seeing the user, the model context or more than one server, the host owns it. If it depends on the token, the backend data or the tool's internal logic, the server owns it.
Authorisation responsibilities, side by side
The authorisation part of the specification applies to HTTP-based transports. Implementations using STDIO should not follow it and should instead retrieve credentials from the environment, which moves credential handling for local servers onto whoever configures the host. For remote servers, duties split as follows.
| Control | Client owner | Server owner | Authorisation server owner |
|---|---|---|---|
| Discovery | Must use Protected Resource Metadata (RFC 9728) to find the authorisation server; must parse WWW-Authenticate and handle HTTP 401 | Must publish Protected Resource Metadata listing authorization_servers; should include a scope parameter in challenges | Must provide OAuth 2.0 Authorization Server Metadata or OpenID Connect Discovery |
| Client registration | Should support Client ID Metadata Documents and preregistration; host the metadata document over HTTPS with a matching client_id | None directly | Must validate fetched client_id matches the URL and validate redirect URIs against the document; should warn on localhost-only redirect URIs |
| Code protection | Must implement PKCE, use S256 when capable, and refuse to proceed if code_challenge_methods_supported is absent | None | Advertise code_challenge_methods_supported in metadata (required for OpenID Connect Discovery providers) |
| Audience binding | Must send the RFC 8707 resource parameter with the server's canonical URI in both authorisation and token requests | Must validate the token was issued for this server and reject others | Should issue short-lived access tokens |
| Token transport | Must use the Authorization header on every request, never the query string; must not send tokens from other issuers | Must return 401 for invalid or expired tokens and 403 for insufficient scope | Must serve all endpoints over HTTPS |
| Scope | Should start with baseline scopes and step up only when challenged; should cap retries | Should emit precise scope challenges, not the full catalogue; log elevation events | May issue a subset of requested scopes |
| Upstream calls | None | Must not pass through the client's token; obtain a separate upstream token | Supports token exchange where used |
| Proxy consent | None | Proxy servers using a static upstream client ID must keep per-client consent, exact redirect URI matching and single-use state | Exact redirect URI validation |
Two client duties are easy to miss because they look like server problems. First, SSRF: during discovery a malicious server can point resource_metadata, authorization_servers or token endpoints at internal addresses, including 169.254.169.254. The security best practices page says clients deployed to a server must consider SSRF and should require HTTPS, block private and link-local ranges, validate redirect hops and, for server-side clients, use an egress proxy. Second, authorisation URL handling: clients must allow only https (and http for loopback during development), must reject javascript:, data:, file: and vbscript:, and must not open URLs through a shell. See the MCP Authorisation URL Injection guide for the detail.
Tool poisoning versus server compromise
These two are often merged under "malicious MCP server", but they have different mechanics, detection points and owners. MITRE ATLAS describes AI Agent Tool Poisoning (AML.T0110) as altering tool behaviour such as parameters or descriptions to keep influence over an agent, and AI Agent Tool (AML.T0010.005) as a supply chain path into the agent's environment.
| Aspect | Tool poisoning | Server compromise |
|---|---|---|
| What changes | Tool names, descriptions, annotations or results carry instructions aimed at the model (indirect prompt injection, AML.T0051.001) | The server code, package, hosting or credentials are controlled by an attacker, so its actions are malicious even with honest metadata |
| Where harm happens | Inside the host: the model calls other tools, leaks context or follows planted steps | Inside the server and its backends: data copied, actions taken with the server's own credentials |
| Who can see it first | Client owner: definition change detection, review of descriptions, tool call approval | Server operator: code review, release integrity, runtime monitoring; organisation: package provenance |
| Primary controls | Treat metadata as untrusted, pin and diff tool definitions, re-approve on notifications/tools/list_changed, show inputs before calls, restrict cross-server flows | Signed releases, version pinning, least-privilege server credentials, upstream token separation, egress limits, logging of every call |
| Typical containment | Disable the server in the host, revoke its approval, review recent tool calls | Pull the version, rotate every credential the server held, check backend logs |
The postmark-mcp malicious server shows server compromise: after 15 working versions, one added line in version 1.0.16 blind-copied every outgoing email using the victim's own credentials. No client-side description check would have caught it; version pinning and provenance would. The Sentry MCP agentjacking research shows the other pattern: attacker-written error data came back as tool output and coding agents ran the planted steps. That is a host decision failure, and human approval for shell commands that originate in tool output is the client-side fix. For detection signals, see MCP Tool Poisoning Detection.
Controls the client and host owner must deliver
Consent and visibility
- Tool exposure: show which tools are available to the model and visibly indicate each invocation, with a human able to deny calls, as the tools section recommends.
- Argument preview: show tool inputs to the user before sending them to the server for sensitive operations, to stop accidental or induced exfiltration.
- Local server installation: where one-click local configuration exists, the client must show the exact command without truncation, flag it as code execution, require explicit approval and allow cancellation.
- Workspace configuration: treat repository-level MCP config files as untrusted input. The Amazon Q MCP config vulnerability launched servers from a repository file on folder open, and the fix added a consent prompt before loading workspace servers.
Isolation and least privilege
- Sandboxing: the specification recommends running local servers with minimal default privileges and restricted file system and network access, with explicit grants when needed.
- Environment scrubbing: do not pass the developer's full environment (cloud keys, CLI sessions, SSH agent) to child server processes; inject only the credential each server needs. See How to give MCP servers and local agents secrets without plain-text config files.
- Roots: clients must expose only roots with appropriate permissions, validate root URIs against path traversal, and should prompt before exposing them.
- Cross-server flow: decide which servers may share a session, and require confirmation when output from one server becomes arguments for a write or send tool on another.
Server-initiated requests
- Sampling: users must explicitly approve sampling requests and control the prompt and what results the server sees; set iteration limits on tool loops.
- Elicitation: clients must show which server is asking, offer decline and cancel, and for URL mode must not pre-fetch, must show the full URL and must open it in a context the client and model cannot inspect. See the MCP Sampling and Elicitation Security Guide.
Tokens and logging
- Token storage: store access and refresh tokens in the operating system credential store, not in plain configuration; handle
MCP-Session-Idvalues securely. - Audit: log tool calls with server, tool, arguments hash, approval decision and outcome, as the tools section recommends, and forward to central logging in managed estates.
Controls the server owner must deliver
- Token validation: validate every inbound request, check audience and issuer, and reject tokens not issued for this server. Servers must not use sessions for authentication.
- No passthrough: obtain separate upstream tokens; passthrough breaks audit trails and lets a stolen token use the server as an exfiltration proxy.
- Tool safety: servers must validate all tool inputs, implement access controls, rate limit invocations and sanitise outputs. Content returned from third-party data (tickets, errors, emails) should be marked or filtered, because the server is the last point that knows its provenance.
- Session handling: use cryptographically random session IDs and bind queued state to the user, for example a
<user_id>:<session_id>key, so a guessed ID cannot inject events. - Transport hardening: Streamable HTTP servers must validate the
Originheader and return 403 when it is invalid; local HTTP servers should bind to 127.0.0.1, and local servers should prefer STDIO or authenticated IPC. - Scope design: publish a small baseline scope and step up per operation; avoid wildcard scopes and full catalogues in
scopes_supported. - Elicitation state: bind elicitation to the user identity from the token (for example the
subclaim), never request secrets via form mode, and never place pre-authenticated URLs in URL mode requests. - Release integrity: publish through one verifiable channel, sign releases and document tool definition changes so clients can re-approve. See the MCP Registry and Server Publishing Security Guide.
Controls the organisation owns
Several controls fail if left to either side alone. Name a platform owner for each.
| Control | Why neither side can own it | Typical mechanism |
|---|---|---|
| Inventory of hosts, clients and servers | Developers install servers per machine; vendors cannot see your estate | Endpoint discovery of config files plus a registry. See How to audit MCP servers on developer laptops. |
| Approved server list and version pinning | Clients enforce, but someone must decide | Registry or gateway allow list, managed host settings |
| Credential issuance for servers | Each server is a non-human identity with delegated access | Per-server scoped credentials from the secrets platform, short lifetimes |
| Central logging and correlation | Client logs show intent, server logs show effect | Gateway logs or forwarded client and server logs keyed by correlation ID |
| Supplier assessment | Third-party remote servers are external services | Trust assessment before approval. See MCP Server Trust Assessment. |
A gateway can centralise several client and server duties, but it does not remove the host's consent duty or the server's token validation. See the MCP Gateway and MCP Server Governance Guide.
Implementation order
- Agree the RACI: take the tables above, assign a named owner per control for each host product and each internal server, and record gaps.
- Inventory first: find every host and configured server across endpoints and CI. Without it, the rest cannot be measured.
- Client quick wins: turn on tool call approval for write, send and shell tools; disable automatic loading of workspace config; update host versions to builds with untrusted server prompts.
- Credential separation: replace inherited environment credentials with per-server scoped secrets. Pilot with one team, compare tool success rates, then widen.
- Server conformance: for internal remote servers, test audience rejection (send a token for another resource and expect 401), passthrough absence, Origin validation and scope challenges in a staging ring before production.
- Pin and diff: pin server versions and tool definition hashes; alert on change and require re-approval.
- Central logging: forward tool call logs and server authorisation logs; build the metrics below.
- Rollback: keep the previous approved version and config per server so a bad release or a broken policy can be reverted within the host management tool in minutes.
Decision guidance
- Local STDIO or remote HTTP: local servers put almost every control on the host owner (sandbox, credentials, consent). Remote servers move token validation and data access control to the server operator but add the OAuth client duties. Prefer remote for shared, data-holding tools where the operator can enforce access centrally.
- Gateway or direct: small teams with a few vetted servers can enforce through managed host settings. Larger estates benefit from a gateway that holds the allow list and logs, while hosts keep consent. See MCP Gateway vs Direct MCP Connections.
- Vendor host or in-house host: with a vendor host, your duties shrink to configuration and policy, so test the vendor's consent, URL handling and environment behaviour yourself. With an in-house agent platform, every client "must" in this guide is your engineering backlog.
Detection and measurement
- Monitor on the client side: new server registrations, tool definition changes, denied approvals, URL elicitation to new domains, shell commands following tool output.
- Monitor on the server side: 401 rates by audience mismatch, scope elevation events, rate limit hits, unusual upstream data volumes, Origin rejections.
| Metric | Owner | Target direction |
|---|---|---|
| Percentage of configured servers on the approved list with pinned versions | Organisation | Towards 100% |
| Percentage of hosts with approval required for write, send and shell tools | Client owner | Towards 100% |
| Servers using inherited environment credentials | Client owner | Towards zero |
| Internal remote servers passing audience rejection and no-passthrough tests | Server owner | Towards 100% |
| Median time from tool definition change to re-approval or block | Client owner | Down |
| Tool calls with a correlation ID present in both client and server logs | Organisation | Up |
Common failure patterns
- Assuming the server will refuse bad requests: host teams rely on server-side checks while the real harm comes from the model chaining honest tools, as in the Sentry case.
- Auto-loading repository configuration: a cloned repository becomes a code execution path with the developer's credentials, as the Amazon Q case showed.
- Unpinned server packages: trust built over many clean releases is spent in one update, as with postmark-mcp.
- Token passthrough "for now": a server forwards the client token upstream, losing audit attribution and turning token theft into backend access.
- Broad scopes requested up front: clients request everything in
scopes_supported, so one leaked token reaches every tool. - No owner for inventory: each side assumes the other tracks installed servers, so incident responders cannot answer which machines ran the affected version. See the MCP Incident Response Playbook.
Framework mapping
| Area | NIST SP 800-53 Rev 5 | NIST CSF 2.0 | Threat references |
|---|---|---|---|
| Consent, least privilege, roots | AC-6 Least Privilege, AC-21 Information Sharing | PR.AA-05 | OWASP LLM06:2025 Excessive Agency |
| Local server execution and sandboxing | CM-7 Least Functionality, CM-11 User-installed Software | PR.PS-05 | ATLAS AML.T0010.005 |
| Token audience and service authentication | IA-9 Service Identification and Authentication | PR.AA-05 | MCP token passthrough |
| Tool poisoning and untrusted output | SC-7 Boundary Protection | DE.CM-09 | ATLAS AML.T0110, AML.T0051.001; OWASP LLM01:2025 Prompt Injection |
| Server supply chain and third-party servers | SR-3 Supply Chain Controls and Processes, SA-9 External System Services | GV.SC-07 | ATT&CK T1195.002; OWASP LLM03:2025 Supply Chain |
| Inventory and logging | AU-12 Audit Record Generation, CM-10 Software Usage Restrictions | ID.AM-02, DE.CM-09 |
Practitioner checklist
- Publish a control ownership matrix covering host, client, server, authorisation server and platform owner for every MCP deployment.
- Require explicit approval for write, send and shell tools in every managed host, and show arguments before execution.
- Disable automatic loading of repository or workspace MCP configuration without a consent prompt.
- Remove inherited environment credentials from local server processes and issue per-server scoped secrets.
- Pin server versions and tool definition hashes, and re-approve on change.
- Test internal remote servers for audience rejection, no token passthrough, Origin validation and precise scope challenges.
- Verify host clients enforce PKCE S256, the resource parameter, authorisation URL scheme allow lists and SSRF blocking during discovery.
- Maintain an inventory of hosts and servers with owners, and correlate client and server logs centrally.
Standards and references
- Model Context Protocol: Specification 2025-11-25
- Model Context Protocol: Authorization
- Model Context Protocol: Security Best Practices
- Model Context Protocol: Architecture
- Model Context Protocol: Tools
- IETF: RFC 9728 OAuth 2.0 Protected Resource Metadata
- OWASP: Top 10 for LLM Applications 2025
- MITRE ATLAS: AI Agent Tool Poisoning
Related NHI Mgmt Group resources: MCP Security Guide · Local MCP Server Security Guide · MCP Authorisation Specification Guide · MCP Gateway and MCP Server Governance Guide