1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//! Procedural macros for stand-in MCP server framework.
//!
//! This crate provides the following macros:
//! - `#[mcp_server]` — Wire everything together, generates initialization and dispatch
//! - `#[mcp_tool]` — Declare a tool with typed parameters
//! - `#[mcp_resource]` — Expose a resource with URI templates
//! - `#[mcp_prompt]` — Define reusable prompt templates
use TokenStream;
/// Marks a struct as an MCP server.
///
/// Generates initialization, capability negotiation, and dispatch logic.
///
/// # Example
///
/// ```rust,ignore
/// #[mcp_server]
/// struct MyServer;
/// ```
/// Marks an async function as an MCP tool.
///
/// The macro infers the JSON Schema from the function signature and generates
/// the `McpTool` implementation automatically.
///
/// # Example
///
/// ```rust,ignore
/// #[mcp_tool(
/// name = "get_weather",
/// description = "Returns current weather for a given city"
/// )]
/// async fn get_weather(city: String) -> Result<String> {
/// Ok(format!("{}: sunny", city))
/// }
/// ```
/// Marks an async function as an MCP resource.
///
/// # Example
///
/// ```rust,ignore
/// #[mcp_resource(
/// uri = "project://{project_id}/readme",
/// description = "The project README"
/// )]
/// async fn project_readme(project_id: String) -> Result<String> {
/// Ok("# README".to_string())
/// }
/// ```
/// Marks an async function as an MCP prompt template.
///
/// # Example
///
/// ```rust,ignore
/// #[mcp_prompt(
/// name = "summarize_project",
/// description = "Generate a project status summary"
/// )]
/// async fn summarize_project(project_id: String) -> Result<Prompt> {
/// Ok(Prompt::user("Summarize this project"))
/// }
/// ```