feat(model): add ServerConfig and ClientConfig (#1266)
This commit is contained in:
parent
fbfc5cc96e
commit
165ff92df1
63 changed files with 331 additions and 303 deletions
36
README.md
36
README.md
|
|
@ -99,10 +99,10 @@ Use [`ClientServiceExt::serve_with_lifecycle`](crates/rmcp/src/service/client.rs
|
||||||
select another lifecycle explicitly:
|
select another lifecycle explicitly:
|
||||||
|
|
||||||
```rust, ignore
|
```rust, ignore
|
||||||
use rmcp::{ClientLifecycleMode, ClientServiceExt, InitializeRequestParams, ProtocolVersion};
|
use rmcp::{ClientLifecycleMode, ClientServiceExt, ProtocolVersion, model::ClientConfig};
|
||||||
|
|
||||||
// Start directly with server/discover and include client metadata on every request.
|
// Start directly with server/discover and include client metadata on every request.
|
||||||
let client = InitializeRequestParams::default()
|
let client = ClientConfig::default()
|
||||||
.serve_with_lifecycle(
|
.serve_with_lifecycle(
|
||||||
transport,
|
transport,
|
||||||
ClientLifecycleMode::Discover {
|
ClientLifecycleMode::Discover {
|
||||||
|
|
@ -113,7 +113,7 @@ let client = InitializeRequestParams::default()
|
||||||
|
|
||||||
// Or probe the discover lifecycle and fall back when a legacy server reports
|
// Or probe the discover lifecycle and fall back when a legacy server reports
|
||||||
// that server/discover is not implemented or does not respond within 10 seconds.
|
// that server/discover is not implemented or does not respond within 10 seconds.
|
||||||
let client = InitializeRequestParams::default()
|
let client = ClientConfig::default()
|
||||||
.serve_with_lifecycle(
|
.serve_with_lifecycle(
|
||||||
transport,
|
transport,
|
||||||
ClientLifecycleMode::Auto {
|
ClientLifecycleMode::Auto {
|
||||||
|
|
@ -369,8 +369,8 @@ use serde_json::json;
|
||||||
struct MyServer;
|
struct MyServer;
|
||||||
|
|
||||||
impl ServerHandler for MyServer {
|
impl ServerHandler for MyServer {
|
||||||
fn get_info(&self) -> InitializeResult {
|
fn get_info(&self) -> ServerConfig {
|
||||||
InitializeResult::new(
|
ServerConfig::new(
|
||||||
ServerCapabilities::builder()
|
ServerCapabilities::builder()
|
||||||
.enable_resources()
|
.enable_resources()
|
||||||
.build(),
|
.build(),
|
||||||
|
|
@ -582,8 +582,8 @@ impl MyServer {
|
||||||
|
|
||||||
#[prompt_handler]
|
#[prompt_handler]
|
||||||
impl ServerHandler for MyServer {
|
impl ServerHandler for MyServer {
|
||||||
fn get_info(&self) -> InitializeResult {
|
fn get_info(&self) -> ServerConfig {
|
||||||
InitializeResult::new(ServerCapabilities::builder().enable_prompts().build())
|
ServerConfig::new(ServerCapabilities::builder().enable_prompts().build())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
@ -934,8 +934,8 @@ Enable the logging capability, handle level changes from the client, and send lo
|
||||||
use rmcp::{ServerHandler, model::*, service::RequestContext};
|
use rmcp::{ServerHandler, model::*, service::RequestContext};
|
||||||
|
|
||||||
impl ServerHandler for MyServer {
|
impl ServerHandler for MyServer {
|
||||||
fn get_info(&self) -> InitializeResult {
|
fn get_info(&self) -> ServerConfig {
|
||||||
InitializeResult::new(
|
ServerConfig::new(
|
||||||
ServerCapabilities::builder()
|
ServerCapabilities::builder()
|
||||||
.enable_logging()
|
.enable_logging()
|
||||||
.build(),
|
.build(),
|
||||||
|
|
@ -1007,8 +1007,8 @@ Enable the completions capability and implement the `complete()` handler. Use `r
|
||||||
use rmcp::{ErrorData as McpError, ServerHandler, model::*, service::RequestContext, RoleServer};
|
use rmcp::{ErrorData as McpError, ServerHandler, model::*, service::RequestContext, RoleServer};
|
||||||
|
|
||||||
impl ServerHandler for MyServer {
|
impl ServerHandler for MyServer {
|
||||||
fn get_info(&self) -> InitializeResult {
|
fn get_info(&self) -> ServerConfig {
|
||||||
InitializeResult::new(
|
ServerConfig::new(
|
||||||
ServerCapabilities::builder()
|
ServerCapabilities::builder()
|
||||||
.enable_completions()
|
.enable_completions()
|
||||||
.enable_prompts()
|
.enable_prompts()
|
||||||
|
|
@ -1253,8 +1253,8 @@ use rmcp::{
|
||||||
};
|
};
|
||||||
|
|
||||||
impl ServerHandler for MyServer {
|
impl ServerHandler for MyServer {
|
||||||
fn get_info(&self) -> InitializeResult {
|
fn get_info(&self) -> ServerConfig {
|
||||||
InitializeResult::new(
|
ServerConfig::new(
|
||||||
ServerCapabilities::builder()
|
ServerCapabilities::builder()
|
||||||
.enable_tools()
|
.enable_tools()
|
||||||
.enable_tool_list_changed()
|
.enable_tool_list_changed()
|
||||||
|
|
@ -1584,7 +1584,7 @@ use rmcp::transport::StreamableHttpClientTransport;
|
||||||
|
|
||||||
// Defaults are stateless-friendly.
|
// Defaults are stateless-friendly.
|
||||||
let transport = StreamableHttpClientTransport::from_uri("http://localhost:8000/mcp");
|
let transport = StreamableHttpClientTransport::from_uri("http://localhost:8000/mcp");
|
||||||
let client = InitializeRequestParams::default().serve(transport).await?;
|
let client = ClientConfig::default().serve(transport).await?;
|
||||||
```
|
```
|
||||||
|
|
||||||
**Example:** [`examples/servers/src/counter_streamhttp.rs`](examples/servers/src/counter_streamhttp.rs) (server), [`examples/clients/src/streamable_http.rs`](examples/clients/src/streamable_http.rs) (client)
|
**Example:** [`examples/servers/src/counter_streamhttp.rs`](examples/servers/src/counter_streamhttp.rs) (server), [`examples/clients/src/streamable_http.rs`](examples/clients/src/streamable_http.rs) (client)
|
||||||
|
|
@ -1638,7 +1638,7 @@ server example). The client transport connects with a single URI:
|
||||||
use rmcp::transport::StreamableHttpClientTransport;
|
use rmcp::transport::StreamableHttpClientTransport;
|
||||||
|
|
||||||
let transport = StreamableHttpClientTransport::from_uri("http://localhost:8000/mcp");
|
let transport = StreamableHttpClientTransport::from_uri("http://localhost:8000/mcp");
|
||||||
let client = InitializeRequestParams::default().serve(transport).await?;
|
let client = ClientConfig::default().serve(transport).await?;
|
||||||
```
|
```
|
||||||
|
|
||||||
The client allows up to 16 ordinary http POSTs at once. Configure this with
|
The client allows up to 16 ordinary http POSTs at once. Configure this with
|
||||||
|
|
@ -1742,10 +1742,10 @@ knows what the other supports. Declare yours with the `ServerCapabilities`
|
||||||
builder in `get_info()`:
|
builder in `get_info()`:
|
||||||
|
|
||||||
```rust,ignore
|
```rust,ignore
|
||||||
use rmcp::model::{InitializeResult, ServerCapabilities};
|
use rmcp::model::{ServerCapabilities, ServerConfig};
|
||||||
|
|
||||||
fn get_info(&self) -> InitializeResult {
|
fn get_info(&self) -> ServerConfig {
|
||||||
InitializeResult::new(
|
ServerConfig::new(
|
||||||
ServerCapabilities::builder()
|
ServerCapabilities::builder()
|
||||||
.enable_tools()
|
.enable_tools()
|
||||||
.enable_prompts()
|
.enable_prompts()
|
||||||
|
|
|
||||||
|
|
@ -74,8 +74,8 @@ impl ClientHandler for BasicClientHandler {}
|
||||||
struct ElicitationDefaultsClientHandler;
|
struct ElicitationDefaultsClientHandler;
|
||||||
|
|
||||||
impl ClientHandler for ElicitationDefaultsClientHandler {
|
impl ClientHandler for ElicitationDefaultsClientHandler {
|
||||||
fn get_info(&self) -> InitializeRequestParams {
|
fn get_info(&self) -> ClientConfig {
|
||||||
let mut info = InitializeRequestParams::default();
|
let mut info = ClientConfig::default();
|
||||||
info.capabilities.elicitation = Some(
|
info.capabilities.elicitation = Some(
|
||||||
ElicitationCapability::new()
|
ElicitationCapability::new()
|
||||||
.with_form(FormElicitationCapability::new().with_schema_validation(true)),
|
.with_form(FormElicitationCapability::new().with_schema_validation(true)),
|
||||||
|
|
@ -163,8 +163,8 @@ impl ClientHandler for ElicitationDefaultsClientHandler {
|
||||||
struct FullClientHandler;
|
struct FullClientHandler;
|
||||||
|
|
||||||
impl ClientHandler for FullClientHandler {
|
impl ClientHandler for FullClientHandler {
|
||||||
fn get_info(&self) -> InitializeRequestParams {
|
fn get_info(&self) -> ClientConfig {
|
||||||
let mut info = InitializeRequestParams::default();
|
let mut info = ClientConfig::default();
|
||||||
info.capabilities.elicitation = Some(
|
info.capabilities.elicitation = Some(
|
||||||
ElicitationCapability::new()
|
ElicitationCapability::new()
|
||||||
.with_form(FormElicitationCapability::new().with_schema_validation(true)),
|
.with_form(FormElicitationCapability::new().with_schema_validation(true)),
|
||||||
|
|
|
||||||
|
|
@ -704,8 +704,8 @@ impl ServerHandler for ConformanceServer {
|
||||||
(name == "test_custom_header").then(custom_header_tool)
|
(name == "test_custom_header").then(custom_header_tool)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_info(&self) -> InitializeResult {
|
fn get_info(&self) -> ServerConfig {
|
||||||
InitializeResult::new(
|
ServerConfig::new(
|
||||||
ServerCapabilities::builder()
|
ServerCapabilities::builder()
|
||||||
.enable_prompts()
|
.enable_prompts()
|
||||||
.enable_prompts_list_changed()
|
.enable_prompts_list_changed()
|
||||||
|
|
|
||||||
|
|
@ -217,8 +217,8 @@ pub fn tool_router(attr: TokenStream, input: TokenStream) -> TokenStream {
|
||||||
/// ```rust,ignore
|
/// ```rust,ignore
|
||||||
/// #[tool_handler]
|
/// #[tool_handler]
|
||||||
/// impl ServerHandler for MyToolHandler {
|
/// impl ServerHandler for MyToolHandler {
|
||||||
/// fn get_info(&self) -> InitializeResult {
|
/// fn get_info(&self) -> ServerConfig {
|
||||||
/// InitializeResult::new(ServerCapabilities::builder().enable_tools().build())
|
/// ServerConfig::new(ServerCapabilities::builder().enable_tools().build())
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ pub(crate) enum CallerCapability {
|
||||||
Prompts,
|
Prompts,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Build a `get_info()` method that returns `InitializeResult` with the appropriate capabilities.
|
/// Build a `get_info()` method that returns `ServerConfig` with the appropriate capabilities.
|
||||||
///
|
///
|
||||||
/// The caller declares its own capability via `caller`. Sibling handler attributes
|
/// The caller declares its own capability via `caller`. Sibling handler attributes
|
||||||
/// (`prompt_handler`, `tool_handler`) are detected automatically
|
/// (`prompt_handler`, `tool_handler`) are detected automatically
|
||||||
|
|
@ -157,8 +157,8 @@ pub(crate) fn build_get_info(
|
||||||
}
|
}
|
||||||
|
|
||||||
syn::parse2::<ImplItem>(quote! {
|
syn::parse2::<ImplItem>(quote! {
|
||||||
fn get_info(&self) -> rmcp::model::InitializeResult {
|
fn get_info(&self) -> rmcp::model::ServerConfig {
|
||||||
rmcp::model::InitializeResult::new(
|
rmcp::model::ServerConfig::new(
|
||||||
rmcp::model::ServerCapabilities::builder()
|
rmcp::model::ServerCapabilities::builder()
|
||||||
#(#capability_calls)*
|
#(#capability_calls)*
|
||||||
.build()
|
.build()
|
||||||
|
|
|
||||||
|
|
@ -274,8 +274,8 @@ macro_rules! client_handler_methods {
|
||||||
std::future::ready(())
|
std::future::ready(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_info(&self) -> ClientInfo {
|
fn get_info(&self) -> ClientConfig {
|
||||||
InitializeRequestParams::default()
|
ClientConfig::default()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -292,12 +292,12 @@ pub trait ClientHandler: Sized + 'static {
|
||||||
client_handler_methods!();
|
client_handler_methods!();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Do nothing, with default client info.
|
/// Do nothing, with the default client config.
|
||||||
impl ClientHandler for () {}
|
impl ClientHandler for () {}
|
||||||
|
|
||||||
/// Do nothing, with a specific client info.
|
/// Do nothing, with a specific client config.
|
||||||
impl ClientHandler for ClientInfo {
|
impl ClientHandler for ClientConfig {
|
||||||
fn get_info(&self) -> ClientInfo {
|
fn get_info(&self) -> ClientConfig {
|
||||||
self.clone()
|
self.clone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -422,7 +422,7 @@ macro_rules! impl_client_handler_for_wrapper {
|
||||||
(**self).on_custom_notification(notification, context)
|
(**self).on_custom_notification(notification, context)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_info(&self) -> ClientInfo {
|
fn get_info(&self) -> ClientConfig {
|
||||||
(**self).get_info()
|
(**self).get_info()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -334,15 +334,15 @@ macro_rules! server_handler_methods {
|
||||||
/// ```
|
/// ```
|
||||||
/// use rmcp::{
|
/// use rmcp::{
|
||||||
/// ErrorData as McpError, RoleServer, ServerHandler,
|
/// ErrorData as McpError, RoleServer, ServerHandler,
|
||||||
/// model::{InitializeRequestParams, InitializeResult, ServerInfo},
|
/// model::{InitializeRequestParams, InitializeResult, ServerConfig},
|
||||||
/// service::RequestContext,
|
/// service::RequestContext,
|
||||||
/// };
|
/// };
|
||||||
///
|
///
|
||||||
/// struct MyServer;
|
/// struct MyServer;
|
||||||
///
|
///
|
||||||
/// impl ServerHandler for MyServer {
|
/// impl ServerHandler for MyServer {
|
||||||
/// fn get_info(&self) -> ServerInfo {
|
/// fn get_info(&self) -> ServerConfig {
|
||||||
/// ServerInfo::default()
|
/// ServerConfig::default()
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// async fn initialize(
|
/// async fn initialize(
|
||||||
|
|
@ -600,8 +600,8 @@ macro_rules! server_handler_methods {
|
||||||
std::future::ready(())
|
std::future::ready(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_info(&self) -> ServerInfo {
|
fn get_info(&self) -> ServerConfig {
|
||||||
InitializeResult::default()
|
ServerConfig::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// SEP-2663 `tasks/get`: return the current [`DetailedTask`] state.
|
/// SEP-2663 `tasks/get`: return the current [`DetailedTask`] state.
|
||||||
|
|
@ -839,7 +839,7 @@ macro_rules! impl_server_handler_for_wrapper {
|
||||||
(**self).on_custom_notification(notification, context)
|
(**self).on_custom_notification(notification, context)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_info(&self) -> ServerInfo {
|
fn get_info(&self) -> ServerConfig {
|
||||||
(**self).get_info()
|
(**self).get_info()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1119,26 +1119,58 @@ impl InitializeResult {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Full server initialize payload (`InitializeResult`).
|
/// A server's own configuration: the protocol version, capabilities,
|
||||||
|
/// implementation identity, and instructions it advertises to clients.
|
||||||
///
|
///
|
||||||
/// Prefer [`InitializeResult`]. The name collides with the protocol's
|
/// This is what `ServerHandler::get_info` returns. It is an alias for
|
||||||
/// `serverInfo` field, which is only the [`Implementation`] identity (#1082).
|
/// [`InitializeResult`] because the same value is sent as the `initialize`
|
||||||
//
|
/// response on the wire.
|
||||||
// The signatures this crate publishes (`ServerHandler::get_info`,
|
///
|
||||||
// `DiscoverResult::from_server_info`, and the `ClientInfo` equivalents below)
|
/// # Examples
|
||||||
// keep spelling the alias. It resolves to the same type, so the spelling makes
|
///
|
||||||
// no difference to callers, but rustdoc records the name as written and the
|
/// ```
|
||||||
// public API check treats a respelling as a changed item. Moving those
|
/// use rmcp::model::{ServerCapabilities, ServerConfig};
|
||||||
// signatures onto the canonical names is a documented API change and belongs in
|
///
|
||||||
// the next major release.
|
/// let config = ServerConfig::new(ServerCapabilities::builder().enable_tools().build())
|
||||||
#[deprecated(note = "use `InitializeResult` instead")]
|
/// .with_instructions("Call `add` to sum two numbers.");
|
||||||
|
/// assert!(config.capabilities.tools.is_some());
|
||||||
|
/// ```
|
||||||
|
pub type ServerConfig = InitializeResult;
|
||||||
|
|
||||||
|
/// A client's own configuration: the protocol version, capabilities, and
|
||||||
|
/// implementation identity it advertises to servers.
|
||||||
|
///
|
||||||
|
/// This is what `ClientHandler::get_info` returns. It is an alias for
|
||||||
|
/// [`InitializeRequestParams`] because the same value is sent as the
|
||||||
|
/// `initialize` request on the wire.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// use rmcp::model::{ClientCapabilities, ClientConfig, Implementation};
|
||||||
|
///
|
||||||
|
/// let config = ClientConfig::new(
|
||||||
|
/// ClientCapabilities::builder().enable_elicitation().build(),
|
||||||
|
/// Implementation::new("my-client", "1.0.0"),
|
||||||
|
/// );
|
||||||
|
/// assert!(config.capabilities.elicitation.is_some());
|
||||||
|
/// ```
|
||||||
|
pub type ClientConfig = InitializeRequestParams;
|
||||||
|
|
||||||
|
/// Deprecated alias for [`ServerConfig`].
|
||||||
|
///
|
||||||
|
/// The name collides with the protocol's `serverInfo` field, which is only the
|
||||||
|
/// [`Implementation`] identity, so `server_info.server_info` was easy to
|
||||||
|
/// misread (#1082).
|
||||||
|
#[deprecated(note = "use `ServerConfig` instead")]
|
||||||
pub type ServerInfo = InitializeResult;
|
pub type ServerInfo = InitializeResult;
|
||||||
|
|
||||||
/// Full client initialize params (`InitializeRequestParams`).
|
/// Deprecated alias for [`ClientConfig`].
|
||||||
///
|
///
|
||||||
/// Prefer [`InitializeRequestParams`]. The name collides with the protocol's
|
/// The name collides with the protocol's `clientInfo` field, which is only the
|
||||||
/// `clientInfo` field, which is only the [`Implementation`] identity (#1082).
|
/// [`Implementation`] identity, so `client_info.client_info` was easy to
|
||||||
#[deprecated(note = "use `InitializeRequestParams` instead")]
|
/// misread (#1082).
|
||||||
|
#[deprecated(note = "use `ClientConfig` instead")]
|
||||||
pub type ClientInfo = InitializeRequestParams;
|
pub type ClientInfo = InitializeRequestParams;
|
||||||
|
|
||||||
/// Information negotiated about a server peer.
|
/// Information negotiated about a server peer.
|
||||||
|
|
@ -1298,18 +1330,18 @@ impl DiscoverResult {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a discovery result from the server's initialization information.
|
/// Create a discovery result from the server's configuration.
|
||||||
pub fn from_server_info(
|
pub fn from_server_info(
|
||||||
supported_versions: Vec<ProtocolVersion>,
|
supported_versions: Vec<ProtocolVersion>,
|
||||||
server_info: ServerInfo,
|
server_config: ServerConfig,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let InitializeResult {
|
let ServerConfig {
|
||||||
capabilities,
|
capabilities,
|
||||||
server_info,
|
server_info,
|
||||||
instructions,
|
instructions,
|
||||||
meta,
|
meta,
|
||||||
..
|
..
|
||||||
} = server_info;
|
} = server_config;
|
||||||
let mut result = Self {
|
let mut result = Self {
|
||||||
result_type: ResultType::COMPLETE,
|
result_type: ResultType::COMPLETE,
|
||||||
supported_versions,
|
supported_versions,
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,10 @@ use crate::{
|
||||||
model::{
|
model::{
|
||||||
ArgumentInfo, CacheScope, CallToolRequest, CallToolRequestParams, CallToolResponse,
|
ArgumentInfo, CacheScope, CallToolRequest, CallToolRequestParams, CallToolResponse,
|
||||||
CallToolResult, CancelTaskParams, CancelTaskRequest, CancelledNotification,
|
CallToolResult, CancelTaskParams, CancelTaskRequest, CancelledNotification,
|
||||||
CancelledNotificationParam, ClientJsonRpcMessage, ClientNotification, ClientRequest,
|
CancelledNotificationParam, ClientConfig, ClientJsonRpcMessage, ClientNotification,
|
||||||
ClientResult, CompleteRequest, CompleteRequestParams, CompleteResult, CompletionContext,
|
ClientRequest, ClientResult, CompleteRequest, CompleteRequestParams, CompleteResult,
|
||||||
CompletionInfo, DEFAULT_MRTR_MAX_ROUNDS, DiscoverRequest, DiscoverRequestParams,
|
CompletionContext, CompletionInfo, DEFAULT_MRTR_MAX_ROUNDS, DiscoverRequest,
|
||||||
DiscoverResult, ErrorData, GetExtensions, GetMeta, GetPromptRequest,
|
DiscoverRequestParams, DiscoverResult, ErrorData, GetExtensions, GetMeta, GetPromptRequest,
|
||||||
GetPromptRequestParams, GetPromptResponse, GetPromptResult, GetTaskParams, GetTaskRequest,
|
GetPromptRequestParams, GetPromptResponse, GetPromptResult, GetTaskParams, GetTaskRequest,
|
||||||
GetTaskResult, InitializeRequest, InitializeRequestParams, InitializedNotification,
|
GetTaskResult, InitializeRequest, InitializeRequestParams, InitializedNotification,
|
||||||
InputRequest, InputRequiredResult, InputResponses, JsonRpcResponse, ListPromptsRequest,
|
InputRequest, InputRequiredResult, InputResponses, JsonRpcResponse, ListPromptsRequest,
|
||||||
|
|
@ -266,7 +266,7 @@ impl ServiceRole for RoleClient {
|
||||||
type PeerReq = ServerRequest;
|
type PeerReq = ServerRequest;
|
||||||
type PeerResp = ServerResult;
|
type PeerResp = ServerResult;
|
||||||
type PeerNot = ServerNotification;
|
type PeerNot = ServerNotification;
|
||||||
type Info = InitializeRequestParams;
|
type Info = ClientConfig;
|
||||||
type PeerInfo = ServerPeerInfo;
|
type PeerInfo = ServerPeerInfo;
|
||||||
type InitializeError = ClientInitializeError;
|
type InitializeError = ClientInitializeError;
|
||||||
const IS_CLIENT: bool = true;
|
const IS_CLIENT: bool = true;
|
||||||
|
|
|
||||||
|
|
@ -16,13 +16,13 @@ use crate::{
|
||||||
CancelledNotification, CancelledNotificationParam, ClientJsonRpcMessage,
|
CancelledNotification, CancelledNotificationParam, ClientJsonRpcMessage,
|
||||||
ClientNotification, ClientRequest, ClientResult, CreateMessageRequest,
|
ClientNotification, ClientRequest, ClientResult, CreateMessageRequest,
|
||||||
CreateMessageRequestParams, CreateMessageResult, EmptyResult, ErrorData,
|
CreateMessageRequestParams, CreateMessageResult, EmptyResult, ErrorData,
|
||||||
InitializeRequestParams, InitializeResult, ListRootsRequest, ListRootsResult,
|
InitializeRequestParams, ListRootsRequest, ListRootsResult, LoggingMessageNotification,
|
||||||
LoggingMessageNotification, LoggingMessageNotificationParam, ProgressNotification,
|
LoggingMessageNotificationParam, ProgressNotification, ProgressNotificationParam,
|
||||||
ProgressNotificationParam, PromptListChangedNotification, ProtocolVersion,
|
PromptListChangedNotification, ProtocolVersion, ResourceListChangedNotification,
|
||||||
ResourceListChangedNotification, ResourceUpdatedNotification,
|
ResourceUpdatedNotification, ResourceUpdatedNotificationParam, ServerConfig,
|
||||||
ResourceUpdatedNotificationParam, ServerNotification, ServerRequest, ServerResult,
|
ServerNotification, ServerRequest, ServerResult, SubscriptionFilter,
|
||||||
SubscriptionFilter, SubscriptionsAcknowledgedNotification,
|
SubscriptionsAcknowledgedNotification, SubscriptionsAcknowledgedNotificationParams,
|
||||||
SubscriptionsAcknowledgedNotificationParams, ToolListChangedNotification,
|
ToolListChangedNotification,
|
||||||
},
|
},
|
||||||
transport::DynamicTransportError,
|
transport::DynamicTransportError,
|
||||||
};
|
};
|
||||||
|
|
@ -38,7 +38,7 @@ impl ServiceRole for RoleServer {
|
||||||
type PeerReq = ClientRequest;
|
type PeerReq = ClientRequest;
|
||||||
type PeerResp = ClientResult;
|
type PeerResp = ClientResult;
|
||||||
type PeerNot = ClientNotification;
|
type PeerNot = ClientNotification;
|
||||||
type Info = InitializeResult;
|
type Info = ServerConfig;
|
||||||
type PeerInfo = InitializeRequestParams;
|
type PeerInfo = InitializeRequestParams;
|
||||||
|
|
||||||
type InitializeError = ServerInitializeError;
|
type InitializeError = ServerInitializeError;
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@ use crate::{
|
||||||
model::{
|
model::{
|
||||||
ClientCapabilities, ClientJsonRpcMessage, ClientNotification, ClientRequest, ErrorCode,
|
ClientCapabilities, ClientJsonRpcMessage, ClientNotification, ClientRequest, ErrorCode,
|
||||||
ErrorData, GetExtensions, GetMeta, Implementation, InitializeRequest,
|
ErrorData, GetExtensions, GetMeta, Implementation, InitializeRequest,
|
||||||
InitializeRequestParams, InitializeResult, InitializedNotification, JsonObject,
|
InitializeRequestParams, InitializedNotification, JsonObject, JsonRpcError,
|
||||||
JsonRpcError, ProtocolVersion, RequestId, ServerJsonRpcMessage, ServerResult,
|
ProtocolVersion, RequestId, ServerConfig, ServerJsonRpcMessage, ServerResult,
|
||||||
},
|
},
|
||||||
serve_server,
|
serve_server,
|
||||||
service::{
|
service::{
|
||||||
|
|
@ -367,7 +367,7 @@ impl<S: Service<RoleServer>> Service<RoleServer> for NegotiatingStatelessHttpSer
|
||||||
self.0.handle_notification(notification, context).await
|
self.0.handle_notification(notification, context).await
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_info(&self) -> InitializeResult {
|
fn get_info(&self) -> ServerConfig {
|
||||||
self.0.get_info()
|
self.0.get_info()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
use rmcp::{
|
use rmcp::{
|
||||||
ServerHandler,
|
ServerHandler,
|
||||||
handler::server::{router::tool::ToolRouter, wrapper::Parameters},
|
handler::server::{router::tool::ToolRouter, wrapper::Parameters},
|
||||||
model::{InitializeResult, ServerCapabilities},
|
model::{ServerCapabilities, ServerConfig},
|
||||||
schemars, tool, tool_router,
|
schemars, tool, tool_router,
|
||||||
};
|
};
|
||||||
#[derive(Debug, serde::Deserialize, schemars::JsonSchema)]
|
#[derive(Debug, serde::Deserialize, schemars::JsonSchema)]
|
||||||
|
|
@ -52,8 +52,8 @@ impl Calculator {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ServerHandler for Calculator {
|
impl ServerHandler for Calculator {
|
||||||
fn get_info(&self) -> InitializeResult {
|
fn get_info(&self) -> ServerConfig {
|
||||||
InitializeResult::new(ServerCapabilities::builder().enable_tools().build())
|
ServerConfig::new(ServerCapabilities::builder().enable_tools().build())
|
||||||
.with_instructions("A simple calculator")
|
.with_instructions("A simple calculator")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -115,8 +115,8 @@ impl TestServer {
|
||||||
|
|
||||||
impl ServerHandler for TestServer {
|
impl ServerHandler for TestServer {
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
fn get_info(&self) -> InitializeResult {
|
fn get_info(&self) -> ServerConfig {
|
||||||
InitializeResult::new(ServerCapabilities::builder().enable_logging().build())
|
ServerConfig::new(ServerCapabilities::builder().enable_logging().build())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ use std::{collections::BTreeSet, process::Stdio, time::Duration};
|
||||||
use rmcp::{
|
use rmcp::{
|
||||||
ErrorData as McpError, RoleServer, ServerHandler, ServiceExt,
|
ErrorData as McpError, RoleServer, ServerHandler, ServiceExt,
|
||||||
model::{
|
model::{
|
||||||
CallToolRequestParams, CallToolResponse, CallToolResult, ContentBlock, InitializeResult,
|
CallToolRequestParams, CallToolResponse, CallToolResult, ContentBlock, ServerCapabilities,
|
||||||
ServerCapabilities,
|
ServerConfig,
|
||||||
},
|
},
|
||||||
service::RequestContext,
|
service::RequestContext,
|
||||||
};
|
};
|
||||||
|
|
@ -91,8 +91,8 @@ async fn cancelled_request_receives_no_response() -> anyhow::Result<()> {
|
||||||
struct WaitForCancelServer;
|
struct WaitForCancelServer;
|
||||||
|
|
||||||
impl ServerHandler for WaitForCancelServer {
|
impl ServerHandler for WaitForCancelServer {
|
||||||
fn get_info(&self) -> InitializeResult {
|
fn get_info(&self) -> ServerConfig {
|
||||||
InitializeResult::new(ServerCapabilities::builder().enable_tools().build())
|
ServerConfig::new(ServerCapabilities::builder().enable_tools().build())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn call_tool(
|
async fn call_tool(
|
||||||
|
|
|
||||||
|
|
@ -719,7 +719,7 @@ async fn test_server_rejects_unsupported_protocol_version() {
|
||||||
use http_body_util::Full;
|
use http_body_util::Full;
|
||||||
use rmcp::{
|
use rmcp::{
|
||||||
handler::server::ServerHandler,
|
handler::server::ServerHandler,
|
||||||
model::{InitializeResult, ServerCapabilities},
|
model::{ServerCapabilities, ServerConfig},
|
||||||
transport::streamable_http_server::{
|
transport::streamable_http_server::{
|
||||||
StreamableHttpServerConfig, StreamableHttpService, session::local::LocalSessionManager,
|
StreamableHttpServerConfig, StreamableHttpService, session::local::LocalSessionManager,
|
||||||
},
|
},
|
||||||
|
|
@ -730,8 +730,8 @@ async fn test_server_rejects_unsupported_protocol_version() {
|
||||||
struct TestHandler;
|
struct TestHandler;
|
||||||
|
|
||||||
impl ServerHandler for TestHandler {
|
impl ServerHandler for TestHandler {
|
||||||
fn get_info(&self) -> InitializeResult {
|
fn get_info(&self) -> ServerConfig {
|
||||||
InitializeResult::new(ServerCapabilities::builder().build())
|
ServerConfig::new(ServerCapabilities::builder().build())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -892,7 +892,7 @@ async fn test_server_validates_host_when_origin_validation_is_disabled_by_defaul
|
||||||
use http_body_util::Full;
|
use http_body_util::Full;
|
||||||
use rmcp::{
|
use rmcp::{
|
||||||
handler::server::ServerHandler,
|
handler::server::ServerHandler,
|
||||||
model::{InitializeResult, ServerCapabilities},
|
model::{ServerCapabilities, ServerConfig},
|
||||||
transport::streamable_http_server::{
|
transport::streamable_http_server::{
|
||||||
StreamableHttpServerConfig, StreamableHttpService, session::local::LocalSessionManager,
|
StreamableHttpServerConfig, StreamableHttpService, session::local::LocalSessionManager,
|
||||||
},
|
},
|
||||||
|
|
@ -903,8 +903,8 @@ async fn test_server_validates_host_when_origin_validation_is_disabled_by_defaul
|
||||||
struct TestHandler;
|
struct TestHandler;
|
||||||
|
|
||||||
impl ServerHandler for TestHandler {
|
impl ServerHandler for TestHandler {
|
||||||
fn get_info(&self) -> InitializeResult {
|
fn get_info(&self) -> ServerConfig {
|
||||||
InitializeResult::new(ServerCapabilities::builder().build())
|
ServerConfig::new(ServerCapabilities::builder().build())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -975,7 +975,7 @@ async fn test_server_validates_host_header_port_for_dns_rebinding_protection() {
|
||||||
use http_body_util::Full;
|
use http_body_util::Full;
|
||||||
use rmcp::{
|
use rmcp::{
|
||||||
handler::server::ServerHandler,
|
handler::server::ServerHandler,
|
||||||
model::{InitializeResult, ServerCapabilities},
|
model::{ServerCapabilities, ServerConfig},
|
||||||
transport::streamable_http_server::{
|
transport::streamable_http_server::{
|
||||||
StreamableHttpServerConfig, StreamableHttpService, session::local::LocalSessionManager,
|
StreamableHttpServerConfig, StreamableHttpService, session::local::LocalSessionManager,
|
||||||
},
|
},
|
||||||
|
|
@ -986,8 +986,8 @@ async fn test_server_validates_host_header_port_for_dns_rebinding_protection() {
|
||||||
struct TestHandler;
|
struct TestHandler;
|
||||||
|
|
||||||
impl ServerHandler for TestHandler {
|
impl ServerHandler for TestHandler {
|
||||||
fn get_info(&self) -> InitializeResult {
|
fn get_info(&self) -> ServerConfig {
|
||||||
InitializeResult::new(ServerCapabilities::builder().build())
|
ServerConfig::new(ServerCapabilities::builder().build())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1046,7 +1046,7 @@ async fn test_server_falls_back_to_uri_authority_when_host_header_missing() {
|
||||||
use http_body_util::Full;
|
use http_body_util::Full;
|
||||||
use rmcp::{
|
use rmcp::{
|
||||||
handler::server::ServerHandler,
|
handler::server::ServerHandler,
|
||||||
model::{InitializeResult, ServerCapabilities},
|
model::{ServerCapabilities, ServerConfig},
|
||||||
transport::streamable_http_server::{
|
transport::streamable_http_server::{
|
||||||
StreamableHttpServerConfig, StreamableHttpService, session::local::LocalSessionManager,
|
StreamableHttpServerConfig, StreamableHttpService, session::local::LocalSessionManager,
|
||||||
},
|
},
|
||||||
|
|
@ -1057,8 +1057,8 @@ async fn test_server_falls_back_to_uri_authority_when_host_header_missing() {
|
||||||
struct TestHandler;
|
struct TestHandler;
|
||||||
|
|
||||||
impl ServerHandler for TestHandler {
|
impl ServerHandler for TestHandler {
|
||||||
fn get_info(&self) -> InitializeResult {
|
fn get_info(&self) -> ServerConfig {
|
||||||
InitializeResult::new(ServerCapabilities::builder().build())
|
ServerConfig::new(ServerCapabilities::builder().build())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1132,7 +1132,7 @@ mod origin_validation {
|
||||||
use http_body_util::Full;
|
use http_body_util::Full;
|
||||||
use rmcp::{
|
use rmcp::{
|
||||||
handler::server::ServerHandler,
|
handler::server::ServerHandler,
|
||||||
model::{InitializeResult, ServerCapabilities},
|
model::{ServerCapabilities, ServerConfig},
|
||||||
transport::streamable_http_server::{
|
transport::streamable_http_server::{
|
||||||
StreamableHttpServerConfig, StreamableHttpService, session::local::LocalSessionManager,
|
StreamableHttpServerConfig, StreamableHttpService, session::local::LocalSessionManager,
|
||||||
},
|
},
|
||||||
|
|
@ -1143,8 +1143,8 @@ mod origin_validation {
|
||||||
struct TestHandler;
|
struct TestHandler;
|
||||||
|
|
||||||
impl ServerHandler for TestHandler {
|
impl ServerHandler for TestHandler {
|
||||||
fn get_info(&self) -> InitializeResult {
|
fn get_info(&self) -> ServerConfig {
|
||||||
InitializeResult::new(ServerCapabilities::builder().build())
|
ServerConfig::new(ServerCapabilities::builder().build())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ use axum::{
|
||||||
};
|
};
|
||||||
use rmcp::{
|
use rmcp::{
|
||||||
ClientLifecycleMode, ClientServiceExt, ServerHandler,
|
ClientLifecycleMode, ClientServiceExt, ServerHandler,
|
||||||
model::{DiscoverResult, ErrorCode, ErrorData, InitializeRequestParams, ProtocolVersion},
|
model::{ClientConfig, DiscoverResult, ErrorCode, ErrorData, ProtocolVersion},
|
||||||
service::{MaybeSendFuture, RequestContext, RoleServer},
|
service::{MaybeSendFuture, RequestContext, RoleServer},
|
||||||
transport::{
|
transport::{
|
||||||
StreamableHttpClientTransport,
|
StreamableHttpClientTransport,
|
||||||
|
|
@ -132,7 +132,7 @@ async fn discover_http_client_bootstraps_headers_without_initialize() {
|
||||||
let transport = StreamableHttpClientTransport::from_config(
|
let transport = StreamableHttpClientTransport::from_config(
|
||||||
StreamableHttpClientTransportConfig::with_uri(format!("http://{address}/mcp")),
|
StreamableHttpClientTransportConfig::with_uri(format!("http://{address}/mcp")),
|
||||||
);
|
);
|
||||||
let client = InitializeRequestParams::default()
|
let client = ClientConfig::default()
|
||||||
.serve_with_lifecycle(
|
.serve_with_lifecycle(
|
||||||
transport,
|
transport,
|
||||||
ClientLifecycleMode::Discover {
|
ClientLifecycleMode::Discover {
|
||||||
|
|
@ -176,7 +176,7 @@ async fn auto_http_client_falls_back_to_stateful_legacy_startup() {
|
||||||
let transport = StreamableHttpClientTransport::from_config(
|
let transport = StreamableHttpClientTransport::from_config(
|
||||||
StreamableHttpClientTransportConfig::with_uri(format!("http://{address}/mcp")),
|
StreamableHttpClientTransportConfig::with_uri(format!("http://{address}/mcp")),
|
||||||
);
|
);
|
||||||
let client = InitializeRequestParams::default()
|
let client = ClientConfig::default()
|
||||||
.serve_with_lifecycle(
|
.serve_with_lifecycle(
|
||||||
transport,
|
transport,
|
||||||
ClientLifecycleMode::Auto {
|
ClientLifecycleMode::Auto {
|
||||||
|
|
@ -217,7 +217,7 @@ async fn auto_http_client_falls_back_after_plain_text_4xx_rejection() {
|
||||||
let transport = StreamableHttpClientTransport::from_config(
|
let transport = StreamableHttpClientTransport::from_config(
|
||||||
StreamableHttpClientTransportConfig::with_uri(format!("http://{address}/mcp")),
|
StreamableHttpClientTransportConfig::with_uri(format!("http://{address}/mcp")),
|
||||||
);
|
);
|
||||||
let client = InitializeRequestParams::default()
|
let client = ClientConfig::default()
|
||||||
.serve_with_lifecycle(
|
.serve_with_lifecycle(
|
||||||
transport,
|
transport,
|
||||||
ClientLifecycleMode::Auto {
|
ClientLifecycleMode::Auto {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ use rmcp::{
|
||||||
ClientHandler, RoleClient, RoleServer, ServerHandler,
|
ClientHandler, RoleClient, RoleServer, ServerHandler,
|
||||||
handler::server::router::{prompt::PromptRouter, tool::ToolRouter},
|
handler::server::router::{prompt::PromptRouter, tool::ToolRouter},
|
||||||
model::{
|
model::{
|
||||||
CacheScope, InitializeRequestParams, InitializeResult, ListPromptsResult, ListToolsResult,
|
CacheScope, ClientConfig, InitializeResult, ListPromptsResult, ListToolsResult,
|
||||||
ProtocolVersion,
|
ProtocolVersion,
|
||||||
},
|
},
|
||||||
prompt_handler,
|
prompt_handler,
|
||||||
|
|
@ -38,8 +38,8 @@ struct VersionedClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ClientHandler for VersionedClient {
|
impl ClientHandler for VersionedClient {
|
||||||
fn get_info(&self) -> InitializeRequestParams {
|
fn get_info(&self) -> ClientConfig {
|
||||||
let mut info = InitializeRequestParams::default();
|
let mut info = ClientConfig::default();
|
||||||
info.protocol_version = self.protocol_version.clone();
|
info.protocol_version = self.protocol_version.clone();
|
||||||
info
|
info
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ use std::{
|
||||||
use rmcp::{
|
use rmcp::{
|
||||||
ServerHandler, ServiceExt,
|
ServerHandler, ServiceExt,
|
||||||
handler::server::{router::tool::ToolRouter, wrapper::Parameters},
|
handler::server::{router::tool::ToolRouter, wrapper::Parameters},
|
||||||
model::{CallToolRequestParams, InitializeRequestParams, InitializeResult, ServerCapabilities},
|
model::{CallToolRequestParams, ClientConfig, ServerCapabilities, ServerConfig},
|
||||||
service::QuitReason,
|
service::QuitReason,
|
||||||
tool, tool_handler, tool_router,
|
tool, tool_handler, tool_router,
|
||||||
};
|
};
|
||||||
|
|
@ -55,8 +55,8 @@ impl SlowToolServer {
|
||||||
|
|
||||||
#[tool_handler]
|
#[tool_handler]
|
||||||
impl ServerHandler for SlowToolServer {
|
impl ServerHandler for SlowToolServer {
|
||||||
fn get_info(&self) -> InitializeResult {
|
fn get_info(&self) -> ServerConfig {
|
||||||
InitializeResult::new(ServerCapabilities::builder().enable_tools().build())
|
ServerConfig::new(ServerCapabilities::builder().enable_tools().build())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -64,8 +64,8 @@ impl ServerHandler for SlowToolServer {
|
||||||
struct DummyClientHandler;
|
struct DummyClientHandler;
|
||||||
|
|
||||||
impl rmcp::ClientHandler for DummyClientHandler {
|
impl rmcp::ClientHandler for DummyClientHandler {
|
||||||
fn get_info(&self) -> InitializeRequestParams {
|
fn get_info(&self) -> ClientConfig {
|
||||||
InitializeRequestParams::default()
|
ClientConfig::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,8 +114,8 @@ impl MacroMrtrServer {
|
||||||
|
|
||||||
#[tool_handler]
|
#[tool_handler]
|
||||||
impl ServerHandler for MacroMrtrServer {
|
impl ServerHandler for MacroMrtrServer {
|
||||||
fn get_info(&self) -> InitializeResult {
|
fn get_info(&self) -> ServerConfig {
|
||||||
let mut info = InitializeResult::new(ServerCapabilities::builder().enable_tools().build());
|
let mut info = ServerConfig::new(ServerCapabilities::builder().enable_tools().build());
|
||||||
info.protocol_version = ProtocolVersion::V_2026_07_28;
|
info.protocol_version = ProtocolVersion::V_2026_07_28;
|
||||||
info
|
info
|
||||||
}
|
}
|
||||||
|
|
@ -221,8 +221,8 @@ impl MrtrServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ServerHandler for MrtrServer {
|
impl ServerHandler for MrtrServer {
|
||||||
fn get_info(&self) -> InitializeResult {
|
fn get_info(&self) -> ServerConfig {
|
||||||
let mut info = InitializeResult::new(
|
let mut info = ServerConfig::new(
|
||||||
ServerCapabilities::builder()
|
ServerCapabilities::builder()
|
||||||
.enable_tools()
|
.enable_tools()
|
||||||
.enable_prompts()
|
.enable_prompts()
|
||||||
|
|
@ -609,9 +609,8 @@ async fn request_state_codec_seals_and_verifies_through_the_loop() -> anyhow::Re
|
||||||
struct SealingServer;
|
struct SealingServer;
|
||||||
|
|
||||||
impl ServerHandler for SealingServer {
|
impl ServerHandler for SealingServer {
|
||||||
fn get_info(&self) -> InitializeResult {
|
fn get_info(&self) -> ServerConfig {
|
||||||
let mut info =
|
let mut info = ServerConfig::new(ServerCapabilities::builder().enable_tools().build());
|
||||||
InitializeResult::new(ServerCapabilities::builder().enable_tools().build());
|
|
||||||
info.protocol_version = ProtocolVersion::V_2026_07_28;
|
info.protocol_version = ProtocolVersion::V_2026_07_28;
|
||||||
info
|
info
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ use std::sync::Arc;
|
||||||
use rmcp::{
|
use rmcp::{
|
||||||
ClientHandler, ServerHandler, ServiceExt,
|
ClientHandler, ServerHandler, ServiceExt,
|
||||||
model::{
|
model::{
|
||||||
ClientNotification, CustomNotification, InitializeResult, ResourceUpdatedNotificationParam,
|
ClientNotification, CustomNotification, ResourceUpdatedNotificationParam,
|
||||||
ServerCapabilities, ServerNotification, SubscribeRequestParams,
|
ServerCapabilities, ServerConfig, ServerNotification, SubscribeRequestParams,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
|
|
@ -16,8 +16,8 @@ use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
||||||
struct Server {}
|
struct Server {}
|
||||||
|
|
||||||
impl ServerHandler for Server {
|
impl ServerHandler for Server {
|
||||||
fn get_info(&self) -> InitializeResult {
|
fn get_info(&self) -> ServerConfig {
|
||||||
InitializeResult::new(
|
ServerConfig::new(
|
||||||
ServerCapabilities::builder()
|
ServerCapabilities::builder()
|
||||||
.enable_resources()
|
.enable_resources()
|
||||||
.enable_resources_subscribe()
|
.enable_resources_subscribe()
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue