docs(MCP): Rewrite MCP server page and generate the tool catalogue#7668
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
Vercel preview of the rewritten page: https://docs-qxrxqbi67-flagsmith.vercel.app/integrating-with-flagsmith/mcp-server |
Docker builds report
|
Rewrite the user-facing MCP server page for the self-built server, replacing the Gram-hosted page: - Cloud (`https://mcp.flagsmith.com`) and self-hosted (`https://<host>/mcp/`) URLs - OAuth (auto-discovered) and `Authorization: Api-Key` authentication - Per-client install tabs: Claude Code, Cursor, Claude Desktop, Codex CLI, Windsurf, Gemini CLI, VS Code, and a generic fallback - Gram deprecation / migration callout, example prompts Generate the tool catalogue from the OpenAPI schema rather than hand-maintaining it, so descriptions stay in sync with the tools: - `manage.py generate_mcp_tool_catalogue` renders an aligned Markdown table of the MCP-tagged operations (verbatim `operationId` + `description`); `--exclude` omits tools already listed in another catalogue. - `make generate-docs` writes the core catalogue (`_mcp-tool-catalogue.md`); `api-tests-with-private-packages` derives the enterprise-only catalogue (`_mcp-tool-catalogue-enterprise.md`) against it. The page composes both via MDX imports (hence the `.md` -> `.mdx` rename). Contributes to Flagsmith/flagsmith-private#144. beep boop
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7668 +/- ##
==========================================
- Coverage 98.52% 98.52% -0.01%
==========================================
Files 1444 1446 +2
Lines 55083 55030 -53
==========================================
- Hits 54273 54220 -53
Misses 810 810 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
|
Visual Regression19 screenshots compared. See report for details. |
5fb9cdd to
6295a4b
Compare
Zaimwa9
left a comment
There was a problem hiding this comment.
Big big improvement. No specific comments on my side, surprised that codex doesn't have a dedicated command
Zaimwa9
left a comment
There was a problem hiding this comment.
Ok, great. Just flagged the CI to make sure it was intentional
emyller
left a comment
There was a problem hiding this comment.
Late non-blocking review.
| - name: Check MCP enterprise tool catalogue is up to date | ||
| env: | ||
| DOTENV_OVERRIDE_FILE: .env-ci | ||
| run: | | ||
| uv run python manage.py generate_mcp_tool_catalogue \ | ||
| --exclude ../docs/docs/integrating-with-flagsmith/_mcp-tool-catalogue.md \ | ||
| > ../docs/docs/integrating-with-flagsmith/_mcp-tool-catalogue-enterprise.md | ||
| git diff --exit-code ../docs/docs/integrating-with-flagsmith/_mcp-tool-catalogue-enterprise.md | ||
|
|
| "--exclude", | ||
| type=Path, | ||
| default=None, | ||
| help="Path to an existing catalogue whose tools should be omitted.", |
There was a problem hiding this comment.
| help="Path to an existing catalogue whose tools should be omitted.", | |
| help="Path to an existing catalogue which tools should be omitted.", |
| def _render_table(header: tuple[str, str], rows: list[tuple[str, str]]) -> str: | ||
| # Render an aligned Markdown table matching Prettier's output so the committed | ||
| # catalogue is reproducible by `make generate-docs` and passes the docs | ||
| # Prettier check unchanged. | ||
| cells = [list(header)] + [[f"`{name}`", description] for name, description in rows] | ||
| widths = [max(len(row[col]) for row in cells) for col in range(len(header))] | ||
| lines = [ | ||
| _render_row(cells[0], widths), | ||
| "| " + " | ".join("-" * width for width in widths) + " |", | ||
| *(_render_row(row, widths) for row in cells[1:]), | ||
| ] | ||
| return "\n".join(lines) |
There was a problem hiding this comment.
note: Not a fan of this, seems fragile. Feels like this code should give place to something that should already exist.
There was a problem hiding this comment.
Yeah full disclosure I didn't ask Claude to generate prettier-compatible markdown. :/
|
|
||
| :::caution | ||
|
|
||
| The `Api-Key ` prefix is required. The header value should look like `Api-Key ser.abc123…`, not the key on its own. |
There was a problem hiding this comment.
| The `Api-Key ` prefix is required. The header value should look like `Api-Key ser.abc123…`, not the key on its own. | |
| The `Api-Key` prefix is required. The header value should look like `Api-Key ser.abc123…`, not the key on its own. |
This isn't incorrect, but leads to a weird rendering:
| claude mcp add flagsmith \ | ||
| --env TRANSPORT=stdio \ | ||
| --env FLAGSMITH_API_TOKEN=<your-api-key> \ | ||
| -- uvx --from "git+https://github.com/Flagsmith/flagsmith.git@main#subdirectory=mcp" flagsmith-mcp |
There was a problem hiding this comment.
q: Would you think this warrants a PyPI package?
There was a problem hiding this comment.
Not sure. I can see the devex improvement but I don't imagine stdio will be used a lot to streamline this command. There's no difference security-wise, IMO.
|
|
||
| The tools available to your assistant depend on what your Flagsmith deployment has installed. The core tools below are | ||
| available on every deployment. The [enterprise tools](#enterprise-tools) require a paid SaaS plan or a self-hosted | ||
| Enterprise deployment, and only appear when those features are present. |
There was a problem hiding this comment.
q: Did you have a chance to verify it? I realise I did not.
There was a problem hiding this comment.
Ah good catch, the tool list result is independent of the upstream API. This needs rewording.
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
Contributes to Flagsmith/flagsmith-private#144.
Preview: https://docs-git-docs-rewrite-mcp-server-flagsmith.vercel.app/integrating-with-flagsmith/mcp-server
Rewrites the user-facing MCP server page for the self-built server, replacing the Gram-hosted page:
https://mcp.flagsmith.com) and self-hosted (https://<your-flagsmith-host>/mcp/) URLs.Authorization: Api-Keyauthentication.Generates the tool catalogue from the OpenAPI schema instead of hand-maintaining it, so the descriptions stay in sync with the tools:
manage.py generate_mcp_tool_cataloguerenders an aligned Markdown table of the MCP-tagged operations (verbatimoperationId+description).--excludeomits tools already present in another catalogue.make generate-docswrites the core catalogue (_mcp-tool-catalogue.md, gated by the existing diff-check).api-tests-with-private-packagesderives the enterprise-only catalogue (_mcp-tool-catalogue-enterprise.md) from it (the enterprise tools only exist with private packages installed). The page composes both via MDX imports — hence the.md→.mdxrename.Note: the page documents URLs/clients ahead of the server going live (doc-led). The install snippets and the Gram deprecation date (currently 30 June 2026) should be confirmed against the live server before/at release — in particular that the documented MCP URL exactly matches the
resourcein the server's OAuth metadata, or OAuth discovery fails.How did you test this code?
make -C api generate-docsreproduces_mcp-tool-catalogue.md(36 core tools) byte-identically;make -C api typecheckand ruff pass; docs Prettier passes on the rewritten page and both partials.flagsmith-privateinstalled (--excludethe core one) → the 7 enterprise tools; verified both partials are Prettier-stable.tests/unit/api/test_generate_mcp_tool_catalogue.py): default rendering,--exclude, and pipe-escaping — all pass.