远程工具集成代理

AINU代理能够无缝结合远程MCP服务器工具和本地工具使用,适用于需要远程和本地工具协同工作的场景。

  • by AINU-Labs
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 ainu-labs/ainu-mcp

使用说明

阿伊努mcp

此存储库演示了AINU代理如何无缝地使用远程MCP服务器工具和本地工具。

该代理是使用以下方式构建的 @ainulabs/ainu.

入门指南

  1. 克隆存储库:

    git clone https://github.com/AINU-Labs/ainu-mcp.git
    cd ainu-mcp
    
  2. 安装依赖项:

    npm install
    
  3. 配置环境变量:

    • 复制 .env.example 向 .env:

      cp .env.example .env
      
    • 在中填写API密钥 .env:

      • ANTHROPIC_API_KEY:人工智能代理的Anthropic API密钥。
  4. 运行代码:

    npm start
    

概述

此存储库包含以下文件:

  • src/agent.ts:定义代理及其功能。
  • src/app.ts:将快速“远程”服务设置为MCP服务器的网关
  • src/index.ts:运行示例的编排功能
  • src/server.ts:创建MCP服务器
  • tests/index.test.ts:包含应用程序的测试用例。

这种结构确保了模块化和清晰性,使其易于扩展和维护。

样本输出

Server is running on http://localhost:3000
Available tools: getLocation, getWeather
AI: I'll help you find out the weather in your current location. First, I'll retrieve your location and then check the weather for you.
AI: Now, I'll fetch the current weather for New York:
AI: Based on the results, the current weather in your location (New York) is sunny. It looks like a nice day outside!