使用说明
吴志刚
此存储库演示了WUZHI代理如何无缝地使用远程MCP服务器工具和本地工具。
该代理是使用以下方式构建的 @wuzhi-ai/wuzhi.
入门指南
-
克隆存储库:
git clone https://github.com/wuzhi-ai/wuzhi-mcp.git cd wuzhi-mcp -
安装依赖项:
npm install -
配置环境变量:
-
复制
.env.example到.env:cp .env.example .env -
在中填写API密钥
.env:ANTHROPIC_API_KEY:人工智能代理的Anthropic API密钥。
-
-
运行代码:
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!
