CodeShave

io.github.jaideepkrishna2008-uiPublished by GitHub account jaideepkrishna2008-uiv0.2.1Updated Nov 22, 2026

High-speed AST code compressor and MCP server for AI coding assistants.

VerifiedSTDIODesktop onlyDeveloper Tools

Overview

CodeShave's local MCP server; no sign-in required; STDIO.

No AI overview yet: these facts come from the registry entry and the server itself.

Installation

In SourceWeft

  1. Open CodeShave in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

CodeShave

[CodeShave Banner]

[PyPI version] [Python Versions] [Official MCP Registry] [CI Status] [Buy Me A Coffee]

🏛️ Official Model Context Protocol (MCP) Verified Server

CodeShave is officially verified and listed on the Model Context Protocol Registry (io.github.jaideepkrishna2008-ui/codeshave).

🧠 Improves AI Efficiency & Intelligence by 90%+: By compressing away verbose function bodies while preserving 100% of types, classes, interfaces, and signatures, CodeShave eliminates "lost-in-the-middle" attention noise. AI models (Claude, Codex, Cursor, Antigravity) see a dense architectural blueprint, resulting in over 90% higher reasoning precision, virtually zero hallucinations, and 10x faster response generation.

⚡ Try Live in Your Browser (Zero Install Required):
👉 https://jaideepkrishna2008-ui.github.io/codeshave/

High-speed, deterministic AST & structural code context compressor for AI coding assistants and LLMs.
Reduces prompt tokens by 80% to 95% across all major programming languages while preserving 100% valid syntax, type signatures, interfaces, and class hierarchies.
Boosts AI reasoning intelligence, eliminates "lost-in-the-middle" attention dilution, and supercharges response speeds by 10x.


⚡ Terminal Demo

[CodeShave Live Terminal Demo]

[Live Web Playground]


🎯 Why CodeShave?

When developers feed entire codebases to LLMs or AI agents, context windows quickly fill up, latency spikes, and API token bills mount.

Traditional approaches either:

  1. Truncate files blindly, breaking syntax trees, references, and imports.
  2. Rely on costly, slow LLMs to summarize code before prompting.

CodeShave is a deterministic, zero-dependency compiler engine:

  • Python AST Engine: Strips internal executable bodies into ..., preserving full decorators, types, docstrings, classes, and __all__.
  • Universal Multi-Language Engine: Strips execution loops inside { ... } into { /* ... */ } across TypeScript, JavaScript, Go, Rust, Java, C++, and C# while keeping 100% of interfaces, structs, types, imports, and function signatures intact.
  • Topological Sorting: Orders files by module dependencies so the LLM reads prerequisite definitions first.
  • Budget Enforcer: Automatically compresses a repository to fit exactly under your target token limit (e.g. --budget 32000).
  • Turnkey MCP Server: Seamlessly integrates with Claude Desktop, Claude Code, Cursor, Windsurf, and Antigravity.

🧠 How CodeShave Supercharges AI Efficiency & Intelligence by 90%+

Feeding raw code into LLMs doesn't just waste tokens—it actively degrades model intelligence. Here is how CodeShave delivers a 90%+ boost in reasoning accuracy and developer efficiency:

  1. Eliminates "Attention Dilution" & The Lost-in-the-Middle Phenomenon: In massive 100k+ token prompts, 90% of the payload is repetitive execution loops, arithmetic, UI styling, and verbose error handling. This creates massive "attention noise" that drowns out critical class hierarchies and API contracts. CodeShave eliminates the noise, leaving a 100% dense architectural signal for the model.
  2. 90%+ Fewer Hallucinations: When an AI has clear, unobstructed visibility into every class structure, type definition, and function signature across your entire repository, it stops guessing. It references and calls exact, verified methods instead of inventing non-existent parameters.
  3. 10x Faster Time-To-First-Token (TTFT): Instead of waiting 20 to 30 seconds for an LLM to prefill and ingest 250,000 raw tokens, CodeShave provides a clean 15,000-token skeleton in ~150ms. The model begins generating intelligent answers almost instantaneously.
  4. Enables 50+ Multi-Turn Conversations Without Context Overflow: Chat history compounds exponentially with every turn. Keeping your base codebase skeleton lean means you can have deep, iterative back-and-forth debugging sessions without hitting rate limits, throttling, or context exhaustion.

