Monitors AI agent context window health, detects degradation, and provides recovery recommendations based on model-specific data.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
We haven't yet run this listing's install command through our automated sandbox check. This isn't a red flag β we're steadily working through the catalog.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Inspect callable tools, capabilities, and parameters exposed to AI agents by Context Rot Detection.
check_my_healthAnalyze the current context window health. Call this periodically during long sessions or before critical decisions.
get_health_historyRetrieve health check history for a specific agent.
get_service_statsGet service-wide utilization statistics. No parameters required.
MCP service that gives AI agents self-awareness about their cognitive state.
Every long-running AI agent suffers from context rot β measurable performance degradation as the context window fills up. Research from Chroma, Stanford ("lost-in-the-middle"), and Redis confirms this is the #1 practical failure mode in production agent systems.
An agent experiencing context rot doesn't know it's degrading β it just starts making worse decisions. This tool gives agents real-time visibility into their own cognitive health.
meta-llama/Llama-3.1-70B and the context window is detected automatically, with results cached in SQLiteAdd to .mcp.json in your project root:
Add to claude_desktop_config.json:
| Environment Variable | Description | Default |
|---|---|---|
HEALTH_HISTORY_DB | Path to SQLite database for health history. Use :memory: for ephemeral storage. | :memory: |
LOG_FILE | Path to append structured JSON log lines. Omit to disable file logging. | (none) |
check_my_healthAnalyze the current context window health. Call this periodically during long sessions or before critical decisions.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
token_count | integer | Yes | Current estimated token count in context window |
model | string | No | LLM model identifier β a curated name (e.g., claude-opus-4, gpt-4o), a HuggingFace repo ID (e.g., meta-llama/Llama-3.1-70B), or any string (falls back to conservative defaults) |
session_duration_minutes | integer | No | How long this session has been running |
tool_calls_count | integer | No | Number of tool calls made in this session |
context_summary | string | No | Brief summary of current task and recent actions |
agent_id | string | No | Unique agent identifier for history tracking |
Example response:
get_health_historyRetrieve health check history for a specific agent.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | Unique agent identifier |
limit | integer | No | Max records to return (default: 20, max: 100) |
get_service_statsGet service-wide utilization statistics. No parameters required.
Returns total calls, unique agents, average health score, model distribution, status distribution, and recent activity (last hour / last 24h).
| Model | Max Tokens | Danger Zone | Middle-Loss Risk |
|---|---|---|---|
claude-opus-4-5 | 200K | 175K | Low |
claude-opus-4 | 200K | 170K | Low |
claude-sonnet-4 | 200K | 165K | Low |
claude-3.7-sonnet | 200K | 160K | LowβMedium |
claude-3.5-sonnet | 200K | 152K | Medium |
claude-haiku-3.5 | 200K | 130K | Medium |
gpt-4.1 | 1M | 500K | Medium |
gpt-4.1-mini | 1M | 450K | Medium |
gpt-4o | 128K | 105K | Medium |
gpt-4o-mini | 128K | 95K | MediumβHigh |
o3 | 200K | 160K | LowβMedium |
o4-mini | 200K | 150K | Medium |
gemini-2.5-pro | 1M | 600K | Medium |
gemini-2.5-flash | 1M | 520K | MediumβHigh |
gemini-2.0-flash | 1M | 500K | High |
Any model string containing / is treated as a HuggingFace repo ID. The server fetches config.json from the repo, extracts the context window size (max_position_embeddings, n_positions, or max_seq_len), and generates a conservative degradation profile:
Results are cached in SQLite β subsequent lookups are instant.
If the fetch fails (network error, gated model, missing config), the server falls back silently to conservative defaults.
Any unrecognized model string without / falls back to conservative defaults (128K max, 100K danger zone).
The health score is a weighted composite of four signals:
| Signal | Weight | Source |
|---|---|---|
| Token utilization quality | 40% | Model-specific sigmoid degradation curve |
| Retrieval accuracy | 25% | Base accuracy minus lost-in-the-middle penalty |
| Tool-call burden | 20% | Compounding quality loss after 10+ tool calls |
| Session length | 15% | Time-based fatigue heuristic |
The degradation curves are derived from empirical research:
MIT
Factual signals from GitHub, npm, and our automated checks β not a rating.
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/context-rot-detection)<a href="https://allmcps.com/mcp/context-rot-detection"><img src="https://allmcps.com/api/badge/context-rot-detection?style=directory" alt="Context Rot Detection on AllMCPs" /></a>