rust-sdk/examples/servers/Cargo.toml
Michael Assaf 9349f5cb26
feat: Add prompt support (#351)
* feat: add prompt support with typed argument handling

- Implement #[prompt], #[prompt_router], and #[prompt_handler] macros
- Add automatic JSON schema generation from Rust types for arguments
- Support flexible async handler signatures with automatic adaptation
- Create PromptRouter for efficient prompt dispatch
- Include comprehensive tests and example implementation

This enables MCP servers to provide reusable prompt templates that
LLMs can discover and invoke with strongly-typed parameters, similar
to the existing tool system but optimized for prompt use cases.

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>

* refactor: unify parameter handling between tools and prompts

- Replace Arguments<T> with Parameters<T> for consistent API
- Create shared common module for tool/prompt utilities
- Modernize async handling with futures::future::BoxFuture
- Move cached_schema_for_type to common module for reuse
- Update error types from rmcp::Error to rmcp::ErrorData
- Add comprehensive trait implementations for parameter extraction

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor: extract Parameters wrapper to shared module and unify trait usage

- Move Parameters type from common.rs to dedicated wrapper/parameters.rs module
- Unify extractor traits by using FromContextPart for both tools and prompts
- Remove duplicate FromToolCallContextPart and FromPromptContextPart traits
- Add structured output support to Json wrapper with IntoCallToolResult impl
- Improve error messages with more descriptive panic for schema serialization
- Update all imports across codebase to use new module path
- Clean up trailing whitespace and formatting inconsistencies

This consolidates parameter extraction logic and reduces code duplication
between tool and prompt handlers while maintaining backward compatibility.

* chore: remove committed .egg-info directory and update gitignore

* docs: fix documentation formatting
2025-08-21 11:22:19 +08:00

100 lines
2.1 KiB
TOML

[package]
name = "mcp-server-examples"
version = "0.1.5"
edition = "2024"
publish = false
[dependencies]
rmcp = { workspace = true, features = [
"server",
"macros",
"transport-sse-server",
"transport-io",
"transport-streamable-http-server",
"auth",
"elicitation",
"schemars",
] }
tokio = { version = "1", features = [
"macros",
"rt",
"rt-multi-thread",
"io-std",
"signal",
] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
anyhow = "1.0"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = [
"env-filter",
"std",
"fmt",
] }
futures = "0.3"
rand = { version = "0.9", features = ["std"] }
axum = { version = "0.8", features = ["macros"] }
schemars = "1.0"
reqwest = { version = "0.12", features = ["json"] }
chrono = "0.4"
uuid = { version = "1.6", features = ["v4", "serde"] }
serde_urlencoded = "0.7"
askama = { version = "0.14" }
tower-http = { version = "0.6", features = ["cors"] }
hyper = { version = "1" }
hyper-util = { version = "0", features = ["server"] }
tokio-util = { version = "0.7" }
[dev-dependencies]
tokio-stream = { version = "0.1" }
tokio-util = { version = "0.7", features = ["codec"] }
[[example]]
name = "servers_counter_stdio"
path = "src/counter_stdio.rs"
[[example]]
name = "servers_counter_sse"
path = "src/counter_sse.rs"
[[example]]
name = "servers_counter_sse_directly"
path = "src/counter_sse_directly.rs"
[[example]]
name = "servers_memory_stdio"
path = "src/memory_stdio.rs"
[[example]]
name = "servers_counter_streamhttp"
path = "src/counter_streamhttp.rs"
[[example]]
name = "servers_complex_auth_sse"
path = "src/complex_auth_sse.rs"
[[example]]
name = "servers_simple_auth_sse"
path = "src/simple_auth_sse.rs"
[[example]]
name = "servers_prompt_stdio"
path = "src/prompt_stdio.rs"
[[example]]
name = "counter_hyper_streamable_http"
path = "src/counter_hyper_streamable_http.rs"
[[example]]
name = "servers_sampling_stdio"
path = "src/sampling_stdio.rs"
[[example]]
name = "servers_structured_output"
path = "src/structured_output.rs"
[[example]]
name = "servers_elicitation_stdio"
path = "src/elicitation_stdio.rs"