mcp-audit-gateway
mcp-audit
你的 AI 代理昨天发起了 847 次工具调用。你能验证它做了什么吗?
为 AI 代理工具调用提供防篡改审计追踪。
设置(10 秒)
之前:
{
"command": "npx",
"args": ["@modelcontextprotocol/server-github"]
}之后:
{
"command": "npx",
"args": ["mcp-audit", "wrap", "--", "npx", "@modelcontextprotocol/server-github"]
}现在每次工具调用都经过加密签名并形成哈希链。其他一切不变。MCP 服务器的工作方式与之前完全相同。
Related MCP server: DCL Evaluator
功能
$ mcp-audit tail
✓ 14:32:01 github/create_pr 234ms bf7a2f62
✓ 14:32:03 github/list_issues 89ms a1c4e890
✗ 14:32:05 fs/delete_file 12ms c3d9f012
✓ 14:32:08 github/merge_pr 456ms e5f6a7b8每条记录都使用 HMAC-SHA256 签名,并与前一条记录链接。篡改任何一条记录,验证就会失败。删除一条记录,链条就会断裂。
验证完整性
$ mcp-audit verify ~/.mcp-audit/audit.jsonl
Results:
Total records: 847
Valid: 847
Invalid: 0
All records verified successfully.工作原理
┌────────────┐ ┌───────────┐ ┌────────────┐
│ MCP Client │──────▶│ mcp-audit │──────▶│ MCP Server │
│ (Claude, │◀──────│ wrap │◀──────│ (any) │
│ Cursor) │ └─────┬─────┘ └────────────┘
└────────────┘ │
▼
~/.mcp-audit/
audit.jsonlwrap 命令将你的 MCP 服务器作为子进程启动,并通过 stdio 位于客户端和服务器之间。它透明地转发所有消息。只有 tools/call 的响应会被签名和记录。其他所有内容都原样通过。
首次运行时,会在 ~/.mcp-audit/key.hex 中自动生成签名密钥。无需任何配置。
审计记录格式
{
"id": "bf7a2f62-4d0f-4cce-afd2-cbfbf7bca2a5",
"timestamp": "2026-08-16T14:32:01.000Z",
"method": "tools/call",
"toolName": "github/create_pr",
"args": {"title": "Fix bug", "body": "..."},
"durationMs": 234,
"success": true,
"previousHash": "8a3f2b...",
"attestation": "7c4d9e..."
}attestation 是对记录规范字段的 HMAC-SHA256 签名。previousHash 是前一条记录的 SHA-256 哈希。两者共同检测篡改、顺序和完整性。
与 Claude Desktop 配合使用
claude_desktop_config.json:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["mcp-audit", "wrap", "--", "npx", "@modelcontextprotocol/server-github"]
},
"filesystem": {
"command": "npx",
"args": ["mcp-audit", "wrap", "--", "npx", "@modelcontextprotocol/server-filesystem", "/tmp"]
}
}
}与 Claude Code 配合使用
.claude/hooks/mcp-servers.json 或直接在你的 MCP 服务器命令中——加上 mcp-audit wrap -- 前缀。
命令行界面
mcp-audit wrap -- <cmd> [args] # Wrap any MCP server
mcp-audit tail # Live stream of tool calls
mcp-audit verify <log> # Verify chain integrity
mcp-audit serve [config] # Full gateway (policy + OTel)
mcp-audit keygen [dir] # Generate Ed25519 key pair完整网关模式
对于还需要访问控制、速率限制和多服务器路由的团队:
mcp-audit serve gateway.config.json完整网关增加了:
策略引擎(基于 glob 的 ACL、按主体限速)
跨多个上游 MCP 服务器的工具命名空间
OpenTelemetry 追踪和指标导出
上游健康管理,支持自动重连
Ed25519 签名(比 HMAC 更强,可移植验证)
有关完整模式,请参阅 网关配置。
安装
npm install -g @mcp-audit-gateway/core这会将 mcp-audit CLI 全局安装。或者无需安装即可使用:
npx @mcp-audit-gateway/core wrap -- <your mcp server command>证明层
签名和验证子系统超越了逐条记录的 HMAC。它提供了跨日志轮转、崩溃恢复和多文件链的防篡改证据。
检查点记录允许消费者通过外部存储单个哈希来检测尾部截断。链在文件轮转时继续向前(不会静默重置)。强制重启会发出签名的 chain_break 记录,而不是悄悄重新开始。
规范形式是类型标记且单射的,通过完全拒绝不安全数字来避免 JCS 的浮点格式化问题,并已通过 46 个一致性向量(JS + Python)证明了跨语言等价性。有关完整规范和威胁模型,请参阅 SECURITY-DESIGN.md。
跨 SDK 差分测试
MCP 有 10 个官方 SDK,但没有跨 SDK 一致性测试。我们构建了一个 Wycheproof 风格的差分测试框架,在全部 10 个 SDK 上运行 40 个序列化边界测试,并报告它们之间的分歧。
结果:8 个不同的序列化器之间存在 26 处线上级分歧。1e20 有六种不同表示。三种不兼容的键排序算法。TypeScript 在 2^53+1 处静默丢失整数精度。C# 会转义其他 SDK 都不转义的字符。Python SDK 在相同的代码路径上,不同 pydantic-core 版本会产生不同的字节。
./test/vectors/cross-sdk-diff.sh # full matrix (stdlib + SDK)
./test/vectors/cross-sdk-diff.sh --layer sdk # SDK-wire-level only
./test/vectors/cross-sdk-diff.sh --json # structured output审计网关的规范化设计旨在免疫所有 26 类分歧:仅安全整数、显式字段顺序、拒绝代理项。有关完整的分歧表和方法论,请参阅 SDK-AUDIT.md。
一致性
此实现满足以下属性(通过跨语言一致性向量和单元测试验证):
单射规范形式(无跨类型摘要冲突)
跨语言排序等价性(UTF-16 代码单元顺序)
拒绝未配对代理项
日志轮转时哈希链连续性
启动时检测植入状态
合法链断裂后无误报
对损坏或超大输入采取故障关闭
在 chain_break 边界处分段单调性
通过检查点记录实现消费者锚定的完整性
内存受限初始化(1MB 上限)
APS action-ref-v1 一致性:51/51 向量通过(JCS 重新计算 + 故障关闭摘要比较)。
测试
npm test # unit tests
node test/vectors/verify-checkpoint.mjs # JS conformance vectors
python3 test/vectors/verify-checkpoint.py # Python conformance vectors
node test/vectors/aps-action-ref-v1.mjs # 51 APS vectors
./test/vectors/cross-sdk-diff.sh # 10-SDK differential test许可证
MIT
APS 一致性测试夹具(test/vectors/aps-action-ref-v1-vectors.json)
改编自上游 Apache-2.0 来源。有关来源和条款,请参阅
test/vectors/SOURCE.md。
This server cannot be installed
Maintenance
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables AI agents to sign decisions with post-quantum cryptographic proofs and maintain secure audit trails for compliance. It provides tools for stamping events, verifying chain integrity, and exporting audit data across industries like finance and healthcare.498MIT
- FlicenseNot gradedqualityCmaintenanceTamper-evident cryptographic audit trail for LLM outputs. Compliance logging for AI agent decisions.

evermint-mcpofficial
AlicenseNot gradedqualityDmaintenanceTamper-evident receipts for AI agent actions. The notary layer for agent-to-agent transactions.891MIT- AlicenseNot gradedqualityFmaintenanceProvides tamper-proof audit logging for AI agents using SHA-256 hash chains, integrity verification, and compliance reporting for the EU AI Act.1MIT
Related MCP Connectors
Bitcoin-anchored, tamper-evident audit log for AI agents — record, disclose and verify actions.
Hash-chained HMAC-signed audit log MCP for A2A (agent-to-agent) calls. Every tool-call, agent-ha...
Etch is a signed audit chain for AI agent decisions, offline-verifiable against pinned public keys.
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/elang2/mcp-audit-gateway'
If you have feedback or need assistance with the MCP directory API, please join our Discord server