Integrate LessToken's compression capabilities into Windsurf AI coding assistant. Use compression tools directly in your Windsurf workflow.
Windsurf is an AI-powered code editor that supports MCP servers natively. By configuring Windsurf 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 AI models, reducing token usage and improving response times.
Windsurf stores its configuration in a file called .windsurfrules or in the Windsurf settings. The location depends on your setup:
.windsurfrules~/.windsurf/config.jsonAdd the MCP server configuration to your Windsurf settings. You can configure it in the Windsurf settings UI or in the configuration file:
{
"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 configuration secure.To automatically use compression without typing use context7 in every prompt, add a rule to your .windsurfrules 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 AI models. This means you
should automatically use the compression tool to optimize content for token efficiency.After saving the configuration, restart Windsurf completely. The MCP server will be connected when Windsurf starts.
In Windsurf, you should now see the compress_text tool available. You can verify this by checking available tools or using compression in your AI conversations.
Compress large code contexts before sending to AI:
You: I have a large codebase context I want to send to the AI.
Can you compress it first using compress_text?
AI: I'll compress the code context for you to reduce token usage.
[AI uses compress_text tool]
Compressed context ready. Original: 5000 tokens, Compressed: 3200 tokens (36% reduction)With the auto-invoke rule configured, Windsurf will automatically compress content:
You: This prompt is too verbose. Can you optimize it?
AI: I'll optimize the prompt using compress_text automatically.
[AI uses compress_text tool]
Here's the compressed version optimized for efficiency...less-token-compression