
Store and retrieve entities, relations and observations in a persistent local knowledge graph.

An MCP server that uses dual-layer in-memory and Redis caching to optimize and extend context windows for large chat histories.
Context Optimizer MCP is cataloged as an MCP server attributed to degenhero. An MCP server that uses dual-layer in-memory and Redis caching to optimize and extend context windows for large chat histories. It is categorized under ai agents-models. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.
Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.
Catalog license label: MIT. Check the source repository's current license and terms before using, modifying or distributing this software.
Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.
No reviewed records to display. This does not establish that upstream lacks this capability.
No reviewed records to display. This does not establish that upstream lacks this capability.
No reviewed records to display. This does not establish that upstream lacks this capability.
Email delivery is not connected. This page does not collect email addresses or create subscriptions.
Browse the registry for current listings instead.
Reviews for Context Optimizer MCP are not available yet
Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.
It summarizes older messages when a conversation exceeds 80% of the model's token limit, and the summary is cached for future use.
It currently supports Anthropic's Claude models.
README.md · b916b993e81f · Fetched 2026-11-13 11:36:06 UTC
Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.
Showing the last retrieved documentation snapshot; check the source for current changes.
An MCP (Model Context Protocol) server that uses Redis and in-memory caching to optimize and extend context windows for large chat histories.
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:
Context Window Optimization: When conversations approach the model's token limit, older messages are automatically summarized while preserving key information.
Efficient Caching:
Transparent Processing: The server handles all context management automatically while maintaining compatibility with the standard API.
The easiest way to install and run this server is using the MCP client:
# Install via npx
npx mcp install degenhero/context-optimizer-mcp
# Or using uvx
uvx mcp install degenhero/context-optimizer-mcp
Make sure to set your Anthropic API key when prompted during installation.
# Clone the repository
git clone https://github.com/degenhero/context-optimizer-mcp.git
cd context-optimizer-mcp
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env
# Edit .env with your configuration
# Start the server
npm start
# Clone the repository
git clone https://github.com/degenhero/context-optimizer-mcp.git
cd context-optimizer-mcp
# Build and start with Docker Compose
docker-compose up -d
This will start both the MCP server and a Redis instance.
Configure the server by editing the .env file:
# Server configuration
PORT=3000
# Anthropic API key
ANTHROPIC_API_KEY=your_anthropic_api_key
# Redis configuration
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=
# Caching settings
IN_MEMORY_CACHE_MAX_SIZE=1000
REDIS_CACHE_TTL=86400 # 24 hours in seconds
# Model settings
DEFAULT_MODEL=claude-3-opus-20240229
DEFAULT_MAX_TOKENS=4096
The server exposes a compatible API endpoint that works like the standard Claude API with additional context optimization features:
// Example client usage
const response = await fetch('http://localhost:3000/v1/messages', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'claude-3-opus-20240229',
messages: [
{ role: 'user', content: 'Hello!' },
{ role: 'assistant', content: 'How can I help you today?' },
{ role: 'user', content: 'Tell me about context management.' }
],
max_tokens: 1000,
// Optional MCP-specific parameters:
conversation_id: 'unique-conversation-id', // For context tracking
context_optimization: true, // Enable/disable optimization
}),
});
const result = await response.json();
GET /v1/token-count?text=your_text&model=model_name: Count tokens in a text stringGET /health: Server health checkGET /metrics: View server performance metricsA test script is included to demonstrate how context optimization works:
# Run the test script
npm run test:context
This will start an interactive session where you can have a conversation and see how the context gets optimized as it grows.
When a conversation exceeds 80% of the model's token limit, the server automatically summarizes older messages. This summarization is cached for future use.
By providing a consistent conversation_id in requests, the server can maintain context across multiple API calls, even if individual requests would exceed token limits.
Additional documentation can be found in the docs/ directory:
MIT
Claim this server with your GitHub account to request manual ownership verification.
Link to the catalog listing for Context Optimizer MCP from your README. This badge does not certify ownership, compatibility or security.
[](https://awesome-mcp.com/servers/context-optimizer-mcp)Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.
Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.
No reviewed package or image identity; download statistics are not listed yet.
Alternative and complementary servers in the same category

Store and retrieve entities, relations and observations in a persistent local knowledge graph.

Organize problem solving into revisable, branching thought steps through an MCP tool.

Query-aware context compression with an MCP plugin for coding agents, plus Python and HTTP interfaces for reducing the context sent to a language model.