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
- codebase-memory-mcp — MIT
- headroom — Apache 2.0
- spec-kit — MIT
License
MIT
Metadata
Release files for contextforge-mcp 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| contextforge_mcp-0.2.4.tar.gz | 33.4 kB | With provenance | Details for contextforge_mcp-0.2.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| contextforge_mcp-0.2.4-py3-none-any.whl | Python 3 | none | any | Details for contextforge_mcp-0.2.4-py3-none-any.whl |
Total release size: 49.9 kB
Release files / contextforge_mcp-0.2.4.tar.gz
| Download URL | contextforge_mcp-0.2.4.tar.gz |
|---|---|
| Size | 33.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
95c5bb5da2a7738b5fbdc7b637f78deee2d7255d11223214da1c4858fa099709
|
|
BLAKE2b-256 checksum How to use checksums |
95b9df8a86a03b1318d786e6ef40127e7b682e7672bf29bef491466165ac6535
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 10, 2026.
Transparency logRelease files / contextforge_mcp-0.2.4-py3-none-any.whl
| Download URL | contextforge_mcp-0.2.4-py3-none-any.whl |
|---|---|
| Size | 16.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2b8951cce679676b0926a75a07cf6942f6e9e50b0efab7e54b5cff70be7b18dc
|
|
BLAKE2b-256 checksum How to use checksums |
ae0789e773c7ace7d878dcf67ceb6066d11eba3dc7d1652d800a201cd3e03b6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 10, 2026.
Transparency logSecurity for contextforge-mcp 0.2.4
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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for contextforge_mcp-0.2.4.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 Jul 10, 2026.
Transparency logA 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.