Integrate LessToken's compression capabilities into Claude Code editor. Use compression tools directly in your Claude Code workflow.
Claude Code is Anthropic's code editor that integrates with Claude AI and supports MCP servers. By configuring Claude Code to use our MCP server, you can access compression tools directly in your coding workflow.
This integration allows you to compress code, documentation, and prompts before sending them to Claude, reducing token usage and improving efficiency.
Claude Code stores its configuration in a JSON file. The location depends on your operating system:
~/Library/Application Support/Claude Code/config.json%APPDATA%\Claude Code\config.json~/.config/Claude Code/config.jsonOpen the configuration file and add the MCP server configuration. If the file doesn't exist, create it with the following structure:
{
"mcpServers": {
"less-token-compression": {
"url": "https://lesstokens.hive-hub.ai/api/mcp",
"headers": {
"X-API-Key": "YOUR_API_KEY_HERE"
}
}
}
}YOUR_API_KEY_HERE with your actual LessToken API key. Keep this file secure.To automatically use compression, add a rule to your CLAUDE.md file:
Always use the compress_text tool from less-token-compression MCP server when I need
to compress code, documentation, or prompts before sending them to Claude. This means you
should automatically use the compression tool to optimize content for token efficiency.After saving the configuration, restart Claude Code completely. The MCP server will be connected when Claude Code starts.
In Claude Code, you should now see the compress_text tool available. You can verify this by checking available tools or using compression in your conversations.
Compress large code contexts before sending to Claude:
You: I have a large codebase context I want to send to Claude.
Can you compress it first using compress_text?
Claude: I'll compress the code context for you to reduce token usage.
[Claude uses compress_text tool]
Compressed context ready. Original: 5000 tokens, Compressed: 3200 tokens (36% reduction)With the auto-invoke rule configured, Claude will automatically compress content:
You: This prompt is too verbose. Can you optimize it?
Claude: I'll optimize the prompt using compress_text automatically.
[Claude uses compress_text tool]
Here's the compressed version optimized for efficiency...less-token-compression