contextforge-mcp

contextforge-mcp

Orchestrates codebase indexing, token compression, and spec-driven development into a single MCP pipeline for AI coding agents.

Category
访问服务器

README

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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选