Repository navigation
feat(mcp): rvt-rs-mcp, a stateless stdio MCP server over the decoded model (#1324) - #1330
Merged
Merged
Conversation
…model (#1324) A crate of its own (rvt-mcp, rust-version 1.88) that links rvt in process and serves MCP 2026-07-28 and the older initialize handshake over stdio. open_model runs the decode rvt-ifc runs and every tool reads that model, so an answer and the IFC export cannot disagree. Exports go to a caller-named path with progress and cancellation. The core crate gains two small public functions, element_global_ids and room_rows, and no export changes.
…ck a tagged element in the test (#1324)
…ors, cancellation tested, no tokio net (#1324) Exports go through tempfile (unique exclusive name, persist_noclobber without overwrite), the write loop stops on cancel, arguments are read by the tools so a malformed object is isError text, the server serves stdin and stdout without rmcp's transport-io (tokio net off, checked in audit-mcp-network.sh), Einhoven runs in both lifecycles, an E2E case cancels an export, the tool contract is dumped to docs/mcp-tools.json and rendered by tools/ci/render-mcp-tools.py, and publish.yml publishes rvt-rs-mcp only when PUBLISH_RVT_RS_MCP is true.
…ockets (#1324) A Unix socketpair is tokio's signal driver, linked into the test build by the client's process feature; the check now fails only on a socket in a TCP, UDP, raw or packet table.
…ring (#1324) docs/mcp-tools.json is the server's tools/list from CI run 41784311944 (the mcp-tools artifact), docs/mcp-tools.md is tools/ci/render-mcp-tools.py's rendering of it. The end-to-end test holds the JSON to the built server's, the PII guard job holds the Markdown to the JSON.
…ot a failed start (#1324) server/discover and unsupported-version requests are answered before rmcp starts a session, so a probe that closes stdin after only discover reached ConnectionClosed from the bootstrap and the server exited 1, which failed the release-binaries smoke test on every target. That error is now a clean exit (info log); every other start failure stays an error. The raw-stdio tests cover discover then EOF, initialize then EOF, immediate EOF and a non-request first message (still exit 1).
DrunkOnJava
marked this pull request as ready for review
November 4, 2026 07:07
DrunkOnJava
enabled auto-merge (squash)
November 4, 2026 07:07
Merged
8 of 9 tasks
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
Adds
rvt-rs-mcp, a local, read-only MCP server over stdio, as the new workspace cratervt-mcp/. It linksrvtin process, serves MCP 2026-07-28 (stateless) and the olderinitializehandshake, and answers an agent's questions about a Revit file from the same model the IFC exporter writes.Closes #1324
Refs #1325 #1326 #1327 #1331
Motivation
The design is the body of #1324. In short: an agent should be able to open a
.rvt,.rfa,.rteor.rft, ask about its elements, levels, rooms and diagnostics, and export it, with no Revit install and no network, and with every answer saying where it comes from and what was not read.Changes
rvt-mcp/(packagervt-rs-mcp,rust-version = "1.88", rmcp 3.8 withserver,macros,transport-io,schemars; no HTTP feature). Nine tools:open_model,get_summary,list_elements(category, class, level),get_element(ElementId or GlobalId),list_rooms,list_levels,get_diagnostics,export_ifc,export_gltf. Each declares anoutputSchemaand returnsstructuredContentplus the same JSON as text; each element carries aprovenanceobject. Source layout:pipeline.rsisrvt-ifc's decode (same steps and order assrc/bin/rvt_ifc.rs),store.rsthe LRU keyed by canonical path, size and mtime,views.rsthe answers,exports.rsandoutput.rsthe exports,server.rsthe tools.open_modelreturns an opaquemodel_id(hash of the identity, no path in it); every tool takes it or the path. An unknown, evicted or stale id is anisErrorresult telling the model to callopen_modelagain. The lifetime is inopen_model's description and indocs/mcp.md. Two decoded models are kept by default (--max-open-models).notifications/cancelledcancels the walk throughWalkerControl(nothing partial is written; the export is written beside its target and renamed). The server never asks the client for anything..ifc/.glb, not the model, not existing unlessoverwrite, inside--output-dirwhen set), result is a summary with the SHA-256 plus aresource_link. Refuses when a resource limit left streams unread unlessallow_partial(the CLIs' exit 3).#![deny(clippy::print_stdout, clippy::print_stderr)], logging through tracing to stderr, exit on stdin EOF,tools/listcarriesttlMsfor 2026-07-28 peers.ifc::step_writer::element_global_ids(the loop the STEP writer already ran, now shared so a tool names an element by the GlobalId its IFC carries) andifc::schedule_csv::room_rows(whatrooms_csvrenders;rooms_csvnow renders from it).rvt-rs-mcp(including its test), the dependency-tree guardtools/ci/audit-mcp-network.sh(no HTTP, TLS or WebSocket crate), the end-to-end test in the test matrix on every OS and again in Corpus health on Einhoven, acargo +1.88 checkof the crate on the MSRV entry.tools/check-local.shruns the guard and the test.release-binaries.ymlbuilds-p rvt -p rvt-rs-mcp, packsrvt-rs-mcpinto every archive (and so the image), checks its.dep-v0section and smoke-tests it (--version,server/discover);publish.ymladds a source-install smoke andcargo publish -p rvt-rs-mcpafterrvt, and checks both crates' versions against the tag.RELEASE.md,docs/maintaining.md,docs/install.md,docs/status.mdand the README say so.tempfile(a uniquely named, exclusively created temp file in the target's folder;persist_noclobberwithoutoverwrite,persistwith it; removed on every error path), the write loop stops on cancellation, and bad arguments areisErrortool errors (the tools read their arguments themselves, because rmcp'sParametersextractor answers a malformed object with a JSON-RPC error). The server serves(tokio::io::stdin(), tokio::io::stdout())throughtransport-async-rwinstead oftransport-io, which turns tokio'sneton;audit-mcp-network.shasserts tokio has nonet,processorsignalfeature and thatmioandsocket2are absent.docs/mcp-tools.json(names, descriptions, input and output schemas, annotations) to what the built server reports fortools/list;tools/ci/render-mcp-tools.pyrendersdocs/mcp-tools.mdfrom it, and the PII guard job runs it with--check.pipeline.rsis a copy ofrvt-ifc's steps, asrvt-pyandrvt-wasmcarry their own; One export pipeline: rvt-ifc, Python, wasm and the MCP server run the same function #1331 replaces all four with one function (a comment says so). The byte-for-byte export comparison guards the copy meanwhile.publish.ymlpublishesrvt-rs-mcponly when the repository variablePUBLISH_RVT_RS_MCPistrue, so a missing first publish cannot leave a tag half published; the binary is in the archives either way (RELEASE.md, step 8).docs/mcp.md(install, client configuration, tools, handle lifetime, provenance fields that exist today, what is not provided yet, limits, privacy),rvt-mcp/README.md, a changelog fragment.Testing
Unit tests are banned and none were added. The end-to-end test is
rvt-mcp/tests/mcp_stdio.rs:rvt-rs-mcpand drives it over real stdio with rmcp's client:server/discoverat 2026-07-28 andinitializepinned to 2025-11-25, oncorpus/tier1/architectural-2024(and on Einhoven whenRVT_PROJECT_CORPUS_DIRis set);outputSchemaon each,ttlMs > 0andresultTypeonly for the 2026-07-28 peer), the opaque handle, id and path both accepted, an unknown id's error, every tool's structured and text content agreeing, an element looked up by ElementId and by GlobalId, and that GlobalId in the IFC the export wrote;export_ifc(default and withsaved_meshes: off,no_base_quantities) andexport_gltfbyte for byte withrvt-ifcandrvt-gltfon the same file, withSOURCE_DATE_EPOCHfixed (RVT_REQUIRE_CLI_PARITY=1in CI makes their absence a failure);server/discoverlists 2026-07-28, an unsupported_metaprotocol version is -32022 with the supported list, a call with a progress token getsnotifications/progressbefore its result, every line on stdout is JSON, on Linux the server holds no TCP, UDP or raw socket, and the process exits when stdin closes; and--output-dirrefuses a path outside it.Where CI runs it:
ci.yml, jobbuild + real files, stepMCP server end to end(ubuntu stable, windows, macos), and jobCorpus health, stepMCP server end to end on Einhoven; themsrventry runscargo +1.88 check -p rvt-rs-mcp --all-targets --locked.tools/check-local.shpasses: not run locally (no local builds on the Mac); the same gates run in CI. Run here:cargo fmt --all,cargo deny check(passes),cargo audit(passes),tools/ci/audit-mcp-network.sh(passes),python3 tools/release/changelog.py check(passes).Audit-honesty checklist
changelog.d/added/1324-mcp-server.md.docs/mcp.md.Legal and contribution hygiene
Breaking changes
None.
rvtgains two public functions (element_global_ids,room_rowswithRoomRow);rvtkeeps#![forbid(unsafe_code)], 1.87, and no tokio or rmcp dependency.Cargo.lockgains the MCP server's dependencies (66 packages, licences withindeny.toml) andlibcmoves 0.2.185 to 0.2.191.Release step for the maintainer session (not done here)
rvt-rs-mcpis a new crate on crates.io, and a trusted publisher can be added only to a crate that exists. Before the next tag:After
rvtX.Y.Z is on crates.io, publishrvt-rs-mcpX.Y.Z by hand from the release commit (cargo publish -p rvt-rs-mcp), or reserve the name with the first version.On crates.io, add a trusted publisher to
rvt-rs-mcp: repository DrunkOnJava/rvt-rs, workflowpublish.yml, environmentcrates-io.Set the repository variable
PUBLISH_RVT_RS_MCPtotrue.publish.yml's stepCargo publish the MCP serverruns only then, so until it is set a release publishesrvtand the archives and skipsrvt-rs-mcpinstead of failing half way.RELEASE.mdstep 8 says so. The release pull request also bumpsrvt-mcp/Cargo.toml(its version and its=X.Y.Zpin onrvt), whichRELEASE.mdnow lists.Output samples
The server's own descriptions state what is not read and point to
docs/status.md; the end-to-end test asserts it for every tool.Related issues
Closes #1324. Refs #1325, #1326, #1327, #1331.