Skip to main content

brep_mcp_core/
lib.rs

1//! brep_mcp_core — the BREP MCP server, host-agnostic.
2//!
3//! Design record: `docs/developer/mcp-automation-build-spec.md`. The governing
4//! rule is that **the shape of the engine drives the MCP**: every tool, schema
5//! and resource this crate serves is read from a registry the engine or the app
6//! exposes, never from a table kept here. What lives in this crate is the
7//! translation to the Model Context Protocol, session management, the
8//! server-side compositions (image post-processing, scripts, validation) that
9//! are MCP concerns rather than engine concerns, and the two transports.
10//!
11//! The crate does not depend on the app. A *host* owns an app instance and
12//! answers the [`host`] protocol; two exist: the app's own window (`brep-app
13//! --mcp`, `BREP_app/src/mcp.rs`) and BREP_mcp's headless `egui_kittest`
14//! harness. That is what lets the app embed the server without a dependency
15//! cycle.
16//!
17//! Module map:
18//! - [`tools`]   — the server's view of a tool: `ToolSpec` (name, group, doc,
19//!   derived input schema, annotations, handler) and the sets that produce them.
20//! - [`server`]  — the dynamic `rmcp::ServerHandler` over those sets, stdio.
21//! - [`http`]    — the same server over streamable HTTP on a loopback listener.
22//! - [`schema`]  — the kernel feature catalogue rendered as JSON Schema.
23//! - [`validate`]— feature-parameter validation against the catalogue.
24//! - [`script`]  — the `test-mcp` script format and its expectation operators.
25//! - [`image`]   — PNG decode/encode, crop, scale, diff for screenshots.
26//! - [`runner`]  — plays a script through a tool set and writes the artefacts.
27//! - [`generate`]— renders the registries to the checked-in generated docs.
28//! - [`host`]    — the host protocol: envelopes, replies, the backend seam.
29//! - [`session`] — one app instance under one host, its directory and recorder.
30pub mod generate;
31pub mod host;
32pub mod http;
33pub mod image;
34pub mod runner;
35pub mod schema;
36pub mod script;
37pub mod server;
38pub mod session;
39pub mod tools;
40pub mod validate;