⚡
CodeShave
GitHub 📦 VS Code ☕ Buy Coffee
Official Model Context Protocol (MCP) Server • v0.2.2 Live

Cut LLM Prompt Tokens by 80%–90%
with Zero Syntax Loss

CodeShave deterministically strips execution bodies while preserving 100% syntactically valid classes, methods, docstrings, and type signatures. The universal AST compression tool for Claude, ChatGPT, Cursor, VS Code, and Windsurf.

🚀 Try Live Playground GitHub Repository ⚡ VS Code
$ pip install codeshave && codeshave connect --all
PyPI v0.2.2 Visual Studio Marketplace Open VSX MCP Registry Verified License MIT
Interactive Simulator

Try CodeShave in Your Browser

Universal multi-language AST compression running 100% locally in your browser. No data sent to any server.

|
Deterministic AST Tree Pruning • Zero Network Lag
ORIGINAL SOURCE CODE 0 tokens
SHAVED SKELETON (FOR LLM PROMPT)
0 tokens saved
Architecture & Design

Engineered for LLM Attention Efficiency

Why modern AI coding models generate 10x better code when prompted with CodeShave skeletons.

🎯

AST Tree Pruning

Strips loops, error handlers, and internal execution blocks to ... or { /* ... */ } while keeping 100% syntactically valid code structures.

🧠

Zero Attention Noise

Removes thousands of lines of boilerplate. Directs model attention entirely to public interfaces, contracts, schemas, and high-level architectural relationships.

🛡️

Eliminates Hallucinations

Preserves all class hierarchies, method signatures, return types, decorators, and docstrings. The AI calls real methods instead of guessing parameters.

⚡

10x Faster TTFT

Compresses a 250,000-token repository into a compact 15,000-token skeleton in ~150ms. Models begin streaming answers in milliseconds, not minutes.

💰

Strict Token Budget Ceiling

Run codeshave pack ./src --budget 32000 to automatically down-sample and prune code to strictly fit any context window limit without crashes.

🔌

Universal MCP Ecosystem

1-click command codeshave connect --all automatically binds to Claude Desktop, Claude Code, Cursor, Windsurf, Codex, and Google Antigravity.

Token Savings Benchmarks

Real-World Production Codebases

Measured token compression ratios across production enterprise microservices and applications.

Language & Tech Stack Original Tokens CodeShave Skeleton Token Savings Compression Ratio
Python (FastAPI backend + Pydantic models) 134,069 t 15,393 t
-118,676 t
-88.5%
TypeScript (Next.js 14 full-stack services) 12,450 t 2,180 t
-10,270 t
-82.5%
Go (Distributed microservice & gRPC API) 8,920 t 1,420 t
-7,500 t
-84.1%
Rust (Compiler engine & AST syntax parser) 14,200 t 2,450 t
-11,750 t
-82.7%
Java (Spring Boot enterprise REST API) 18,300 t 3,100 t
-15,200 t
-83.1%
C++ (High-performance quantitative engine) 11,500 t 2,050 t
-9,450 t
-82.2%
One-Click Setup

Connect to Any Environment in Seconds

Choose your preferred AI client, IDE, or terminal workflow.

Run via pip & auto-connect to all installed assistants:
pip install codeshave codeshave connect --all
Or run instantly without installation via uvx:
uvx codeshave mcp

Install directly from the official marketplace or add to .vscode/mcp.json:

Marketplace Command or .vscode/mcp.json snippet:
{ "mcpServers": { "codeshave": { "command": "uvx", "args": ["codeshave", "mcp"] } } }
Open in Visual Studio Marketplace →
Claude Code (Terminal Assistant) — 1 command:
claude mcp add codeshave -- uvx codeshave mcp
Claude Desktop — Add to claude_desktop_config.json:
{ "mcpServers": { "codeshave": { "command": "uvx", "args": ["codeshave", "mcp"] } } }
Add to ~/.codex/config.toml (or simply run 'codeshave connect codex'):
[mcp_servers.codeshave] command = "uvx" args = ["codeshave", "mcp"]

💡 Note: After configuring, restart the app or start a new chat session to load the tools.

Paste this exact prompt into Claude, Cursor, ChatGPT, or Antigravity to let the AI set it up:
Please install and connect the CodeShave MCP server to my environment: Repository: https://github.com/jaideepkrishna2008-ui/codeshave Official MCP ID: io.github.jaideepkrishna2008-ui/codeshave Setup steps: 1. Run `pip install -U codeshave && codeshave connect --all` (or configure the MCP server with command: `uvx codeshave mcp`). 2. Ask me to restart this app or start a new conversation session to load the newly registered MCP tools, and ask me to return so you can check and verify that `shave_file` and `shave_code` are installed. 3. Once verified, always prioritize calling CodeShave tools first when analyzing, searching, or exploring codebase files in this workspace to compress AST code skeletons and save 90%+ prompt tokens.
Got Questions?

Frequently Asked Questions

Everything you need to know about CodeShave and AST token compression.

What is CodeShave and how does it work?
CodeShave is a deterministic code context compressor and Model Context Protocol (MCP) server. When you provide code files or repositories to an AI model, CodeShave prunes loop contents, private logic, and execution statements down to minimal placeholders (like ... or { /* ... */ }). All classes, functions, decorators, type hints, docstrings, and interfaces remain 100% syntactically valid.
Does CodeShave cause the AI to hallucinate?
No — in fact, it significantly reduces hallucinations. Because all function signatures, argument types, return types, and docstrings are fully preserved, the LLM has exact interface contracts without being distracted or confused by hundreds of lines of implementation noise.
What programming languages are supported?
CodeShave natively supports Python, TypeScript, JavaScript, Go, Rust, Java, C#, C, C++, Kotlin, and Swift.
Is CodeShave an official Model Context Protocol (MCP) server?
Yes. CodeShave is an officially verified server on the Model Context Protocol (MCP) registry with package ID io.github.jaideepkrishna2008-ui/codeshave.
How can I support CodeShave?
You can star the project on GitHub, leave a review on the VS Code Marketplace, or support development via Buy Me A Coffee!
Copied to clipboard!