Skip to main content

Model Context Protocol server for the cma compound practice loop. Subprocess wrapper around the canonical bash cma binary; methodology-agnostic substrate; three-section payload (analysis + agent_guidance + provenance) on every response.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

cma-mcp

tests-mcp codeql Python License Companions

The Model Context Protocol distribution layer for cma, Clarethium's executable compound practice loop.

Where this lives

cma-mcp is one component of the cma project. The repository root holds the canonical bash cma reference implementation; this cma-mcp/ subdirectory holds the Python wrapper that exposes the same loop to MCP-compatible AI clients. The two components release independently:

  • bash cma: see the parent README for the CLI surface, install, and Claude Code / shell hook integrations.
  • cma-mcp: this README, focused on the PyPI installation and MCP client configuration.

Cross-cutting governance (license, citation, security, contribution) lives at the repository root.

Status

cma-mcp 0.1.1 is the current release line. 0.1.0 was uploaded to PyPI on 2026-05-07 and yanked on 2026-05-15; the reason and upgrade path are documented in the [0.1.1] block of CHANGELOG.md. Adopters install with pip install cma-mcp, which resolves to 0.1.1 (yanked versions are excluded from default resolution).

What this is

Most MCP servers expose new capability. cma-mcp exposes an existing capability (bash cma's seven primitives) to a wider set of operator environments: Claude Desktop, Cursor, Cline, Continue.dev, and any other MCP-compatible client. The contribution is reach. Drift is the named enemy: cma-mcp invokes the canonical bash cma binary as a subprocess for every captured action, so cma-mcp picks up cma's evolution automatically and never diverges from the 1.0 reference implementation.

Quickstart

cma-mcp wraps the canonical bash cma binary. Install bash cma first from the parent repository, then confirm it is on PATH:

cma --help

Install cma-mcp from source (PyPI publication pending):

git clone https://github.com/Clarethium/cma.git
cd cma/cma-mcp
pip install -e .

The cma-mcp console script lands on PATH after install. Confirm:

cma-mcp --version

Point your MCP client at the installed entry point. For Claude Desktop, add to claude_desktop_config.json:

{
  "mcpServers": {
    "cma": {
      "command": "cma-mcp"
    }
  }
}

Restart the client. Then in any conversation: "Record a miss: I claimed verified without testing the cross-tenant write path", or "What active rejections do I have?", or "What does cma stats show for prevention/miss ratio over the last 30 days?"

For Cursor, Cline, Continue.dev, and other MCP-compatible clients, the same pattern applies (point the client at the cma-mcp command; the stdio handshake runs).

What it exposes

Seven tools mirroring bash cma's seven primitives:

Tool Wraps When the agent invokes it
cma_miss cma miss A failure happened that may recur
cma_decision cma decision A non-trivial architectural choice was made
cma_reject cma reject An option was eliminated and should not be silently rebuilt
cma_prevented cma prevented A surfaced warning actually changed behavior
cma_distill cma distill (modes: default / retire / review) Promote, retire, or preview a distilled learning
cma_surface cma surface Pull relevant prior captures before acting (logs surface event for leak detection)
cma_stats cma stats (views: default / leaks / recurrence / preventions / rejections / behavior) Inspect loop-closing evidence

Four resources for read-only context:

URI Reads
cma://decisions Active decisions in the last 180 days
cma://rejections Active rejections in the last 30 days
cma://core Active core learnings (retired filtered)
cma://stats Default stats summary

Three-section payload

Every tool response and resource read returns a JSON payload with three top-level sections:

{
  "analysis":       { ... data and stdout },
  "agent_guidance": { what to tell the user, how to cite },
  "provenance":     { server_version, license, cost: 0.0, ... }
}

The agent_guidance and provenance sections exist because an agent passing cma-mcp output to a user without attribution would strip the reproducibility that makes the loop's evidence worth citing. Surfacing "how to cite faithfully" inside the payload is the structure that carries that integrity forward. This convention is established by frame-check; cma-mcp inherits it. Adversarial tests in tests/test_payload_determinism.py pin the structure.

Approach

Subprocess over reimplementation. cma-mcp invokes bash cma as a subprocess for every captured action. cma-mcp does not reimplement cma's seven primitives in Python. See DECISIONS.md AD-001 for the rationale.

Methodology-agnostic substrate. cma stores --fm (failure mode) as an opaque string. cma-mcp does not bundle any methodology's failure-mode catalog. Operators tag captures with their methodology's vocabulary (Lodestone's FM-1..10 or otherwise) by passing the tag through; for autoclassification, set CMA_FM_CLASSIFIER per cma's plugin convention.

No external runtime dependencies. cma-mcp implements MCP directly in-repo using JSON-RPC 2.0 over stdio. No third-party MCP SDK; no pip-installed runtime requirements beyond the Python standard library. (Test-time deps: pytest.)

Platform support

Linux and macOS native. Windows operators run cma-mcp under WSL because cma-mcp shells out to the bash cma binary. Routing every tool call through the same canonical binary on every platform is how cma-mcp avoids drift; a parallel Python implementation would require keeping two surface definitions in sync forever. Any operator running an MCP-compatible AI client on Windows is reasonably expected to have WSL available.

Install fingerprint

cma-mcp --version

Emits a one-line JSON fingerprint with server_version, protocol_version, git_sha (with +dirty flag if the working tree has uncommitted changes), cma_binary_version (probed from cma --version), python version, and script path. Lets an operator confirm the cma-mcp install configured in their MCP client is the expected one.

Offline sanity check

cma-mcp --test

Prints the full three-section payload for a cma_stats (default view) call against the operator's ~/.cma/ data. Useful to verify pipeline wiring and that the cma binary is reachable.

Documentation

Project-level (repository root):

cma-mcp specific (this directory):

Running tests

From this directory:

pip install -e .[test]
python3 -m pytest -q

The suite covers MCP protocol conformance, three-section payload determinism, JSONL parsing tolerance, and subprocess-wrapper isolation (argv-array discipline, timeout discipline). Tests that require the bash cma binary skip when it is not on PATH.

Issues

Bug reports and feature requests at github.com/Clarethium/cma/issues. Use the cma-mcp label or include [cma-mcp] in the title to disambiguate from bash cma issues.

Security issues go to lovro.lucic@gmail.com per SECURITY.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cma_mcp-0.1.1.tar.gz (46.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cma_mcp-0.1.1-py3-none-any.whl (38.6 kB view details)

Uploaded Python 3

File details

Details for the file cma_mcp-0.1.1.tar.gz.

File metadata

  • Download URL: cma_mcp-0.1.1.tar.gz
  • Upload date:
  • Size: 46.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cma_mcp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 325261f88167e9ddb79e5e9129d03a9b3e32e4efc8972846782c61845fcd5d5c
MD5 4381c5a6b93605c7deb2c1925460b1ff
BLAKE2b-256 6482f64acbfd98f371e82980284412a2e0b0b65d195cb02affff711ebf67fbb3

See more details on using hashes here.

Provenance

The following attestation bundles were made for cma_mcp-0.1.1.tar.gz:

Publisher: publish-mcp.yml on Clarethium/cma

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cma_mcp-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: cma_mcp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 38.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cma_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d06d70f024a14801c299ed7265f107e214a9b3b55548f90dcd2c714b75bb083b
MD5 a5e4c081130e4da8bfd5668d8b3be402
BLAKE2b-256 053391b1ceec191a3742f366d248ffaa13863889a217964ab160c444cd8ca469

See more details on using hashes here.

Provenance

The following attestation bundles were made for cma_mcp-0.1.1-py3-none-any.whl:

Publisher: publish-mcp.yml on Clarethium/cma

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page