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 { cmd: vec!["my-mcp-server".into()] },
23//! vec![],
24//! ).await?;
25//! let invite = control.invite(vec!["notes".into()]).await?;
26//! println!("send this to a friend: {}", invite.invite_line);
27//! # Ok(())
28//! # }
29//! ```
30//!
31//! The node is a full peer: everything the mcpmesh daemon can do — pairing, live MCP
32//! sessions (`open_session`), roster/org mode, blobs, audit — works through
33//! [`Node::control`], because it runs the daemon's own handlers.
34
35/// This crate's version — the mcpmesh release-train version the daemon binary ships on.
36pub const VERSION: &str = env!("CARGO_PKG_VERSION");
37
38pub use config::Config;
39pub use node::{Node, NodeBuilder, StartError};
40pub use paths::NodePaths;
41
42#[doc(hidden)]
43pub mod allowlist;
44#[doc(hidden)]
45pub mod audit;
46#[doc(hidden)]
47pub mod backends;
48#[doc(hidden)]
49pub mod blobs;
50#[doc(hidden)]
51pub mod config;
52#[doc(hidden)]
53pub mod control;
54#[doc(hidden)]
55pub mod daemon;
56#[doc(hidden)]
57pub mod ipc;
58#[doc(hidden)]
59pub mod limits;
60pub mod node;
61#[doc(hidden)]
62pub mod pairing;
63pub mod paths;
64#[doc(hidden)]
65pub mod roster;
66#[doc(hidden)]
67pub mod stream;
68#[doc(hidden)]
69pub mod util;