基本能力
产品定位
Claude Desktop API Integration via MCP 是一个中间件服务,旨在桥接Claude Desktop应用与Claude API,提供更灵活的功能使用方式。
核心功能
- 通过MCP直接集成Claude API
- 对话历史跟踪和管理
- 支持系统提示
- 无缝切换专业版计划和API使用
- 与Claude Desktop轻松配置
适用场景
- 专业版计划(默认):
- Claude Desktop中的常规对话
- 在计划限制内的基本使用
-
无需特殊配置
-
API令牌(通过此MCP服务器):
- 需要更长的上下文窗口时
- 使用自定义系统提示时
- 绕过速率限制时
- 进行高级对话管理时
工具列表
query_claude
- 直接向Claude发起API调用
- 支持系统提示
-
对话跟踪
-
clear_conversation
- 重置对话历史
-
管理多个对话线程
-
get_conversation_history
- 检索对话记录
- 调试对话流程
常见问题解答
- API密钥问题
- 验证.env中的API密钥
- 检查Claude Desktop配置路径
-
确保API密钥具有正确的权限
-
连接问题
- 检查MCP服务器是否正在运行
- 验证Python环境
-
检查Claude Desktop日志
-
使用问题
- 确保正确的@claude-api语法
- 检查对话ID
- 验证系统提示格式
使用教程
使用依赖
bash
pip install -r requirements.txt
安装教程
-
克隆仓库
bash
git clone https://github.com/mlobo2012/Claude_Desktop_API_USE_VIA_MCP.git
cd Claude_Desktop_API_USE_VIA_MCP -
配置环境
```bash
cp .env.example .env
编辑.env并添加您的API密钥
ANTHROPIC_API_KEY=your_api_key_here
```
- 配置Claude Desktop
- macOS: 导航到
~/Library/Application Support/Claude/
- Windows: 导航到
%APPDATA%\Claude\
- 创建或编辑
claude_desktop_config.json
- 从
config/claude_desktop_config.json
复制内容 - 更新路径和API密钥
调试方式
-
基本使用
@claude-api Please answer using the API: What is the capital of France?
-
高级功能
@claude-api {"system_prompt": "You are an expert fitness coach"} Create a workout plan
-
管理对话
```
开始新对话
@claude-api {"conversation_id": "project1"} Let's discuss Python
继续相同对话
@claude-api {"conversation_id": "project1"} Tell me more
查看对话历史
@claude-api get_conversation_history project1
清除对话
@claude-api clear_conversation project1
```