MCP Shield Runtime
MCP Shield Runtime is a local-first security gateway that controls MCP tool calls with parameter-level policies, approval gates, secret redaction, rate limiting, contract drift detection, and tamper-evident auditing before they reach the upstream MCP server.
README
MCP Shield Runtime
Control every MCP tool call before it executes.
MCP Shield Runtime is a local-first security gateway for Model Context Protocol clients and servers. It provides parameter-level policies, tool visibility filtering, approval gates, emergency deny rules, secret redaction, tool-contract drift detection, rate limiting, and tamper-evident audit records.
Project status: production-oriented preview. The core gateway and controls are working and tested, but the project has not yet completed an independent security audit. Use staged rollout and least-privilege upstream credentials for production environments.
Why this project exists
An allowlist that says an agent may use read_file or send_email is not enough. Security decisions must consider the concrete path, recipient, repository, branch, URL, command, environment, identity, detected data, and prior approval.
AI client
|
v
MCP Shield Runtime
| policy, approval, DLP, contract lock, audit
v
MCP server
Architecture

How it works

Features
- Stdio proxy for local MCP servers
- Streamable HTTP reverse proxy
- MCP 2026 routing-header validation and generation
- Client-independent parameter-level policy decisions
- Built-in emergency blocks for secret paths, private metadata URLs, and destructive commands
- Human approval with retry grants
- Tool discovery filtering
- Tool schema and description lockfile
- Response secret redaction
- Tamper-evident hash-chained audit log with optional HMAC signatures
- Per-user, per-server, per-tool token-bucket rate limiting
- Local dashboard and approval queue
- Zero runtime npm dependencies
- Docker hardening example
- Node built-in test suite and CodeQL workflow
Requirements
- Node.js 22 or newer
- An existing MCP server
- JSON policy and configuration files
Quick start
git clone https://github.com/your-org/mcp-shield-runtime.git
cd mcp-shield-runtime
npm install
npm run check
node src/cli.js init --dir .mcp-shield
Protect a local stdio server
node src/cli.js run \
--config .mcp-shield/config.json \
-- node examples/risky-demo-server.js
Example MCP client configuration:
{
"mcpServers": {
"protected-demo": {
"command": "node",
"args": [
"/absolute/path/mcp-shield-runtime/src/cli.js",
"run",
"--config",
"/absolute/path/mcp-shield-runtime/.mcp-shield/config.json",
"--",
"node",
"/absolute/path/mcp-shield-runtime/examples/risky-demo-server.js"
]
}
}
}
Protect a remote Streamable HTTP server
node src/cli.js gateway \
--config config/default.config.json \
--upstream https://upstream.example.com/mcp
Point the MCP client to http://127.0.0.1:7777/mcp. The local dashboard is at http://127.0.0.1:7777/.
Approval flow
When a call requires approval, the gateway returns JSON-RPC error -32070 with an approval ID.
node src/cli.js approvals list --config .mcp-shield/config.json
node src/cli.js approvals approve apr_ID \
--config .mcp-shield/config.json \
--ttl 300
Retry the identical tool call. The approval is scoped to the request fingerprint and expiration.
Example policy
{
"version": 1,
"defaults": { "decision": "deny" },
"rules": [
{
"id": "allow-repository-read",
"priority": 100,
"match": {
"methods": ["tools/call"],
"tools": ["read_file"],
"arguments": {
"path": {
"within": ["${workspace}"],
"exclude": ["**/.env", "**/.ssh/**", "**/*.pem"]
}
}
},
"effect": { "decision": "allow" }
},
{
"id": "approve-write",
"priority": 90,
"match": {
"methods": ["tools/call"],
"tools": ["write_file", "push_files"]
},
"effect": {
"decision": "require_approval",
"approvalTtlSeconds": 300
}
}
]
}
See Policy reference.
Security model
The gateway enforces what it can observe at the MCP boundary. A protocol proxy cannot fully constrain a local server process after launch. Strong filesystem and network isolation requires a container, operating-system sandbox, or workload boundary.
Important deployment rules:
- Keep upstream credentials least-privileged.
- Bind the dashboard to localhost unless an API token and TLS termination are configured.
- Enable HMAC audit signing.
- Use a container or operating-system sandbox for untrusted local servers.
- Set
allowSseWithoutInspectiontofalsefor tools requiring response DLP. - Pin upstream package and container versions.
- Review tool-contract changes before enabling
blockSchemaDrift.
Read SECURITY.md and Threat model.
Commands
mcp-shield init
mcp-shield gateway
mcp-shield run -- COMMAND
mcp-shield policy test
mcp-shield approvals list|approve|deny
mcp-shield audit list|verify
mcp-shield contracts list|approve
mcp-shield scan
mcp-shield doctor
Protocol compatibility
The proxy is protocol-neutral for JSON-RPC messages and can forward legacy and modern MCP traffic. The HTTP gateway validates or generates modern Mcp-Method and Mcp-Name routing headers. Stateful legacy HTTP servers may require upstream session handling specific to their deployment.
The project intentionally keeps policy logic separate from the official MCP SDK. SDK-backed client and server adapters can be added without moving the trusted policy core.
Documentation
License
Apache License 2.0.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。