内容
# Cursor MCP - Claude Desktop Integration
<a href="https://smithery.ai/badge/cursor-mcp-tool"><img src="https://smithery.ai/badge/cursor-mcp-tool" alt="smithery badge"></a>
一个模型上下文协议(MCP)的实现,通过 Cursor IDE 实现 Claude AI 和桌面应用程序之间的无缝集成。该工具充当 Claude 的功能和桌面软件之间的桥梁,从而实现增强的 AI 驱动的开发工作流程。
<a href="https://glama.ai/mcp/servers/4fg1gxbcex"><img width="380" height="200" src="https://glama.ai/mcp/servers/4fg1gxbcex/badge" alt="Cursor Server MCP server" /></a>
## Quick Start (Windows)
### Installing via Smithery
要通过 [Smithery](https://smithery.ai/server/cursor-mcp-tool) 自动安装 Cursor for Claude Desktop:
```bash
npx -y @smithery/cli install cursor-mcp-tool --client claude
```
### Installing Manually
1. **Prerequisites**
- [Node.js](https://nodejs.org/) v18 或更高版本
- [Cursor IDE](https://cursor.sh/)
- Windows 10 或更高版本
2. **Installation**
```bash
# Install globally
npm install -g mcp-cursor
# Or install locally
git clone https://github.com/yourusername/cursor-mcp.git
cd cursor-mcp
npm install
```
3. **Configuration**
- 在项目根目录中创建一个 `.env` 文件:
```bash
# Windows path example
DEFAULT_WORKSPACE_PATH=C:/Users/YourUsername/Documents/cursor-workspaces
```
4. **Add to Claude's MCP Configuration**
将以下内容添加到您的 Claude 配置中:
```json
{
"name": "cursor",
"type": "mcp",
"config": {
"server": "https://glama.ai/mcp/servers/4fg1gxbcex",
"capabilities": ["cursor_control", "window_management"]
}
}
```
5. **Start the Server**
```bash
# If installed globally
mcp-cursor
# If installed locally
npm start
```
## Features
- 在您的开发工作流程中提供实时的 AI 辅助
- 上下文感知的代码建议和补全
- 与 Cursor IDE 无缝集成
- Windows 自动化,以提高生产力
## Detailed Setup
### Local Development Setup
1. 克隆并安装:
```bash
git clone https://github.com/yourusername/cursor-mcp.git
cd cursor-mcp
npm install
```
2. 创建环境配置:
```bash
cp .env.example .env
```
编辑 `.env` 并设置您的工作区路径:
```bash
DEFAULT_WORKSPACE_PATH=C:/Users/YourUsername/Documents/cursor-workspaces
```
3. 构建并运行:
```bash
# Development mode with hot reload
npm run dev
# Production mode
npm run build
npm start
```
### Troubleshooting
1. **Window Detection Issues**
- 确保 Cursor IDE 正在运行
- 尝试重新启动 MCP 服务器
- 检查您的工作区路径是否正确
2. **Permission Issues**
- 首次设置时以管理员身份运行终端
- 确保工作区目录中具有正确的文件权限
3. **Node Version Issues**
- 使用 `nvm` 切换到 Node.js v18 或更高版本:
```bash
nvm install 18
nvm use 18
```
## Project Structure
```
cursor-mcp/
├── src/ # Source code
│ ├── services/ # Core services
│ ├── handlers/ # Event handlers
│ └── types/ # TypeScript definitions
├── build/ # Compiled JavaScript
└── .env # Environment configuration
```
## Scripts
- `npm run build` - 编译 TypeScript
- `npm start` - 运行生产服务器
- `npm run dev` - 启动具有热重载的开发服务器
## Contributing
1. Fork the repository
2. Create feature branch (`git checkout -b feature/amazing-feature`)
3. Commit changes (`git commit -m 'Add feature'`)
4. Push to branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request
## License
MIT License - see LICENSE file for details.
## Running evals
evals 包加载一个 mcp 客户端,然后运行 index.ts 文件,因此无需在测试之间重建。您可以通过为 npx 命令添加前缀来加载环境变量。完整的文档可以在[这里](https://www.mcpevals.io/docs)找到。
```bash
OPENAI_API_KEY=your-key npx mcp-eval src/evals/evals.ts src/tools/cursor-tools.ts
```
## Support
寻求支持:
- 在 GitHub 存储库中打开一个 issue
- 加入我们的 [Discord community](https://discord.gg/yourcommunity)
- 查看 [FAQ](https://github.com/yourusername/cursor-mcp/wiki/FAQ)