Expand description
brep_mcp_core — the BREP MCP server, host-agnostic.
The governing rule is that the shape of the engine drives the MCP: every tool, schema and resource this crate serves is read from a registry the engine or the app exposes, never from a table kept here. What lives in this crate is the translation to the Model Context Protocol, session management, the server-side compositions (image post-processing, scripts, validation) that are MCP concerns rather than engine concerns, and the two transports.
The crate does not depend on the app. A host owns an app instance and
answers the host protocol; two exist: the app’s own window (brep-app --mcp, in the BREP_app crate) and the BREP_mcp crate’s headless
egui_kittest harness. That is what lets the app embed the server without
a dependency cycle.
Module map:
tools— the server’s view of a tool:ToolSpec(name, group, doc, derived input schema, annotations, handler) and the sets that produce them.host— the host protocol: envelopes, replies, the backend seam and thehost::Platforma host supplies.session— one app instance under one host, its directory and recorder.schema— the kernel feature catalogue rendered as JSON Schema.validate— feature-parameter validation against the catalogue.script— the JSON step-list script format and itsexpectoperators.script_sdk— thesdk.<namespace>.<action>(args)catalogue every host’s code runner exposes, and thesdktool that describes it.declarations— one action’s TypeScript signature, from its schemas.files— bounded file operations under named roots.image— PNG decode/encode, crop, scale, diff for screenshots.
With the server feature (default):
server— the dynamicrmcp::ServerHandlerover those sets, stdio;server::BrepServeris the entry point a host constructs.http— the same server over streamable HTTP on a loopback listener.cad— the CAD operation service: code execution (run), the front-door tools, artifacts and journals.program— JavaScript test programs played through the code runner.runner— plays a script through a tool set and writes the artefacts.render_mesh— a CPU mesh renderer and silhouette comparison.generate— renders the registries to Markdown/JSON reference docs and the old-to-new SDK mapping.launch_state— the native launch policy for execution journals.skills,skill_distribution,prompts— the embedded reviewed workflows, their offline bundle installer, and MCP prompts.plm_fixture— a realbrep-plm servea script runs against (plm).
Without server the crate is the tool set over the host protocol alone,
for a host that supplies its own platform — the browser build of the app,
which compiles this for wasm32 so a page serves the same tools the desktop
does. See the README for the transports, credentials and launch options.
Modules§
- cad
- The CAD operation service (owner brief 2026-10-28).
- declarations
- TypeScript for one
sdk.<namespace>.<action>, rendered on demand from the action’s own JSON Schemas (thesdktool’s{topic: "ns.action"}): the argument and result types are read off the schemas the host validates with, so what an agent reads is what the call takes. Nothing is written ahead of a question; there is no declaration file. - files
- Bounded file operations shared by MCP, CodeMode and the browser store. Hosts provide storage primitives; this module owns request semantics and limits.
- generate
- Render the registries to the checked-in generated docs: what a reviewer diffs to see what a change exposed, and what the freshness test compares against. Nobody edits these.
- host
- The host protocol. A host owns an app instance and answers
commands; the server talks to it through
HostHandle— a tokio channel in, a oneshot per reply out — so async tool handlers never block. - http
- The server over MCP’s streamable HTTP transport, for an app that is already
running (
brep-app --mcp): an agent connects tohttp://127.0.0.1:<port>/mcpinstead of launching a process. rmcp’s transport is a tower service; hyper serves it connection by connection on the listener the caller bound. - image
- Screenshot post-processing: PNG encode/decode, crop, downscale, diff, a
drawn cursor, and the animated-GIF encoder the docs walkthroughs are
written with. Pure CPU,
imagecrate, no fonts — the annotation a walkthrough carries (caption, highlight ring) is painted by the HOST, in egui, before the frame is captured, because there is no font here to rasterise with and nothing in the repo to load one from (BREP_mcp/src/headless.rs,annotate). - launch_
state - Native launch policy for execution journals. Resolving a policy never creates a directory or opens a journal; the host applies it before admitting work.
- plm_
fixture - The PLM fixture: a real
brep-plm servefor onetest-mcpscript. - program
- test-mcp’s SCRIPT MODE: a
BREP_mcp/tests/scripts/*.jsprogram played through code mode, the way an agent drives the app throughrun. - prompts
- User-selected workflow prompts share the embedded skill text.
- render_
mesh - CPU mesh renderer and silhouette comparison.
- runner
- The
test-mcpscript runner: plays aScriptthrough aToolSet, checks everyexpect, saves and compares images, and writes the per-step artefacts (NNNN-<tool>.json, images,result.json) under an output directory. It knows nothing about hosts or sessions: the tool set it is handed is whatever the session generated, so a script written against the running app and one written against the catalogue tools run the same way. - schema
- The kernel’s feature catalogue (
brep_kernel::feature_schema_catalogue, reached throughbrep_render::features) rendered as JSON Schema. - script
- The
test-mcpscript format (spec Appendix E): a session description plus a list of tool calls, each with optional expectations on the tool’s JSON result and optional image capture / comparison. - script_
sdk - The one script namespace every host’s code runner exposes:
sdk.<namespace>.<action>(args), and thesdktool that describes it. - server
- The dynamic
rmcp::ServerHandler. - session
- A session: one app instance under one host, plus the session directory
(store, shots, exports, log) and the recorder. Where the
directory and the log ARE is the host’s platform’s business
(
crate::host::Platform): a directory tree natively, a name and a blob URL in a browser page. - skill_
distribution - Offline installation of reviewed Markdown skills. The trusted binary is the provenance anchor; a package’s self-declared publisher is not one.
- skills
- Allowlisted, versioned workflow instructions served by the Skills extension.
- tools
- The server’s view of a tool.
- validate
- Feature-parameter validation against the kernel catalogue, run in the
server before a
feature_add/feature_set_paramsreaches the engine.