MCP Chat
MCP Chat
MCP Chat 是一个命令行界面应用程序,通过 Anthropic API 实现与 AI 模型的交互式聊天功能。该应用程序支持文档检索、基于命令的提示,以及通过 MCP(Model Control Protocol)架构实现的可扩展工具集成。 https://anthropic.skilljar.com/claude-with-the-anthropic-api/
工具:模型控制:Claude 决定何时调用这些工具。结果由 Claude 使用。用于:
为 Claude 提供额外功能
资源:应用程序控制:我们的应用程序决定何时调用这些资源。结果主要由我们的应用程序使用。用于:
将数据导入我们的应用程序
为消息添加上下文
提示:用户控制:用户决定何时使用这些提示。用于:
根据用户输入运行预定义的工作流,例如斜杠命令、按钮点击或菜单选项。
先决条件
Python 3.9+
Anthropic API 密钥
Related MCP server: MCP Chat Server
设置
步骤 1:配置环境变量
在项目根目录中创建或编辑
.env文件,并确认以下变量已正确设置:
ANTHROPIC_API_KEY="" # Enter your Anthropic API secret key步骤 2:安装依赖
选项 1:使用 uv 设置(推荐)
uv 是一个快速的 Python 包安装器和解析器。
如果尚未安装 uv,请先安装:
pip install uv创建并激活虚拟环境:
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate安装依赖:
uv pip install -e .运行项目
uv run main.py选项 2:不使用 uv 设置
创建并激活虚拟环境:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate安装依赖:
pip install anthropic python-dotenv prompt-toolkit "mcp[cli]==1.8.0"运行项目
uv run main.py或者
python main.py要查看 MCP Web 检查器以调试您的 mcp_server.py 更改,请运行:
uv run mcp dev mcp_server.py使用方法
基本交互
直接输入您的消息并按 Enter 即可与模型聊天。
文档检索
使用 @ 符号后跟文档 ID,将文档内容包含在您的查询中:
> Tell me about @deposition.md命令
使用 / 前缀执行 MCP 服务器中定义的命令:
> /summarize deposition.md按 Tab 键时命令将自动补全。
开发
添加新文档
编辑 mcp_server.py 文件,向 docs 字典中添加新文档。
实现 MCP 功能
要完整实现 MCP 功能:
完成
mcp_server.py中的 TODOs在
mcp_client.py中实现缺失的功能
代码检查和类型检查
目前未实现任何 lint 或类型检查。
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Use AI models for chat, image, and video generation from Claude Code and other MCP hosts.
Talk to your public-facing AI from any MCP client — Claude, ChatGPT, Cursor, Cline, Windsurf.
Real-time chat for AI agents. Claude Code, Cursor, Cline and Codex join channels over MCP.
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
Related MCP Servers
- FlicenseBqualityDmaintenanceEnables interactive chat with AI models and document retrieval via the Anthropic API, supporting command-based prompts and MCP tool integrations.2-
- FlicenseBqualityDmaintenanceEnables interactive chat with AI models via Anthropic API, supporting document retrieval and extensible command-based tool integrations.2-
- FlicenseCqualityDmaintenanceEnables interactive chat with AI models via Anthropic API, supporting document retrieval and command-based prompts through the MCP architecture.3-
- FlicenseAqualityDmaintenanceEnables interactive chat with AI models through the Anthropic API, supporting document retrieval, command-based prompts, and extensible tool integrations via the MCP architecture.2-