Skip to content

feat(mcp): discoverability — --list-tools, --probe, rivet docs mcp#231

Open
avrabe wants to merge 2 commits intomainfrom
feat/mcp-discoverability
Open

feat(mcp): discoverability — --list-tools, --probe, rivet docs mcp#231
avrabe wants to merge 2 commits intomainfrom
feat/mcp-discoverability

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Apr 28, 2026

Why

Scenario C dogfood (an AI integrator wiring rivet's MCP server into a
custom client) burned ~30 minutes on two unrelated discoverability
gaps: figuring out the JSON-RPC framing the server expects (line-delimited
vs LSP-style Content-Length) and writing throwaway JSON-RPC by hand to
enumerate the tool catalog. Both should be solvable in seconds.

What

Two changes on top of feat/v0.5.0-readme-quickstart-changelog:

  1. rivet mcp --list-tools and rivet mcp --probe — two new flags
    on the existing rivet mcp subcommand. Neither starts a long-running
    server.

    • --list-tools walks the registered ToolRouter and prints the
      15-tool catalog. Default output is a human table; --format json
      emits the JSON-RPC tools/list payload exactly as the wire server
      would. Works without a project loaded — useful as a "is this
      binary an MCP-capable rivet?" check before any setup.
    • --probe runs the in-process equivalent of tools/call rivet_list
      (no args) against the current project and prints the decoded
      result.content[0].text payload. Verifies the project loads, the
      schema parses, and a real read tool returns artifacts — without
      spinning up stdio.

    Both reuse the exact handlers the wire server dispatches to, so
    their output cannot drift from a real session.

  2. rivet docs mcp — a new embedded doc topic (~1400 words) that
    covers what the server exposes, the wire format (line-delimited
    JSON-RPC, NOT LSP Content-Length), the 3-message handshake (with the
    easily-forgotten notifications/initialized notification), the
    15-tool catalog with inputs, the result.content[0].text
    double-parse gotcha, three smoke-test recipes (one of them the
    bash-only raw JSON-RPC fallback), the mutate-then-rivet_reload
    convention, and a pointer to the upstream MCP spec. Registered in
    the docs index so rivet docs lists mcp alongside cli,
    cross-repo, etc.

    Also amends rivet docs cli to mention the new flags and cross-link
    to rivet docs mcp.

Test plan

  • cargo check --workspace — clean
  • cargo clippy --workspace --all-targets -- -D warnings — clean
    (only pre-existing MSRV info warning, no new lint errors)
  • cargo fmt --all
  • cargo test -p rivet-cli --test mcp_integration — 22/22 pass,
    including test_tools_list_returns_all_15_tools
  • rivet docs lists mcp under Reference
  • rivet docs mcp prints the new topic (1411 words)
  • rivet mcp --list-tools lists 15 tools with parameters
  • rivet mcp --list-tools --format json emits a JSON-RPC
    tools/list-shaped payload (result.tools[] with name,
    description, inputSchema)
  • rivet mcp --probe returns the rivet_list payload (759
    artifacts on this project) without errors
  • rivet --project /tmp mcp --list-tools works without a project

Trailers

Per CLAUDE.md, the feature commit carries:

Implements: REQ-007
Refs: FEAT-010

The docs commit is Trace: skip (docs-only, exempt per the AGENTS.md
trailer policy).

🤖 Generated with Claude Code

avrabe added 2 commits April 28, 2026 06:10
`rivet mcp --list-tools` walks the registered tool router and prints
the catalog (15 tools today) as either a human-readable table or — with
`--format json` — the JSON-RPC `tools/list` payload exactly as the
stdio server would emit it. Does not start the server and does not
need a project to be present, so it works as a fast capability probe
even before any artifact files exist.

`rivet mcp --probe` runs the in-process equivalent of
`tools/call rivet_list` (no args) against the current project and
prints the decoded `result.content[0].text` payload — the same envelope
an MCP client would observe — without standing up a stdio server. Used
as a smoke test for AI integrators verifying their project is
reachable through MCP.

Both flags reuse the same handlers the wire server dispatches to, so
their output cannot drift from what a real client would see.

Implements: REQ-007
Refs: FEAT-010
…log, gotchas

Adds an embedded documentation topic for the MCP server, registered in
the docs registry so `rivet docs mcp` and the `rivet docs` listing both
surface it. Companion to the new `rivet mcp --list-tools` and
`rivet mcp --probe` flags.

Covers: what the server exposes; the line-delimited JSON-RPC over stdio
wire format (and the LSP Content-Length pitfall it is NOT); the
3-message handshake including the easily-forgotten
`notifications/initialized` notification; the 15-tool catalog with
inputs; the `result.content[0].text` double-parse envelope gotcha; three
smoke-test recipes (`--list-tools`, `--probe`, raw bash JSON-RPC); the
mutate-then-`rivet_reload` convention; and a pointer to the upstream
MCP spec for clients building from scratch.

Also amends `rivet docs cli` to mention the new `mcp` subflags and
cross-link to `rivet docs mcp`.

Trace: skip
@github-actions
Copy link
Copy Markdown

📐 Rivet artifact delta

No artifact changes in this PR. Code-only changes (renderer, CLI wiring, tests) don't touch the artifact graph.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Rivet Criterion Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: 681563c Previous: 92ad95d Ratio
link_graph_build/10000 36870006 ns/iter (± 4159555) 30052745 ns/iter (± 2252438) 1.23
query/10000 141563 ns/iter (± 4674) 109024 ns/iter (± 1298) 1.30

This comment was automatically generated by workflow using github-action-benchmark.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant