Claude API MCP server

Integrates Claude API features, enabling direct API access, extended context windows, and advanced conversation management. Helpful to bypass standard daily limits of Claude.ai.
Back to servers
Provider
mlobo2012
Release date
Jan 19, 2025
Language
TypeScript
Stats
11 stars

This MCP server implementation enables seamless integration between Claude Desktop and the Claude API, allowing you to bypass Professional Plan limitations and access advanced features like custom system prompts and conversation management.

Installation

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

Install Dependencies

pip install -r requirements.txt

Configure Environment

# Copy environment template
cp .env.example .env

# Edit .env and add your API key
ANTHROPIC_API_KEY=your_api_key_here

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

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

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

Using System Prompts

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

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

Available MCP Tools

  • query_claude

    • Make direct API calls to Claude
    • Support for system prompts
    • Conversation tracking
  • clear_conversation

    • Reset conversation history
    • Manage multiple conversation threads
  • get_conversation_history

    • Retrieve conversation records
    • Debug conversation flow

Troubleshooting

API Key Issues

  • Verify your API key in .env
  • Check Claude Desktop config paths
  • Ensure API key has correct permissions

Connection Issues

  • Check if MCP server is running
  • Verify Python environment
  • Check Claude Desktop logs

Usage Issues

  • Ensure correct @claude-api syntax
  • Check conversation IDs
  • Verify system prompt format

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later