Skip to main content

Module server

Module server 

Source
Expand description

MCP Server implementation

Exposes agents and tools as an MCP server that can be consumed by MCP clients like Claude Desktop, VS Code extensions, etc.

§Architecture

┌─────────────────────────────────────────────────────────┐
│                     MCP Server                          │
├─────────────────────────────────────────────────────────┤
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────────┐  │
│  │   Tools     │  │  Resources  │  │    Prompts      │  │
│  │  Handler    │  │   Handler   │  │    Handler      │  │
│  └──────┬──────┘  └──────┬──────┘  └────────┬────────┘  │
│         │                │                  │           │
│  ┌──────┴────────────────┴──────────────────┴────────┐  │
│  │              Request Router                       │  │
│  └───────────────────────┬───────────────────────────┘  │
│                          │                              │
│  ┌───────────────────────┴───────────────────────────┐  │
│  │           Server Transport (STDIO/SSE)            │  │
│  └───────────────────────────────────────────────────┘  │
└─────────────────────────────────────────────────────────┘

§Example

use cortexai_mcp::server::{McpServer, ServerConfig};

let server = McpServer::builder()
    .name("my-agent-server")
    .version("1.0.0")
    .add_tool(my_tool)
    .add_agent_as_tool(my_agent)
    .build();

// Run with STDIO transport
server.run_stdio().await?;

Structs§

AsyncFnTool
Async function-based tool
FnTool
A simple function-based tool
McpServer
MCP Server that exposes tools, resources, and prompts
McpServerBuilder
Builder for McpServer
PromptMessage
Prompt message (for get_prompt response)
ServerConfig
Server configuration

Enums§

PromptContent
Prompt content

Traits§

PromptHandler
Handler for prompts
ResourceHandler
Handler for resources
ToolHandler
Handler for a single tool