QAE-Claude-mcp-example
Deterministic pre-execution safety certification for autonomous AI agents. Evaluates proposed actions across scope, reversibility, and sensitivity constraints — returns Certified, Warning, Escalate, or Blocked decisions with cryptographic audit trails. 3 tools: certify_action, check_budget, get_certification_history. Built on the QAE Safety Kernel (Rust + PyO3 bindings, pip install qae-safety).
README
QAE Safety Certification — Claude MCP Server
<!-- mcp-name: io.github.tb8412/qae-safety-mcp -->
An MCP (Model Context Protocol) server that gives Claude access to deterministic safety certification for autonomous actions. Built on the QAE safety kernel, this server enables Claude to evaluate the safety profile of proposed actions across multiple constraint dimensions (scope, reversibility, sensitivity) before execution.
Architecture
Claude Desktop / IDE
↓
MCP Client
↓
MCP Protocol
↓
QAE-Claude-MCP-Server
↓
Python MCP SDK
↓
qae_safety Package (PyO3 bindings to Rust kernel)
↓
QAE Safety Certification Engine
↓
SafetyCertificate (Certified / Warning / Escalate / Blocked)
Quick Start
1. Install the Package
pip install -e .
This installs the MCP server and its dependencies (qae-safety, mcp). The qae-safety package is the production PyO3 binding to the Rust QAE safety kernel, available on PyPI. Requires Python 3.9+.
2. Configure Claude Desktop
Add the MCP server to your Claude Desktop configuration:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"qae-safety": {
"command": "python",
"args": ["-m", "qae_mcp_server"],
"env": {}
}
}
}
3. Restart Claude Desktop
The MCP server will start automatically. You can see available tools in the tool menu.
4. Use QAE Safety Certification
In Claude, you can now use the following tools:
-
certify_action— Evaluate the safety of a proposed actionAction: "Deploy new recommendation algorithm to 10% of users" Scope: 0.7 (affects moderate user segment) Reversibility: 0.4 (difficult to rollback) Sensitivity: 0.8 (high impact on user experience) -
check_budget— View your current safety budget utilization -
get_certification_history— Retrieve recent certification decisions
Features
- Deterministic Certification: No randomness. Same inputs → Same decision every time.
- Constraint-Based Safety: Evaluates scope, reversibility, and sensitivity independently.
- Safety Zones:
- Safe (Certified): margin > 0.6 — Safe to proceed
- Caution (CertifiedWithWarning): margin 0.3–0.6 — Proceed with caution
- Danger (EscalateToHuman): margin 0.1–0.3 — Human review required
- Danger (Blocked): margin ≤ 0.1 — Action blocked
- Budget Tracking: Certifications consume a safety budget; budget resets on schedule.
- Audit Trail: Every certification is logged with full details for review.
Certification Workflow
- Claude proposes an action with scope, reversibility, and sensitivity scores.
- MCP server instantiates a
SafetyCertifierwith theAgenticAdapter. - QAE kernel evaluates across three constraint channels.
- Margin is computed as normalized headroom in [0, 1].
- Decision is mapped to zone and returned to Claude.
- Certificate is logged with ID and deterministic hash.
Example flow:
from qae_safety import AgenticAdapter, SafetyCertifier, SimpleAction, StateDelta
# Create adapter and certifier
adapter = AgenticAdapter(budget_limit=100.0, rate_limit=50.0)
certifier = SafetyCertifier(adapter)
# Define action with state deltas
action = SimpleAction(
action_id="act_123",
agent_id="claude_v3",
state_deltas=[
StateDelta(dimension="scope_score", from_value=0.0, to_value=0.7),
StateDelta(dimension="reversibility_score", from_value=1.0, to_value=0.4),
StateDelta(dimension="sensitivity_score", from_value=0.0, to_value=0.8),
]
)
# Certify
cert = certifier.certify(action)
# Check decision
print(f"Decision: {cert.decision}") # "Certified", "CertifiedWithWarning", etc.
print(f"Zone: {cert.zone}") # "Safe", "Caution", "Danger"
print(f"Margins: {cert.margins}") # {"scope": 0.6, "reversibility": 0.5, ...}
API Reference
certify_action
Evaluate the safety of an action.
Input:
action_id(str): Unique action identifieragent_id(str): Agent performing the actionscope(float): Scope dimension score [0, 1]reversibility(float): Reversibility dimension score [0, 1]sensitivity(float): Sensitivity dimension score [0, 1]
Output:
{
"decision": "Certified" | "CertifiedWithWarning" | "EscalateToHuman" | "Blocked",
"zone": "Safe" | "Caution" | "Danger",
"margins": {
"scope": 0.75,
"reversibility": 0.45,
"sensitivity": 0.60
},
"binding_constraint": "reversibility" | null,
"drift_budget": 25.5,
"certificate_id": "cert_abc123",
"deterministic_hash": "sha256:0x...",
"timestamp": "2025-03-15T14:23:45Z"
}
check_budget
Check current budget utilization.
Output:
{
"budget_limit": 100.0,
"budget_used": 34.5,
"budget_remaining": 65.5,
"budget_utilization": 0.345,
"rate_limit": 50.0,
"certifications_this_period": 5,
"utilization_percent": 34.5,
"timestamp": "2025-03-15T14:23:45Z"
}
get_certification_history
Retrieve recent certifications (limit: 50).
Output:
{
"certifications": [
{
"certificate_id": "cert_xyz789",
"action_id": "act_456",
"decision": "CertifiedWithWarning",
"timestamp": "2025-03-15T14:15:32Z"
}
]
}
Configuration
The MCP server uses the built-in AgenticAdapter with default thresholds:
- Safe Threshold: margin > 0.6
- Caution Threshold: margin 0.3–0.6
- Block Threshold: margin ≤ 0.1
To customize, edit src/qae_mcp_server/server.py and modify the AgenticAdapter initialization.
References
- QAE Research: https://doi.org/10.6084/m9.figshare.31742857
- QAE Platform: https://qaesubstrate.com
- PyPI Package: https://pypi.org/project/qae-safety/
- Model Context Protocol: https://modelcontextprotocol.io
License
This example is part of the QAE fintech risk certification platform. See the main repository for license details.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。