Skip to content

feat(mcp): instrument the local MCP tool-dispatch chokepoint with PostHog events (opt-in) #6238

Description

@JSONbored

Context

Part of #6228. With the local-side telemetry wrapper module in place (companion issue), this issue wires it into packages/loopover-mcp/bin/loopover-mcp.js's --stdio tool-dispatch path.

Requirements

  • Find (or create) a single chokepoint through which every registerStdioTool-registered tool's invocation passes, and call the telemetry wrapper there.
  • Record: tool name, caller type ("local"), success/failure, coarse latency — same fields as the remote side, nothing more.
  • Must respect the opt-in flag — if a user hasn't run loopover-mcp telemetry enable, zero data is ever sent (verify this is actually true, not just documented).
  • Must not throw or block a tool response if the telemetry call fails.

Test Coverage Requirements

Match this package's existing test conventions; a regression test confirming default-off behavior sends nothing, and that a tool call succeeds normally regardless of telemetry state.

Deliverables

  • Every local tool invocation triggers exactly one recordMcpToolCall when opted in, and zero when not.
  • Zero behavior change to any tool's actual response.

Expected Outcome

Real usage data starts flowing for local MCP tool calls, strictly from users who've explicitly opted in.

Links & Resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions