Skip to main content

cma-mcp

Python License

The Model Context Protocol layer for cma. cma stores notes you choose to write, and can show a matching note on a later edit. The counts are records you wrote. Whether a note changes the next failure is unmeasured.

cma-mcp wraps the canonical cma command-line tool and exposes its seven primitives to MCP-compatible AI clients. It does not reimplement the loop; it shells out to the cma binary on PATH, so the result matches that binary.

Status

pip install cma-mcp installs the latest release from PyPI. The release history is in CHANGELOG.md.

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 environments: Claude Desktop, Cursor, Cline, Continue.dev, and any other MCP-compatible client. The contribution is reach. It invokes the cma binary on PATH for every call. The result matches that binary. An older cma earlier on PATH is the one that runs.

Quickstart

cma-mcp shells out to the cma command-line tool, so that binary must be installed and on your PATH first. Confirm it:

cma --help

Then install cma-mcp:

pip install cma-mcp

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 Record a self-attested note that a warning changed the next action
cma_distill cma distill (modes: default / retire / review) Promote, retire, or preview a distilled learning
cma_surface cma surface Show captures for a file or a surface (logs a surface event)
cma_stats cma stats (views: default / leaks / recurrence / preventions / rejections / behavior) Inspect loop counts (self-reported)

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

Protocol

cma-mcp speaks the current Model Context Protocol and negotiates the revision with each client: it echoes the revision the client requests when it supports it (2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05) and otherwise offers its newest. Transport is stdio.

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, protocol_version, license, cost_usd: 0.0, ... }
}

Tool calls also return this payload as structuredContent (validated against each tool's outputSchema) for MCP clients on protocol 2025-06-18 or newer, alongside the text form older clients read.

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. 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; that is a deliberate subprocess-over-reimplementation decision.

Methodology-agnostic substrate. cma stores --fm (failure mode) as an opaque string. cma-mcp does not bundle any methodology's failure-mode catalog. You tag captures with your methodology's own vocabulary 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. On Windows, 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. If you run an MCP-compatible AI client on Windows, you likely already 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 you confirm the cma-mcp install configured in your 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 your ~/.cma/ data. Useful to verify pipeline wiring and that the cma binary is reachable.

Documentation

In the repository:

  • CHANGELOG.md: cma-mcp release history
  • docs/MCP_SERVER.md: protocol reference
  • docs/ARCHITECTURE.md: module layout, data flow, contracts
  • docs/FAQ.md: conceptual questions, install gotchas, cross-client config
  • docs/TROUBLESHOOTING.md: symptoms and fixes

The installed wheel carries LICENSE and NOTICE in its dist-info metadata (Apache-2.0 attribution); the docs above live in the source repository.

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: https://github.com/lluvr/cma/issues.

Security reports: do not open a public issue. Use GitHub private vulnerability reporting (https://github.com/lluvr/cma/security/advisories/new); see SECURITY.md.

Metadata

Release files for cma-mcp 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cma-mcp 0.1.6
File Size Uploaded Provenance Actions
cma_mcp-0.1.6.tar.gz 46.6 kB With provenance Details for cma_mcp-0.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cma-mcp 0.1.6
File Interpreter ABI Platform Actions
cma_mcp-0.1.6-py3-none-any.whl Python 3 none any Details for cma_mcp-0.1.6-py3-none-any.whl

Total release size: 85.7 kB

Release files / cma_mcp-0.1.6.tar.gz

Download URL cma_mcp-0.1.6.tar.gz
Size 46.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5391b95718a7e143eda409904f57c9d9d3e24e8f251f3c55b2ecc11fb9b2b1e1
BLAKE2b-256 checksum
How to use checksums
b2c6bf792725a3aa5c32c47c9049b5bbe1b3fd83c835f1c07bee98f4a142d8f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / cma_mcp-0.1.6-py3-none-any.whl

Download URL cma_mcp-0.1.6-py3-none-any.whl
Size 39.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f7e7ab04b1a3bd2ba70260052ad69c956fdfcd61e966f6c414943eb634daf4c0
BLAKE2b-256 checksum
How to use checksums
c8a792c62e79b875363fac597fbe2a74ed48a7ff44bb8358fd7088548060a9b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for cma-mcp 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cma_mcp-0.1.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page