{
  "markdown": "# QAE Safety Certification — Claude MCP Server\n\n<!-- mcp-name: io.github.tb8412/qae-safety-mcp -->\n\nAn 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.\n\n[![QAE-Claude-mcp-example MCP server](https://glama.ai/mcp/servers/tb8412/qae-claude-mcp-example/badges/card.svg)](https://glama.ai/mcp/servers/tb8412/qae-claude-mcp-example)\n\n## Architecture\n\n```\nClaude Desktop / IDE\n         ↓\n    MCP Client\n         ↓\n    MCP Protocol\n         ↓\nQAE-Claude-MCP-Server\n         ↓\n    Python MCP SDK\n         ↓\n  qae_safety Package (PyO3 bindings to Rust kernel)\n         ↓\nQAE Safety Certification Engine\n         ↓\nSafetyCertificate (Certified / Warning / Escalate / Blocked)\n```\n\n## Quick Start\n\n### 1. Install the Package\n\n```bash\npip install -e .\n```\n\nThis 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+.\n\n### 2. Configure Claude Desktop\n\nAdd the MCP server to your Claude Desktop configuration:\n\n**macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`\n**Windows:** `%APPDATA%\\Claude\\claude_desktop_config.json`\n**Linux:** `~/.config/Claude/claude_desktop_config.json`\n\n```json\n{\n  \"mcpServers\": {\n    \"qae-safety\": {\n      \"command\": \"python\",\n      \"args\": [\"-m\", \"qae_mcp_server\"],\n      \"env\": {}\n    }\n  }\n}\n```\n\n### 3. Restart Claude Desktop\n\nThe MCP server will start automatically. You can see available tools in the tool menu.\n\n### 4. Use QAE Safety Certification\n\nIn Claude, you can now use the following tools:\n\n- **`certify_action`** — Evaluate the safety of a proposed action\n  ```\n  Action: \"Deploy new recommendation algorithm to 10% of users\"\n  Scope: 0.7 (affects moderate user segment)\n  Reversibility: 0.4 (difficult to rollback)\n  Sensitivity: 0.8 (high impact on user experience)\n  ```\n\n- **`check_budget`** — View your current safety budget utilization\n\n- **`get_certification_history`** — Retrieve recent certification decisions\n\n## Features\n\n- **Deterministic Certification**: No randomness. Same inputs → Same decision every time.\n- **Constraint-Based Safety**: Evaluates scope, reversibility, and sensitivity independently.\n- **Safety Zones**:\n  - **Safe (Certified)**: margin > 0.6 — Safe to proceed\n  - **Caution (CertifiedWithWarning)**: margin 0.3–0.6 — Proceed with caution\n  - **Danger (EscalateToHuman)**: margin 0.1–0.3 — Human review required\n  - **Danger (Blocked)**: margin ≤ 0.1 — Action blocked\n- **Budget Tracking**: Certifications consume a safety budget; budget resets on schedule.\n- **Audit Trail**: Every certification is logged with full details for review.\n\n## Certification Workflow\n\n1. **Claude proposes an action** with scope, reversibility, and sensitivity scores.\n2. **MCP server instantiates a `SafetyCertifier`** with the `AgenticAdapter`.\n3. **QAE kernel evaluates** across three constraint channels.\n4. **Margin is computed** as normalized headroom in [0, 1].\n5. **Decision is mapped** to zone and returned to Claude.\n6. **Certificate is logged** with ID and deterministic hash.\n\nExample flow:\n```python\nfrom qae_safety import AgenticAdapter, SafetyCertifier, SimpleAction, StateDelta\n\n# Create adapter and certifier\nadapter = AgenticAdapter(budget_limit=100.0, rate_limit=50.0)\ncertifier = SafetyCertifier(adapter)\n\n# Define action with state deltas\naction = SimpleAction(\n    action_id=\"act_123\",\n    agent_id=\"claude_v3\",\n    state_deltas=[\n        StateDelta(dimension=\"scope_score\", from_value=0.0, to_value=0.7),\n        StateDelta(dimension=\"reversibility_score\", from_value=1.0, to_value=0.4),\n        StateDelta(dimension=\"sensitivity_score\", from_value=0.0, to_value=0.8),\n    ]\n)\n\n# Certify\ncert = certifier.certify(action)\n\n# Check decision\nprint(f\"Decision: {cert.decision}\")  # \"Certified\", \"CertifiedWithWarning\", etc.\nprint(f\"Zone: {cert.zone}\")          # \"Safe\", \"Caution\", \"Danger\"\nprint(f\"Margins: {cert.margins}\")    # {\"scope\": 0.6, \"reversibility\": 0.5, ...}\n```\n\n## API Reference\n\n### `certify_action`\n\nEvaluate the safety of an action.\n\n**Input:**\n- `action_id` (str): Unique action identifier\n- `agent_id` (str): Agent performing the action\n- `scope` (float): Scope dimension score [0, 1]\n- `reversibility` (float): Reversibility dimension score [0, 1]\n- `sensitivity` (float): Sensitivity dimension score [0, 1]\n\n**Output:**\n```json\n{\n  \"decision\": \"Certified\" | \"CertifiedWithWarning\" | \"EscalateToHuman\" | \"Blocked\",\n  \"zone\": \"Safe\" | \"Caution\" | \"Danger\",\n  \"margins\": {\n    \"scope\": 0.75,\n    \"reversibility\": 0.45,\n    \"sensitivity\": 0.60\n  },\n  \"binding_constraint\": \"reversibility\" | null,\n  \"drift_budget\": 25.5,\n  \"certificate_id\": \"cert_abc123\",\n  \"deterministic_hash\": \"sha256:0x...\",\n  \"timestamp\": \"2025-03-15T14:23:45Z\"\n}\n```\n\n### `check_budget`\n\nCheck current budget utilization.\n\n**Output:**\n```json\n{\n  \"budget_limit\": 100.0,\n  \"budget_used\": 34.5,\n  \"budget_remaining\": 65.5,\n  \"budget_utilization\": 0.345,\n  \"rate_limit\": 50.0,\n  \"certifications_this_period\": 5,\n  \"utilization_percent\": 34.5,\n  \"timestamp\": \"2025-03-15T14:23:45Z\"\n}\n```\n\n### `get_certification_history`\n\nRetrieve recent certifications (limit: 50).\n\n**Output:**\n```json\n{\n  \"certifications\": [\n    {\n      \"certificate_id\": \"cert_xyz789\",\n      \"action_id\": \"act_456\",\n      \"decision\": \"CertifiedWithWarning\",\n      \"timestamp\": \"2025-03-15T14:15:32Z\"\n    }\n  ]\n}\n```\n\n## Configuration\n\nThe MCP server uses the built-in `AgenticAdapter` with default thresholds:\n\n- **Safe Threshold**: margin > 0.6\n- **Caution Threshold**: margin 0.3–0.6\n- **Block Threshold**: margin ≤ 0.1\n\nTo customize, edit `src/qae_mcp_server/server.py` and modify the `AgenticAdapter` initialization.\n\n## References\n\n- **QAE Research**: https://doi.org/10.6084/m9.figshare.31742857\n- **QAE Platform**: https://qaesubstrate.com\n- **PyPI Package**: https://pypi.org/project/qae-safety/\n- **Model Context Protocol**: https://modelcontextprotocol.io\n\n## License\n\nThis example is part of the QAE fintech risk certification platform. See the main repository for license details.",
  "bytes": 6352,
  "sha": "2cb8cb6dd837875cef15bc96c85649ec7e90922709da0d3858f18365757ae27c",
  "repo_slug": "tb8412/qae-claude-mcp-example",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_tb8412_qae_safety_mcp_1db94807/readme"
}