Context
Part of #6228 (telemetry spec — the tracked-field allowlist and vendor choice are already decided there: PostHog, tool name + caller type + success/failure + coarse latency only, no arguments/source/wallet/hotkey/trust-score data). This issue is the first concrete step: a thin, typed wrapper module around the PostHog Node SDK that the rest of this MCP-telemetry work builds on.
Requirements
- Add the PostHog Node SDK as a dependency of the root package (where
src/mcp/server.ts lives).
- Create a small wrapper module (e.g.
src/mcp/telemetry.ts) exposing a single typed function like recordMcpToolCall({ tool, callerType: "remote", ok, durationMs }) — no caller outside this module should construct a raw PostHog event.
- The wrapper must be a safe no-op (never throw) if the PostHog API key isn't configured for a given deployment — self-hosters who don't opt in to telemetry must see zero behavior change.
- Do not wire this into the actual tool-dispatch path yet — that's a separate issue (see Links).
Test Coverage Requirements
99%+ Codecov patch coverage; test both the "configured" and "not configured" (safe no-op) paths.
Deliverables
Expected Outcome
A ready-to-use, typed telemetry function the tool-dispatch instrumentation issue can call, with the field allowlist already enforced at the type level.
Links & Resources
Context
Part of #6228 (telemetry spec — the tracked-field allowlist and vendor choice are already decided there: PostHog, tool name + caller type + success/failure + coarse latency only, no arguments/source/wallet/hotkey/trust-score data). This issue is the first concrete step: a thin, typed wrapper module around the PostHog Node SDK that the rest of this MCP-telemetry work builds on.
Requirements
src/mcp/server.tslives).src/mcp/telemetry.ts) exposing a single typed function likerecordMcpToolCall({ tool, callerType: "remote", ok, durationMs })— no caller outside this module should construct a raw PostHog event.Test Coverage Requirements
99%+ Codecov patch coverage; test both the "configured" and "not configured" (safe no-op) paths.
Deliverables
src/mcp/telemetry.ts(or equivalent) with a typedrecordMcpToolCall-style function.Expected Outcome
A ready-to-use, typed telemetry function the tool-dispatch instrumentation issue can call, with the field allowlist already enforced at the type level.
Links & Resources