home / mcp / slimcontext mcp server

SlimContext MCP Server

Provides AI-assisted and token-aware chat history compression for MCP clients using SlimContext.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "agentailor-slimcontext-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "slimcontext-mcp-server"
      ],
      "env": {
        "OPENAI_API_KEY": "<OPENAI_API_KEY>"
      }
    }
  }
}

SlimContext MCP Server provides two compact, configurable chat history compression tools for MCP-compatible clients. It wraps the SlimContext library to help you trim or summarize conversations, reducing token usage while preserving essential context for ongoing dialogs.

How to use

You run the SlimContext MCP Server locally or in your environment and connect your MCP client to it. You can choose between two compression strategies depending on your needs: trim_messages, which removes the oldest non-system messages when the token limit is reached, and summarize_messages, which uses AI to generate concise summaries that preserve important context.

Configure your MCP client to point at the SlimContext MCP Server using the provided MCP command. This enables you to invoke the two tools from within your chat sessions. When a conversation reaches the configured token threshold, you can trigger the chosen compression method to reduce history while keeping essential context intact.

{
  "mcpServers": {
    "slimcontext": {
      "command": "npx",
      "args": ["-y", "slimcontext-mcp-server"]
    }
  }
}

How to run tools in practice

You can apply trim_messages to remove older messages when the conversation grows too long, while keeping system messages and the most recent exchanges. This helps maintain responsiveness and reduces token consumption without losing core context.

If you need deeper context preservation, use summarize_messages to create a compact summary of the middle portion of the chat, while still preserving the most recent messages and system instructions. This approach relies on OpenAI to generate context-rich summaries.

Available tools

trim_messages

Compresses chat history by removing oldest non-system messages when token thresholds are exceeded, preserving system messages and the most recent exchanges.

summarize_messages

AI-powered compression that generates concise summaries of the middle portion of a conversation, preserving system messages and recent context.