Skip to content

docs(mcp-analytics): add an install path for languages without an SDK - #20895

Merged
lucasheriques merged 9 commits into
masterfrom
lucas/mcp-docs-any-language
Oct 28, 2026
Merged

lucasheriques merged 9 commits into
masterfrom
lucas/mcp-docs-any-language

Conversation

@lucasheriques

@lucasheriques lucasheriques commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Changes

MCP Analytics has SDKs for TypeScript, Python, Go, and Ruby. A team with an MCP server in another language (Java, Kotlin, C#, PHP, Elixir, Swift) reads the installation page and concludes that the product does not support them. That is not true. The dashboards read $mcp_tool_call events where $mcp_source is "posthog_mcp_analytics". They do not check which library sent the event.

This PR adds a page that tells a person or a coding agent how to send those events from any language:

File Change
installation/other-languages.mdx New page. The context argument for intent, the session ID rules, the required and recommended properties of $mcp_tool_call, failure fields, a redaction checklist for payloads, flush, and a SQL query that checks the events.
installation/index.mdx One line after the wizard command. It sends coding agents to the Markdown version of the new page when no SDK exists for the language.
events.mdx The intro names the new page.
src/navs/index.js "Other languages" entry under Installation. The platform card on the installation index comes from this entry.

The content comes from the MCP analytics spec in sdk-specs and from the properties that the mcp_analytics backend filters on. The page asks for a subset of the spec: what an SDK does automatically (conversation IDs, full redaction, the virtual tools) is listed at the end as "What the SDKs do that this page doesn't".

This replaces the approach in #20249. That PR edits custom-servers.mdx and installation.mdx, which no longer exist on master after the installation pages moved to installation/<language>.mdx.

Checklist

  • I've read the docs and/or content style guides.
  • Words are spelled using American English
  • Use relative URLs for internal links
  • I've checked the pages added or changed in the Vercel preview build
  • If I moved a page, I added a redirect in vercel.json (no pages moved)

Verification

  • Ran the page's verification query on a project with MCP Analytics traffic: 126,015 calls in the last hour, and every missing_ and bad_ count was 0.
  • Checked that JSONType returns String for "false" and Bool for false, so the query flags a boolean or a number sent as a string.
  • prettier --check passes on the changed files.
  • Loaded the three changed pages on the deploy preview. The new page renders all steps, and the sidebar and the platform card show the new entry. The console shows React hydration errors Burger menu color fix #418 and Small fixes for pricing and free trial pages #423. The unchanged Go installation page shows the same errors, so this PR does not cause them.
  • The .md version returns 404 on the preview. The .md version of the existing Go page also returns 404 on the preview and 200 on posthog.com, so .md pages exist only in production.
  • The card label is "Other" because "Other languages" was truncated in the card grid. The sidebar entry keeps the full name.

Review

Two reviewers (Claude Opus and Claude Sonnet) checked the page against the spec and the backend. Changes from that review:

  • A required "Redact free text" step. Before the review, $mcp_intent and $mcp_error_message were sent without redaction when the reader skipped the optional payload step.
  • Send $mcp_tool_call only for the final outcome of a tool that exists. Do not send it for an unknown tool, an input_required round, or a task handle.
  • The session table covers SSE, WebSocket, and the stateless 2026-07-28 revision.
  • $exception uses the same distinct_id and $process_person_profile as the call event.
  • An optional $mcp_initialize step. The "MCP clients" and "MCP users and sessions" insights in the dashboard template count only that event.
  • The check query also counts a missing $mcp_tool_name.

Not changed: the session hash. The page tells the reader to use any stable hash, and says that sessions split when an SDK and custom code serve the same session.


Update: I merged master into this branch. The only conflict was the sidebar, where master added WebMCP. Both entries stay, and "Other languages" is last. posthog-rs 0.29.0 now has experimental MCP Analytics, so the page no longer gives Rust as a language without an SDK. When #21600 merges, this page can link the Rust installation page.

Adds /docs/mcp-analytics/installation/other-languages: the $mcp_tool_call
contract a server in any language can send through its PostHog SDK or the
capture API, with the context argument for intent, session ID rules,
failure fields, a redaction checklist for payloads, and a SQL check.
Derived from the sdk-specs mcp-analytics spec and the properties the
mcp_analytics backend filters on ($mcp_source, $mcp_server_name).

Links it from the sidebar, the installation index (as the coding-agent
fallback when the wizard doesn't apply), and the event reference intro.

Tested: ran the page's verification query on project 2 (126,015 calls in
the last hour, all missing_/bad_ counts 0) and confirmed JSONType returns
String for a "false" string and Bool for false. prettier --check passes.
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Deploy preview

Status Details Updated (UTC)
🟢 Ready View preview Oct 28, 2026 05:14PM

Changed pages

Page Source
Event and property reference contents/docs/mcp-analytics/events.mdx
Install MCP Analytics contents/docs/mcp-analytics/installation/index.mdx
Other languages MCP Analytics installation contents/docs/mcp-analytics/installation/other-languages.mdx

@github-actions github-actions Bot added the docs Improvements or additions to product documentation, "Docs" label Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Vale prose linter → found 0 errors, 14 warnings, 1 suggestions in your markdown

Full report → Copy the linter results into an LLM to batch-fix issues.

Linter being weird? Update the rules!

contents/docs/mcp-analytics/events.mdx — 0 errors, 13 warnings, 1 suggestions
Line Severity Message Rule
46:458 warning 'params' is a possible misspelling. PostHogBase.Spelling
46:486 warning Use 'SDK' instead of 'sdk'. Vale.Terms
49:262 suggestion Address the reader directly. Use 'you' instead of 'the user'. PostHogDocs.DirectAddress
50:186 warning 'accessors' is a possible misspelling. PostHogBase.Spelling
67:33 warning 'sessionless' is a possible misspelling. PostHogBase.Spelling
75:141 warning Use 'AI' instead of 'ai'. Vale.Terms
75:145 warning 'Cowork' is a possible misspelling. PostHogBase.Spelling
79:103 warning Use 'AI' instead of 'ai'. Vale.Terms
79:273 warning Use 'AI' instead of 'ai'. Vale.Terms
95:236 warning Capitalize 'Error Tracking' for PostHog's product. Use 'Error tracking' for the general industry concept. PostHogBase.ProductNames
108:87 warning 'symbolicate' is a possible misspelling. PostHogBase.Spelling
126:73 warning 'groupType' is a possible misspelling. PostHogBase.Spelling
126:86 warning 'groupKey' is a possible misspelling. PostHogBase.Spelling
140:57 warning 'typesafe' is a possible misspelling. PostHogBase.Spelling
contents/docs/mcp-analytics/installation/other-languages.mdx — 0 errors, 1 warnings, 0 suggestions
Line Severity Message Rule
139:184 warning Use 'AI' instead of 'ai'. Vale.Terms

…tract

Pre-PR review (opus + sonnet) found that $mcp_intent and $mcp_error_message
went out unredacted on the required path, since the only redaction rules sat
in the optional payload step. Adds a required "Redact free text" step and
points the payload step at it. Also from the review:

- capture only final outcomes of registered tools (no unknown tools,
  input_required rounds, or task handles)
- session table covers SSE and WebSocket and the 2026-07-28 stateless case
- $exception keeps the call's distinct_id and $process_person_profile
- $mcp_error_type precedence, $mcp_error_status, blank/"{}" intent omitted
- optional $mcp_initialize step: the default dashboard template's "MCP
  clients" and "MCP users and sessions" insights count only that event
- check query also flags a missing $mcp_tool_name

Tested: re-ran the revised check query on project 2 (124,683 calls in the
last hour, all missing_/bad_ counts 0). prettier --check passes.
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Bundle report

Total JS (gzip)

10.44 MiB (+3.6 KiB / +0.0%)

Largest changed named chunks
Chunk Gzip Δ vs master
app.js 2352.8 KiB +3.6 KiB / +0.2%

Eager graph (modules shipped in each entrypoint's initial chunks)

Entrypoint Eager size Budget Modules
✅ app 20.36 MiB (+27.5 KiB / +0.1%) report-only 2111
Largest modules in the app closure
Module Size
./src/data/mcp-tools.json 1451.1 KiB
css ./node_modules/.pnpm/[email protected][email protected]/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[8].oneOf[1].use[1]!./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[8].oneOf[1].use[2]!./src/styles/global.css 817.2 KiB
./src/components/Stickers/Stickers.tsx 696.4 KiB
./node_modules/.pnpm/@[email protected][email protected]/node_modules/@posthog/brand/dist/generated/hoggies/svg/x-ray.mjs 481.2 KiB
./node_modules/.pnpm/@[email protected][email protected]/node_modules/@posthog/brand/dist/generated/hoggies/svg/trenchcoat.mjs 450.8 KiB
./node_modules/.pnpm/[email protected]/node_modules/rehype-raw/lib/index.js + 29 modules 395.1 KiB
./node_modules/.pnpm/@[email protected][email protected]/node_modules/@posthog/brand/dist/generated/hoggies/svg/im-the-driver.mjs 385.8 KiB
./src/hooks/useCustomers.tsx + 61 modules 381.8 KiB
./node_modules/.pnpm/@[email protected][email protected]/node_modules/@posthog/brand/dist/generated/hoggies/svg/tourist.mjs 364.6 KiB
./node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@posthog/icons/dist/posthog-icons.es.js 354.8 KiB
./node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/react-markdown/lib/react-markdown.js + 88 modules 351.4 KiB
./src/components/ProductComparisonTable/index.tsx + 130 modules 314.2 KiB
./node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/render/components/motion/proxy.mjs + 127 modules 287.8 KiB
./node_modules/.pnpm/@[email protected][email protected]/node_modules/@posthog/brand/dist/generated/hoggies/svg/doll-house.mjs 284.1 KiB
./node_modules/.pnpm/[email protected][email protected]/node_modules/cloudinary-core/cloudinary-core.js 281.9 KiB

Eager-graph budgets are report-only until a baseline is established. Sizes are gzip of public/**/*.js; eager size is webpack module source bytes for the modules actually shipped in the entrypoint's initial chunks (post-tree-shake).

The card grid on /docs/mcp-analytics/installation truncated "Other languages" to "Other languag..." in a 1558px window (seen on the deploy preview). The sidebar entry keeps the full name.
@lucasheriques
lucasheriques marked this pull request as ready for review October 7, 2026 14:38
@github-actions

Copy link
Copy Markdown
Contributor

This PR hasn't seen activity in two weeks! Should it be merged, closed, or further worked on? If you want to keep it open, please remove the stale label – otherwise this will be closed in another week. If you want to permanently keep it open, use the waiting label.

@github-actions github-actions Bot added the stale This pull request has been marked as stale and will be closed soon automatically label Oct 22, 2026
posthog-rs 0.29.0 ships experimental MCP Analytics behind the mcp feature, so
a Rust server should use it instead of sending events by hand. The Rust
install page is in #21600; link it from here once that merges.

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed 077109d: 2 Should fix.

See this review and its findings in PostHog Review. Comment @posthog review --deep for a Deep review. A Deep review takes longer and looks deeper than a Standard review.

@github-actions github-actions Bot removed the stale This pull request has been marked as stale and will be closed soon automatically label Oct 28, 2026
PostHog Review found two gaps. An optional context argument still fails a
validator whose schema sets additionalProperties: false, and the PHP SDK
sends its queue inside capture() when the queue is full (QueueConsumer::enqueue,
default lib_curl consumer), so capture is not always asynchronous.
The Rust SDK page lands in #21600; merge that first so the link resolves.
@github-actions

Copy link
Copy Markdown
Contributor

AEO/SEO: I'm in danger

This PR may affect SEO/AEO

@natalia-amorim, please review the items below before this PR merges. If Natalia is out, ask Ian or Andy to review instead.

🔍 Worth a look (1)

  • 1 link to missing pages in contents/docs/mcp-analytics/installation/other-languages.mdx
    No page or redirect exists at /docs/mcp-analytics/installation/rust in contents/docs/mcp-analytics/installation/other-languages.mdx. Broken links waste crawl budget and send readers to a 404.
    Fix: Fix the path, or add the missing redirect.

This comment updates on each push. The check reads the diff only, so it can miss problems or flag safe changes. If this is a false alarm, reply here so the check can improve.

…eir page

PHP's QueueConsumer flushes inside enqueue() at batch_size (100), not when
the queue is full (max_queue_size drops). Found by independent verification.
@lucasheriques
lucasheriques merged commit da1ec0f into master Oct 28, 2026
22 checks passed
@lucasheriques
lucasheriques deleted the lucas/mcp-docs-any-language branch October 28, 2026 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to product documentation, "Docs"

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant