Skip to main content

Crate openreadout_mcp

Crate openreadout_mcp 

Source
Expand description

MCP (Model Context Protocol) server exposing the same operations as the CLI, over stdio. Tool inputs and outputs are the same serde/schemars types the CLI uses, so an agent sees one schema whichever way it calls us.

MCP is the protocol AI assistants (Claude, Cursor, VS Code, …) use to call local tools. The server offers one tool per operation (openreadout_info, openreadout_stats, openreadout_peaks, openreadout_export, …), named like the CLI commands and taking the CLI flags’ names as arguments, resources (openreadout://formats, openreadout://file/{path}) and prompts; book/src/reference/mcp.md in the repository lists them.

§Cargo features

featuredefaultwhat it adds
httpnoserve_http and HttpOptions: MCP over Streamable HTTP on a loopback address (optional bearer token). Off by default so that the stdio server contains no networking code.

§Example

use openreadout_core::Registry;

/// The readers the server may use; called once per request so that every call gets fresh
/// readers. Real servers register the format crates' readers here.
fn registry() -> Registry {
    Registry::new()
}

// Serve on stdin/stdout until the client disconnects.
openreadout_mcp::serve_stdio(registry)?;

Structs§

HttpOptions
Options of serve_http.
InstrumentServer
The server. Holds a registry factory so each call gets fresh readers.

Constants§

ERROR_META_KEY
Result _meta key of a failed call: {code, exit_code, hint}.
INSTRUCTIONS
Server instructions sent at initialization.
PREVIEW_BUDGET
Byte budget of a preview returned inline (tool image content or resource blob).

Functions§

serve_http
Serve MCP over Streamable HTTP until the process is stopped.
serve_stdio
Serve over stdio until the client disconnects.