mcp-context-inspector

Independent, unaffiliated open-source project. ctxwindow is not built, maintained, or endorsed by Anthropic. "Claude" and "Claude Code" are Anthropic's products; ctxwindow reads their publicly documented OpenTelemetry export and MCP protocol, nothing more.
The package/repo name on disk stays mcp-context-inspector; the product it ships is
called ctxwindow (after its domain, ctxwindow.uk).
Quick start
Live demo, no install: https://ctxwindow.uk
Not yet published to PyPI, so run it from source (Python 3.11+):
git clone https://github.com/sohaibsohail98/mcp-context-inspector
cd mcp-context-inspector && uv run python -m mcp_server.serverWith no MCP_AUTH_TOKEN set, the server generates and prints one on startup, using the
same trust model as a Jupyter server's printed token.
Then sign in at /auth/login (locally or on the live demo) and the page hands you one
command that writes the MCP connection and telemetry config into your own
~/.claude/settings.json (backed up first, merged, never overwritten):
curl -fsSL https://ctxwindow.uk/setup/install?t=<code> | shOn Windows the page's Windows (PowerShell) tab gives you the equivalent
irm "https://ctxwindow.uk/setup/install?os=windows&t=<code>" | iex instead.
The ?t= code is single-use and short-lived, so your real token is never in the command
itself. Close and reopen Claude Code afterward, since env vars only load at process
startup, then run one prompt and check "Test my connection" on the page.
Prefer to wire it up by hand, or connect claude.ai, the Messages API, or Copilot instead? See Usage and Run it locally.
Documentation
Docs site, the full single-page reference (architecture, auth model, storage backends, deploying your own, environment variables, roadmap)
CONTRIBUTING.md, lint, tests, and what a good PR looks like here
LICENSE, MIT
Report a bug or ask a question. For a security issue, please open a private security advisory instead of a public issue.
Why this exists
Most agent observability tools re-show data your own UI already displays. ctxwindow shows something you normally can't see at all: system prompt, tool specs, reasoning, tool calls and results, and the final answer, in the order they actually entered context. Each block is measured against the model's real context window and marked as either visible to the user or invisible overhead. Token counts are honest, labeled estimates, not exact provider usage (see Architecture for why that tradeoff is the right one here).
Anthropic's Claude Code docs page, "Explore the context window", is an interactive simulation of what loads into a session and what each file read costs. It motivated wanting the same visibility for an arbitrary agent loop, not just Claude Code.
The 8 MCP tools
Tool | Returns | Read/write |
| Session metadata + per-prompt tokens/latency/cost | Read |
| Per-turn token/latency breakdown | Read |
| Tool call counts by status | Read |
| Ordered tool-call sequence for one session | Read |
| Estimated cost, one session or a time window | Read |
| Most recent sessions, newest first | Read |
| Full context-window block breakdown | Read |
| Records one agent execution's metrics | Write (append-only) |
Each tool ships explicit MCP annotations (readOnlyHint / destructiveHint /
idempotentHint / openWorldHint), so a client can auto-approve the seven reads and
prompt only for record_session. Nothing here reaches outside this server's own store
(openWorldHint is always false), and record_session only ever inserts a new session —
it never mutates or deletes one.
Plain REST equivalents are exposed under /api/*. Payload shapes are in
Architecture.
Contributing
See CONTRIBUTING.md for lint, tests, and what a good PR looks like
here. Run the suite with uv run pytest and lint with uv run ruff check ..
License
MIT licensed; see LICENSE. Developed alongside
sre-investigation-agent,
the reference chat UI and Bedrock agent this package was extracted from.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/sohaibsohail98/mcp-context-inspector'
If you have feedback or need assistance with the MCP directory API, please join our Discord server