use stand_in::prelude::*;
#[mcp_resource(
uri = "info://version",
name = "Server Version",
description = "Stand-in resource server version info",
mime_type = "application/json"
)]
async fn server_version() -> Result<String> {
Ok(serde_json::json!({
"name": env!("CARGO_PKG_NAME"),
"version": env!("CARGO_PKG_VERSION")
})
.to_string())
}
#[mcp_resource(
uri = "config://settings",
name = "Server Settings",
mime_type = "application/json"
)]
async fn server_settings() -> Result<String> {
Ok(serde_json::json!({
"max_connections": 100,
"timeout": 30
})
.to_string())
}
#[mcp_resource(
uri = "docs://{topic}/readme",
name = "Documentation",
description = "Documentation for a given topic",
mime_type = "text/markdown"
)]
async fn docs_readme(topic: String) -> Result<String> {
Ok(format!("# {topic}\n\nDocumentation for **{topic}**."))
}
#[mcp_server]
struct ResourceServer;
#[tokio::main]
async fn main() {
ResourceServer::serve(StdioTransport).await.unwrap();
}