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 prompt;
32pub mod protocol;
33pub mod server;
34pub mod tool;
35pub mod transport;
36
37pub use stand_in_macros::*;
38
39/// Prelude module — import everything you need with `use stand_in::prelude::*`.
40pub mod prelude {
41    pub use crate::error::{Error, Result};
42    pub use crate::prompt::{Prompt, PromptMessage};
43    pub use crate::protocol::{JsonRpcError, JsonRpcNotification, JsonRpcRequest, JsonRpcResponse};
44    pub use crate::server::{
45        ClientInfo, InitializeParams, InitializeResult, RequestHandler, ServerCapabilities,
46        ServerInfo, ToolsCapability,
47    };
48    pub use crate::tool::{
49        CallToolParams, CallToolResult, Content, InputSchema, ListToolsResult, McpTool,
50        ToolDefinition, ToolRegistry,
51    };
52    #[cfg(feature = "http")]
53    pub use crate::transport::HttpTransport;
54    #[cfg(feature = "stdio")]
55    pub use crate::transport::StdioTransport;
56    pub use crate::transport::Transport;
57    pub use stand_in_macros::*;
58}