Context Optimizer MCP
About
An MCP server that uses Redis and in-memory caching to optimize and extend context windows for large chat histories
Details
- Author
- degenhero
- Downloads
- 275
- Categories
- Other
Jump to
- Dual-layer caching: in-memory LRU and persistent Redis
- Automatic context summarization when nearing token limit
- Rate limiting with burst protection
- Drop-in replacement for Anthropic API
- Built-in performance monitoring and metrics collection
- Conversation continuity via unique conversation_id
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
Context Optimizer MCPCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Install using the MCP client (npx mcp install degenhero/context-optimizer-mcp), manually via npm install, or with Docker (docker-compose up -d). Configure environment variables in .env (Anthropic API key, Redis host/port, caching settings). Start the server, then send HTTP POST requests to http://localhost:3000/v1/messages using the standard Anthropic API format, optionally including conversation_id and context_optimization parameters.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"context optimizer mcp": {
"context-optimizer-mcp": {
"command": "npx",
"args": [
"mcp",
"install",
"degenhero/context-optimizer-mcp"
]
}
}
}
}
McpServers
{
"context-optimizer-mcp": {
"command": "npx",
"args": [
"mcp",
"install",
"degenhero/context-optimizer-mcp"
]
}
}
Context Optimizer MCP
An MCP (Model Context Protocol) server that uses Redis and in-memory caching to optimize and extend context windows for large chat histories.
Features
- Dual-Layer Caching: Combines fast in-memory LRU cache with persistent Redis storage
- Smart Context Management: Automatically summarizes older messages to maintain context within token limits
- Rate Limiting: Redis-based rate limiting with burst protection
- API Compatibility: Drop-in replacement for Anthropic API with enhanced context handling
- Metrics Collection: Built-in performance monitoring and logging
How It Works
This MCP server acts as a middleware between your application and LLM providers (currently supporting Anthropic's Claude models). It intelligently manages conversation context through these strategies:
1. Context Window Optimization: When conversations approach the model's token limit, older messages are automatically summarized while preserving key information.
2. Efficient Caching:
- In-memory LRU cache for frequently accessed conversation summaries
- Redis for persistent, distributed storage of conversation history and summaries
3. Transparent Processing: The server handles all context management automatically while maintaining compatibility with the standard API.
Getting Started
Prerequisites
- Node.js 18+
- Redis server (local or remote)
- Anthropic API key
Installation Options
1. Using MCP client
The easiest way to install and run this server is using the MCP client:
```bash
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



