Add an optional local MCP stdio server and policy boundary

Author: jmaglyCreated Sep 22, 2026Updated Sep 22, 2026

Depends on: #208.

Outcome

An operator who installs obliteratus[mcp] can start an OBLITERATUS MCP server with python -m obliteratus.mcp_server (and optionally obliteratus mcp serve). Ordinary package import and CLI help still work without the MCP extra.

Implementation

  • Use the maintained Python MCP SDK v2 with a bounded compatible optional dependency and updated uv.lock; do not copy PR #206's handwritten JSON-RPC framing or hard-code a single protocol version.
  • Add a thin obliteratus/mcp_server.py for SDK registration/stdio startup and obliteratus/mcp_policy.py for immutable startup capabilities, allowed roots, archive root, input/output limits, and execution/network flags. Reject invalid policy before serving. Keep operator settings out of shared repository files.
  • Register only server_status initially. It reports version and enabled capabilities without returning secrets, environment variables, or filesystem inventories. Tool listing is deterministic.
  • Keep protocol stdout free of banners, logs, prints, and child-process output. Use stderr for diagnostics. Do not import heavyweight model runtimes on server startup or tool discovery.

Acceptance tests

  • An official SDK client connects over stdio, lists/calls server_status, and negotiates the current plus a supported legacy protocol path.
  • Invalid arguments, unknown tools, malformed requests, and a failing tool do not corrupt the stream or prevent a subsequent valid request.
  • A fresh, offline process does not download models, open network connections, create run artifacts, or expose execution tools.
  • Packaging, import, CLI help, Ruff F, lock, selected tests, changed-line coverage, and risk-map checks pass.

Source: elder-plinius/OBLITERATUS