ContextForge
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ContextForgeTrace inbound calls to processPayment"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ContextForge
MCP orchestrator that combines codebase-memory-mcp + headroom into a single pipeline.
Your AI agent gets a code knowledge graph and automatic context compression — in one MCP server.
Agent (Claude Code / Codex / Cursor)
│
▼
ContextForge ←─── single MCP server
│
├─→ codebase-memory-mcp (graph query: 99% fewer retrieval tokens)
│ │
│ ▼
└─→ headroom (compression: 60–95% fewer prompt tokens)
│
▼
LLM ProviderWhy
Problem | Without ContextForge | With ContextForge |
"What calls | Agent greps 30 files → ~80K tokens | Graph query → ~500 tokens |
Tool output bloat | Raw JSON/logs fill context | headroom compresses 60–95% |
Managing two MCP servers | Two configs, two binaries | One |
Session visibility | No insight |
|
Real numbers from the upstream projects:
codebase-memory-mcp: 5 structural queries used ~3,400 tokens vs ~412,000 via file-by-file grep (99.2% reduction, arXiv:2603.27277)headroom: 47–92% token reduction on real workloads (GSM8K, TruthfulQA, SQuAD v2 accuracy preserved)
Related MCP server: knowing
Install
Prerequisites
Dependency | Install |
Python 3.10+ | |
Node.js + npm | |
codebase-memory-mcp |
|
headroom-ai |
|
Quick install (Linux / macOS)
curl -fsSL https://raw.githubusercontent.com/yourusername/contextforge/main/scripts/install.sh | bashQuick install (Windows PowerShell)
iwr -useb https://raw.githubusercontent.com/yourusername/contextforge/main/scripts/install.ps1 | iexManual install
pip install contextforge
# or with uv (recommended):
uv tool install contextforgeSetup
1. Health check
contextforge doctorExpected output:
✅ Python 3.12
✅ mcp (Model Context Protocol SDK)
✅ headroom-ai
✅ codebase-memory-mcp → /usr/local/bin/codebase-memory-mcp
✅ Everything looks good!2. Configure your agent
Claude Code (writes .mcp.json in current directory):
contextforge install --target claudeManual — add to your .mcp.json:
{
"mcpServers": {
"contextforge": {
"command": "contextforge",
"args": ["run"]
}
}
}3. Add to CLAUDE.md (recommended)
Paste this into ~/.claude/CLAUDE.md or your project's CLAUDE.md:
## ContextForge (code intelligence + compression)
When ContextForge MCP tools are available, **always prefer cbm_* tools over
grep/Glob/Read for structural code questions** — they use 99% fewer tokens.
| Instead of... | Use... |
|----------------------------|-----------------------------------------|
| Grep for a function name | `cbm_search_graph(name_pattern="...")` |
| Reading files for call chains | `cbm_trace_path(function_name="...")` |
| Exploring the architecture | `cbm_get_architecture()` |
| Text search across files | `cbm_search_code(query="...")` |
Index first: `cbm_index_repository(repo_path=".")`. After that, all results
pass through headroom compression automatically. Use `cf_stats` to see savings.Usage
Index your project (first time)
cbm_index_repository(repo_path="/path/to/your/project")This takes seconds to minutes depending on repo size. The Linux kernel (28M LOC) indexes in ~3 minutes.
Structural queries (all auto-compressed)
# Find all functions matching a pattern
cbm_search_graph(name_pattern=".*Handler.*", label="Function")
# Who calls processPayment?
cbm_trace_path(function_name="processPayment", direction="inbound")
# What would break if I change this?
cbm_get_impact(node_id="<node_id_from_search>")
# High-level architecture view
cbm_get_architecture()
# Full-text search ranked by graph importance
cbm_search_code(query="database connection pool")
# Find unused code
cbm_find_dead_code(confidence="high")Compression utilities
# Compress arbitrary text before including in context
cf_compress(text="<large log output>", hint="logs")
# Session stats
cf_stats()
# → { "tokens_saved": 42183, "overall_compression_ratio": "78%", ... }
# Reset counters for a new session
cf_reset_stats()Available tools
CBM tools (14) — routed to codebase-memory-mcp + compressed
Tool | Description |
| Index a repo into the knowledge graph |
| Search by name pattern (regex) |
| Full-text + graph-ranked code search |
| Trace call paths (inbound/outbound) |
| Full call chain analysis |
| High-level module/service overview |
| Detailed info on a graph node |
| Detect unreachable code |
| Find code clones |
| Impact radius of a change |
| Raw Cypher-like graph query |
| Architecture Decision Records |
| HTTP/gRPC/GraphQL cross-service edges |
| Indexing progress |
ContextForge meta tools (3)
Tool | Description |
| Session compression statistics |
| Compress arbitrary text with headroom |
| Reset session counters |
Environment variables
Variable | Default | Description |
| auto-detect | Path to |
|
| Model hint for headroom token counting |
|
|
|
Architecture
contextforge/
├── src/contextforge/
│ ├── __init__.py
│ ├── server.py # FastMCP server — tool definitions + orchestration
│ ├── cbm_client.py # stdio JSON-RPC client for the CBM binary
│ ├── compressor.py # headroom-ai wrapper with per-tool profiles + stats
│ └── cli.py # typer CLI (run / install / doctor / info)
├── config/
│ └── default.toml # Default configuration
├── scripts/
│ ├── install.sh # Linux/macOS quick install
│ └── install.ps1 # Windows PowerShell quick install
├── pyproject.toml
└── README.mdRequest lifecycle:
Agent calls a
cbm_*tool via MCPserver.pyforwards the call tocbm_client.pycbm_client.pysends a JSON-RPC request to thecodebase-memory-mcpsubprocess over stdioThe result comes back as structured JSON
compressor.pyruns it throughheadroom-ai[compress()]with a tool-specific profileCompressed result (+ token savings header) is returned to the agent
Why a subprocess and not a native library?
codebase-memory-mcp is a static C binary — no Python bindings exist. The stdio JSON-RPC protocol is its native interface. This is actually an advantage: zero Python dependency conflicts, and the binary is self-contained.
Contributing
PRs welcome. Key areas:
Additional tool profiles in
compressor.py— better headroom hints per CBM toolIncremental reindex — watch file changes and trigger
index_repositoryautomaticallyStats persistence — save session stats to disk for long-running workflows
Docker image — bundle both binaries in one container
Credits
Built on top of:
codebase-memory-mcp by DeusData — MIT License
headroom by headroomlabs-ai — Apache 2.0
ContextForge itself is MIT licensed.
License
MIT — see LICENSE
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityCmaintenanceUnified MCP orchestration layer that consolidates multiple MCPs into a single interface with semantic tool discovery, code-mode execution, scheduling, and intelligent caching to reduce token usage by 97% and eliminate choice paralysis.Last updated213096Elastic 2.0

knowingofficial
Alicense-qualityAmaintenanceContent-addressed code graph that produces ranked context for AI agents in one call. 22 MCP tools across indexing, blast radius, test scope, semantic diff, runtime traffic, and feedback-aware context packing. Incremental updates via Merkle DAG (no re-indexing). GCF wire format saves 84% tokens vs JSONLast updated16MIT- Alicense-qualityAmaintenanceToken-efficient MCP reimplementation with progressive tool discovery, result handling, and compact wire encoding, reducing token usage by up to 89% on tool definitions.Last updated1MIT
- AlicenseCqualityAmaintenanceAn MCP server that filters and compresses context by 80-90% before sending to an LLM, using code knowledge graphs and compression.Last updated202MIT
Related MCP Connectors
A paid remote MCP for OpenAI Codex context compressor, built to return verdicts, receipts, usage log
Persistent memory and cross-session learning for AI coding assistants (hosted remote MCP).
Agent Cost Allocator MCP — multi-tenant LLM cost attribution for chargeback billing. Companion to
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/capatinore/ContextForge'
If you have feedback or need assistance with the MCP directory API, please join our Discord server