MCP Server • Rust AI Agent SDK

MCPServer: MCP server for exposing tools.

MCPServer

Defined in the MCP module.

Rust AI Agent SDK

MCP server for exposing tools.

Fields

NameTypeDescription
nameStringServer name
toolsVec<MCPTool>Registered tools
resourcesVec<MCPResource>Registered resources
runningboolRunning status

Methods

new

rust
fn new(name: impl Into<String>) -> Self

Create a new MCP server

Parameters:

NameType
nameimpl Into&lt;String&gt;

register_tool

rust
fn register_tool(&mut self, tool: MCPTool) -> ()

Register a tool

Parameters:

NameType
toolMCPTool

register_resource

rust
fn register_resource(&mut self, resource: MCPResource) -> ()

Register a resource

Parameters:

NameType
resourceMCPResource

tools

rust
fn tools(&self) -> &[MCPTool]

Get registered tools

resources

rust
fn resources(&self) -> &[MCPResource]

Get registered resources

is_running

rust
fn is_running(&self) -> bool

Check if running

start

rust
async fn start(&mut self) -> Result<()>

Start the server (placeholder)

stop

rust
async fn stop(&mut self) -> Result<()>

Stop the server

Source

View on GitHub

praisonai/src/mcp/mod.rs at line 605


Related Documentation