A2A和MCP客户端和服务器库
注:这不是MCP和A2A的完整实现,而是“精简”版本 用于本地测试和实验。此代码允许您体验不同的 查看客户端和服务器之间的数据流。
先决条件
- 安装节点 v22.10.0或更高版本
- Google AI Studio API密钥来自https://aistudio.google.com/api-keys
将此密钥添加到.env文件中,例如
GEMINI_API_KEY=your-api-key安装此仓库进行本地测试
打开终端窗口并执行:
git clone git@github.com:agentic-profile/agentic-profile-a2a-mcp-express.git本地A2A测试
- 启动A2A和MCP服务
npm install
npm run dev- 在单独的终端中,启动A2A客户端
npm run chat- 对于详细的调试输出,请添加-v标志
npm run chat -- --v true本地MCP测试
- 启动A2A和MCP服务
npm install
npm run dev- 启动MCP检查器
npx @modelcontextprotocol/inspector- 从浏览器中运行的MCP检查器
- 网址:http://localhost:4004/mcp/presence
- 传输类型:流式HTTP
- 连接类型:直接
然后单击“连接”按钮
