@yavdaanalytics/context-optimiser
OfficialClick on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@@yavdaanalytics/context-optimisercompact my conversation history"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
@yavdaanalytics/context-optimiser
A context window optimizer and session rotator MCP server for agentic workflows. It prevents LLMs/coding agents from running out of context window space by estimating token usage, compacting chat history using semantic failure clustering (Topic Attempt Graph - TAG), and rotating chat sessions dynamically while preserving session continuity links.
Features
Token Estimation: Heuristically counts and budgets tokens for a conversation.
Context Compaction: Uses semantic failure clustering (TAG) and heuristic offloading to shrink conversational history, offloading large code dumps/logs to disk or local ChromaDB.
Session Auto-Rotation: Dynamically rotates chat sessions when context limit thresholds are reached, updating next/previous session pointers for linked context history.
Local Vector Search: Stores offloaded messages in ChromaDB and retrieves them via semantic similarity search.
Related MCP server: claw-tsaver
Quick Start
1. Installation
Install globally via npm:
npm install -g @yavdaanalytics/context-optimiser2. Setup
Run the setup utility to configure the MCP server globally for Gemini, Cursor, and Claude Desktop, and copy the agent loading skills:
context-optimiser-setupThis will automatically configure:
Gemini:
~/.gemini/settings.jsonCursor:
~/.cursor/mcp.jsonClaude Desktop:
~/.claude/settings.jsonand%APPDATA%/Claude/claude_desktop_config.jsonLoader Skills: Copies
SKILL.mdto~/.cursor/skills/context-optimiser/SKILL.md,~/.claude/skills/context-optimiser/SKILL.md, and~/.gemini/config/skills/context-optimiser/SKILL.md.
MCP Tools API
The server registers the following MCP tools for client use:
estimate_tokens(conversation): Returns estimated token usage, capacity limits, and percentage used.compact_context(conversation, strategy, keep_last_n_turns): Returns compacted message history.rotate_session(conversation, origin_prompt, token_limit, threshold_pct): Returns rotated session metadata and compacted history.get_current_session(): Returns active session JSON metadata.query_vector_store(query_text, n_results): Performs semantic vector similarity queries on offloaded history.
Development & Local Testing
If you are developing locally, run setup in local mode to link the configuration to your checkout directory:
node bin/setup.js --localRun Tests
To verify all tool integrations and ChromaDB vector queries:
python scratch/test_tools.pyThis server cannot be deployed
Maintenance
Related MCP Connectors
Persistent memory for AI agents — log and recall conversation context over MCP.
An MCP memory server. One memory your agents share — across models, devices and apps.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
shared AI-context layer for teams — persistent memory your agents search and update over MCP
Related MCP Servers
- FlicenseBqualityDmaintenanceA Model Context Protocol (MCP) server that optimizes token usage by caching data during language model interactions, compatible with any language model and MCP client.42-
- AlicenseAqualityCmaintenanceAn MCP server that helps AI agents reduce token usage by compressing, summarizing, and managing conversation/context data more efficiently.11MIT
- AlicenseAqualityAmaintenanceGraph-based MCP server for persistent AI memory, session checkpointing, context compression, and cross-session context management for LLM applications.630MIT
- FlicenseNot gradedqualityCmaintenanceToken-optimized multi-agent orchestration MCP server that owns session state, compacts context between agent hops, routes work to smaller models when safe, and reports estimated token savings.1-