# CodeShave

> CodeShave is an open-source MCP server for developer tools. Compresses code into syntax-valid skeletons so AI coding assistants use fewer tokens. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, VS Code, macOS, Windows, Linux
- **Repository:** https://github.com/jaideepkrishna2008-ui/codeshave
- **MCP Registry name:** io.github.jaideepkrishna2008-ui/codeshave
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-11-27

## About

CodeShave shrinks source code before it reaches a language model. It parses files with language-native AST tools and keeps the parts a model needs to understand a codebase, such as types, classes, interfaces, docstrings, decorators and function signatures, while collapsing repetitive function bodies and loops into placeholders. The output stays syntactically valid, so assistants can still read it as real code.

The tool runs as an MCP server over stdio and can also be used from the command line. Commands cover copying a compressed view to the clipboard, packing a directory into a Markdown or XML context bundle, showing a diff of the lines removed, and enforcing a token budget so output fits under a chosen limit. A connect command registers it with several AI clients, and an IDE extension is available for VS Code-based editors.

It suits developers who work with large repositories in tools such as Claude, Cursor, Windsurf or VS Code Copilot and want to keep prompts within context limits. The project is MIT licensed and includes a browser playground for testing compression on your own code.

## Features

- **AST-based body pruning:** Replaces function and method bodies with placeholders while leaving the surrounding structure intact.
- **Syntax-valid output:** Compressed files remain parseable in the source language, so models receive clean code structure.
- **Token budget enforcement:** Automatically prunes files so the packed output fits under a specified token ceiling.
- **Multi-language support:** Handles Python, TypeScript and JavaScript, Go, Rust, Java, C and C++, C#, Kotlin and Swift.
- **Client auto-connect:** A single command detects installed AI clients and registers the MCP server with them.
- **Clipboard and pack commands:** Copies compressed code to the clipboard or writes it to Markdown or XML context files.

## Good for

- Giving an AI assistant an overview of a large repository without exceeding its context window
- Reducing prompt token costs when asking models about a codebase
- Packing a project into a single context file for a chat session
- Reviewing which lines a compression pass removed before sharing code

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
claude mcp add codeshave -- uvx codeshave
```

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

### Claude Code: Or share it with your project (.mcp.json)

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

### Claude Desktop (claude_desktop_config.json)

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

Settings → Developer → Edit Config, then quit and reopen Claude Desktop.

### Cursor (~/.cursor/mcp.json)

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

Use .cursor/mcp.json in a project to share it with the project.

### VS Code (~/.copilot/mcp-config.json)

```json
{
  "mcpServers": {
    "codeshave": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "codeshave"
      ]
    }
  }
}
```

Or put the same entry in .mcp.json at your workspace root to share it.

### Codex: Add with the CLI (Terminal)

```sh
codex mcp add codeshave -- uvx codeshave
```

### Codex: Or add to config.toml (~/.codex/config.toml)

```toml
[mcp_servers.codeshave]
command = "uvx"
args = ["codeshave"]
```

### Gemini CLI and Antigravity: Gemini CLI (~/.gemini/settings.json)

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

Or run: gemini mcp add -s user codeshave uvx -- codeshave

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

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

Use .agents/mcp_config.json to add it to one workspace only.

### Devin Desktop (~/.config/devin/mcp_config.json)

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

On Windows the file is %APPDATA%\\devin\\mcp_config.json. Use .devin/mcp_config.json to share it with a project.

### Cline (cline_mcp_settings.json)

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

Open it from the MCP Servers icon → Configure → Configure MCP Servers.

### Zed (Zed settings.json)

```json
{
  "context_servers": {
    "codeshave": {
      "command": "uvx",
      "args": [
        "codeshave"
      ]
    }
  }
}
```

Open it with zed: open settings file. Merge context_servers into the settings you already have.

### JetBrains AI Assistant and Junie: AI Assistant (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

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

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

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

Use .junie/mcp/mcp.json to share it with a project.

### Kiro (~/.kiro/settings/mcp.json)

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

Use .kiro/settings/mcp.json to add it to one workspace only.

### Other clients (your client's MCP settings (most use this shape))

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

## FAQ

### How do I install CodeShave as an MCP server?

Run pip install codeshave followed by codeshave connect --all, or configure the server to run with uvx codeshave mcp.

### Which languages are supported?

Python, TypeScript and JavaScript, Go, Rust, Java, C and C++, C#, Kotlin and Swift are supported.

### What is the license?

CodeShave is released under the MIT license.

### Is CodeShave free?

Yes. CodeShave is open source, so you can use and self-host it for free.

### How do I add CodeShave to Claude Code?

Run this command in your terminal: claude mcp add codeshave -- uvx codeshave

### What are the best alternatives to CodeShave?

The closest alternatives to CodeShave are Compress-token, Air, Smart Context MCP, Codegraph and Diogenes Context Compression & Code Solvers MCP.

## Where this comes from

- Description: written from the project's README and its MCP Registry entry.
- Install steps: from the official MCP Registry entry.

## Alternatives

- [Compress-token](https://ai-powered.com/mcp/compress-token): Compress-token is an open-source MCP server for developer tools.
- [Air](https://ai-powered.com/mcp/air): Air is an open-source MCP server for developer tools.
- [Smart Context MCP](https://ai-powered.com/mcp/smart-context-mcp): Smart Context MCP is an open-source MCP server for developer tools.
- [Codegraph](https://ai-powered.com/mcp/codegraph): Codegraph is an open-source MCP server for developer tools.
- [Diogenes Context Compression & Code Solvers MCP](https://ai-powered.com/mcp/diogenes-context-compression-and-code-solvers-mcp): Diogenes Context Compression & Code Solvers MCP is a freemium MCP server for developer tools.
- [treecut](https://ai-powered.com/mcp/treecut): treecut is an open-source MCP server for developer tools.
- [Daimonos](https://ai-powered.com/mcp/daimonos): Daimonos is an open-source MCP server for developer tools.
- [BACH CodeCommander](https://ai-powered.com/mcp/bach-codecommander): BACH CodeCommander is an open-source MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/codeshave
