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
| Name | Type | Description |
|---|---|---|
name | String | Server name |
tools | Vec<MCPTool> | Registered tools |
resources | Vec<MCPResource> | Registered resources |
running | bool | Running status |
Methods
new
fn new(name: impl Into<String>) -> SelfCreate a new MCP server
Parameters:
| Name | Type |
|---|---|
name | impl Into<String> |
register_tool
fn register_tool(&mut self, tool: MCPTool) -> ()Register a tool
Parameters:
| Name | Type |
|---|---|
tool | MCPTool |
register_resource
fn register_resource(&mut self, resource: MCPResource) -> ()Register a resource
Parameters:
| Name | Type |
|---|---|
resource | MCPResource |
tools
fn tools(&self) -> &[MCPTool]Get registered tools
resources
fn resources(&self) -> &[MCPResource]Get registered resources
is_running
fn is_running(&self) -> boolCheck if running
start
async fn start(&mut self) -> Result<()>Start the server (placeholder)
stop
async fn stop(&mut self) -> Result<()>Stop the server
Source
View on GitHubpraisonai/src/mcp/mod.rs at line 605