MCP测试客户端

一个支持Anthropic Claude和OpenAI GPT模型的命令行MCP客户端,用于执行LLM驱动的工具。

  • by BenItBuhner
  • TypeScript
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 BenItBuhner/MCP-Base

使用说明

MCP测试客户端

一个命令行MCP(模型上下文协议)客户端,支持Anthropic Claude和OpenAI GPT模型,用于LLM驱动的工具执行。

在分享之前,需要更清楚地说明一个小型AI/MCP项目吗?看 20美元人工智能代理发射救援.

特性

  • 多提供商支持:通过环境变量在Anthropic Claude和OpenAI GPT之间切换
  • 多种身份验证方法:没有身份验证、承载令牌和OAuth流
  • 多服务器配置:基于JSON的服务器配置,带有环境变量占位符
  • 多回转刀具执行:自动处理对话回合中的工具调用
  • 交互式CLI:聊天界面,可选择服务器
  • 本地服务器支持:通过stdio在本地运行MCP服务器

安装

bun install

配置

环境变量

创建 .env 文件来自 .env.example 并填写必要的字段供您使用。

服务器配置

打开并编辑 mcp-servers.json;添加您的首选服务器:

[
  {
    "name": "Public Server",
    "url": "https://mcp.example.com/mcp",
    "auth": { "type": "none" }
  },
  {
    "name": "API Key Server",
    "url": "https://api.example.com/mcp",
    "auth": {
      "type": "bearer",
      "token": "${API_TOKEN}"
    }
  },
  {
    "name": "OAuth Server",
    "url": "https://oauth.example.com/mcp",
    "auth": {
      "type": "oauth",
      "oauth": {
        "clientId": "${CLIENT_ID}",
        "clientSecret": "${CLIENT_SECRET}",
        "authorizationUrl": "https://oauth.example.com/authorize",
        "tokenUrl": "https://oauth.example.com/token",
        "redirectUri": "http://localhost:8090/callback",
        "scopes": ["read", "write"]
      }
    }
  },
  {
    "name": "Local Server",
    "type": "local",
    "command": "npx",
    "args": ["@modelcontextprotocol/server-filesystem", "/path/to/dir"]
  }
]

用法

运行CLI:

bun src/cli.ts

选择服务器并开始聊天。键入“quit”退出。