Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions conformance/src/bin/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,8 @@ async fn perform_oauth_flow_preregistered(
manager.set_metadata(metadata);

// Configure with pre-registered credentials
let config = rmcp::transport::auth::OAuthClientConfig {
client_id: client_id.to_string(),
client_secret: Some(client_secret.to_string()),
scopes: vec![],
redirect_uri: REDIRECT_URI.to_string(),
};
let config = rmcp::transport::auth::OAuthClientConfig::new(client_id, REDIRECT_URI)
.with_client_secret(client_secret);
manager.configure_client(config)?;

let scopes = manager.select_scopes(None, &[]);
Expand Down
5 changes: 1 addition & 4 deletions conformance/src/bin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -818,10 +818,7 @@ async fn main() -> anyhow::Result<()> {
tracing::info!("Starting conformance server on {}", bind_addr);

let server = ConformanceServer::new();
let config = StreamableHttpServerConfig {
stateful_mode: true,
..Default::default()
};
let config = StreamableHttpServerConfig::default();
let service = StreamableHttpService::new(
move || Ok(server.clone()),
LocalSessionManager::default().into(),
Expand Down
4 changes: 4 additions & 0 deletions crates/rmcp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ readme = { workspace = true }
description = "Rust SDK for Model Context Protocol"
documentation = "https://docs.rs/rmcp"

[lints.clippy]
exhaustive_structs = "warn"
exhaustive_enums = "warn"

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
Expand Down
2 changes: 2 additions & 0 deletions crates/rmcp/src/handler/server/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ where
}
}

#[allow(clippy::exhaustive_structs)]
pub struct Extension<T>(pub T);

impl<C, T> FromContextPart<C> for Extension<T>
Expand Down Expand Up @@ -182,6 +183,7 @@ where
}
}

#[allow(clippy::exhaustive_structs)]
pub struct RequestId(pub crate::model::RequestId);

impl<C> FromContextPart<C> for RequestId
Expand Down
3 changes: 3 additions & 0 deletions crates/rmcp/src/handler/server/prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use crate::{
};

/// Context for prompt retrieval operations
#[non_exhaustive]
pub struct PromptContext<'a, S> {
pub server: &'a S,
pub name: String,
Expand Down Expand Up @@ -117,6 +118,7 @@ impl<T: IntoGetPromptResult> IntoGetPromptResult for Result<T, crate::ErrorData>
// Future wrapper that automatically handles IntoGetPromptResult conversion
pin_project_lite::pin_project! {
#[project = IntoGetPromptResultFutProj]
#[non_exhaustive]
pub enum IntoGetPromptResultFut<F, R> {
Pending {
#[pin]
Expand Down Expand Up @@ -151,6 +153,7 @@ where
}

// Prompt-specific extractor for prompt name
#[allow(clippy::exhaustive_structs)]
pub struct PromptName(pub String);

impl<S> FromContextPart<PromptContext<'_, S>> for PromptName {
Expand Down
1 change: 1 addition & 0 deletions crates/rmcp/src/handler/server/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::{
pub mod prompt;
pub mod tool;

#[non_exhaustive]
pub struct Router<S> {
pub tool_router: tool::ToolRouter<S>,
pub prompt_router: prompt::PromptRouter<S>,
Expand Down
3 changes: 3 additions & 0 deletions crates/rmcp/src/handler/server/router/prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::{
service::{MaybeBoxFuture, MaybeSend},
};

#[non_exhaustive]
pub struct PromptRoute<S> {
#[allow(clippy::type_complexity)]
pub get: Arc<DynGetPromptHandler<S>>,
Expand Down Expand Up @@ -90,6 +91,7 @@ where
}

/// Adapter for functions generated by the #\[prompt\] macro
#[allow(clippy::exhaustive_structs)]
pub struct PromptAttrGenerateFunctionAdapter;

impl<S, F> IntoPromptRoute<S, PromptAttrGenerateFunctionAdapter> for F
Expand All @@ -103,6 +105,7 @@ where
}

#[derive(Debug)]
#[non_exhaustive]
pub struct PromptRouter<S> {
#[allow(clippy::type_complexity)]
pub map: std::collections::HashMap<Cow<'static, str>, PromptRoute<S>>,
Expand Down
4 changes: 4 additions & 0 deletions crates/rmcp/src/handler/server/router/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ use crate::{
service::{MaybeBoxFuture, MaybeSend},
};

#[non_exhaustive]
pub struct ToolRoute<S> {
#[allow(clippy::type_complexity)]
pub call: Arc<DynCallToolHandler<S>>,
Expand Down Expand Up @@ -216,6 +217,7 @@ where
}
}

#[allow(clippy::exhaustive_structs)]
pub struct ToolAttrGenerateFunctionAdapter;
impl<S, F> IntoToolRoute<S, ToolAttrGenerateFunctionAdapter> for F
where
Expand Down Expand Up @@ -251,6 +253,7 @@ where
}
}

#[non_exhaustive]
pub struct WithToolAttr<C, S, A>
where
C: CallToolHandler<S, A> + MaybeSend + Clone + 'static,
Expand Down Expand Up @@ -292,6 +295,7 @@ where
}
}
#[derive(Debug)]
#[non_exhaustive]
pub struct ToolRouter<S> {
#[allow(clippy::type_complexity)]
pub map: std::collections::HashMap<Cow<'static, str>, ToolRoute<S>>,
Expand Down
3 changes: 3 additions & 0 deletions crates/rmcp/src/handler/server/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub fn parse_json_object<T: DeserializeOwned>(input: JsonObject) -> Result<T, cr
)
})
}
#[non_exhaustive]
pub struct ToolCallContext<'s, S> {
pub request_context: RequestContext<RoleServer>,
pub service: &'s S,
Expand Down Expand Up @@ -104,6 +105,7 @@ impl<T: IntoCallToolResult> IntoCallToolResult for Result<T, crate::ErrorData> {

pin_project_lite::pin_project! {
#[project = IntoCallToolResultFutProj]
#[non_exhaustive]
pub enum IntoCallToolResultFut<F, R> {
Pending {
#[pin]
Expand Down Expand Up @@ -163,6 +165,7 @@ pub type DynCallToolHandler<S> =
-> futures::future::LocalBoxFuture<'s, Result<CallToolResult, crate::ErrorData>>;

// Tool-specific extractor for tool name
#[allow(clippy::exhaustive_structs)]
pub struct ToolName(pub Cow<'static, str>);

impl<S> FromContextPart<ToolCallContext<'_, S>> for ToolName {
Expand Down
1 change: 1 addition & 0 deletions crates/rmcp/src/handler/server/wrapper/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use crate::{
/// serialized as structured JSON content with an associated schema.
/// The framework will place the JSON in the `structured_content` field
/// of the tool result rather than the regular `content` field.
#[allow(clippy::exhaustive_structs)]
pub struct Json<T>(pub T);

// Implement JsonSchema for Json<T> to delegate to T's schema
Expand Down
1 change: 1 addition & 0 deletions crates/rmcp/src/handler/server/wrapper/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ use schemars::JsonSchema;
/// - Returns appropriate error responses if deserialization fails
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(transparent)]
#[allow(clippy::exhaustive_structs)]
pub struct Parameters<P>(pub P);

impl<P: JsonSchema> JsonSchema for Parameters<P> {
Expand Down
Loading
Loading