ContextForge MCP
Click on "Deploy 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., "@ContextForge MCP compile this repo for the auth flow into a 6000-token pack"
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 — Deterministic Token Compressor & Context-Window Compiler
Live Remote MCP Endpoint (Streamable HTTP · Zero Auth · Zero LLM Calls): https://context-forge-mcp.yashwant938.workers.dev/mcp
Live Interactive Edge Playground: https://context-forge-mcp.yashwant938.workers.dev
Official MCP Registry ID: io.github.yashwant938/context-forge-mcp
ContextForge MCP is a zero-dependency Model Context Protocol (2025-03-26) server, standalone CLI, and installable Agent Plugin that cuts 60–90% of context-window bloat deterministically—with zero external LLM API keys, zero runtime dependencies, and exact line-number traceability.
Most agent failures in production aren't model-intelligence failures—they're context-harness failures:
Codebase Overload — Dumping 25 raw files burns 40,000+ tokens and triggers Lost-in-the-Middle recall decay.
Noisy Terminal Logs & Giant JSON Dumps — Repetitive timestamps, UUIDs, healthcheck lines, and 500-row API arrays drown out the 3 lines that actually explain the crash.
Silent RAG Encoder Truncation — Chunks exceeding 256 tokens (
all-minilm-l6-v2) or 512 tokens (bge-small-en) are silently chopped off during embedding, while redundant chunks waste generation context.Blind Token Economics — Connecting 30+ eager MCP tools quietly burns 6,000–12,000 tokens every single turn before the user even writes a sentence.
ContextForge replaces ad-hoc truncation with deterministic multi-language code skeletonization, Drain-style log clustering, JSON/OpenAPI schema folding, token-bounded RAG re-chunking + U-shaped attention packing, and BM25 multi-fidelity budget compilation.
Quick Connect (Claude Code, Cursor, Antigravity, Windsurf, Codex)
Option A — Hosted Remote MCP (5 Seconds · Zero Install · Zero Auth)
{
"mcpServers": {
"context-forge": {
"url": "https://context-forge-mcp.yashwant938.workers.dev/mcp"
}
}
}Option B — Local Stdio MCP (Unlocks Direct Disk compile_repo_context)
{
"mcpServers": {
"context-forge-local": {
"command": "node",
"args": ["/absolute/path/to/context-forge-mcp/bin/context-forge-mcp.mjs"]
}
}
}Option C — Standalone CLI (Zero Dependencies · Node >= 20)
# BM25-rank & pack a repository into a strict 6,000-token XML bundle
node bin/cli.mjs pack . "authentication jwt refresh" 6000
# Skeletonize any JS/TS/Python/C++/Go/Rust/Java file with Lstart-Lend ranges
node bin/cli.mjs skeleton src/engines/codeSkeletonizer.mjs signatures
# Cluster a noisy CI/Docker/server log into prioritized error templates + unique stack traces
node bin/cli.mjs logs build.log
# Compact a huge JSON payload or OpenAPI 3.x spec into an inferred schema + stats
node bin/cli.mjs json openapi.json
# Simulate multi-turn token growth, compaction cliff & monthly USD savings
node bin/cli.mjs budget claude-sonnet-4 35 25Related MCP server: cap-shield-mcp
MCP Primitives Implemented (7 Tools · 4 Resources · 3 Prompts)
7 Deterministic MCP Tools
Tool | Transport | What It Computes |
| Local | Walks a repo on disk (ignoring |
| Remote & Local | Multi-artifact BM25 + multi-fidelity context compiler over source files, logs, and JSON passed over HTTP, with a dropped-file manifest for on-demand expansion |
| Remote & Local | Multi-language skeletonizer (JS/TS, Python, C/C++, Go, Rust, Java) with 3 modes: |
| Remote & Local | Drain-style template normalizer (timestamps, UUIDs, IPs, hex, numbers) + severity-prioritized clustering + unique stack-trace extraction (70–95% savings) |
| Remote & Local | Collapses giant JSON arrays into inferred typed schemas ( |
| Remote & Local | Audits encoder truncation ( |
| Remote & Local | Turn-by-turn token trajectory across 8 frontier models ( |
4 MCP Resources (resources/list, resources/read)
context-forge://guide/compression-playbooks— Deterministic strategy matrix by artifact typecontext-forge://guide/model-pricing-windows— Frontier context windows, attention sweet spots & cached pricingcontext-forge://guide/lost-in-the-middle— Encoder truncation limits & U-shaped attention packingcontext-forge://guide/mcp-token-hygiene— Avoiding eager MCP tool-schema bloat
3 MCP Prompts (prompts/list, prompts/get)
compress-debug-session— Cluster raw crash logs + pack suspect source files before diagnosing a bugpack-repo-for-feature— BM25 repo packing workflow before multi-file implementationoptimize-rag-pipeline— Encoder overflow audit + near-duplicate pruning + U-shaped reordering
Development, Testing & Deployment
# Run full unit + local stdio MCP + Cloudflare Worker Streamable HTTP tests
npm test
# Dogfood BM25 repo packer on ContextForge's own codebase
npm run pack:self
# Build zero-dependency Cloudflare Worker bundle (dist/worker.mjs)
npm run build:worker
# Deploy to Cloudflare Workers Edge
npx wrangler deployRelated project: ArchGuard MCP (Architecture Drift, SQL DDL & Distributed Systems Verifier)
Available Tools
7 toolsaudit_and_pack_rag_contextA
Audit retrieved RAG passages against embedding encoder hard limits (MiniLM 256, BGE/E5 512, Nomic 2048, OpenAI 8191, Voyage 32k), eliminate silent truncation via sentence-bounded re-chunking, remove Jaccard near-duplicates, and apply Lost-in-the-Middle U-shaped attention ordering inside a strict token budget.
Inputs: chunks (required), encoderModel, overlapTokens, dedupThreshold, +3 more.
compact_json_and_apiA
Deterministically compact huge JSON payloads, DB query dumps, or OpenAPI 3.x/Swagger specs into an inferred typed schema with field cardinality, numeric min/max ranges, enum distributions, and a trimmed sample item (75-92% token reduction).
Inputs: payload (required), maxDepth.
compile_context_packB
BM25-ranked, token-budgeted multi-artifact context compiler. Ranks source files, logs, JSON dumps, and docs against a taskQuery, keeping top files verbatim, skeletonizing supporting dependencies, clustering logs, and outputting a strict XML context pack + dropped-file manifest.
Inputs: files (required), taskQuery (required), fullTopK, tokenBudget.
compile_repo_contextA
Walk a local repository on disk (skipping node_modules, .git, lockfiles, binaries, and .env secrets), rank files against taskQuery via BM25, and compile a strict token-budgeted context pack mixing verbatim target code and line-indexed skeletons.
Inputs: rootPath (required), taskQuery (required), fullTopK, maxFiles, +1 more.
compress_logs_and_tracesA
Drain-style deterministic log template clusterer and stack-trace deduplicator. Normalizes timestamps, UUIDs, IPs, hex pointers, and numbers to collapse 1,000+ noisy CI/server/test lines into frequency-ranked ERROR/WARN clusters + unique stack traces (70-95% token reduction).
Inputs: logs (required), maxClusters, preserveStackTraces.
simulate_context_budgetB
Deterministic multi-turn agent context-window and cost economics simulator. Computes exact MCP schema tax, turn-by-turn token growth, Lost-in-the-Middle degradation cliff turn, 85% compaction wall turn, prompt-cache economics, and monthly USD savings across 8 frontier models.
Inputs: model, turns, mcpToolCount, sessionsPerDay, +6 more.
skeletonize_codeA
Deterministically compress JS/TS, Python, C/C++, Go, Rust, or Java source code into a line-indexed signature skeleton (or symbol-focus view that expands only matching functions), cutting 65-88% tokens while preserving imports, types, signatures, and exact Lstart-Lend ranges.
Inputs: code (required), mode, path, language, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool targets a distinct artifact type (JSON/OpenAPI, source code, logs/traces, RAG passages) or task (repo walk, budget simulation), so purposes are mostly clear. The three 'pack/compile' tools (compile_context_pack, compile_repo_context, audit_and_pack_rag_context) overlap somewhat since all produce budgeted context, but input-source differences in the descriptions help disambiguate.
Names follow a consistent snake_case, verb-led convention (compact_, compile_, skeletonize_, compress_, audit_and_pack_, simulate_). Minor deviations: audit_and_pack_rag_context uses two verbs, and compress vs compact are near-synonyms, but overall pattern is predictable.
Seven tools is well-scoped for a context/token-optimization toolkit, with each tool covering a distinct compression or analysis concern. No redundant or filler tools.
The surface broadly covers artifact compaction (JSON, code, logs), context packing (multi-artifact, repo, RAG), and budget simulation, forming a coherent lifecycle. Minor gaps: no standalone token-count/validation tool and no inverse (expand/restore) operations, though simulate_context_budget partially covers estimation.
Maintenance
Related MCP Connectors
Compress coding-agent context ~64%. Hosted Neural Keep MCP for Cursor/Claude/Codex.
Context selection and compression for AI agents - recall measured, not claimed.
Codebase intelligence for agents: 152 structured artifacts across 21 programs, one call.
Cut tokens from HTML, JSON, logs and public URLs into compact context for LLMs.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA task-aware context compression layer for Agent workflows, RAG pipelines, and AI Coding assistants, reducing noisy logs, retrieval chunks, and code context into high-signal LLM inputs via CLI, Python SDK, and MCP.22 PyPI324MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to compress and selectively retrieve context, with measured recall rather than claimed performance. It provides tools to assess potential traffic and token savings, list compression dictionaries, and assemble relevant memory entries within a token budget.MIT
- FlicenseNot gradedqualityNot gradedmaintenanceEnables MCP-compatible clients and autonomous agents to dynamically compress long-horizon context by pruning verbose tool outputs, HTML boilerplate, and semantic redundancy by 40-70%. It reduces token burn and latency through deterministic, zero-dependency processing.-
- AlicenseAqualityBmaintenanceDeterministic, local-first context optimization for AI coding agents. Automatically compresses raw development session data (messages, tool logs, error stack traces, and git diffs) into a compact, task-specific context window. Operates 100% locally with zero external LLM dependencies, ensuring your source code never leaves your machine.633 npmMIT