Skip to main content

Crate mcpmesh_node

Crate mcpmesh_node 

Source
Expand description

Embed a full mcpmesh node in-process.

The supported surface is NodeBuilder/Node plus the mcpmesh-local/1 control protocol Node::control speaks (see docs/local-protocol.md). Every other module in this crate is #[doc(hidden)] internals of the mcpmesh daemon — no stability promise is made for them; they may change or vanish in any release without a major version bump.

Only driving a RUNNING daemon (the sidecar model)? Depend on mcpmesh-local-api instead — it links no networking stack at all. The full embedding guide (root-dir layout, host contract, sidecar-vs-embedded) is docs/embedding.md.

§Quickstart

let node = mcpmesh_node::NodeBuilder::new("/var/lib/myapp/mesh").start().await?;
let mut control = node.control().await?;
control.register_service(
    "notes",
    mcpmesh_local_api::BackendSpec::Run { cmd: vec!["my-mcp-server".into()] },
    vec![],
).await?;
let invite = control.invite(vec!["notes".into()]).await?;
println!("send this to a friend: {}", invite.invite_line);

The node is a full peer: everything the mcpmesh daemon can do — pairing, live MCP sessions (open_session), roster/org mode, blobs, audit — works through Node::control, because it runs the daemon’s own handlers.

Re-exports§

pub use node::Node;
pub use node::NodeBuilder;
pub use node::StartError;
pub use paths::NodePaths;

Modules§

node
The supported embedding surface: build (NodeBuilder) and drive (Node) a full in-process mesh node. The node is its OWN mesh identity under its OWN root directory — it never touches the per-user daemon’s state, socket, or singleton lock, so it coexists freely with a running mcpmesh daemon (and with other embedded nodes under other roots).
paths
Every filesystem location a node reads or writes, resolved ONCE at construction. The node itself never consults the environment: the embedder picks a root (NodePaths::under_root — layout-identical to a mcpmesh --profile <root> dir), and the daemon shell resolves the standard per-user layout (NodePaths::from_env).

Structs§

Config

Constants§

VERSION
This crate’s version — the mcpmesh release-train version the daemon binary ships on.