pub struct McpServer { /* private fields */ }Expand description
A synchronous MCP server that handles JSON-RPC 2.0 messages.
Holds loaded code graphs and dispatches tool/resource/prompt requests to the appropriate handler.
Implementations§
Source§impl McpServer
impl McpServer
Sourcepub fn load_graph(&mut self, name: String, graph: CodeGraph)
pub fn load_graph(&mut self, name: String, graph: CodeGraph)
Load a code graph into the server under the given name.
Sourcepub fn set_deferred_graph(&mut self, name: String, path: String)
pub fn set_deferred_graph(&mut self, name: String, path: String)
Set a deferred graph path for lazy loading.
If no graphs are loaded when a tool is called, the server will attempt to load this graph automatically. This provides a safety net when startup auto-resolve fails (e.g. wrong CWD).
Sourcepub fn unload_graph(&mut self, name: &str) -> Option<CodeGraph>
pub fn unload_graph(&mut self, name: &str) -> Option<CodeGraph>
Remove a loaded code graph.
Sourcepub fn get_graph(&self, name: &str) -> Option<&CodeGraph>
pub fn get_graph(&self, name: &str) -> Option<&CodeGraph>
Get a reference to a loaded graph by name.
Sourcepub fn graph_names(&self) -> Vec<&str>
pub fn graph_names(&self) -> Vec<&str>
List all loaded graph names.
Sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
Check if the server has been initialised.
Sourcepub fn handle_raw(&mut self, raw: &str) -> String
pub fn handle_raw(&mut self, raw: &str) -> String
Handle a raw JSON-RPC message string.
Parses the message, dispatches to the appropriate handler, and returns the serialised JSON-RPC response.
Sourcepub fn handle_request(&mut self, request: JsonRpcRequest) -> JsonRpcResponse
pub fn handle_request(&mut self, request: JsonRpcRequest) -> JsonRpcResponse
Handle a parsed JSON-RPC request.
Sourcepub fn operation_log(&self) -> &[OperationRecord]
pub fn operation_log(&self) -> &[OperationRecord]
Access the operation log.
Sourcepub fn workspace_manager(&self) -> &WorkspaceManager
pub fn workspace_manager(&self) -> &WorkspaceManager
Access the workspace manager.
Sourcepub fn workspace_manager_mut(&mut self) -> &mut WorkspaceManager
pub fn workspace_manager_mut(&mut self) -> &mut WorkspaceManager
Access the workspace manager mutably.