M3 + MCP协议:打造最强AI Agent
MCP(Model Context Protocol)是Anthropic推出的Agent尺度协议,M3是国内首个完备支持MCP的开源模子。共同MonkeyCode,一个指令让Agent调用几十个工具完成复杂任务。MCP是什么?
传统Function Calling是串行的:
模型 → 调1个工具 → 等结果 → 调下1个工具...(串行)MCP让模子一次性看到全部可用工具:
// 服务端暴露工具列表(JSON Schema)
{
"tools": [
{"name": "filesystem_read", "params": {"path": "string"}},
{"name": "database_query", "params": {"sql": "string"}},
{"name": "github_pr", "params": {"title": "string", "body": "string"}}
]
}
// 客户端:Claude Code、Cline、Continue.dev均支持MCPMonkeyCode集成MCP设置
// ~/.monkeycode/mcp_servers.json
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/user/workspace"],
"env": {}
},
"database": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {"DATABASE_URL": "postgresql://user:pwd@localhost:5432/db"}
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {"GITHUB_TOKEN": "ghp_your_token"}
}
}
}# 在MonkeyCode中使用
from monkeycode import MonkeyCode
mc = MonkeyCode(
model="minimax/m3",
mcp_config="~/.monkeycode/mcp_servers.json"
)
# 列出所有可用工具
print(mc.list_tools())
# 输出: Agent实战:一条指令完成复杂任务
场景:修复Bug → 提交PR → 摆设上线
# 一条指令,M3自动完成:
# 1. 读取CI失败日志
# 2. 分析代码找Bug
# 3. 自动修复
# 4. 写测试验证
# 5. 提交GitHub PR
# 6. 合并后自动部署
result = mc.execute(
task="修复CI失败的测试,并在GitHub上创建PR然后部署到staging环境",
context={
"ci_log_url": "https://github.com/org/repo/actions/runs/12345",
"deployment_target": "staging"
},
mode="thinking"
)
print(result.chain)
# [
# {"step": 1, "tool": "filesystem/read_file", "input": "logs/ci.log", "output": "Test failed at test_auth.py:23"},
# {"step": 2, "tool": "analyze", "input": "...", "output": "Fix: add token refresh logic"},
# {"step": 3, "tool": "filesystem/write_file", "input": "auth.py patch", "output": "OK"},
# {"step": 4, "tool": "execute", "input": "pytest", "output": "3 tests passed"},
# {"step": 5, "tool": "github/create_pr", "input": "...", "output": "PR #234 created"},
# {"step": 6, "tool": "deploy", "input": "...", "output": "Deployed to staging ✅"}
# ]为什么M3得当做Agent?
特性告急性M3表现Tool调用准确性⭐⭐⭐⭐⭐✅ 在Claw-Eval获最高分长任务保持专注⭐⭐⭐⭐✅ 1M上下文,中央效果不丢失多轮推理⭐⭐⭐⭐⭐✅ thinking模式支持实验服从⭐⭐⭐⭐✅ MSA架构,推理快常用MCP工具组合
场景MCP Server用途代码开发filesystem读写项目文件数据库postgres/mysql查询/实验SQLGit操纵github创建PR、归并MR欣赏器puppeteerWeb自动化测试API测试httpRESTful接口测试Dockerdocker容器编排摆设// 添加更多MCP服务器
{
"mcpServers": {
"docker": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-docker"]
},
"http": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-http"]
}
}
}M3的Tool Calling vs GPT/Claude
指标M3GPT-5.5Claude 3.5Claw-Eval得分最高分82%79%Tool选择准确率94%91%93%参数添补准确率89%85%87%多Tool调用次序✅✅⚠️Tool实验失败规复✅⚠️⚠️总结
M3 + MCP = Agent的黄金组合:
[*]Claw-Eval最高分:Agent本领如今最强
[*]MCP完备支持:生态工具即插即用
[*]开源免费:本身摆设,本钱可控
共同MonkeyCode,一条指令让M3帮你完成从分析到摆设的完备流程。
免责声明:如果侵犯了您的权益,请联系站长及时删除侵权内容,谢谢合作!qidao123.com:ToB企服之家,中国第一个企服评测及软件市场,开放入驻,技术点评得现金.
页:
[1]