MCP Compressor MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add mcp-compressor -- uvx mcp-compressor uvx mcp-server-fetch
README.md

An MCP server wrapper for reducing tokens consumed by MCP tools.

mcp-compressor

An MCP server wrapper for reducing tokens consumed by MCP tools.

Overview

MCP Compressor is a proxy server that wraps existing Model Context Protocol (MCP) servers and compresses their tool descriptions to significantly reduce token consumption. Instead of exposing all tools with full schemas directly to language models, it provides a two-step interface:

  1. get_tool_schema(tool_name) - Retrieve the full schema for a specific tool when needed
  2. invoke_tool(tool_name, tool_input) - Execute a tool with the provided arguments

This approach dramatically reduces the number of tokens sent in the initial context while maintaining full functionality.

Why?

MCP servers are exploding in popularity, but their tool descriptions consume significant tokens in every LLM request. For example:

  • The official GitHub MCP server exposes 94 tools consuming 17,600 tokens
  • The official Atlassian MCP server consumes ~10,000 tokens

With 30k+ tokens just for tool descriptions, costs can reach 1-10 cents per request depending on prompt caching. MCP Compressor solves this by replacing dozens of tools with just 2 wrapper tools, achieving 70-97% token reduction while maintaining full functionality. This enables:

  • Adding many MCP servers without blowing out context windows
  • Significant cost savings on token-based API pricing
  • Support for providing 100s or 1000s of tools across multiple servers to your agent

Features

  • Token Reduction: Compress tool descriptions by up to 99% depending on compression level and tool count
  • Multiple Compression Levels: Choose between low, medium, high, or max
  • Universal Compatibility: Works with any MCP server (stdio, HTTP, SSE)
  • Zero Functionality Loss: All tools remain fully accessible through the wrapper interface
  • Easy Integration: Drop-in replacement for existing MCP servers

Installation

Install using pip or uv:

pip install mcp-compressor
# or
uv pip install mcp-compressor

Quick Start

Basic Usage

Wrap any MCP server by providing its command or URL:

# Wrap a stdio MCP server
uvx mcp-compressor uvx mcp-server-fetch

# Wrap a remote HTTP MCP server
uvx mcp-compressor https://example.com/server/mcp

# Wrap a remote SSE MCP server
uvx mcp-compressor https://example.com/server/sse

See uvx mcp-compressor --help for detailed documentation on available arguments.

Compression Levels

Control how much compression to apply with the --compression-level or -c flag:

# Low
mcp-compressor uvx mcp-server-fetch -c low

# Medium (default)
mcp-compressor uvx mcp-server-fetch -c medium

# High
mcp-compressor uvx mcp-server-fetch -c high

# Max
mcp-compressor uvx mcp-server-fetch -c max

Advanced Options

Stdio Servers
# Set working directory
mcp-compressor uvx mcp-server-fetch --cwd /path/to/dir

# Pass environment variables (supports environment variable expansion)
mcp-compressor uvx mcp-server-fetch \
  -e API_KEY=${MY_API_KEY} \
  -e DEBUG=true
Remote Servers (HTTP/SSE)
# Add custom headers
mcp-compressor https://api.example.com/mcp \
  -H "Authorization=Bearer ${TOKEN}" \
  -H "X-Custom-Header=value"

# Set timeout (default: 10 seconds)
mcp-compressor https://api.example.com/mcp \
  --timeout 30
Custom Server Names

When running multiple MCP servers through mcp-compressor, you can add custom prefixes to the wrapper tool names to avoid conflicts:

# Without server name - tools will be: get_tool_schema, invoke_tool
mcp-compressor uvx mcp-server-fetch

# With server name - tools will be: github_get_tool_schema, github_invoke_tool
mcp-compressor https://api.githubcopilot.com/mcp/ --server-name github

# Special characters are automatically sanitized
mcp-compressor uvx mcp-server-fetch --server-name "My Server!"
  # Results in: my_server__get_tool_schema, my_server__invoke_tool
Logging
# Set log level
mcp-compressor uvx mcp-server-fetch --log-level debug
mcp-compressor uvx mcp-server-fetch -l warning

Ho

Tools (2)

get_tool_schemaRetrieve the full schema for a specific tool when needed.
invoke_toolExecute a tool with the provided arguments.

Configuration

claude_desktop_config.json
{"mcpServers": {"mcp-compressor": {"command": "uvx", "args": ["mcp-compressor", "uvx", "mcp-server-fetch"]}}}

Try it

Use get_tool_schema to find the parameters for the fetch_url tool from the wrapped server.
Invoke the fetch_url tool with the URL https://example.com using the invoke_tool function.
Compress my current MCP server tools to reduce token usage by using the high compression level.

Frequently Asked Questions

What are the key features of MCP Compressor?

Compresses tool descriptions by up to 99% to reduce token consumption. Provides a two-step interface to retrieve schemas and invoke tools on demand. Supports multiple compression levels including low, medium, high, and max. Compatible with any MCP server type including stdio, HTTP, and SSE. Allows custom prefixes for tool names to prevent conflicts when running multiple servers.

What can I use MCP Compressor for?

Integrating large MCP servers with hundreds of tools without exceeding LLM context limits. Reducing API costs for agents that frequently use MCP tools by minimizing prompt token counts. Running multiple MCP servers simultaneously while keeping the total tool description overhead low. Optimizing agent performance by only loading full tool schemas when a specific tool is required.

How do I install MCP Compressor?

Install MCP Compressor by running: pip install mcp-compressor

What MCP clients work with MCP Compressor?

MCP Compressor works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep MCP Compressor docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare