claude-code-traceparent
Echo tool MCP server that extracts and logs W3C Trace Context from requests to verify propagation from Claude Code.
README
claude-code-traceparent PoC
Claude Code が MCP Server へのリクエストに W3C Trace Context を付与するのか検証
セットアップ
bun install
起動
bun run src/server.ts # http(デフォルト)
| 環境変数 | デフォルト | 説明 |
|---|---|---|
TRANSPORT |
http |
stdio / http を切替 |
PORT |
3456 |
HTTP モードの待受ポート |
LOG_FILE |
debug.log |
受信内容を追記するログファイル |
echo ツール
引数: message: string
処理: message をエコーバック。_meta / HTTP ヘッダーを解析して traceparent を抽出しデバッグログに残す
確認手順
1. MCP Server の起動
bun run src/server.ts
2. Grafana の起動
OpenTelemetry のトレースを可視化するために Grafana を起動する。
docker run -p 3000:3000 -p 4317:4317 -p 4318:4318 --name lgtm grafana/otel-lgtm
3. Claude Code を起動
claude
# Claude Code 内で確認
> /mcp
> use the echo tool with message "hello"
補足:以下のファイルで OpenTelemetry の有効設定と MCP の登録を行っている
- .claude/settings.json — MCP 登録の有無や traceparent の伝播設定
- .mcp.json — MCP サーバの登録内容
4. 結果の見方
ツール実行後、debug.log / Claude Code のセッション履歴 / Claude Code OTel Traces の突合を確認する
- debug.log から trace_id を確認
- grafana の Web UI から trace_id で Log や Trace を検索する
- grep で Claude Code のセッション履歴ファイルを特定する
trace_id=<YOUR_TRACE_ID>
grep -r $trace_id ~/.claude
5. CLI 単体での疎通確認
サーバ単体の動作だけ確かめたい場合:
# stdio
TP="00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01"
printf '%s\n%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"cli","version":"0"}}}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"echo","arguments":{"message":"hi"},"_meta":{"traceparent":"'"$TP"'"}}}' \
| TRANSPORT=stdio bun run src/server.ts
# HTTP(サーバ起動後)
curl -s -X POST http://localhost:3456/ \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"echo","arguments":{"message":"hi"},"_meta":{"traceparent":"'"$TP"'"}}}'
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.