LessTokens Logo
Mcp Server
Windsurf

Documentation

Getting Started

  • Overview
  • Account Setup
  • First API Key
  • First Request
  • Understanding Metrics

API Reference

  • Overview
  • Authentication
  • Compressionnew
  • MCP Servernew
  • Errors

Integrations

  • Node.js / TypeScript
  • Python
  • cURL

Resources

  • Best Practices

Need help?

Join our community or contact support for assistance.

Contact Support →

Windsurf Integration

Integrate LessToken's compression capabilities into Windsurf AI coding assistant. Use compression tools directly in your Windsurf workflow.

Overview

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.

Prerequisites

  • Windsurf installed on your system
  • A LessToken API key (get one here)
  • Access to Windsurf configuration files

Configuration Steps

1

Locate Windsurf Config

Windsurf stores its configuration in a file called .windsurfrules or in the Windsurf settings. The location depends on your setup:

Project-level config
.windsurfrules
Global config
~/.windsurf/config.json
2

Configure MCP Server

Add the MCP server configuration to your Windsurf settings. You can configure it in the Windsurf settings UI or in the configuration file:

Windsurf MCP Configuration
{
  "mcpServers": {
    "less-token-compression": {
      "url": "https://lesstokens.hive-hub.ai/api/mcp",
      "headers": {
        "X-API-Key": "YOUR_API_KEY_HERE"
      }
    }
  }
}
Important: Replace YOUR_API_KEY_HERE with your actual LessToken API key. Keep this configuration secure.
3

Add Auto-Invoke Rule (Optional)

To automatically use compression without typing use context7 in every prompt, add a rule to your .windsurfrules file:

.windsurfrules
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.
4

Restart Windsurf

After saving the configuration, restart Windsurf completely. The MCP server will be connected when Windsurf starts.

5

Verify Integration

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.

Usage Examples

Example 1: Compress Code Context

Compress large code contexts before sending to AI:

Windsurf Chat
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)

Example 2: Automatic Compression

With the auto-invoke rule configured, Windsurf will automatically compress content:

Windsurf Chat
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...

Troubleshooting

MCP Server Not Connecting

  • Verify your API key is correct in the configuration
  • Ensure Windsurf has been restarted after configuration changes
  • Check Windsurf logs for connection errors
  • Verify the MCP server URL is accessible

Tool Not Available

  • Confirm the configuration file syntax is correct (valid JSON)
  • Check that the MCP server name matches: less-token-compression
  • Try removing and re-adding the MCP server configuration
  • Check Windsurf's MCP server status in settings

Additional Resources

MCP Server Docs

Return to the main MCP server documentation.

Windsurf Docs

Official Windsurf documentation.