AgentContext
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
AgentContext
Reversible context optimization for AI agents. AgentContext is a local-first MCP server that turns oversized tool output — long test logs, large JSON responses, whole files, diffs, repeated content — into smaller, structured results, while keeping the original on your machine so the agent can recover any omitted part exactly.
Deterministic — no LLM calls, no API key; same input, same output.
Reversible — every omission is recorded and recoverable byte-for-byte.
Conservative — nothing is judged irrelevant unless you ask; when in doubt the original is returned.
Local — no telemetry, no network; data stays in your user profile.
Measured — token counts are labelled as estimates; benchmarks include the cost of recovery.
Status: v0.1.0 release candidate. See limitations.
Quick start
Requires Node.js ≥ 22.13.
# Claude Code (after the npm release)
claude mcp add agentcontext -- npx -y @agentcontext/mcp-server
# from a source checkout
pnpm install && pnpm build
claude mcp add agentcontext -- node /absolute/path/to/AgentContext/apps/mcp-server/dist/cli.jsThen ask your agent to pass long outputs through optimize_context, or to read
large files with read_file. Full guide: Getting started.
Related MCP server: cap-shield-mcp
What it looks like
Real output for the terminal-large benchmark input (a 1,000-line test run), abridged:
2026-11-23T10:00:00Z INFO [db] pool size=10 idle=8
[... s1: repeated 719 more times (lines 7-11, 14-19, 22-27, ... (+117 more))]
2026-11-23T10:00:06Z INFO [http] GET /health 200 2ms
[... s2: repeated 119 more times (lines 20, 28, 37, ... (+116 more))]
✓ src/module001.test.ts (11 tests) 10ms
...
FAIL src/billing/invoice.test.ts > computes totals with tax
AssertionError: expected 118.5 to be 118.05 // Object.is equality
at src/billing/invoice.test.ts:42:19
...
---
[agentcontext] log-compressor: 2734/22049 tokens (estimated), 87.6% saved.
Recover omitted parts (s1, s2, s3, s4) with retrieve_context {"contextId":"ctx_01M8...","selector":{"type":"segment_id","value":"<sN>"}}, or omit the selector for the full original.Tools
Tool | Purpose |
| Compress text; optional selections (JSON paths, Markdown sections, line ranges, log levels) and token budgets |
| Recover the full original, a line range, a JSONPath, keyword matches, or a segment |
| Read and optimize a file inside the allowed project roots |
| Run an allowlisted command (no shell) and optimize its output — disabled by default |
| Tokens saved, including what was recovered |
Plus the resources agentcontext://stats and
agentcontext://context/{id}/metadata, and the agentcontext_guidelines
prompt. Reference: docs/tools.md.
Benchmarks
On seven reproducible scenarios (test logs, API responses, duplicate-heavy text, documentation, source code, diffs), counting recovered content:
Median reduction | Extraction accuracy | Recovery integrity | Unrecoverable omissions |
86.6% | 100% | 100% | 0 |
Synthetic datasets, estimated tokens and a deterministic oracle — see the
full report and methodology.
Run them yourself with pnpm bench.
Documentation
Guide | Reference | Design |
Development
pnpm install
pnpm check # lint + typecheck + test + build
pnpm bench # benchmarks and reportsMonorepo: apps/mcp-server (the only package that imports the MCP SDK),
packages/{shared,core,strategies,tokenization,storage,retrieval,observability},
benchmarks/. See CONTRIBUTING.md.
Security
Report vulnerabilities privately — see SECURITY.md.
License
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Deterministic JSON repair, validate, example-gen, schema-coerce for agents. Zero LLM, sub-10ms.
Deterministic AI agent microtools, no accounts/API keys. fetch_extract: 98% token cut. 47 tools.
Turn messy text into strict JSON schemas agents can trust (invoice, receipt, contact, resume).
Provide your AI coding tools with token-efficient access to up-to-date technical documentation for…
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables local-first context compression for AI agents, offering tools to compress text, retrieve original content, and get compression statistics.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to compress and selectively retrieve context, with measured recall rather than claimed performance. It provides tools to assess potential traffic and token savings, list compression dictionaries, and assemble relevant memory entries within a token budget.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI coding agents to compress terminal output and file context in real time, preserving full error tracebacks while reducing token consumption by 60-85%.43MIT
- FlicenseNot gradedqualityBmaintenanceShrinks logs, JSON, docs and web pages before your AI reads them: offline, deterministic, no API key. Folds repetitive log lines (12,037 to 127 tokens on a 400-line log) while code, URLs and quoted strings come back byte-for-byte. Also fetches URLs as clean text, counts tokens exactly, and has optional local Ollama tools for image and text compression.59 PyPI25-