Skip to main content

Module server

Module server 

Source
Expand description

Unified MCP Server

This module provides a concrete MCP server implementation that aggregates multiple tools and implements the ToolProtocol trait, routing tool calls to the appropriate underlying tool implementation.

The server acts as a dispatcher that can be deployed as an HTTP service, allowing multiple agents (local or remote) to access a unified set of tools through a single ToolProtocol interface.

§Architecture

Multiple Tools (Memory, Bash, etc.)
        ↓
UnifiedMcpServer (implements ToolProtocol)
        ↓
HTTP Endpoints (GET /tools, POST /execute)
        ↓
Agents/Clients (via McpClientProtocol)

§Example

use cloudllm::mcp_server::UnifiedMcpServer;
use cloudllm::tools::Memory;
use cloudllm::tool_protocols::MemoryProtocol;
use cloudllm::tool_protocol::ToolProtocol;
use std::sync::Arc;

let memory = Arc::new(Memory::new());
let memory_protocol = Arc::new(MemoryProtocol::new(memory));

let mut server = UnifiedMcpServer::new();
server.register_tool("memory", memory_protocol);

// Now the server implements ToolProtocol and can route calls
let tools = server.list_tools().await.unwrap();

Structs§

UnifiedMcpServer
A unified MCP server that aggregates multiple tools