Claude Desktop API MCP
通过 MCP 集成 Claude 桌面 API
该项目提供了一个 MCP 服务器实现,可实现 Claude Desktop 与 Claude API 之间的无缝集成。它允许您绕过专业计划的限制,并使用自定义系统提示和对话管理等高级功能。
特征
通过 MCP 直接集成 Claude API
对话历史跟踪和管理
系统提示支持
专业计划和 API 使用之间的无缝切换
使用 Claude Desktop 轻松配置
Related MCP server: Desktop Commander MCP
何时使用
专业计划(默认):
Claude Desktop 中的常规对话
计划限制内的基本使用情况
无需特殊配置
API 令牌(通过此 MCP 服务器):
当您需要更长的上下文窗口时
使用自定义系统提示
绕过速率限制
用于高级对话管理
设置说明
克隆存储库
# Using VS Code: # 1. Press Cmd + Shift + P # 2. Type "Git: Clone" # 3. Paste: https://github.com/mlobo2012/Claude_Desktop_API_USE_VIA_MCP.git # Or using terminal: git clone https://github.com/mlobo2012/Claude_Desktop_API_USE_VIA_MCP.git cd Claude_Desktop_API_USE_VIA_MCP安装依赖项
pip install -r requirements.txt配置环境
# Copy environment template cp .env.example .env # Edit .env and add your API key ANTHROPIC_API_KEY=your_api_key_here配置 Claude 桌面
macOS:导航至
~/Library/Application Support/Claude/# Using Finder: # 1. Press Cmd + Shift + G # 2. Enter: ~/Library/Application Support/Claude/Windows:导航至
%APPDATA%\Claude\创建或编辑
claude_desktop_config.json从
config/claude_desktop_config.json复制内容更新路径和 API 密钥
使用指南
基本用法
常规 Claude 桌面使用情况
和克劳德正常聊天就行
使用您的专业计划
无需特殊命令
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管理对话
# Start a new conversation @claude-api {"conversation_id": "project1"} Let's discuss Python # Continue same conversation @claude-api {"conversation_id": "project1"} Tell me more # View conversation history @claude-api get_conversation_history project1 # Clear conversation @claude-api clear_conversation project1
成本管理
API 调用使用您的 Anthropic API 积分,可能会产生费用
使用专业计划进行常规查询
仅在您特别需要时使用@claude-api:
更长的上下文窗口
自定义系统提示
绕过速率限制
MCP 工具可用
query_claude直接对 Claude 进行 API 调用
支持系统提示
对话追踪
clear_conversation重置对话历史记录
管理多个对话线程
get_conversation_history检索对话记录
调试对话流程
发展
主服务器实现位于src/claude_api_server.py中。要扩展功能,可以使用@mcp.tool()装饰器添加新工具。
添加新工具的示例:
@mcp.tool()
async def custom_tool(param: str) -> str:
"""
Custom tool description
Args:
param: Parameter description
"""
try:
# Tool implementation
return result
except Exception as e:
return f"Error: {str(e)}"故障排除
API 密钥问题
在 .env 中验证您的 API 密钥
检查 Claude Desktop 配置路径
确保 API 密钥具有正确的权限
连接问题
检查 MCP 服务器是否正在运行
验证 Python 环境
检查 Claude Desktop 日志
使用问题
确保@claude-api语法正确
检查对话 ID
验证系统提示格式
贡献
分叉存储库
创建功能分支
进行更改
提交拉取请求
执照
麻省理工学院
支持
对于问题和疑问:
在存储库中打开一个问题
检查现有讨论
查看故障排除指南
Available Tools
1 toolsend-messageC
Send a message to Claude
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | Message to send to Claude |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. It states the action ('send a message') but doesn't describe what happens after sending, whether there are rate limits, authentication requirements, response expectations, or error conditions. This leaves significant behavioral uncertainty for an agent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is perfectly concise at just 4 words, front-loading the essential action without any wasted words. Every element earns its place, making it immediately understandable while being maximally efficient.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no annotations and no output schema, the description is insufficiently complete. It doesn't explain what happens after sending the message, what kind of response to expect, or any behavioral characteristics. For a communication tool with zero structured metadata, more context about the interaction pattern would be needed.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 100%, with the single parameter 'message' clearly documented in the schema. The description doesn't add any parameter information beyond what's already in the schema, so it meets the baseline for high schema coverage without providing additional semantic context.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb ('send') and resource ('message to Claude'), making the purpose immediately understandable. However, it doesn't differentiate from siblings since there are none, and could be slightly more specific about what type of message or context this involves.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives, prerequisites, or contextual constraints. With no sibling tools, this is less critical, but still lacks any usage context that would help an agent determine appropriate invocation scenarios.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
- First observed
send-message
TDQS
Scored across 1 tool
With only one tool, there is no possibility of ambiguity or confusion between tools. The single tool has a clear, distinct purpose that cannot be mistaken for any other tool in the set.
A single tool inherently demonstrates perfect naming consistency. There are no other tools to compare against, so no inconsistency can exist in the naming pattern.
One tool is too few for meaningful interaction with a Claude Desktop API. While the tool's purpose is clear, a single send-message operation severely limits functionality and suggests an incomplete or minimal implementation.
The tool surface is severely incomplete for a Claude Desktop API. With only send-message, there are no tools for receiving messages, managing conversations, handling settings, or performing any other expected API operations. This creates significant dead ends for agents.
Maintenance
Related MCP Connectors
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
Hosted Amazon Seller Central and Amazon Ads MCP server for Claude, ChatGPT, Cursor, and agents.
Hosted Amazon Seller and Vendor MCP server for Claude, ChatGPT, Cursor, Codex, Gemini, Copilot.
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
Related MCP Servers
- FlicenseAqualityDmaintenanceThe server facilitates natural language interactions for exploring and understanding codebases, providing insights into data models and system architecture using a cost-effective, simple setup with support for existing Claude Pro subscriptions.427-
- AlicenseAqualityDmaintenanceA server that lets Claude desktop app execute terminal commands on your computer and edit files through Model Context Protocol, featuring command execution, process management, and advanced file operations.19206,624 npm6MIT
- FlicenseDqualityDmaintenanceA server built on mcp-framework that enables integration with Claude Desktop through the Model Context Protocol.11-
- FlicenseCqualityDmaintenanceA server built with mcp-framework that allows users to extend Claude's capabilities by adding custom tools that can be used through the Claude Desktop client.334 npm-