mcp-context-inspector
mcp-context-inspector
任意のツール呼び出しエージェント向けの、ドロップインMCPサーバー + 実行メトリクス記録ツール。エージェントのループで、実行後に record_session(prompt, model_id, loop_result) を指すだけで、以下の機能が無料で得られます。
実際のMCPサーバー(Streamable HTTP)— Claude Desktop、Cursor、独自のチャットUIなど、任意のMCPクライアントが接続可能。セッション履歴、コスト、トークン/ツールメトリクスを公開する7つの読み取り専用ツールを提供し、さらに...
コンテキストウィンドウエクスプローラー — モデルのコンテキストウィンドウに何が入力されたかを、ブロックごとに完全に透明化。正直な(明示的に「推定値」とラベル付けされた)トークン数、比例セグメントバー、ブロックごとのクリック拡張可能な詳細パネルを備えています。

*(このパッケージと同時に開発されたリファレンスチャットUI —
sre-investigation-agent— のスクリーンショット。上記のパネルは、任意のMCPクライアントがget_context_timelineをクエリした際に取得できるものです。) *
ほとんどのエージェント観測ツールは、自身のUIが既に表示しているデータを再表示します。このツールは、通常はまったく見えないものを表示します。システムプロンプト vs. ツール仕様 vs. 推論 vs. ツール呼び出し/結果 vs. 最終回答、それらが実際にコンテキストに入力された順序、モデルの実際のコンテキストウィンドウに対する累計トークン数、そしてそれらのブロックのうちエンドユーザーに表示されるものと表示されないオーバーヘッドを明らかにします。
インストール
uv add mcp-context-inspector # or: pip install mcp-context-inspector
# while co-developing locally against an editable checkout:
uv add --editable ../mcp-context-inspectorRelated MCP server: ai-usage-metrics-mcp
エージェントに組み込む
from metrics import store
session_id = store.record_session(prompt, model_id, loop_result)loop_result はエージェントループが返す任意のものです。このパッケージが必要とする形式は以下の通りです。
{
"trace": [{"tool": "...", "args": {...}, "status": "ok"}, ...],
"turns": [{"input_tokens": int, "output_tokens": int, "latency_ms": int}, ...],
"input_tokens": int, "output_tokens": int, "total_tokens": int, "latency_ms": int,
"context_blocks": [ # optional — omit and you just lose the Explorer, nothing crashes
{"category": "system", "label": "...", "char_count": int, "token_estimate": int, "turn_n": int | None},
...
],
}context_blocks のカテゴリ: system, tools, user, reasoning, thinking, tool_call, tool_result (オプションで失敗を色分けするための "status" キーを含む)、answer。
サーバーの起動
uv run python -m mcp_server.serverMCP_AUTH_TOKEN が設定されていない場合、起動時に生成して出力します。Jupyterサーバーが出力するトークンと同じ信頼モデルです。再起動後も安定した値が必要な場合は、自分で設定してください。任意のMCPクライアントを http://127.0.0.1:8787/mcp に Authorization: Bearer <token> ヘッダー付きで接続します。
ストレージバックエンド
STORAGE_BACKEND=sqlite(デフォルト、ローカル開発 — data/metrics.db)または STORAGE_BACKEND=dynamodb(METRICS_TABLE/AWS_REGION を設定)— どちらの場合も同じ関数シグネチャで、呼び出し側はどちらがアクティブかを意識しません。
7つのMCPツール
get_session_metrics, get_token_breakdown, get_tool_metrics, get_agent_trace, get_cost_estimate, get_recent_sessions, get_context_timeline。プレーンなRESTエンドポイントも /api/* で公開されています — curlに便利なデバッグ代替手段で、同じ内部の metrics/store.py の関数を呼び出します。
関連リポジトリ
sre-investigation-agent —
このパッケージの基盤となり、同時に開発されたリファレンスチャットUI + Bedrockエージェント。
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityAmaintenanceMCP-native agent evaluation and observability server. Log traces, evaluate output quality with 12 built-in rules (PII detection, prompt injection, cost thresholds), and track agent costs. Real-time dashboard, OTel-compatible spans. Self-hosted, MIT licensed.93467MIT
- Alicense-qualityDmaintenanceA MCP server for tracking AI usage metrics and structured logs across applications. Monitor model calls, analyze usage patterns, track costs, and debug AI interactions.10MIT
- AlicenseAqualityBmaintenanceAn MCP server that provides cost and reliability observability for LLM and agent workflows. It records model calls and allows querying and aggregating telemetry data through MCP tools.6MIT
- Alicense-qualityAmaintenanceAn MCP server that gives AI agents observability over their own tool calls, enabling auditing, cost tracking, latency analysis, and alerting.MIT
Related MCP Connectors
Agent Replay Debugger MCP — record every agent step + deterministic replay. Step-debugger for
Hosted MCP server for LLM cost estimation, model comparison, and budget-aware routing.
MCP server providing access to the Scorecard API to evaluate and optimize LLM systems.
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