production-mcp-server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@production-mcp-serverShow me the audit trail for the last rollback attempt."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
production-mcp-server
A production-grade MCP (Model Context Protocol) server demonstrating how to safely expose tools to AI agents in enterprise environments.
Most MCP examples show how to connect tools to agents. This repo shows how to do it safely at scale โ with permission enforcement, behavioral guardrails, blast-radius controls, and structured audit trails on every invocation.
The Problem โ Solution โ Impact
Problem | AI agents need tool access to be useful โ but unconstrained tool access causes production incidents. Teams either lock agents down (useless) or give full access (dangerous). |
Solution | A governed MCP gateway layer that sits between every agent and every tool: permission-checked, blast-radius controlled, and fully audited on every call. |
Impact | Agents operate safely in production with enterprise-grade authorization. Security teams can audit every action. Developers ship agent features without fear of side effects. |
Related MCP server: nice
System Design
graph TD
A[๐ค AI Agent<br/>Claude / Any LLM] -->|MCP Protocol| B
subgraph MCP Gateway โ Governed Tool Access
B[Request Received] --> C{Layer 1<br/>Permission Check}
C -->|Missing permissions| D[โ Denied<br/>Audit logged]
C -->|Permitted| E{Layer 2<br/>Blast-Radius Guard}
E -->|HIGH risk, no confirmation| F[โ Blocked<br/>Audit logged]
E -->|Confirmed or LOW/MED| G{Layer 3<br/>Input Validation}
G -->|Path traversal / SQL injection| H[โ Blocked<br/>Audit logged]
G -->|Clean inputs| I[โ
Tool Handler Executes]
end
I --> J[(Tool Registry<br/>name ยท permissions ยท risk_level)]
I --> K[๐ Audit Trail<br/>every call ยท permitted or denied]
subgraph Tools
I --> L[๐ Read Metrics]
I --> M[๐ Query Database]
I --> N[๐ Trigger Rollback<br/>HIGH RISK โ requires confirmed=True]
endLayer Breakdown
Layer | What It Does | Why It Matters |
Tool Registry | Stores name, description, required permissions, and risk level for every tool | Single source of truth โ no tool runs without being registered |
Permission Enforcement | Checks caller permissions against tool requirements before execution | Agents can only call tools they are explicitly authorized for |
Blast-Radius Guard | Requires | Agents cannot accidentally trigger destructive operations |
Input Validation | Blocks path traversal, destructive SQL, and other attack patterns | Defense-in-depth โ validates before any handler runs |
Audit Trail | Immutable append-only log of every invocation | Complete auditability for compliance and debugging |
The Problem
When AI agents gain tool access, three failure modes emerge immediately:
Unconstrained access โ agents call tools they shouldn't, causing unintended side effects
No audit trail โ when something goes wrong, you can't reconstruct what the agent did
Silent failures โ permission errors are swallowed, making debugging impossible
This server addresses all three.
Architecture
Agent (Claude / any LLM)
โ
โผ MCP Protocol
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MCP Server โ
โ โโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Guardrail Layer โ โ โ permission check โ blast-radius guard โ arg validation
โ โโโโโโโโโโโโฌโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโผโโโโโโโโโโโโ โ
โ โ Tool Registry โ โ โ name, description, required_permissions, risk_level
โ โโโโโโโโโโโโฌโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโผโโโโโโโโโโโโ โ
โ โ Tool Handlers โ โ โ plain Python functions, no security logic here
โ โโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโผโโโโโโโโโโโโ โ
โ โ Audit Trail โ โ โ every invocation logged, permitted or denied
โ โโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโKey Patterns
1. Governed Tool Access
Every tool is registered with explicit permission requirements:
registry.register(ToolDefinition(
name="trigger_rollback",
description="Initiate a deployment rollback.",
handler=trigger_rollback,
required_permissions={"deployments:write", "deployments:rollback"},
risk_level=RiskLevel.HIGH,
requires_confirmation=True, # blast-radius guard
))2. Permission Enforcement
The guardrail layer checks permissions before any handler runs:
# Agent tries to trigger rollback but lacks deployments:write
guardrails.invoke(
tool_name="trigger_rollback",
arguments={"deployment_id": "d-123", "reason": "high error rate"},
caller_id="monitoring-agent",
caller_permissions={"deployments:read"}, # missing write permission
)
# โ PermissionDeniedError: Caller 'monitoring-agent' lacks permissions
# {'deployments:write', 'deployments:rollback'} for tool 'trigger_rollback'3. Blast-Radius Controls
HIGH risk tools require an explicit confirmation flag โ agents cannot accidentally trigger destructive operations:
# Without confirmation โ blocked
guardrails.invoke("trigger_rollback", {...}, confirmed=False)
# โ GuardrailViolationError: HIGH risk tool requires confirmed=True
# With confirmation โ permitted
guardrails.invoke("trigger_rollback", {...}, confirmed=True)4. Input Validation
Argument-level checks run before any tool handler:
# Path traversal โ blocked automatically
guardrails.invoke("read_file", {"path": "../../etc/passwd"}, ...)
# โ GuardrailViolationError: Path traversal detected
# Destructive SQL โ blocked automatically
guardrails.invoke("query", {"query": "DROP TABLE users"}, ...)
# โ GuardrailViolationError: Destructive SQL pattern detected5. Structured Audit Trail
Every invocation โ permitted or denied โ is recorded:
# After some invocations
events = audit.get_events()
print(events[0].to_json())
# {
# "tool_name": "read_deployment_status",
# "caller_id": "oncall-agent-v1",
# "arguments": {"deployment_id": "d-abc"},
# "result": "{'status': 'healthy', ...}",
# "permitted": true,
# "timestamp": "2026-08-26T14:30:00+00:00",
# "duration_ms": 12.4
# }
print(f"Denied requests: {audit.denied_count()}")Project Structure
production-mcp-server/
โโโ src/
โ โโโ server.py # MCP server entry point โ tool registration + FastMCP wiring
โ โโโ registry.py # Tool registry โ metadata, permissions, risk classification
โ โโโ guardrails.py # Guardrail layer โ 3-layer enforcement on every invocation
โ โโโ audit.py # Structured audit trail โ append-only event log
โ โโโ tools/
โ โโโ example_tools.py # Example handlers โ swap with your real data sources
โโโ tests/
โ โโโ test_guardrails.py # Permission enforcement, blast-radius, input validation
โ โโโ test_registry.py # Tool registration and lookup
โโโ examples/
โ โโโ basic_usage.py # Standalone usage without the MCP server
โโโ pyproject.tomlInstallation
pip install -e ".[dev]"Running the Server
python -m src.serverConnect any MCP-compatible client (Claude Desktop, Claude Code, etc.) to the server.
Running Tests
pytest tests/ -vExtending
Adding a New Tool
Write the handler function in
src/tools/:
def read_config(config_key: str) -> str:
return os.environ.get(config_key, "not_found")Register it with permissions and risk level:
registry.register(ToolDefinition(
name="read_config",
description="Read a configuration value by key.",
handler=read_config,
required_permissions={"config:read"},
risk_level=RiskLevel.LOW,
))Expose via FastMCP:
@mcp.tool()
def config(config_key: str) -> str:
return guardrails.invoke("read_config", {"config_key": config_key}, ...)The guardrail and audit layers apply automatically โ no changes needed there.
Integrating Your Auth Layer
Replace the static CALLER_ID / CALLER_PERMISSIONS in server.py with your real identity provider:
# Example: derive permissions from an OAuth token in the MCP session context
def get_caller_context(session) -> tuple[str, set[str]]:
token = session.headers.get("Authorization")
claims = verify_jwt(token)
return claims["sub"], set(claims["permissions"])Why This Matters
AI agents operating with tool access in production need the same controls as any privileged service: least-privilege authorization, input validation, blast-radius limits, and a complete audit trail. This repo is a reference implementation of those patterns using the MCP protocol.
License
MIT
Part of the Agentic Infrastructure Stack
This repo is one piece of a production AI agent infrastructure portfolio:
Repo | What It Is |
Full system design: how these pieces fit together in a production deployment that eliminated 95% of manual oncall triage | |
โ You are here: the MCP governance layer | |
How agent quality is measured and regressions caught before they ship |
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceA secure MCP gateway for enterprise AI tool execution, enabling governed invocation of business tools with authentication, RBAC, audit logging, PII redaction, and async processing.Apache 2.0
- AlicenseNot gradedqualityBmaintenanceProvides a secure MCP gateway for AI agents to access APIs without exposing raw credentials, with scoped access, audit logging, and OAuth support.MIT

AgentsGateofficial
AlicenseNot gradedqualityAmaintenanceEnables AI agents to securely call MCP tools with risk scoring, checkpoints, rollback, and approval workflows.134MIT
evav-gatewayofficial
AlicenseNot gradedqualityBmaintenanceGoverned MCP gateway that lets AI agents call tools with policy enforcement, prompt-injection screening, a kill-switch, and tamper-evident signed audit logs.Apache 2.0
Related MCP Connectors
See, price, and control every tool call your AI agents make: policy checks, cost, and audit tools.
Security firewall for AI agents โ scans MCP calls for injection, secrets, and risks.
Runtime permission, approval, and audit layer for AI agent tool execution.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/TushGoel/production-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server