Skip to main content

nestrs_mcp/
lib.rs

1//! `nestrs-mcp` — Model Context Protocol server for nestrs.
2//!
3//! Crate root. The binary entry point lives in `main.rs`; this `lib.rs`
4//! exposes the server so embedders (e.g. a future `nestrs-cli` `mcp`
5//! subcommand) can mount it without spawning a subprocess.
6//!
7//! ## Module layout
8//!
9//! - [`error`] — crate-level `Error` type and `Result` alias.
10//! - [`introspection`] — source-level + live-registry snapshot.
11//! - [`docs`] — local-file docs search (CHANGELOG, mdBook, READMEs).
12//! - [`scaffold`] — `new_project` / `create_module` / `create_resource` /
13//!   `create_dto` / `generate_crud`.
14//! - [`runtime`] — HTTP client for the live admin port on a running app.
15//! - [`server`] — the `ServerHandler` + `#[tool_router]` aggregator.
16//! - [`tools`] — one module per surface, each implementing a group of MCP
17//!   `#[tool]` methods.
18
19#![warn(missing_debug_implementations)]
20#![warn(rust_2018_idioms)]
21
22pub mod docs;
23pub mod error;
24pub mod introspection;
25#[cfg(feature = "authz")]
26pub mod mcp_data_context;
27pub mod runtime;
28pub mod scaffold;
29pub mod server;
30pub mod surfaces;
31pub mod tools;
32pub mod wizard;
33
34pub use error::{Error, Result};
35
36#[cfg(feature = "admin")]
37pub use nestrs::admin::{AdminHandle, AdminOptions};
38
39#[cfg(feature = "authz")]
40pub use mcp_data_context::{current_mcp_ability, current_mcp_transaction, McpDataContext};
41
42#[cfg(feature = "elicitation")]
43pub use surfaces::ElicitationHandler;
44pub use surfaces::{
45    assistant_text, elicit_input, input_responses, text_contents, user_text, CacheHints,
46    McpSurfaces,
47};