Skip to main content

stand_in/
lib.rs

1//! # stand-in
2//!
3//! A stand-in for your MCP server boilerplate.
4//!
5//! You write declarative macros that look like your MCP server — tools, resources, prompts —
6//! but when the compiler rolls, the macros step aside and production-ready code takes their place.
7//!
8//! ## Quick Start
9//!
10//! ```rust,ignore
11//! use stand_in::prelude::*;
12//!
13//! #[mcp_tool(
14//!     name = "get_weather",
15//!     description = "Returns current weather for a given city"
16//! )]
17//! async fn get_weather(city: String) -> Result<String> {
18//!     Ok(format!("{}: sunny", city))
19//! }
20//!
21//! #[mcp_server]
22//! struct MyServer;
23//!
24//! #[tokio::main]
25//! async fn main() {
26//!     MyServer::serve(StdioTransport::default()).await;
27//! }
28//! ```
29
30pub mod error;
31pub mod protocol;
32pub mod server;
33pub mod tool;
34pub mod transport;
35
36pub use stand_in_macros::*;
37
38/// Prelude module — import everything you need with `use stand_in::prelude::*`.
39pub mod prelude {
40    pub use crate::error::{Error, Result};
41    pub use crate::protocol::{JsonRpcError, JsonRpcNotification, JsonRpcRequest, JsonRpcResponse};
42    pub use crate::server::{
43        ClientInfo, InitializeParams, InitializeResult, RequestHandler, ServerCapabilities,
44        ServerInfo, ToolsCapability,
45    };
46    pub use crate::tool::{
47        CallToolParams, CallToolResult, Content, InputSchema, ListToolsResult, McpTool,
48        ToolDefinition, ToolRegistry,
49    };
50    #[cfg(feature = "http")]
51    pub use crate::transport::HttpTransport;
52    #[cfg(feature = "stdio")]
53    pub use crate::transport::StdioTransport;
54    pub use crate::transport::Transport;
55    pub use stand_in_macros::*;
56}