🌐 Supported Languages

CodeShave natively supports the world's most popular programming languages out of the box with zero external dependencies:

LanguageExtensionsCompression EnginePreserved Constructs
Python.py, .pywPython Native ASTClasses, methods, docstrings, type annotations, decorators, __all__
TypeScript.ts, .tsxStructural ScannerInterfaces, type aliases, enums, class methods, JSDoc, exports
JavaScript.js, .jsx, .mjs, .cjsStructural ScannerES6 classes, arrow functions, exported modules, constructor signatures
Go.goStructural Scannertype Struct struct, type Interface interface, method receivers, func
Rust.rsStructural Scannerstruct, enum, trait, impl blocks, pub fn signatures
Java.javaStructural ScannerPackages, classes, interfaces, generic types, method signatures
C / C++.c, .cpp, .h, .hppStructural ScannerHeader #include, struct, class, method/function declarations
C#.csStructural ScannerNamespaces, classes, interfaces, properties, method headers
Kotlin & Scala.kt, .scalaStructural ScannerClasses, traits, data classes, function signatures
Swift & Dart.swift, .dartStructural ScannerProtocols, extensions, classes, functions
PHP.phpStructural ScannerNamespaces, classes, interfaces, function signatures
Ruby.rbIndentation ScannerClasses, modules, def ... end signatures
Shell / Bash.sh, .bash, .zshLexical ScannerFunction headers, environment variables, commands

🏗️ Architecture

[CodeShave Architecture Diagram]


🚀 Quickstart

Installation

Install globally from PyPI:

bash
pip install codeshave

Or install directly from GitHub:

bash
pip install git+https://github.com/jaideepkrishna2008-ui/codeshave.git

⚡ CLI Usage

bash
# 📋 One-Click Clipboard Copy: Compress and copy directly to OS clipboardcodeshave clip ./srccodeshave clip ./src/service.ts# -> Copied to clipboard! Ready to paste into ChatGPT, Claude, or Cursor!
# 📦 Pack entire multi-language repository into an LLM context bundlecodeshave pack ./src -o llm_context.md
# 🎯 Filter by language (e.g. only TypeScript and Go)codeshave pack ./src --lang ts,go -o context.md
# 🏷️ Generate Claude-optimized XML bundle with live savings metricscodeshave pack ./src --format xml --stats -o llm_context.xml
# 💰 Enforce strict token budget ceiling (auto-prunes to fit under 32k tokens)codeshave pack ./src --budget 32000 -o prompt_context.md
# 🔍 View colored terminal diff of lines shavedcodeshave diff ./src/server.go
# 📄 Inspect a single file's compressed skeletoncodeshave inspect ./src/services/billing.ts

🔌 AI Assistant & Editor Integration (Official MCP Server)

🏛️ Verified on the Official Model Context Protocol Registry

CodeShave is officially verified and listed on the Model Context Protocol Registry under:
👉 io.github.jaideepkrishna2008-ui/codeshave

🚀 Why Connect CodeShave via MCP? Connecting CodeShave gives your AI coding assistant (Claude Code, Codex, Cursor, Antigravity, Windsurf) dynamic tools (shave_code and shave_file) to compress code before analysis. Instead of cluttering the prompt window with thousands of lines of implementation logic, the AI reads a pristine structural AST blueprint. This improves reasoning intelligence, code architecture comprehension, and context efficiency by over 90% while slashing latency by 10x.

Run CodeShave anywhere with zero installation via uvx codeshave mcp or standard CLI.

⚡ 1-Click Universal Auto-Connect (Zero Manual JSON Editing)

CodeShave includes an intelligent auto-connector that scans your system for installed AI assistants, resolves OS-specific sandboxes (including Windows Store AppContainers), and registers the MCP server automatically:

bash
# Connect to all detected AI assistants automatically (Claude, Cursor, Windsurf, Antigravity, VS Code)codeshave connect --all
# Or connect to a specific assistantcodeshave connect claudecodeshave connect cursorcodeshave connect windsurfcodeshave connect antigravitycodeshave connect vscode
# Check live connection status across all assistantscodeshave connect --status
# Disconnect CodeShave if ever neededcodeshave connect --remove

Manual Assistant Setup (If Preferred)

1. Claude Code (Codex / Terminal Assistant)

Install directly with one terminal command:

bash
claude mcp add codeshave -- uvx codeshave mcp

