Claude Code MCP for Cursor

Claude Code MCP for Cursor

Bridges Claude Code CLI with Cursor IDE to use your existing Claude subscription without separate API costs.

Category
访问服务器

README

Claude Code MCP for Cursor

Use your existing Claude subscription ($20/month) with Cursor IDE instead of paying separate API costs.

🎯 What This Does

This MCP (Model Context Protocol) server bridges Claude Code CLI with Cursor IDE, allowing you to:

  • ✅ Use your existing $20/month Claude subscription in Cursor
  • ✅ Avoid separate pay-per-use API billing
  • ✅ Keep your Claude usage within your monthly plan limits
  • ✅ Get the same Claude experience directly in your IDE

💰 Cost Benefits

Method Cost Structure Monthly Estimate*
This MCP Bridge $20/month (your existing plan) $20
Direct API Pay-per-token usage $30-100+

*Estimates vary based on usage patterns

🔧 Prerequisites

  1. Claude Code CLI installed and authenticated

    # Install Claude Code (if not already installed)
    curl -fsSL https://claude.ai/install.sh | bash
    
    # Verify it works
    claude chat "Hello"
    
  2. Cursor IDE with MCP support

  3. Node.js installed on your system

📦 Installation

Step 1: Clone this repository

git clone https://github.com/Blackpenguin46/Claude-Code-MCP-for-Cursor.git
cd Claude-Code-MCP-for-Cursor

Step 2: Set up the MCP server in your project

Copy the files to your project directory:

# Copy the MCP server to your project root
cp claude-mcp-server.js /path/to/your/project/

# Create the .cursor directory if it doesn't exist
mkdir -p /path/to/your/project/.cursor

# Copy the MCP configuration
cp mcp.json /path/to/your/project/.cursor/

Your project structure should look like:

your-project/
├── .cursor/
│   └── mcp.json
├── claude-mcp-server.js
└── (your other project files)

Step 3: Configure Cursor

  1. Open Cursor
  2. Go to SettingsTools & IntegrationsMCP Tools
  3. You should see "claude-code" in the MCP Tools section
  4. Make sure the toggle is enabled (green)
  5. Verify it shows "1 tools enabled" (not "0 tools enabled")

If you see "0 tools enabled":

  • Restart Cursor completely
  • Check that files are in the correct locations
  • Ensure claude-mcp-server.js is executable: chmod +x claude-mcp-server.js

🧪 Testing

Test that everything works:

  1. Test Claude Code directly:

    claude chat "What is 2+2?"
    
  2. Test the MCP server:

    cd your-project
    node claude-mcp-server.js
    

    Then paste this JSON and press Enter:

    {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"claude_chat","arguments":{"message":"What is 2+2?"}}}
    

    You should see a response like:

    {"jsonrpc":"2.0","id":3,"result":{"content":[{"type":"text","text":"4"}]}}
    
  3. Test in Cursor:

    • Open a chat in Cursor
    • Ask Claude a question
    • Verify the response comes from your Claude Code subscription

🔍 How It Works

graph LR
    A[Cursor IDE] --> B[MCP Server]
    B --> C[Claude Code CLI]
    C --> D[Your $20 Subscription]
    D --> E[Claude API]
    E --> D
    D --> C
    C --> B
    B --> A
  1. Cursor sends chat requests to the MCP server
  2. MCP Server translates requests to Claude Code CLI commands
  3. Claude Code uses your existing subscription to contact Claude
  4. Response flows back through the chain to Cursor

📁 File Descriptions

claude-mcp-server.js

The main MCP server that bridges Cursor and Claude Code. Handles:

  • JSON-RPC protocol for MCP communication
  • Spawning Claude Code processes
  • Response cleaning and formatting
  • Error handling and timeouts

.cursor/mcp.json

Cursor's MCP configuration file that tells Cursor how to connect to the server:

{
  "mcpServers": {
    "claude-code": {
      "command": "node",
      "args": ["claude-mcp-server.js"],
      "env": {}
    }
  }
}

🚨 Troubleshooting

"0 tools enabled" in Cursor

  • Ensure files are in correct locations
  • Restart Cursor completely
  • Check file permissions: chmod +x claude-mcp-server.js
  • Verify Claude Code works: claude chat "test"

MCP server hangs or errors

  • Test Claude Code independently first
  • Check that you're authenticated with Claude Code
  • Verify Node.js is installed and working
  • Look at Cursor's developer console for errors

"Claude Code error" messages

  • Ensure Claude Code is properly installed and authenticated
  • Check your Claude subscription status
  • Verify you haven't exceeded usage limits

🔄 Usage Patterns

Best Practices

  • Development work: Perfect for code review, debugging, refactoring
  • Documentation: Great for generating comments and documentation
  • Learning: Ideal for understanding new codebases or technologies

What Counts Against Your Limits

  • Each message sent through Cursor counts against your $20/month plan limits
  • Same usage tracking as using Claude Code directly in terminal
  • Monitor your usage in Claude's web interface

🎁 Benefits Over Direct API

Feature MCP Bridge Direct API
Cost Predictability ✅ Fixed $20/month ❌ Variable usage costs
Usage Limits ✅ Clear monthly limits ❌ Surprise bills possible
Setup Complexity ⚠️ Initial setup required ✅ Simple API key
Claude Code Integration ✅ Uses existing auth ❌ Separate billing

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

📄 License

MIT License - feel free to use and modify as needed.

⚡ Quick Start Summary

# 1. Clone repo
git clone https://github.com/Blackpenguin46/Claude-Code-MCP-for-Cursor.git

# 2. Copy files to your project
cp claude-mcp-server.js /path/to/project/
mkdir -p /path/to/project/.cursor
cp mcp.json /path/to/project/.cursor/

# 3. Test
claude chat "Hello"  # Verify Claude Code works
node claude-mcp-server.js  # Test MCP server

# 4. Restart Cursor and check MCP Tools section

💡 Pro Tip: This setup is perfect for developers who use Claude regularly for coding tasks and want predictable monthly costs instead of surprise API bills!

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选