Skip to content

Commit 9528de9

Browse files
committed
fix(rmcp): adapt to non-exhaustive structs in rmcp 1.1.1
rmcp v1.1.1 made ServerInfo and Implementation non-exhaustive, requiring use of constructors instead of struct literals. - Use Implementation::new(name, version) for construction - Use ServerInfo::new(capabilities) for initialization - Set optional fields via field mutations - Remove unused ProtocolVersion import - Update test to remove protocol_version assertion (handled internally)
1 parent 9caf100 commit 9528de9

1 file changed

Lines changed: 19 additions & 23 deletions

File tree

crates/mcpls-core/src/mcp/server.rs

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use std::sync::Arc;
77

88
use rmcp::handler::server::wrapper::Parameters;
9-
use rmcp::model::{Implementation, ProtocolVersion, ServerCapabilities, ServerInfo};
9+
use rmcp::model::{Implementation, ServerCapabilities, ServerInfo};
1010
use rmcp::{ErrorData as McpError, ServerHandler, tool, tool_handler, tool_router};
1111
use tokio::sync::Mutex;
1212

@@ -427,27 +427,24 @@ impl McplsServer {
427427
#[tool_handler]
428428
impl ServerHandler for McplsServer {
429429
fn get_info(&self) -> ServerInfo {
430-
ServerInfo {
431-
protocol_version: ProtocolVersion::V_2024_11_05,
432-
capabilities: ServerCapabilities::builder().enable_tools().build(),
433-
server_info: Implementation {
434-
name: "mcpls".to_string(),
435-
title: Some("MCPLS - MCP to LSP Bridge".to_string()),
436-
version: env!("CARGO_PKG_VERSION").to_string(),
437-
description: Some(env!("CARGO_PKG_DESCRIPTION").to_string()),
438-
icons: None,
439-
website_url: Some("https://github.com/bug-ops/mcpls".to_string()),
440-
},
441-
instructions: Some(
442-
concat!(
443-
"Universal MCP to LSP bridge. Exposes Language Server Protocol ",
444-
"capabilities as MCP tools for semantic code intelligence. ",
445-
"Supports hover, definition, references, diagnostics, rename, ",
446-
"completions, symbols, and formatting."
447-
)
448-
.to_string(),
449-
),
450-
}
430+
let mut implementation = Implementation::new("mcpls", env!("CARGO_PKG_VERSION"));
431+
implementation.title = Some("MCPLS - MCP to LSP Bridge".to_string());
432+
implementation.description = Some(env!("CARGO_PKG_DESCRIPTION").to_string());
433+
implementation.website_url = Some("https://github.com/bug-ops/mcpls".to_string());
434+
435+
let mut server_info = ServerInfo::new(ServerCapabilities::builder().enable_tools().build());
436+
server_info.server_info = implementation;
437+
server_info.instructions = Some(
438+
concat!(
439+
"Universal MCP to LSP bridge. Exposes Language Server Protocol ",
440+
"capabilities as MCP tools for semantic code intelligence. ",
441+
"Supports hover, definition, references, diagnostics, rename, ",
442+
"completions, symbols, and formatting."
443+
)
444+
.to_string(),
445+
);
446+
447+
server_info
451448
}
452449
}
453450

@@ -466,7 +463,6 @@ mod tests {
466463
let server = create_test_server();
467464
let info = server.get_info();
468465

469-
assert_eq!(info.protocol_version, ProtocolVersion::V_2024_11_05);
470466
assert!(info.capabilities.tools.is_some());
471467
assert_eq!(info.server_info.name, "mcpls");
472468
assert!(info.instructions.is_some());

0 commit comments

Comments
 (0)