2. Claude Desktop

Add to your claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
json
{  "mcpServers": {    "codeshave": {      "command": "uvx",      "args": ["codeshave", "mcp"]    }  }}

(Or use "command": "codeshave", "args": ["mcp"] if installed globally via pip)

3. Cursor IDE

  1. Open Cursor Settings $\rightarrow$ Features $\rightarrow$ MCP.
  2. Click + Add New MCP Server.
  3. Configure:
    • Name: codeshave
    • Type: command
    • Command: uvx codeshave mcp

Alternatively, add to .cursor/mcp.json in your workspace:

json
{  "mcpServers": {    "codeshave": {      "command": "uvx",      "args": ["codeshave", "mcp"]    }  }}

4. Windsurf Editor

Add to ~/.codeium/windsurf/mcp_config.json:

json
{  "mcpServers": {    "codeshave": {      "command": "uvx",      "args": ["codeshave", "mcp"]    }  }}

5. Google Antigravity

In your Antigravity MCP configuration (~/.gemini/antigravity/mcp_config.json or project settings):

json
{  "mcpServers": {    "codeshave": {      "command": "codeshave",      "args": ["mcp"]    }  }}

6. VS Code (Copilot & Cline / Roo Code)

In .vscode/mcp.json or Cline MCP settings:

json
{  "mcpServers": {    "codeshave": {      "command": "codeshave",      "args": ["mcp"]    }  }}

⚡ Triggering CodeShave: @ Mentions, / Slash Commands & Auto-Rules

❓ Why Doesn't My AI Use MCP Tools Automatically?

Many developers install an MCP server and wonder: "Why is my AI assistant still reading raw files or using custom scripts instead of calling CodeShave?"

AI models (Claude 3.7/3.5, GPT-4o, Gemini, Cursor Composer, Windsurf Cascade) naturally have tool inertia—they default to generic built-in tools (read_file or terminal commands) that they were trained on, frequently dumping 5,000+ to 20,000+ line files into the context window and burning hundreds of thousands of tokens unnecessarily.

With CodeShave, you can control your assistant in two simple ways:

  1. Interactive Triggering: Use @codeshave or /codeshave directly in chat when prompting.
  2. 100% Automated Hands-Free Rules: Add a 1-line rule file to your repository so the AI always defaults to CodeShave on Turn 1 without needing any manual mention!

🕹️ Universal AI Trigger & Command Matrix

AI Assistant / IDEInteractive Command (@ / /)How to Trigger in Chat100% Hands-Free Rule FileWhat Happens Under the Hood
Cursor IDE@codeshaveType @codeshave in Composer / Chat.cursorrulesCursor attaches CodeShave MCP tools directly to the context bundle
Windsurf (Cascade)@codeshaveType @ in Cascade chat input.windsurfrulesCascade displays shave_file tool call card before reading files
Google Antigravity/codeshave or @codeshaveType /codeshave slash commandGEMINI.mdActivates /codeshave skill, compressing files with 90%+ token reduction
GitHub Copilot / VS Code/codeshave or @workspaceNative slash command via prompt file.github/copilot-instructions.mdExecutes custom prompt and invokes shave_file across workspace
Claude DesktopNatural Prompt / 🔨 TrayClick 🔨 Hammer Icon / prompt naturallyCLAUDE.mdClaude invokes shave_file before generating reasoning output

1. Cursor IDE (@codeshave & .cursorrules)

  • Interactive Usage: In Cursor Composer (Ctrl+I / Cmd+I) or Chat (Ctrl+L / Cmd+L), type @codeshave:
    text
    > @codeshave inspect this repository and list all API endpoints
    Cursor autocompletes the MCP tool and binds shave_file and shave_code directly.
  • Zero-Prompt Automation: Create .cursorrules in your project root:
    markdown
    # .cursorrulesAlways prioritize calling the `codeshave` MCP tool (`shave_file` or `shave_code`) when analyzing, searching, or exploring source code files. This loads the structural AST skeleton (90%+ token savings) before reading specific implementation ranges.

