Add MCP tool callouts to API endpoint docs#16871
Draft
thmsobrmlr wants to merge 1 commit into
Draft
Conversation
Surfaces matching MCP tools on each REST API endpoint page so users discover the MCP equivalent without leaving the API reference. - Enrich fetchMCPTools to emit a byName map (summary, description, category, required_scopes) alongside the existing categories shape. - Cache the full MCP tools payload in onPreBootstrap so downstream consumers can read either shape. - Seed src/data/mcp-rest-mapping.json with 137 operationId -> tool mappings (direct underscore-to-hyphen matches plus verb-swap CRUD entries for feature flags, dashboards, insights, cohorts, experiments, annotations, surveys). - Add scripts/generate-mcp-rest-mapping-candidates.js to refresh candidates as the upstream tool list / OpenAPI spec evolve. - Render <MCPCallout /> inside ApiEndpoint.tsx, returning null when there is no mapping so unmapped endpoints stay clean. Generated-By: PostHog Code Task-Id: 5e7552fa-6b4b-4e3a-ba92-d71895b6f041
Contributor
Deploy preview
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
byNamemap (summary, description, category, required_scopes) alongside the existing categories shape, and caches the full payload inonPreBootstrap.src/data/mcp-rest-mapping.json(137 entries — direct_→-matches plus verb-swap CRUD entries for feature flags, dashboards, insights, cohorts, experiments, annotations, surveys) and a helper script to regenerate candidates as the upstream tool list / OpenAPI spec evolve.<MCPCallout operationId={...} />insideApiEndpoint.tsxright after each endpoint heading; returns null when no mapping exists so unmapped endpoints stay clean.Test plan
pnpm clean && pnpm install && pnpm start/docs/api/feature-flags— each operation with a mapping entry should show a yellow-bordered callout above the description listing the matching MCP tool(s) with summaries and a link to/docs/model-context-protocol.pnpm buildstill completes without TypeScript errors.Generated-By: PostHog Code
Task-Id: 5e7552fa-6b4b-4e3a-ba92-d71895b6f041