pub struct McpServer { /* private fields */ }Implementations§
Source§impl McpServer
impl McpServer
Sourcepub fn enable_layered_pipeline(&mut self, pipeline: SessionPipeline)
pub fn enable_layered_pipeline(&mut self, pipeline: SessionPipeline)
Enable the Paper 2 layered pipeline (L0 cross-turn dedup) for the
lifetime of this server. Once set, every tools/call response is
passed through SessionPipeline::process before being returned.
Sourcepub fn on_compaction_boundary(&self)
pub fn on_compaction_boundary(&self)
Drop the layered-pipeline cache partition on host compaction.
Sourcepub fn set_routing_engine(&mut self, engine: Arc<RoutingEngine>)
pub fn set_routing_engine(&mut self, engine: Arc<RoutingEngine>)
Install a transparent-routing engine. Must be built by the caller after upstream tools have been fetched and the local tool catalogue has been enumerated.
Sourcepub fn set_telemetry(&mut self, buffer: TelemetryBuffer)
pub fn set_telemetry(&mut self, buffer: TelemetryBuffer)
Install a telemetry buffer. Every tool invocation emits one event into it.
Sourcepub fn set_builtin_tools_config(
&mut self,
config: BuiltinToolsConfig,
) -> Result<()>
pub fn set_builtin_tools_config( &mut self, config: BuiltinToolsConfig, ) -> Result<()>
Set the built-in tools filtering configuration.
Returns an error if both disabled and enabled are set (mutually exclusive).
Sourcepub fn set_proxy_manager(&mut self, proxy_manager: ProxyManager)
pub fn set_proxy_manager(&mut self, proxy_manager: ProxyManager)
Set the proxy manager for upstream MCP server connections.
Sourcepub fn set_deferred_init(&mut self, receiver: Receiver<DeferredInit>)
pub fn set_deferred_init(&mut self, receiver: Receiver<DeferredInit>)
Set deferred initialization that will be resolved on first tools/list or tools/call.
This allows the MCP server to start reading stdin immediately while remote config fetch, proxy connections, and tool loading run in the background.
pub fn add_meeting_provider(&mut self, provider: Arc<dyn MeetingNotesProvider>)
pub fn add_knowledge_base_provider( &mut self, provider: Arc<dyn KnowledgeBaseProvider>, )
pub fn add_knowledge_base_provider_to_context( &mut self, context: &str, provider: Arc<dyn KnowledgeBaseProvider>, )
pub fn add_messenger_provider(&mut self, provider: Arc<dyn MessengerProvider>)
pub fn add_messenger_provider_to_context( &mut self, context: &str, provider: Arc<dyn MessengerProvider>, )
pub fn add_provider(&mut self, provider: Arc<dyn Provider>)
Sourcepub fn add_provider_to_context(
&mut self,
context: &str,
provider: Arc<dyn Provider>,
)
pub fn add_provider_to_context( &mut self, context: &str, provider: Arc<dyn Provider>, )
Add a provider under a named context.
Sourcepub fn ensure_context(&mut self, context: &str)
pub fn ensure_context(&mut self, context: &str)
Ensure a named context exists, even if it has no providers.
pub fn set_active_context(&self, context: &str) -> Result<()>
Sourcepub fn active_context_name(&self) -> String
pub fn active_context_name(&self) -> String
Get active context name.
Sourcepub fn context_names(&self) -> Vec<String>
pub fn context_names(&self) -> Vec<String>
List all context names.
Sourcepub fn active_providers(&self) -> Vec<Arc<dyn Provider>>
pub fn active_providers(&self) -> Vec<Arc<dyn Provider>>
Get providers in active context.
Sourcepub fn active_knowledge_base_providers(
&self,
) -> Vec<Arc<dyn KnowledgeBaseProvider>>
pub fn active_knowledge_base_providers( &self, ) -> Vec<Arc<dyn KnowledgeBaseProvider>>
Get knowledge base providers in active context.
Sourcepub fn active_messenger_providers(&self) -> Vec<Arc<dyn MessengerProvider>>
pub fn active_messenger_providers(&self) -> Vec<Arc<dyn MessengerProvider>>
Get messenger providers in active context.
Sourcepub async fn handle_request(&mut self, req: JsonRpcRequest) -> JsonRpcResponse
pub async fn handle_request(&mut self, req: JsonRpcRequest) -> JsonRpcResponse
Handle a JSON-RPC request.
Sourcepub fn handle_tools_list(&self, id: RequestId) -> JsonRpcResponse
pub fn handle_tools_list(&self, id: RequestId) -> JsonRpcResponse
Handle tools/list request.
Returns the list of available tools filtered by configured providers. This method is public to allow integration testing.
Sourcepub async fn execute_for_prefetch(
&self,
name: &str,
arguments: Option<Value>,
) -> ToolCallResult
pub async fn execute_for_prefetch( &self, name: &str, arguments: Option<Value>, ) -> ToolCallResult
Paper 3 — execute a tool out-of-band for the speculative pre-fetch dispatcher.
Goes through the same routing engine as the main flow so that
transparent-proxy prefixes / fallbacks / mock providers all
work identically. Differences from handle_tools_call:
- No
JsonRpcResponsewrapping — returns the rawToolCallResult. - No telemetry write here — the synthetic
PipelineEventis emitted later bySessionPipeline::write_prefetch_to_cachewithenricher_prefetched = true. - No mutation invalidation — the planner’s
is_speculatable()filter blocksMutatesLocal/MutatesExternalupstream, so we never reach this method for a write. - No dedup post-pass — the prefetched body is written into the
dedup cache afterward by
SessionPipeline, not here.
Internal-context tools (use_context, list_contexts, …) are
not eligible for speculation by design, so they short-circuit
to an error result rather than mutating server state.