Expand description
Opt-in Model Context Protocol server for FerroUI. Call serve on the UI thread after
application setup and keep the returned handle alive until shutdown. No server starts merely
by linking the crate. Property writes and input are independently disabled by default.
The tools run on the shared inspector of the UI thread (ferroui_inspect::Inspector::shared),
the one the Chrome DevTools Protocol endpoint uses too: node IDs are the same for both, and a
custom lifetime registers its top levels there (register_root).
Structs§
- Options
- Permissions
- Mutating operations are disabled unless explicitly enabled by the application.
- Request
Context - A request-scoped cancellation/deadline fence. Check immediately before committing durable work.
- Server
Handle - Dropping this handle stops accepting requests and invalidates queued work. A stdio reader blocked in the OS remains parked until EOF; it cannot execute more UI operations. This inspector-only handle can be moved to another thread after server startup.
- UiServer
Handle - A server that also owns application tools on the creating UI thread.
Enums§
- Transport
- HTTP listens only on a loopback address. Port zero chooses an unused port.
Traits§
- Service
Tool Provider - A service whose state is safe to access from transport workers. No UI objects may be held. Tool definitions are immutable for the server lifetime. Mutating tools additionally require the server’s existing write permission; identity/room ACLs remain the provider’s responsibility.
- UiTool
Provider - An application-owned set of MCP tools. Every method runs on the creating UI thread.
Functions§
- reserve_
stdout - Reserve stdout for MCP before application startup. Ordinary stdout is redirected to stderr for the rest of the process, including native/library output on Unix (on Windows, output through the process’s standard handle). Pass the returned file in Options.
- serve
- Start the server on the UI thread. The returned handle is the lifetime of the service.
- serve_
service - Host an isolated, thread-safe application service through the existing MCP protocol.
- serve_
service_ with_ token - Use a securely persisted 256-bit bearer for a durable service, so restarting the process does not invalidate peers’ endpoints. Inspector servers continue generating fresh tokens.
- serve_
with_ tools - Serve inspector tools and application tools through the same transport, permissions, cancellation and UI dispatcher. Keep the returned handle on this UI thread.