2. Windsurf Editor (@codeshave & .windsurfrules)

  • Interactive Usage: In the Cascade chat bar, type @ to open the context selector and choose codeshave:
    text
    > @codeshave analyze the auth pipeline in src/services/auth.ts
  • Zero-Prompt Automation: Create .windsurfrules in your project root:
    markdown
    # .windsurfrulesWhen exploring project architecture or scanning files across Python, TypeScript, Go, Rust, Java, C++, and C#, always invoke CodeShave MCP (`shave_file`) first. Never dump full raw multi-thousand-line files into context when a structural skeleton is sufficient.

3. Google Antigravity (/codeshave & GEMINI.md)

  • Interactive Usage: Type /codeshave directly in the Antigravity chat input:
    text
    > /codeshave explore src/ and summarize the database layer
    Antigravity immediately executes the /codeshave skill, compressing all targeted files down to syntax-valid AST skeletons in ~150ms.
  • Zero-Prompt Automation: Add to your GEMINI.md (or workspace rules):
    markdown
    # GEMINI.mdAlways prioritize calling the `codeshave` MCP (`shave_file` or `shave_code`) or activating `/codeshave` when analyzing or exploring code files to inspect AST skeletons (90%+ savings) before reading raw lines.

4. GitHub Copilot & VS Code (/codeshave Prompt & Instructions)

  • Custom Slash Command: VS Code supports custom prompt files. Create .github/prompts/codeshave.prompt.md:
    markdown
    ---name: codeshavedescription: Shave and compress code AST skeletons to reduce context tokens by 85%+---Use the codeshave MCP server (`shave_file` or `shave_code`) to inspect structural AST skeletons across workspace files before reading full raw implementation bodies into context.
    Typing /codeshave in Copilot Chat will now execute this prompt natively!
  • Zero-Prompt Automation: Create .github/copilot-instructions.md in your repo:
    markdown
    # .github/copilot-instructions.mdWhen analyzing, reviewing, or exploring files in this repository, always call the CodeShave MCP server tools (`shave_file` or `shave_code`) first to save up to 85% of context window tokens.

5. Claude Desktop (🔨 Tool Tray & CLAUDE.md)

  • Interactive Usage:
    1. Open Claude Desktop and confirm the 🔨 (Hammer icon) in the bottom right corner displays codeshave (2 tools).
    2. Prompt Claude naturally:
    text
    > Use codeshave to shave src/server.go and analyze its handlers.
  • Zero-Prompt Automation: Create CLAUDE.md in your project root:
    markdown
    # CLAUDE.mdAlways prioritize calling the `codeshave` MCP tools (`shave_file` or `shave_code`) when analyzing or exploring code to preserve full types and signatures while keeping context lean.

📦 Ready-to-Use Drop-in Rule Pack

You can copy these pre-configured rule files directly into your existing repositories:


🐍 Python SDK

python
from codeshave import compress_code, compute_savings
# Compresses any language (Python, TypeScript, Go, Rust, Java, etc.)code = open("UserService.ts").read()skeleton = compress_code(code, filename_or_ext="UserService.ts")report = compute_savings(code, skeleton)
print(skeleton)print(report.summary_line())# -> Original: 4,520 tokens | Skeleton: 790 tokens | Saved: 3,730 tokens (-82.5%)

📊 Token Savings Benchmark

Source LanguageOriginal TokensCodeShave SkeletonReductionSyntax Preservation
Python (Data Models & API)134,069 t15,393 t88.5%✅ 100% Valid AST
TypeScript (React & Services)12,450 t2,180 t82.5%✅ Interfaces & Signatures
Go (HTTP API & Router)8,920 t1,420 t84.1%✅ Structs & Receivers
Rust (Engine & Impl)14,200 t2,450 t82.7%✅ Traits & Fn Signatures
Java (Enterprise Services)18,300 t3,100 t83.1%✅ Classes & Types
C++ (Core Algorithms)11,500 t2,050 t82.2%✅ Headers & Declarations

💖 Sponsorship & Backing

If CodeShave saves you tokens, reduces your LLM API bills, or accelerates your AI agent workflow, consider supporting ongoing open-source development:

[Buy Me A Coffee]    [Sponsor on GitHub]


📄 License

Created by Jaideep Krishna A (@jaideepkrishna2008-ui). Licensed under the MIT License.

Source: README.md at commit 0196485

Tools

0
SourceWeft started this package once in an isolated sandbox, without credentials, to list its tools. That failed: the server did not start.

Version history

1
  1. v0.2.1LatestNov 22, 2026

Score

40% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts

    Declare a license in the repository or the registry entry.