A remote MCP server is an internet-facing API that executes actions on behalf of AI agents, often holding credentials to a dozen downstream systems, yet many are deployed with the security of a weekend prototype. Operators of hosted MCP servers over Streamable HTTP need the same baseline as any privileged API (strong authentication, tenant isolation, rate limits, safe errors and audit logging) plus MCP-specific rules on token audience, header validation and tool exposure. This guide sets out that baseline using MCP specification revision 2026-07-28 (checked on 27 October 2026) and the OWASP GenAI Security Project's A Practical Guide for Secure MCP Server Development (version 1.0, February 2026). It is for platform, application security and SRE teams running MCP servers for internal users or customers. Gateway placement and server governance are covered in the MCP Gateway and MCP Server Governance Guide.
Key takeaways
- Authenticate every request and fail closed. Remote servers should require OAuth 2.1 or OIDC tokens, validate signature, issuer, audience and expiry on every call, and reject anything that does not validate.
- The server needs its own identity downstream. Never forward a client's token; use a separate credential or token exchange, held in a vault the model cannot reach.
- Isolate tenants by design, not by convention. No global state for user data, state keyed to the verified user, per-tenant quotas and deterministic clean-up.
- Use the protocol's own validation hooks. In revision 2026-07-28, servers MUST validate
Origin, require theMCP-Protocol-Version,Mcp-MethodandMcp-Nameheaders, and reject header and body mismatches. - Log tool calls like privileged transactions. Record who called which tool with what outcome, redact secrets, ship to a SIEM and alert on validation spikes and unusual call rates.
How identity and access work in remote MCP servers
Revision 2026-07-28 made MCP stateless: the initialize handshake and protocol-level sessions (the Mcp-Session-Id header) were removed, and every request carries its protocol version and client capabilities in _meta. That simplifies security, because each POST to the single MCP endpoint must stand on its own: the authorisation specification says authorisation MUST be included in every HTTP request.
| Client population | Recommended authentication | Notes |
|---|---|---|
| Interactive users through MCP clients | OAuth 2.1 authorisation code with PKCE, per the MCP authorisation specification | Server publishes RFC 9728 metadata and validates audience; see the MCP Authorisation Specification Guide |
| Known internal clients or agents | Allowlisted clients, mutual TLS, or OAuth client credentials | OWASP lists allowlists, hardcoded connections and mTLS for known clients |
| Dynamic or third-party clients | OAuth 2.1 or OIDC with Client ID Metadata Documents and a domain trust policy | Dynamic Client Registration is deprecated in 2026-07-28 |
| No authentication | Only for genuinely public, read-only data | The transport says servers SHOULD authenticate all connections |
Token validation is where hosted servers fail. The specification requires servers to validate tokens per OAuth 2.1 Section 5.2, confirm they are the intended audience under RFC 8707, return 401 for invalid or expired tokens and 403 for insufficient scope. OWASP adds: validate iss, aud, exp and the signature on every request, keep access tokens to minutes, and never authorise on a session identifier alone. Possession of a server-minted state handle is not authentication either; bind stored state to the user ID taken from the verified token, keyed as <user_id>:<handle>.
Decision guidance: a team serving only its own staff should put the server behind the corporate identity provider with pre-registered clients and short tokens. A public SaaS server needs CIMD support, scope design that starts minimal, and abuse controls on any registration endpoint. Large estates with many servers should centralise authentication, consent, tool filtering and audit at a gateway or policy layer, which OWASP explicitly recommends.
Admin roles and privileged access
The most dangerous credentials around a hosted MCP server are usually not the users' tokens but the operator's: deployment tokens, container registry credentials, cloud roles, and admin keys for the server or gateway itself.
- Deployment and hosting tokens: scope them to one application and keep them off build machines. In the Smithery.ai MCP hosting breach, an unvalidated build path let researchers read a Docker config file holding a fly.io token with control over more than 3,000 apps, most of them hosted MCP servers.
- Master and admin keys: never ship example or default keys, and never expose admin interfaces to the internet. Rotate on any suspicion.
- Operator access to production: just-in-time, MFA-protected, logged; break-glass accounts reviewed after use. See the Privileged Access Management Guide.
- Change control for tools: OWASP asks for signed tool manifests covering description, schema, version and required permissions, verified at load time, and an approval workflow with SAST, dynamic testing, dependency scanning and manual review before a tool is added or changed. Tool definitions are instructions to the model, so changing a description is a privileged change.
- Configuration changes: log old and new values for every change to authentication, tool exposure or tenant settings.
Integrations, API tokens and service accounts
A remote MCP server is a non-human identity that calls upstream systems on behalf of users. How it holds and uses those credentials determines blast radius.
| Pattern | Description | Assessment |
|---|---|---|
| Token passthrough | Forward the client's token to the upstream API | Forbidden by the specification: breaks audience boundaries and audit trails |
| Shared service account | One powerful upstream credential for all users | Simple, but every tenant's data is one bug away; per-user authorisation must be rebuilt in the server |
| Per-user upstream OAuth | Server acts as an OAuth client and stores a token per user | Good isolation; tokens must be encrypted, scoped and revocable; proxies need per-client consent |
| Token exchange (RFC 8693) or on-behalf-of | Exchange the inbound token for a narrowly scoped upstream token carrying user context | OWASP's preferred delegation model; keeps the server's own identity separate |
- Secrets storage: OWASP says store credentials and API keys in a vault, not in environment variables, logs or code, and handle them in middleware the model cannot reach. See the Cloud Secrets Managers Guide.
- Workload identity over static keys: where the server runs in a cloud or Kubernetes, use the platform's workload identity to obtain short-lived credentials. See the Cloud Workload Identity Guide.
- One identity per agent or backend process: each with narrow permissions and audited use, so a compromise is attributable and containable.
- OAuth proxy obligations: if the server fronts a third-party API with a static client ID, it MUST implement per-client consent before forwarding, with exact redirect URI matching and post-consent
statehandling. See the MCP Security Best Practices Explained.
Logging and detection
OWASP's guide asks for audit logs of tool invocations, resource access, authentication events and configuration changes, with sensitive fields redacted or hashed and logs stored immutably, then sent to a SIEM with alerts on spikes in failed validations, high-frequency tool calls and unusual file access.
| Event | Fields to capture | Alert on |
|---|---|---|
| Token validation | Result, failure reason (signature, issuer, audience, expiry), client ID, subject, source IP | Audience failures from a new client; bursts of invalid tokens |
| Tool call | Mcp-Method, Mcp-Name, tenant, subject, argument hash, outcome, latency, upstream identity used | Call rates above baseline; high-risk tools outside business hours |
| Scope elevation | Requested and granted scopes, correlation ID | Repeated elevation for admin-class scopes |
| Validation rejects | Schema failures, HeaderMismatch (-32020), invalid Origin (403) | Spikes that suggest probing or a broken client release |
| Configuration change | Actor, object, old and new values | Changes to auth settings or tool descriptions outside change windows |
Revision 2026-07-28 documents OpenTelemetry trace context propagation in _meta (traceparent, tracestate, baggage), which lets you correlate an agent's request across gateway, server and upstream API. Never log tokens, full arguments containing personal data, or upstream credentials. See the Secure Error Handling and Logging Guide.
Metrics that show the baseline is working:
- Percentage of requests authenticated with audience-validated tokens (target 100% outside public read-only tools).
- Median access token lifetime for MCP clients (target minutes, per OWASP).
- Rate-limited requests per tenant, and tenants hitting quotas repeatedly.
- Critical and high vulnerabilities open in the server image beyond SLA (target zero).
- Tools in production without a signed, reviewed manifest (target zero).
- Mean time to revoke an upstream credential after an alert.
Hardening baseline
Transport and protocol
- TLS: TLS 1.2 or higher on the MCP endpoint (OWASP); authorisation server endpoints MUST be HTTPS.
Originvalidation: servers MUST validateOriginon all incoming connections and MUST return 403 when it is present and invalid.- Header and body consistency: every POST MUST carry
MCP-Protocol-Version, andMcp-MethodplusMcp-Namefortools/call,resources/readandprompts/get. Servers MUST reject mismatches with 400 and JSON-RPC error-32020(HeaderMismatch), decoding Base64-encoded values first. This stops a gateway routing or rate-limiting on one value while the server executes another. - Intermediaries: gateways enforcing policy on mirrored headers SHOULD reject requests whose protocol version predates header validation rather than trust unvalidated headers.
- Legacy traffic: a 2026-07-28-only server SHOULD return 405 to GET or DELETE on the endpoint and ignore
Mcp-Session-IdandLast-Event-ID. Retire the deprecated HTTP+SSE transport. - Schema validation: validate all JSON-RPC messages against the MCP schema and every tool input and output against its JSON Schema; reject what does not match and enforce output size limits.
Isolation, tenancy and resource limits
- No shared user state: OWASP warns against global variables, class-level attributes and singletons for user data; use per-request objects or a store namespaced by verified user and tenant.
- Clean-up: flush temporary files, in-memory context and cached tokens when work ends or times out.
- Quotas: limit memory, CPU, filesystem and API rate per user identity and per tool, with timeouts and compute budgets. See the Rate Limiting and API Abuse Guide.
- Containers: minimal hardened images, non-root, unnecessary packages and Linux capabilities removed, seccomp and AppArmor applied.
- Network: restricted segment, default-deny Kubernetes NetworkPolicies or firewall rules, and an egress allowlist so a compromised tool cannot reach arbitrary hosts or the cloud metadata service.
- Safe errors: never return stack traces, tokens, file paths or tool internals to the client or model.
- High-risk actions: require human confirmation, for example through elicitation, for deletions, payments or system changes.
Phased rollout
- Baseline audit: scan for unauthenticated endpoints, default keys and wildcard CORS or
Originhandling; inventory upstream credentials. - Authentication first: deploy fail-closed token middleware in monitor mode, logging what would be rejected, for one release.
- Enforce in rings: internal tenants, then a pilot customer group, then everyone. Keep a per-client exception list with expiry rather than a global bypass.
- Isolation and limits: introduce quotas with generous thresholds, tighten from observed baselines.
- Supply chain gates: pin and scan dependencies, sign images, keep an AI-BOM, and fail CI on new critical vulnerabilities or unapproved dependencies.
- Rollback: blue-green deployments so a faulty validation change can be reverted without disabling authentication.
Framework mapping
| Baseline area | NIST SP 800-53 Rev. 5 | NIST CSF 2.0 | ATT&CK addressed |
|---|---|---|---|
| Authentication and audience validation | IA-2, IA-8, IA-9, AC-3 | PR.AA-03 | T1190 Exploit Public-Facing Application, T1550.001 Application Access Token |
| Least-privilege tools and scopes | AC-6 | PR.AA-05 | T1078.004 Cloud Accounts |
| Rate limits and quotas | SC-5 Denial-of-service Protection | PR.IR-01 | T1499 Endpoint Denial of Service, T1110 Brute Force |
| Input and schema validation | SI-10 | PR.PS-06 | T1059 Command and Scripting Interpreter |
| Secrets and workload identity | IA-5 | PR.AA-01 | T1552.005 Cloud Instance Metadata API, T1528 Steal Application Access Token |
| Audit logging and monitoring | AU-2, AU-12, SI-4 | PR.PS-04, DE.CM-09 | Supports detection across the above |
In ISO/IEC 27001:2022 Annex A, see 8.5 Secure authentication, 8.15 Logging, 8.16 Monitoring activities, 8.20 Networks security and 8.22 Segregation of networks. The OWASP MCP Top 10 (2025 beta) items MCP01, MCP05, MCP07 and MCP08 Lack of Audit and Telemetry map most directly.
Common misconfigurations
- Fail-open authentication: an exception in token validation yields an empty identity instead of a 401. In the LiteLLM MCP auth bypass, any bearer token produced an MCP session, and scanned gateways also accepted the example master key
sk-1234or had no authentication at all. - Signature without audience: any token from the corporate identity provider is accepted, so tokens minted for other APIs work.
- Upstream god credential: one shared admin key for the downstream system, stored in an environment variable, with per-user checks bolted on in tool code.
- Cross-tenant leakage through caches: results cached under a key that omits the tenant or user. Revision 2026-07-28 adds
cacheScope("public"or"private") on list and read results; mark per-user resultsprivateso shared intermediaries do not cache them. - Verbose errors: stack traces and file paths returned in tool errors, which the model may repeat to the user.
- No egress control: a tool that fetches URLs can be steered to
169.254.169.254and leak the server's cloud role. See the SSRF Prevention Guide.
Practitioner checklist
- Require OAuth 2.1 or OIDC (or mTLS for known clients) on every endpoint that is not public read-only, and fail closed.
- Validate signature, issuer, audience and expiry on every request; keep access tokens short-lived.
- Remove default and example keys; keep admin interfaces off the internet.
- Never forward client tokens; use per-user upstream OAuth or token exchange, with secrets in a vault.
- Validate
Origin, required MCP headers and header-body consistency; validate all inputs and outputs against schemas. - Isolate tenant state, set
cacheScopecorrectly and enforce per-user and per-tool quotas. - Run as non-root in minimal containers with default-deny network policies and egress allowlists.
- Sign and review tool manifests; treat description changes as privileged changes.
- Log tool calls, auth events and config changes with redaction to a SIEM, and alert on validation spikes and unusual call rates.
- Gate CI on dependency and image scanning, and keep an AI-BOM for every release.
Standards and references
- Model Context Protocol: Streamable HTTP Transport (revision 2026-07-28)
- Model Context Protocol: Authorization (revision 2026-07-28)
- Model Context Protocol: Security Best Practices
- Model Context Protocol: Key Changes in revision 2026-07-28
- OWASP GenAI Security Project: A Practical Guide for Secure MCP Server Development
- OWASP: MCP Top 10
- IETF: RFC 9728 OAuth 2.0 Protected Resource Metadata
Related NHI Mgmt Group resources: MCP Gateway and MCP Server Governance Guide · MCP Authorisation Specification Guide · MCP Security Testing Guide · MCP Incident Response Playbook · API Security Guide