Repository navigation
feat(cli): Generate command-catalog.json from the route tree - #1919
Open
sentry-junior[bot] wants to merge 6 commits into
Open
sentry-junior[bot] wants to merge 6 commits into
sentry-junior[bot] wants to merge 6 commits into
Conversation
The hosted MCP cannot load the CLI's route tree, so `generate:command-catalog` writes the agent-facing metadata of every command whose exposure is not `hidden` to `packages/mcp-core/src/command-catalog.json`: path, brief, permission class, exposure, parameters as JSON Schema, completion kinds, local-path flags, examples, output fields, and API operations. mcp-core exports it as `@sentry/mcp-core/command-catalog`, so mcp-cloudflare can import it without the CLI. The file is committed. `generate:docs` regenerates it, and `check:command-catalog` in `ci:policy` fails when it is stale. A test checks it against `lib/introspect.ts` for the full tree. Closes #1881 Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
…to feat/command-catalog Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The repository quality job lints before building mcp-core, so its types resolve to error types there. Drop the unions with them and give the test's sorts a compare function. Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
This was referenced Nov 3, 2026
…to feat/command-catalog # Conflicts: # packages/cli/package.json Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Both servers read command-catalog.json instead of building schemas at runtime (#1914), so the comments no longer tie the catalog to the hosted server alone. Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
3 of 38 tasks
# Conflicts: # packages/cli/package.json Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
This branch had an error being deployed
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.
Stacks on #1916 (#1880). The base is its branch; retarget to
mainonce it merges.The CLI build now writes each command's MCP metadata to JSON, so both MCP servers read the same generated data and list the same commands with the same schemas (
cli-first-mcptask 1.3). Following #1914, runtime reads generated per-command data instead of computing it: neithersentry mcpnor the hosted server on Workers builds schemas from the route tree at runtime.generate:command-catalog, which runs ingenerate:docs(build, typecheck, test:unit), writespackages/mcp-core/src/command-catalog.jsonfromsrc/lib/command-catalog.ts. That module builds onbuildCommandInfoandpublicTargetPathsfromlib/introspect.ts; only the generator and the test use it. mcp-core exports the result, with its types, as@sentry/mcp-core/command-catalog. The built module has no imports, so mcp-cloudflare can import it without pulling in the CLI, and mcp-core still never imports the CLI.Shape:
{ commands: [...] }, sorted by path. Each entry haspath,brief,permission,exposure,parameters(JSON Schema 2020-12),completions(completion kinds of positionals and flags),localPathFlags,examples,outputFields, andapiOperations(fromcommand-api.json).parametershas two properties.positionalis an array (prefixItemsfor tuples,itemsfor variadics).flagsis keyed by CLI flag name, which is the shape the SDK'sinvoke(path, flags, positional)takes. Flat names wouldn't work because positional placeholders collide with flag names (for exampleorg viewandtrial listboth have anorgpositional and an--orgflag). Hidden flags are left out. Only Striclienumflags becomeenum. The values of achoiceparser are suggestions, since the parser accepts other values (--cursortakes a raw cursor), so they go inexamples. Number typing follows the SDK generator.fullDescriptionis left out. It repeats the examples and the JSON fields section, and including it added about 150 KB.Hidden commands are left out. No MCP server lists or runs them. Leaving them in the hosted bundle would only invite someone to expose them by mistake.
stdio-onlycommands stay in, with their exposure, so a test can compare both servers' lists from one source. Hosted filters toexposed. That leaves 115 commands: 81 exposed and 34 stdio-only.The file is committed (about 474 KB pretty-printed, 289 KB minified;
toolDefinitions.jsonis 374 KB) and excluded from oxfmt.check:command-cataloginci:policyfails when it is stale. Thegit diff --exit-codestep after the CLI project's tests catches it as well, because the tests regenerate the file.test/lib/command-catalog.test.tschecks three things: the committed file equals the catalog of the current tree; each non-hidden command fromextractAllRouteshas an entry with matching brief, permission, exposure, examples, output fields, local-path flags, API operations, flags, and positionals; and the JSON Schema of a fixture command.Open for the execute tools (#1890): the stdio server and the SDK may want camelCase parameter names instead of CLI flag names. The catalog also keeps injected flags such as
jsonandfields, so the executor decides which ones to strip.outputFieldscomes from #1923's generated field data: introspection reads each command's__jsonFields, so the catalog has no derivation of its own.Closes #1881
via @BYK.
--
View Session in Sentry