chore(mcp): remove v1 tools and the v1/v2 version split#60850
Conversation
|
Hey @skoob13! 👋 It looks like your git author email on this PR isn't your
You can fix it for this repo with: git config user.email "you@posthog.com"Or set it globally with |
👥 Auto-assigned reviewersSkipped a review request for |
MCP UI Apps size report
|
|
⏭️ Skipped snapshot commit because branch advanced to The new commit will trigger its own snapshot update workflow. If you expected this workflow to succeed: This can happen due to concurrent commits. To get a fresh workflow run, either:
|
|
Size Change: 0 B Total Size: 80.9 MB ℹ️ View Unchanged
|
9584ee1 to
c03ff5b
Compare
MCP v2 has fully rolled out, so the version-1 code paths are dead weight. - Delete the 8 v1 manually-written tools (query-run, query-validate, hogql-schema, query-generate-hogql-from-question, event-definitions-list, properties-list, property-definitions, entity-search) — superseded by execute-sql, read-data-schema, read-data-warehouse-schema and the typed query wrappers. exec.ts keeps reworded redirects for the old tool names. - Remove the `mcp_version` gating field from every YAML manifest so all tools (formerly v1-only and v2-only) are unconditionally available. - Strip the version concept from code: request plumbing, ToolBase.mcpVersion, new_mcp, the mcp-version-2 flag, the v1 instruction branch, and codegen. Both the Hono pipeline and the Durable-Object server are de-versioned; buildV2Instructions is renamed buildToolsInstructions. - Merge tool-definitions-v2.json into tool-definitions.json. - Keep $mcp_version emitted as a constant 2 for analytics continuity. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
c03ff5b to
f7ea503
Compare
Problem
services/mcp(the PostHog MCP server) still carried a "version 1 vs 2" split. Each request resolved a numeric version — from thex-posthog-mcp-versionheader,?v=query param, themcp-version-2feature flag, or client heuristics — that gated which tools were exposed and which instructions were sent. MCP v2 has fully rolled out (there is no v1 anymore), so the entire branch was dead weight complicating every code path it touched.Changes
query-run,query-validate,hogql-schema,query-generate-hogql-from-question,event-definitions-list,properties-list,property-definitions,entity-search) — all superseded byexecute-sql,read-data-schema,read-data-warehouse-schema, and the typed query wrappers.exec.tskeeps helpful redirects for the old names, reworded to drop the "MCP v2" phrasing.mcp_versiongating field from every YAML manifest (query-wrappers.yamland thereplay/customer_analytics/ai_observabilityproduct manifests) plus the YAML schema, so all tools — formerly v1-only and v2-only — are unconditionally available.ToolBase.mcpVersion,new_mcp, themcp-version-2flag, the v1 instruction branch, and codegen. Both the Hono pipeline and the Durable-Object server are de-versioned;buildV2Instructions→buildToolsInstructions, and the legacy v1 instructions + template are removed.tool-definitions-v2.jsonintotool-definitions.json(one hand-written definition file).$mcp_versionis kept, emitted as a constant2for dashboard continuity, with the per-request version plumbing removed.Intended behavioral effect: plain MCP clients that previously defaulted to v1 now receive the full v2 toolset and the tools-mode instructions. Single-exec (CLI / coding-agent) clients are unchanged — they already ran at v2.
How did you test this code?
I'm an agent (Claude Code); the verification below is automated only — no manual testing was done.
pnpm generate-toolsregenerates the generated tools + definitions with nomcpVersion/new_mcpfields.pnpm lint-tool-namesandpnpm typecheckpass (one pre-existing, unrelated error invisual-review-snapshots.tsxwas left untouched).session-mode-pool.test.tspreviously probed resolved mode via version-gated tool presence (now a vacuous signal); it was re-anchored on a real observable — a pooledtools/liststill returning[exec]in single-exec mode.Automatic notifications
Docs update
No user-facing docs change — add the
skip-inkeep-docslabel.🤖 Agent context
Authored with Claude Code (Opus 4.8). Approach: mapped every version touchpoint across both MCP server implementations (the Hono pipeline and the Durable-Object server) plus the codegen, then removed the v1 tools, un-gated the YAML manifests, and de-versioned the request/runtime plumbing.
Decisions confirmed with the human before implementing:
mcp_version: 1(customer_analytics + ai_observability) are kept and un-gated rather than deleted — they're generated, not part of the hand-written v1 set.exec.tsare kept but reworded to drop the "MCP v2" wording.$mcp_versionanalytics is preserved, hardcoded to2, so existing dashboards keep receiving the property.