MC

mlobo2012/claude_desktop_api_use_via_mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

34 stars 8 forks 质量 45 趋势 12

MCP 服务器实现,用于在 Claude Desktop 上使用 Claude API,提供高级 API 集成和会话管理。

概览

该项目提供了一个MCP服务器实现,实现Claude Desktop与Claude API之间的无缝集成。它允许您绕过专业计划的限制,访问如自定义系统提示和对话管理等高级功能。 - 通过MCP直接集成Claude API——对话记录跟踪和管理——系统提示词支持——专业计划与API使用间无缝切换——Claude桌面配置简便 - (默认):- 在 Claude Desktop 中进行常规对话 - 基本使用在套餐限制内 - 无需特殊配置 - (通过该MCP服务器):- 当你需要更长的上下文窗口时 - 使用自定义系统提示 - 绕过速率限制 - 用于高级对话管理 4. - macOS:前往 ~/Library/Application Support/Claude/ - Windows:前往 %APPDATA%\Claude\ - 创建或编辑claude_desktop_config.json - 从配置/claude_desktop_config.json复制内容 - 更新路径和 API 密钥 1.

概述(AI 翻译)

该项目提供了一个MCP服务器实现,实现Claude Desktop与Claude API之间的无缝集成。它允许您绕过专业计划的限制,访问如自定义系统提示和对话管理等高级功能。

特色

  • 通过MCP直接集成Claude API
  • 对话记录跟踪与管理
  • 系统提示符支持
  • 专业套餐与API使用间无缝切换
  • 使用 Claude Desktop 轻松配置

何时使用?

  • 专业计划(默认):

  • Claude Desktop 中的常规对话

  • 在计划限制内的基本使用情况

  • 无需特殊配置

  • API 令牌(通过该 MCP 服务器):

  • 当你需要更长的上下文窗口时

  • 使用自定义系统提示

  • 绕过速率限制

  • 用于高级会话管理

设置说明

  1. 复制仓库

  2. 安装依赖

  3. 配置环境

  4. 配置Claude Desktop

  • macOS:导航至~/Library/Application Support/Claude/

  • Windows:导航至%APPDATA%\Claude\

  • 创建或编辑claude_desktop_config.json

  • 复制[[T3]的内容]

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Claude Desktop API Integration via MCP

This project provides an MCP server implementation that enables seamless integration between Claude Desktop and the Claude API. It allows you to bypass Professional Plan limitations and access advanced features like custom system prompts and conversation management.

Features

  • Direct Claude API integration via MCP
  • Conversation history tracking and management
  • System prompt support
  • Seamless switching between Professional Plan and API usage
  • Easy configuration with Claude Desktop

When to Use

  • Professional Plan (default):

    • Regular conversations in Claude Desktop
    • Basic usage within plan limits
    • No special configuration needed
  • API Token (via this MCP server):

    • When you need longer context windows
    • To use custom system prompts
    • To bypass rate limits
    • For advanced conversation management

Setup Instructions

  1. Clone the Repository

    # 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
    
  2. Install Dependencies

    pip install -r requirements.txt
    
  3. Configure Environment

    # Copy environment template
    cp .env.example .env
    
    # Edit .env and add your API key
    ANTHROPIC_API_KEY=your_api_key_here
    
  4. Configure Claude Desktop

    • macOS: Navigate to ~/Library/Application Support/Claude/
      # Using Finder:
      # 1. Press Cmd + Shift + G
      # 2. Enter: ~/Library/Application Support/Claude/
      
    • Windows: Navigate to %APPDATA%\Claude\
    • Create or edit claude_desktop_config.json
    • Copy contents from config/claude_desktop_config.json
    • Update paths and API keys

Usage Guide

Basic Usage

  1. Regular Claude Desktop Usage

    • Just chat normally with Claude
    • Uses your Professional Plan
    • No special commands needed
  2. API Usage

    @claude-api Please answer using the API: What is the capital of France?
    

Advanced Features

  1. Using System Prompts

    @claude-api {"system_prompt": "You are an expert fitness coach"} Create a workout plan
    
  2. Managing Conversations

    # 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
    

Cost Management

  • API calls use your Anthropic API credits and may incur charges
  • Use the Professional Plan for regular queries
  • Only use @claude-api when you specifically need:
    • Longer context windows
    • Custom system prompts
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →