这是一个用于动态MCP工具调用的测试应用程序(按用户)
基于用户身份验证的动态MCP调用
- 为每个请求生成MCP客户端实例——显然在finally块中关闭它们。
- 用户身份验证(PAT)仅在MCP客户端创建时传递,AI无法访问它。
仅设置BE
- 克隆Repo
git clone https://github.com/thinker-chetan/mcp-wt-aisdk.git- 创建.env
cp .env.example .env并添加您的Gemini API密钥。
- 创建
userPATStore.json
cp userPATStore.json.example userPATStore.json并添加少量具有PAT密钥的用户。
- 启动开发服务器
npm run build- 构建
npm run build- 启动服务器
npm run start- 测试
curl --location 'http://localhost:8000/chat' \
--header 'x-user: ' \
--header 'Content-Type: application/json' \
--data '{
"message": "Refer the tools. Tell me about me."
}'