A2A和MCP客户端与服务器库

提供A2A和MCP协议的客户端与服务器库,用于本地测试和实验。

  • by agentic-profile
  • TypeScript
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 agentic-profile/agentic-profile-a2a-mcp-express

使用说明

A2A和MCP客户端和服务器库

注:这不是MCP和A2A的完整实现,而是“精简”版本 用于本地测试和实验。此代码允许您体验不同的 查看客户端和服务器之间的数据流。

先决条件

  1. 安装节点 v22.10.0或更高版本

  2. Google AI Studio API密钥来自https://aistudio.google.com/api-keys 将此密钥添加到.env文件中,例如

    GEMINI_API_KEY=your-api-key
    
  3. 安装Git

安装此仓库进行本地测试

打开终端窗口并执行:

git clone git@github.com:agentic-profile/agentic-profile-a2a-mcp-express.git

本地A2A测试

  1. 启动A2A和MCP服务
npm install
npm run dev
  1. 在单独的终端中,启动A2A客户端
npm run chat
  1. 对于详细的调试输出,请添加-v标志
npm run chat -- --v true

本地MCP测试

  1. 启动A2A和MCP服务
npm install
npm run dev
  1. 启动MCP检查器
npx @modelcontextprotocol/inspector
  1. 从浏览器中运行的MCP检查器
  • 网址:http://localhost:4004/mcp/presence
  • 传输类型:流式HTTP
  • 连接类型:直接

然后单击“连接”按钮