Before deploying MCP servers in production, verify these 12 controls. Based on the risks outlined in our MCP Security Risks guide.
Input & validation
1. β Validate all tool parameters β Use Zod (TypeScript) or Pydantic (Python). Never trust raw LLM output.
2. β Sanitize tool responses β Strip potential prompt injection from data returned by tools.
3. β Rate limit tool calls β Prevent runaway agents from making thousands of calls.
Authentication & authorization
4. β Authenticate remote connections β For SSE transport, require API keys or OAuth. Never expose servers without auth.
5. β Implement per-user permissions β Check user permissions on every tool call, not just at connection time.
6. β Use least privilege β Each server only accesses what it absolutely needs.
Isolation & containment
7. β Sandbox MCP servers β Run in Docker containers or separate processes.
8. β Network segmentation β Internal servers (database, files) should not have outbound internet access.
9. β Separate read and write β Consider separate servers for reading vs writing. AI reads freely, needs approval to write.
Monitoring & audit
10. β Log every tool call β Record: timestamp, tool name, parameters, user, result.
11. β Alert on anomalies β Flag unusual patterns: high volume, unexpected tools, off-hours access.
12. β Human approval for destructive actions β Delete, send, deploy, pay β require confirmation.
Quick implementation
Most of these controls can be added in under an hour. Start with the top 3:
- Input validation (Zod/Pydantic) β 15 minutes
- Logging every tool call β 15 minutes
- Least privilege (review what each server accesses) β 30 minutes
Then add auth, sandboxing, and monitoring as you move toward production.
Testing your security
Before deploying, try to break your own MCP server:
- Send SQL injection in tool parameters
- Include prompt injection in tool responses
- Try accessing resources outside the allowed scope
- Test with missing or invalid auth tokens
If any of these succeed, fix them before production.
For GDPR compliance
Also verify: data processed by MCP servers is covered by your DPA, personal data doesnβt flow through non-compliant providers, and consider self-hosting for sensitive data.
Related: MCP Security Risks Β· MCP Complete Guide Β· Self-Hosted AI for GDPR Β· Best Password Managers for Developers