mcp-code-shrinker
A semantic context compiler MCP server that provides stratified L0-L3 code context with exact-source escalation, enabling project analysis, symbol contracts, exact source retrieval, and a patching workflow with sandbox validation.
README
mcp-code-shrinker v0.3.11
Semantic Context Compiler — stratified L0-L3 context with exact-source escalation.
| Status | Feature |
|---|---|
| ✅ Implemented | L0 Project Map, L1 Contracts, L2 Exact Source, L3 Evidence |
| ✅ Implemented | Stable symbol IDs (survive neighbor edits) |
| ✅ Implemented | Symbol revision tracking (body changes → new revision) |
| ✅ Implemented | Context packets with ranking + quality check |
| ✅ Implemented | Patch workflow: propose → validate (sandbox) → apply |
| ✅ Implemented | Path security (MCP roots) |
| ✅ Implemented | Loss manifest + confidence scores |
| 🔨 Experimental | Cross-file call graph (relative imports; package imports planned) |
| 🔨 Experimental | Patch sandbox with project copy (node_modules skipped) |
| 🔨 Experimental | TypeScript typecheck integration (tsc must be installed) |
| 📋 Planned | tree-sitter grammars (regex parser used currently) |
| 📋 Planned | Quality benchmark suite |
| 📋 Planned | Git worktree isolation for patches |
Architecture
Layer 0: Project Map (5%)
Layer 1: Semantic Contracts (40%) signatures, effects, throws, confidence
Layer 2: Exact Source (40%) NO renaming, NO regex, NO format changes
Layer 3: Evidence (15%) tests, stack traces, diagnostics
Tools (11)
| Tool | Status | Description |
|---|---|---|
project.scan |
🔨 Exp | Build cross-file call graph |
project.map |
✅ | L0: file tree + exports |
file.contracts |
✅ | L1: all symbol contracts |
symbol.source |
✅ | L2: EXACT source (never modified) |
symbol.context |
🔨 Exp | Callers/callees/tests from graph |
context.create |
✅ | Build L0-L3 packet |
context.expand |
✅ | Model requests missing symbols |
context.inspect |
✅ | Loss manifest + quality check |
patch.propose |
✅ | Edit operations |
patch.validate |
✅ | Sandbox: parse→typecheck→lint→test |
patch.apply |
✅ | Apply with hash re-check + .bak |
Install
git clone https://github.com/sbrejnev988-coder/mcp-code-shrinker.git
cd mcp-code-shrinker && npm install && npm test
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.