Skip to main content

MCP orchestrator: codebase-memory-mcp + headroom + Spec Kit

Project description

contextforge-mcp

MCP compression middleware that connects codebase-memory-mcp + headroom + Spec Kit into a unified, token-efficient workflow.

Architecture

Claude Code
  ├── codebase-memory-mcp   ← graph queries (cbm_* tools)
  │         │
  │         └── large result
  │                   │
  └── contextforge-mcp  ← YOU ARE HERE
            │
            cf_compress_cbm(result, tool_name)
            │
            └── compressed result (60-95% fewer tokens)

ContextForge does NOT proxy codebase-memory-mcp — both servers run independently. The agent calls CBM for graph queries, then passes results through ContextForge for compression. This design is reliable, cross-platform, and works with any MCP client.

Install

npm install -g codebase-memory-mcp
pip install "headroom-ai[all]"
pip install contextforge-mcp

Setup

# Health check
contextforge-mcp doctor

# Configure Claude Code (writes .mcp.json with both servers)
contextforge-mcp install --target claude

Workflow

# 1. Query the graph (via codebase-memory-mcp)
result = cbm_search_graph(name_pattern=".*Payment.*", label="Function")

# 2. Compress the result (via contextforge-mcp)
compressed = cf_compress_cbm(result=result, tool_name="search_graph")
# → [ContextForge ✓ search_graph: 8420→612 tokens (93% saved in 45ms)]

# 3. Use compressed result in your context
# 4. Check savings
cf_stats()

Tools (9 total)

Compression

Tool Description
cf_compress_cbm(result, tool_name) Compress CBM tool output
cf_compress(text, hint) Compress arbitrary text

Stats

Tool Description
cf_stats() Session token savings + cost estimate
cf_reset_stats() Reset session counters

Spec Kit

Tool Description
cf_read_spec(feature_id) Compressed spec.md
cf_read_plan(feature_id) Compressed plan.md
cf_read_tasks(feature_id) Compressed tasks.md
cf_read_artifact(artifact, feature_id) Any artifact
cf_implement_context(feature_id) Full bundle (spec+plan+tasks)
cf_speckit_status() List all features + phase

Supported CBM tool names for cf_compress_cbm

search_graph · search_code · get_architecture · find_dead_code · find_similar_code · get_impact · trace_path · trace_call_path · cypher_query · get_cross_service_links · get_node_details

Add to CLAUDE.md

## ContextForge MCP — Compression Workflow

After EVERY codebase-memory-mcp tool call that returns a large result,
immediately call cf_compress_cbm(result, tool_name) to compress it.

| CBM Query | Then compress with |
|-----------|-------------------|
| cbm_search_graph(…) | cf_compress_cbm(result, "search_graph") |
| cbm_get_architecture() | cf_compress_cbm(result, "get_architecture") |
| cbm_search_code(…) | cf_compress_cbm(result, "search_code") |
| cbm_trace_path(…) | cf_compress_cbm(result, "trace_path") |
| cbm_get_impact(…) | cf_compress_cbm(result, "get_impact") |

Call cf_stats() at end of session to measure total savings.

Credits

License

MIT

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

contextforge_mcp-0.2.2.tar.gz (32.9 kB view details)

Uploaded Source

Built Distribution

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

contextforge_mcp-0.2.2-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file contextforge_mcp-0.2.2.tar.gz.

File metadata

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

File hashes

Hashes for contextforge_mcp-0.2.2.tar.gz
Algorithm Hash digest
SHA256 8e6dec0b594d32a23b41cb8fc9eefb8900f2f3e01a17dfd5eb1acd6979e694be
MD5 977598ea02ba1b4de80e31aad3d69ea2
BLAKE2b-256 6668189ea18b7ab1fe5aa82e1bd06c9b079a0f475790de50020b16459088abf6

See more details on using hashes here.

Provenance

The following attestation bundles were made for contextforge_mcp-0.2.2.tar.gz:

Publisher: publish.yml on capatinore/contextforge-mcp

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

File details

Details for the file contextforge_mcp-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for contextforge_mcp-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 00f8d84b7b878f2c07721987d4656c2577a7565360662324e0e28d727a6641f4
MD5 f0a9c68ad44e2806f573b8ce9f8cf11b
BLAKE2b-256 c06a985942e1e0d13aac69b111b8d330afe112225a8d36610a439dd6ef0c14c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for contextforge_mcp-0.2.2-py3-none-any.whl:

Publisher: publish.yml on capatinore/contextforge-mcp

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