LessTokens Logo
Mcp Server
Claude Desktop

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 →

Claude Desktop Integration

Integrate LessToken's compression capabilities directly into Claude Desktop conversations. Use the compress_text tool to optimize prompts and reduce token usage.

Overview

Claude Desktop is Anthropic's official desktop application for interacting with Claude AI. By configuring Claude Desktop to use our MCP server, you can access compression tools directly in your conversations with Claude.

This integration allows you to compress long prompts before sending them to Claude, reducing token usage and costs while maintaining semantic meaning.

Prerequisites

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

Configuration Steps

1

Locate Claude Desktop Config File

Claude Desktop stores its configuration in a JSON file. The location depends on your operating system:

macOS
~/Library/Application Support/Claude/claude_desktop_config.json
Windows
%APPDATA%\Claude\claude_desktop_config.json
Linux
~/.config/Claude/claude_desktop_config.json
2

Edit Configuration File

Open the configuration file in a text editor and add the MCP server configuration. If the file doesn't exist, create it with the following structure:

claude_desktop_config.json
{
  "mcpServers": {
    "less-token-compression": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-http",
        "https://lesstokens.hive-hub.ai/api/mcp"
      ],
      "env": {
        "X_API_KEY": "YOUR_API_KEY_HERE"
      }
    }
  }
}
Important: Replace YOUR_API_KEY_HERE with your actual LessToken API key. Keep this file secure and never commit it to version control.
3

Restart Claude Desktop

After saving the configuration file, restart Claude Desktop completely. The MCP server will be automatically connected when Claude Desktop starts.

4

Verify Connection

In Claude Desktop, you should now see the compress_text tool available. You can verify this by asking Claude about available tools or by trying to use compression.

Usage Examples

Example 1: Compress a Long Prompt

You can ask Claude to compress a prompt before using it:

Claude Conversation
You: Can you compress this prompt for me using the compress_text tool?
"The quick brown fox jumps over the lazy dog. This is a test sentence 
with some redundancy and unnecessary verbosity that we want to optimize."

Claude: I'll compress that prompt for you using the compress_text tool.

[Claude uses compress_text tool]

The compressed version is: "Quick brown fox jumps lazy dog. Test sentence."
Original tokens: 28, Compressed tokens: 12, Tokens saved: 16 (57% reduction)

Example 2: Automatic Compression

Claude can automatically compress prompts when they're too long:

Claude Conversation
You: I have a very long prompt that I want to send to another AI model.
Can you help me compress it first?

Claude: I'll compress your prompt using the compress_text tool to reduce 
token usage while preserving the key information.

[Claude uses compress_text tool]

Here's the compressed version optimized for token efficiency...

Troubleshooting

MCP Server Not Connecting

  • Verify your API key is correct in the configuration file
  • Ensure Claude Desktop has been restarted after configuration changes
  • Check Claude Desktop logs for connection errors
  • Verify your internet connection and that 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 exactly: less-token-compression
  • Try removing and re-adding the MCP server configuration

Authentication Errors

  • Verify your API key is valid and not expired
  • Check that the X_API_KEY environment variable is set correctly
  • Ensure there are no extra spaces or quotes around the API key

Additional Resources

MCP Server Docs

Return to the main MCP server documentation.

Claude MCP Docs

Official Claude Desktop MCP documentation.