Define the trust boundary
MCP server security spans the client, server, authorization server, credentials, data sources, local process privileges, network destinations, and the model context that can trigger tools. Inventory the exact server owner, publisher, version, distribution source, methods, filesystem roots, data classes, credentials, network reach, and deployment environment before deciding whether it can launch.
The threat model must cover prompt injection, excessive permissions or scope, secret or token exposure, unsafe writes or deletes, network reach or SSRF, and third-party supply chain or local server compromise. Prompt injection and destructive-action gating are broader AI agent tool security concerns; token audience validation, token passthrough, SSRF, and local server compromise are addressed directly in official MCP security material.
Apply official MCP authorization controls
For HTTP transports, follow the MCP authorization flow, publish protected resource metadata, validate access-token audience, reject tokens not issued for the MCP server, and avoid token passthrough. Request minimal initial scopes and elevate only when a specific method needs more access. Keep credentials in managed storage, out of prompts and ordinary logs, and document rotation and revocation.
Use the official MCP Inspector during validation to enumerate resources, prompts, tools, notifications, and protocol exchanges. Exercise both allowed and denied calls so the review covers behavior rather than configuration alone.
MCP tool permissions boundaries
Define MCP tool boundaries at the tool level, not only at the server level. Decide which tools are visible to the agent, which are callable, which are read-only, and which require explicit approval before write, delete, network, secret, or production access.
Use a policy matrix for read-only, write-limited, and admin tools. Map each enabled tool to a declared workflow, owner, and rollback path. Separate repository read, write, and delete capabilities instead of granting one broad server profile to every agent session.
When vendors use different vocabulary such as permissions boundaries, deny policies, or read-write tool use, translate them into the same review questions: who can invoke the tool, on what target, with what evidence, and under what stop condition.
Compare OAuth, API keys, and mTLS
Authentication is not one checkbox. Use OAuth or the MCP authorization flow when HTTP-based servers need audience-bound tokens and scopes. Use API keys or service tokens only when they are narrowly scoped, runtime-injected, redacted, and revocable. Use mTLS or private network identity when production service-to-service access needs strong client identity and certificate lifecycle control.
The included security config example starts from a conservative read-only profile: token audience validation, blocked secret paths, network allowlists, empty write and destructive method lists, human approval for high-impact access, redacted audit fields, and a named revocation command.
Add operational launch gates
Separate repository read, write, and delete capabilities. Deny outbound network, secret access, and production access by default until each destination and use case is reviewed. Require an informed human decision immediately before destructive or production-facing actions, and retain attributable records that identify the actor, session, server version, method, target, approval, and outcome without logging secrets.
These approval, audit-log, read/write separation, and review-cadence controls are KyenAI operational recommendations. They are not presented as normative MCP specification requirements. Teams can adopt stricter controls when data sensitivity, regulatory obligations, or production impact warrants them.
Recommended play
- Inventory one named server and version, including owner, publisher, methods, data classes, credentials, network reach, dependencies, and deployment environment.
- Validate official MCP authentication and authorization behavior, including token audience, scopes, deny paths, and token-passthrough protection.
- Launch with the narrowest read-only profile, then review write, delete, network, secret, and production capabilities as separate permission decisions.
- Use MCP Inspector to test expected allow and deny cases, record evidence, and prove that disablement and credential revocation work.
MCP security launch decisions
Distinguish protocol-specific requirements and guidance from general operating controls before approving an MCP server.
| Area | Claim basis | Security decision | Launch gate |
|---|---|---|---|
| MCP authentication | Official MCP authorization specification and security guidance | Validate token audience, metadata, scopes, and deny paths; do not pass through unrelated tokens | Authorization tests prove accepted and rejected token behavior |
| MCP permissions | Official least-privilege guidance plus local capability policy | Request minimal scopes and review read, write, delete, network, secret, and production access separately | Every enabled scope and method maps to a declared workflow |
| Human approval | KyenAI operational recommendation | Require an informed decision immediately before destructive or production actions | The prompt identifies actor, target, action, environment, and rollback limits |
| Attributable logs | KyenAI operational recommendation | Record actor, session, server version, method, target, approval, timestamp, and outcome | A reviewer can reconstruct a consequential call without exposing secrets |
| Network isolation | Official SSRF guidance plus KyenAI deployment controls | Validate URLs and redirects; allowlist destinations and block private or metadata endpoints | SSRF, redirect, DNS, and undeclared-destination tests pass |
| Revocation | KyenAI operational recommendation informed by MCP token guidance | Disable the server, revoke credentials and client access, preserve records, and assess affected data | The owner proves emergency disablement and names incident contacts |
Execution steps
Record the server profile
Name the owner, publisher, version, distribution source, methods, resources, prompts, data classes, credential source, network destinations, dependencies, and deployment environment.
Verify authentication and scopes
Test protected resource metadata, token audience, minimal scopes, rejected tokens, incremental elevation, and the absence of token passthrough for HTTP-based MCP authentication.
Complete the permission matrix
Decide repository read, write, delete, outbound network, secret access, and production access separately. Document each default, data risk, approval, logging expectation, and launch gate.
Validate with MCP Inspector
Enumerate exposed protocol features, exercise expected allow and deny cases, inspect errors and protocol exchanges, and retain evidence for the reviewed server version.
Prove revocation and incident response
Disable the server, revoke tokens and secrets, remove client access, identify retained records, and confirm who evaluates affected systems before production approval.
Common pitfalls
Calling every control an MCP requirement
Tie normative language only to official MCP evidence. Label human approval, attributable audit logs, read/write separation, and review cadence as KyenAI operational recommendations.
Granting one broad MCP permission bundle
Review repository read, write, delete, outbound network, secret access, and production access as independent capabilities with separate launch gates.
Testing only the happy path
Use MCP Inspector and direct authorization tests to prove denied scopes, invalid audiences, undeclared destinations, and disabled capabilities stay blocked.
Logging secrets in the name of auditability
Record identifiers and outcomes, not token values or unnecessary payloads. Test redaction before launch.
Implementation checklist
- Record the server owner, publisher, version, distribution source, and deployment environment.
- Classify methods, capabilities, data classes, credentials, network reach, and dependencies.
- Validate MCP authentication, token audience, minimal scopes, and denied authorization paths.
- Keep secrets and tokens out of prompts, source control, tool output, and ordinary logs.
- Separate repository read, write, and delete permissions.
- Deny outbound network, secret access, and production access until independently approved.
- Require human approval for destructive or production actions as an operational control.
- Retain attributable, secret-redacted audit records as an operational control.
- Validate resources, prompts, tools, notifications, and allow or deny behavior with MCP Inspector.
- Test server disablement, credential revocation, incident contacts, and restoration criteria.
Questions this guide answers
What are MCP tool permissions boundaries?
MCP tool boundaries should be defined at the tool level, not only at the server level: decide which tools are visible, which are callable, which are read-only, and which require explicit approval before write, delete, network, secret, or production access.
What should you review before launching an MCP server for coding agents?
Review authentication, token audience, scopes, read/write separation, secret isolation, network allowlists, audit logs, human approval for high-impact actions, and a tested revocation path before the agent can reach the server unattended.
Who should own MCP security review?
Engineering leaders, security reviewers, platform teams, and developer tooling owners who can inventory the server owner, methods, credentials, deployment environment, and rollback plan before rollout.