rucora MCP
rucora 的 MCP(Model Context Protocol)集成。
概述
本 crate 为 rucora 提供 MCP 协议集成支持,用于:
- 连接 MCP 服务器
- 将 MCP 工具转换为 rucora 的
Tooltrait - 统一的 MCP 工具调用接口
安装
[]
= "0.1"
或通过主 rucora crate:
[]
= { = "0.1", = ["mcp"] }
使用方式
连接 MCP 服务器
use ;
// 创建传输层
let transport = new;
// 创建客户端
let client = connect.await?;
// 列出可用工具
let tools = client.list_tools.await?;
for tool in tools
调用 MCP 工具
use ;
use json;
let transport = new;
let client = connect.await?;
let result = client.call_tool.await?;
println!;
作为 rucora 工具使用
use ;
use Tool;
let transport = new;
let client = connect.await?;
let tools = client.list_tools.await?;
let mcp_tool = tools.into_iter.next.unwrap;
let adapter = new;
// 现在可以作为 rucora 工具使用
let result = adapter.call.await?;
子模块
protocol:MCP 协议模型类型tool:MCP 工具适配器transport:MCP 传输层(Stdio、HTTP)
依赖
基于 rmcp 库构建。
许可证
MIT