Skip to main content

mcpmesh_node/
lib.rs

1//! Embed a full [mcpmesh](https://github.com/counterpunchtech/mcpmesh) node in-process.
2//!
3//! The supported surface is [`NodeBuilder`]/[`Node`] plus the `mcpmesh-local/1` control
4//! protocol [`Node::control`] speaks (see `docs/local-protocol.md`). Every other module in
5//! this crate is `#[doc(hidden)]` internals of the mcpmesh daemon — no stability promise is
6//! made for them; they may change or vanish in any release without a major version bump.
7//!
8//! Only driving a RUNNING daemon (the sidecar model)? Depend on
9//! [`mcpmesh-local-api`](https://docs.rs/mcpmesh-local-api) instead — it links no
10//! networking stack at all. The full embedding guide (root-dir layout, host contract,
11//! sidecar-vs-embedded) is
12//! [`docs/embedding.md`](https://github.com/counterpunchtech/mcpmesh/blob/main/docs/embedding.md).
13//!
14//! # Quickstart
15//!
16//! ```no_run
17//! # async fn quickstart() -> anyhow::Result<()> {
18//! let node = mcpmesh_node::NodeBuilder::new("/var/lib/myapp/mesh").start().await?;
19//! let mut control = node.control().await?;
20//! control.register_service(
21//!     "notes",
22//!     mcpmesh_local_api::BackendSpec::Run {
23//!         cmd: vec!["my-mcp-server".into()],
24//!         env: Default::default(),
25//!         cwd: None,
26//!     },
27//!     vec![],
28//! ).await?;
29//! let invite = control.invite(vec!["notes".into()]).await?;
30//! println!("send this to a friend: {}", invite.invite_line);
31//! # Ok(())
32//! # }
33//! ```
34//!
35//! The node is a full peer: everything the mcpmesh daemon can do — pairing, live MCP
36//! sessions (`open_session`), roster/org mode, blobs, audit — works through
37//! [`Node::control`], because it runs the daemon's own handlers.
38
39/// This crate's version — the mcpmesh release-train version the daemon binary ships on.
40pub const VERSION: &str = env!("CARGO_PKG_VERSION");
41
42pub use config::Config;
43pub use node::{Node, NodeBuilder, StartError};
44pub use paths::NodePaths;
45
46#[doc(hidden)]
47pub mod allowlist;
48#[doc(hidden)]
49pub mod audit;
50#[doc(hidden)]
51pub mod backends;
52#[doc(hidden)]
53pub mod blobs;
54#[doc(hidden)]
55pub mod config;
56#[doc(hidden)]
57pub mod control;
58#[doc(hidden)]
59pub mod daemon;
60#[doc(hidden)]
61pub mod ipc;
62#[doc(hidden)]
63pub mod limits;
64pub mod node;
65#[doc(hidden)]
66pub mod pairing;
67pub mod paths;
68#[doc(hidden)]
69pub mod roster;
70#[doc(hidden)]
71pub mod stream;
72#[doc(hidden)]
73pub mod util;