claude-code-traceparent

claude-code-traceparent

Echo tool MCP server that extracts and logs W3C Trace Context from requests to verify propagation from Claude Code.

Category
Visit Server

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 の登録を行っている

4. 結果の見方

ツール実行後、debug.log / Claude Code のセッション履歴 / Claude Code OTel Traces の突合を確認する

  1. debug.log から trace_id を確認
  2. grafana の Web UI から trace_id で Log や Trace を検索する
  3. 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

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured