ChatWithMCP
ChatWithMCP
一个用于 Claude(Anthropic)的命令行聊天客户端,可连接自有及外部 MCP 服务器。聊天直接在终端中进行,工具可自动调用(或经确认后调用),并内置了用于生成和评估提示词变体的系统。
功能特点
终端内交互式聊天(OpenAI 兼容 API,
openaiSDK 对接 Anthropic 端点)连接本地 MCP 服务器(
mcp-server/)及自有工具可选连接官方 GitHub MCP 服务器(通过 Docker)
三种工具调用执行模式:
auto、approve(需确认)和plan(仅规划,不执行)流式响应和扩展思考(可选择性开启)
工具可单独或全部启用/禁用
通过
/attach将文件加载到聊天上下文中通过自有 MCP 工具进行提示词生成和评估(参见 PROMPT_EVALUATION.md)
Related MCP server: MCP Chat
前提条件
Node.js(ESM/
type: module,参见package.json)一个 Anthropic API 密钥
可选:Docker(仅用于 GitHub MCP 服务器)以及一个 GitHub 个人访问令牌
可选:一个 Tavily API 密钥(用于
web_search工具)
安装
npm install配置
在项目根目录创建 .env 文件(已被 .gitignore 排除):
ANTHROPIC_API_KEY=dein-anthropic-api-key
BASE_URL=https://api.anthropic.com/v1
TAVILY_API_KEY=dein-tavily-api-key
GITHUB_PERSONAL_ACCESS_TOKEN=dein-github-tokenANTHROPIC_API_KEY/BASE_URL— 用于聊天客户端和generate_prompts工具TAVILY_API_KEY— 仅用于web_search工具GITHUB_PERSONAL_ACCESS_TOKEN— 仅在使用 GitHub MCP 服务器(通过 Docker)时需要
常规设置(模型、令牌限制、/attach 的基础目录、GitHub 工具集)位于 config.mjs 中。
使用方法
启动聊天:
npm start本地 MCP 服务器(mcp-server/server.mjs)会自动作为子进程启动。GitHub MCP 服务器可通过 Docker 可选连接——如果连接失败,聊天仍会在没有 GitHub 工具的情况下继续运行。
MCP 服务器也可以独立启动(例如用于使用 MCP Inspector 进行测试):
npm run mcp-server聊天命令
常规
/system TEXT— 设置系统提示词/nosystem— 移除系统提示词/clear— 清空聊天历史exit— 退出聊天
工具管理
/tools— 显示可用工具及其状态/disable-tool <名称>//enable-tool <名称>— 单独禁用/启用某个工具/disable-all-tools//enable-all-tools— 禁用/启用所有工具
聊天选项
/options— 显示当前设置/enable-streaming//disable-streaming— 切换流式输出(禁用时会同时禁用所有工具)/enable-thinking//disable-thinking— 切换扩展思考
执行模式
/plan-mode— 模型仅提供计划,不执行工具/auto-mode— 工具无需确认直接执行(默认)/auto-approve— 每次工具调用前需确认/mode— 显示当前模式
文件
/attach <路径>— 读取文件并加入聊天上下文(相对路径基于config.attachBaseDir解析)
提示词评估
/generate-prompts <数量> <提示词> [--style=正式|随意|技术|创意|简洁]/evaluate-prompts/prompts/clear-prompts
详细信息参见 PROMPT_EVALUATION.md。
可用的 MCP 工具
本地 MCP 服务器(mcp-server/tools/)提供以下工具:
工具 | 描述 |
| 返回当前日期或时间 |
| 天气查询 |
| 网络搜索(需要 |
| 加载网页并将其转换为文本 |
| 读取或写入文件 |
| 列出目录内容 |
| 通过 SSH 在远程主机上执行命令 |
| 显示主机的网络接口、子网和 DNS 服务器 |
| 通过 TCP 端口扫描发现本地 IP 网络中的活跃主机 |
| 生成和评估提示词变体 |
通过可选的 GitHub MCP 服务器,还可使用用于仓库、议题、拉取请求和 Actions 的工具(参见 config.mjs → github.toolsets)。
项目结构
chat.mjs CLI-Chat-Client
config.mjs Konfiguration (Modell, Token-Limits, GitHub-Optionen)
mcp-server/
server.mjs MCP-Server (stdio)
tools/ Einzelne Tool-Implementierungen
output/ Ablage für generierte Dateien (z. B. über save_to_file)
PROMPT_EVALUATION.md Dokumentation des Prompt-Evaluation-SystemsThis server cannot be deployed
Maintenance
Related MCP Connectors
Real-time chat for AI agents. Claude Code, Cursor, Cline and Codex join channels over MCP.
- QuallaaOAuthcom.quallaa
Talk to your public-facing AI from any MCP client — Claude, ChatGPT, Cursor, Cline, Windsurf.
Real-time chat hub for AI agents — Claude Code, Cursor, Cline, Codex over MCP or REST.
- mcpOAuthai.butlerbrain
Persistent memory for AI assistants. Save once; recall from Claude, ChatGPT, or any MCP client.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA command-line interface application for interactive chat with AI models via the Anthropic API. It supports document retrieval, command-based prompts, and extensible tool integrations through the MCP architecture.-
- FlicenseAqualityDmaintenanceA command-line interface application enabling interactive chat with AI models via the Anthropic API. It supports document retrieval, command-based prompts, and extensible tool integrations through the MCP architecture.2-
- FlicenseNot gradedqualityDmaintenanceA CLI chat application enabling interactive conversations with AI models via the Anthropic API, with document retrieval and command-based prompt support through the MCP architecture.-
- FlicenseNot gradedqualityCmaintenanceMCP server enabling Claude chat, image analysis, live web search, and model listing through Anthropic's Messages API. Allows any MCP client to consult Claude as a tool via stdio JSON-RPC.-