An MCP server running in production is infrastructure mediating between an AI model and real systems — files, databases, APIs, sometimes shell access. It deserves the same operational security rigor as any other production service that handles credentials and executes actions on behalf of a client, plus a set of additional considerations specific to what it means for an AI model, rather than a conventional client, to be the thing calling it.
Authentication and authorization, correctly implemented
Any MCP server exposed over a network (not a local STDIO server) needs OAuth 2.1-based authentication per the MCP specification, with strict audience validation on every incoming token — covered in more depth separately, but worth restating as the non-negotiable baseline: a production MCP server accepting unauthenticated connections, or accepting tokens without validating they were actually issued for it, is not securely deployed regardless of what other controls exist around it.
Credential scoping for what the server itself can do
The credentials an MCP server holds to perform its actual function — a database connection string, an API key for a downstream service, filesystem access — should be scoped to the minimum the server’s legitimate functionality requires, exactly as you’d scope any service account. A file-management MCP server needs access to specific directories, not the entire filesystem; a database-query server needs read access to specific tables, not admin credentials to the whole database. This scoping determines the actual ceiling of damage if the server is compromised, manipulated through tool poisoning, or exploited through any other vector — it’s the control that holds even when other layers fail.
Input validation on every tool parameter
Tool parameters received from a client should be validated with the same rigor as any external API input — type checking, format validation, and explicit bounds — rather than trusted because the request came through the MCP protocol from what’s presumed to be a well-behaved AI client. A path parameter that isn’t validated against directory traversal, or a query parameter passed unsanitized into a database call, creates exactly the same classes of vulnerability (path traversal, injection) that exist in any traditional API, and MCP’s framing as an “AI-facing” protocol doesn’t make these classic vulnerability classes any less exploitable.
Treat tool call arguments as potentially adversarial, not just malformed
Beyond standard input validation for malformed or malicious input, MCP servers face a distinct risk: an AI agent that’s been manipulated (via prompt injection processing some upstream content) might call a tool with technically well-formed but contextually inappropriate parameters — a legitimate-looking file path that happens to point somewhere sensitive, or a request pattern consistent with data exfiltration rather than normal use. Logging and monitoring actual parameter values used in tool calls, not just whether calls succeeded or failed, gives visibility into this pattern that pure input validation won’t catch on its own.
Rate limiting and resource constraints
An MCP server should apply the same rate limiting and resource consumption controls any production API would need — bounding how many calls a client can make, how much compute or data a single tool call can consume, and timing out long-running operations. This protects against both accidental runaway agent behavior (a poorly designed agent looping on a tool call) and deliberate abuse, and it’s easy to overlook specifically because early MCP server implementations are often built quickly, as internal tools, without the production hardening a public-facing API would receive by default.
Isolate execution for anything resembling code or command execution
If an MCP server’s functionality includes executing code, running shell commands, or any similarly powerful capability, that execution should happen in an isolated, sandboxed environment with no more access than the specific task requires — a compromised or manipulated call to an execution-capable tool should not be able to affect anything beyond its intended, narrow scope. Running such a tool with the same broad privileges as the rest of your infrastructure turns what should be a contained capability into a direct path to full compromise if anything upstream of it goes wrong.
Supply chain hygiene for the server itself
An MCP server is software with its own dependencies, and it’s subject to the same supply chain risks as any other application — a compromised dependency, an unpinned version that silently updates to a malicious release, a base image with known vulnerabilities if containerized. Applying the same dependency scanning, version pinning, and update discipline covered for general software supply chain security applies fully here, and shouldn’t be skipped because the server “just” mediates AI tool calls rather than serving traditional application traffic.
Logging and monitoring built for this specific threat model
Standard uptime and error monitoring won’t surface a tool poisoning attempt, an audience-validation bypass, or an agent being manipulated into unusual tool-call patterns. Logging should capture enough detail — which client, which tool, what parameters, what the underlying credential actually did — to reconstruct an incident specifically involving AI-mediated access, which is a different investigative need than a typical API access log built primarily around request/response codes and latency.
A practical checklist
- Enforce OAuth 2.1 authentication with strict audience validation for any network-exposed server
- Scope the server’s own credentials to the minimum its actual function requires
- Validate every tool parameter as untrusted external input, with explicit type and bounds checking
- Log actual parameter values used in tool calls, not just success/failure, to catch adversarial usage patterns
- Apply rate limiting and resource constraints as you would for any production API
- Sandbox any code or command execution capability with narrowly scoped, isolated access
- Apply standard supply chain hygiene (dependency scanning, version pinning) to the server’s own codebase
Running an MCP server well in production isn’t fundamentally different from running any other service handling credentials and executing actions on a client’s behalf — it just requires recognizing that the client, in this case, is an AI model whose behavior in response to adversarial input isn’t fully predictable, which raises the bar on several of these controls rather than lowering it.
