production-mcp-server
production-mcp-server
エンタープライズ環境でAIエージェントにツールを安全に公開する方法を示す、本番運用グレードのMCP(Model Context Protocol)サーバーです。
ほとんどのMCPの例は、ツールをエージェントに接続する方法を示しています。このリポジトリが示すのは、それを大規模に安全に行う方法です。権限の強制、行動のガードレール、ブラスト半径(影響範囲)の制御、そしてすべての呼び出しにおける構造化された監査証跡を備えています。
問題 → 解決策 → 影響
問題 | AIエージェントが有用であるためにはツールアクセスが必要ですが、制約のないツールアクセスは本番障害を引き起こします。チームはエージェントをロックダウンするか(役に立たない)、完全なアクセスを与えるか(危険)のどちらかしか選べません。 |
解決策 | すべてのエージェントとすべてのツールの間に位置する、ガバナンスの効いたMCPゲートウェイ層。すべての呼び出しで権限チェック、ブラスト半径の制御、完全な監査を実施します。 |
影響 | エージェントはエンタープライズグレードの認可により本番環境で安全に動作します。セキュリティチームはすべてのアクションを監査できます。開発者は副作用を恐れずにエージェント機能をリリースできます。 |
Related MCP server: nice
システム設計
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]
endレイヤーの詳細
レイヤー | 機能 | 重要性 |
ツールレジストリ | すべてのツールについて、名前、説明、必要な権限、リスクレベルを保存します | 信頼できる唯一の情報源。登録されていないツールは実行されません |
権限強制 | 実行前に呼び出し元の権限をツールの要件と照合します | エージェントは明示的に許可されたツールのみを呼び出せます |
ブラスト半径ガード | 高リスクの操作には | エージェントが誤って破壊的な操作をトリガーすることを防ぎます |
入力検証 | パストラバーサル、破壊的なSQL、その他の攻撃パターンをブロックします | 多層防御。ハンドラーが実行される前に検証を行います |
監査証跡 | すべての呼び出しを記録する追記専用の不変ログ | コンプライアンスとデバッグのための完全な監査可能性 |
問題
AIエージェントがツールアクセスを得ると、次の3つの障害モードが直ちに発生します。
制約のないアクセス — エージェントが呼び出すべきでないツールを呼び出し、意図しない副作用を引き起こします
監査証跡の欠如 — 問題が発生したとき、エージェントが何をしたのかを再構築できません
サイレント障害 — 権限エラーが握りつぶされ、デバッグが不可能になります
このサーバーはこの3つすべてに対処します。
アーキテクチャ
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
│ └──────────────────────┘ │
└─────────────────────────────┘主要パターン
1. ガバナンスの効いたツールアクセス
すべてのツールは、明示的な権限要件とともに登録されます。
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. 権限強制
ガードレール層は、ハンドラーが実行される前に権限をチェックします。
# 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. ブラスト半径の制御
高リスクのツールには明示的な確認フラグが必要です。エージェントが誤って破壊的な操作をトリガーすることはできません。
# 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. 入力検証
ツールハンドラーが実行される前に、引数レベルのチェックが行われます。
# 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. 構造化された監査証跡
許可された呼び出しも拒否された呼び出しも、すべて記録されます。
# 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()}")プロジェクト構造
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.tomlインストール
pip install -e ".[dev]"サーバーの起動
python -m src.server任意のMCP互換クライアント(Claude Desktop、Claude Codeなど)をサーバーに接続できます。
テストの実行
pytest tests/ -v拡張
新しいツールの追加
src/tools/にハンドラー関数を記述します。
def read_config(config_key: str) -> str:
return os.environ.get(config_key, "not_found")権限とリスクレベルを指定して登録します。
registry.register(ToolDefinition(
name="read_config",
description="Read a configuration value by key.",
handler=read_config,
required_permissions={"config:read"},
risk_level=RiskLevel.LOW,
))FastMCP で公開します。
@mcp.tool()
def config(config_key: str) -> str:
return guardrails.invoke("read_config", {"config_key": config_key}, ...)ガードレール層と監査層は自動的に適用されるため、そこでの変更は不要です。
独自の認証層の統合
server.py 内の静的な CALLER_ID / CALLER_PERMISSIONS を、実際のアイデンティティプロバイダーに置き換えます。
# 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"])なぜこれが重要なのか
本番環境でツールアクセスを伴って動作するAIエージェントには、特権サービスと同等の制御が必要です。最小権限の認可、入力検証、ブラスト半径の制限、完全な監査証跡です。このリポジトリは、MCPプロトコルを使用したこれらのパターンのリファレンス実装です。
ライセンス
MIT
Agentic Infrastructure Stack の一部
このリポジトリは、本番AIエージェントインフラストラクチャポートフォリオの一部です。
リポジトリ | 内容 |
システム設計全体: これらの要素が、手動オンコールトリアージの95%を排除した本番デプロイでどのように組み合わさるか | |
← 現在地: MCPガバナンス層 | |
エージェントの品質がどのように測定され、リグレッションがリリース前に検出されるか |
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