Token导航 LogoToken导航TokenDH.com
Multiplatform Cursor MCP logo
开发工具未说明官方级别未说明来源级核验

Multiplatform Cursor MCP

MCP Server

Cursor MCP是连接Claude桌面应用与Cursor编辑器的桥梁协议,实现AI驱动的自动化编辑和多实例管理,支持标准化AI服务集成。

工具数

0

提示词数

0

GitHub Stars

67

资源数

0
代码生成TypeScriptClaudeClaude DesktopClaudeCursor

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

johnneerdael

提供方

johnneerdael

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

光标MCP(模型上下文协议)

Cursor MCP是Claude桌面应用程序和Cursor编辑器之间的桥梁,实现了无缝的AI自动化和多实例管理。它是更广泛的模型上下文协议(MCP)生态系统的一部分,允许Cursor通过标准化接口与各种AI模型和服务进行交互。

概述

🤖 人工智能集成

  • 与Claude的桌面应用程序直接集成
  • 能够利用其他兼容MCP的AI服务
  • AI和编辑器之间的实时上下文共享
  • 人工智能驱动的自动化和代码生成

🔌 MCP协议支持

  • 与AI模型的标准化沟通
  • 用于附加MCP的可扩展插件系统
  • 上下文感知命令执行
  • 基于安全令牌的身份验证

🖥️ 跨平台窗口管理

  • 跨操作系统无缝管理游标编辑器窗口
  • 以编程方式聚焦、最小化、还原和排列窗口
  • 跟踪窗口状态变化和位置
  • 同时处理多个游标实例

⌨️ 输入自动化

  • AI驱动的键盘输入,支持:

- 代码生成和插入 - 重构操作 - 上下文感知完成 - 多光标编辑

  • 智能鼠标自动化包括:

- 智能选择 - 上下文菜单操作 - 人工智能导航

🔄 流程管理

  • AI编排的实例管理
  • 智能工作空间组织
  • 自动上下文保存
  • 智能会话恢复

MCP集成

Claude桌面集成

import { ClaudeMCP } from 'cursor-mcp/claude'

// Connect to Claude's desktop app
const claude = await ClaudeMCP.connect()

// Execute AI-powered operations
await claude.generateCode({
    prompt: 'Create a React component',
    context: currentFileContent,
    language: 'typescript'
})

// Get AI suggestions
const suggestions = await claude.getSuggestions({
    code: selectedText,
    type: 'refactor'
})

使用多个MCP

import { MCPRegistry } from 'cursor-mcp/registry'

// Register available MCPs
MCPRegistry.register('claude', ClaudeMCP)
MCPRegistry.register('github-copilot', CopilotMCP)

// Use different AI services
const claude = await MCPRegistry.get('claude')
const copilot = await MCPRegistry.get('github-copilot')

// Compare suggestions
const claudeSuggestions = await claude.getSuggestions(context)
const copilotSuggestions = await copilot.getSuggestions(context)

自定义MCP集成

import { BaseMCP, MCPProvider } from 'cursor-mcp/core'

class CustomMCP extends BaseMCP implements MCPProvider {
    async connect() {
        // Custom connection logic
    }

    async generateSuggestions(context: CodeContext) {
        // Custom AI integration
    }
}

// Register custom MCP
MCPRegistry.register('custom-ai', CustomMCP)

配置

该工具可以通过环境变量或配置文件在以下位置进行配置:

  • 窗户: %LOCALAPPDATA%\cursor-mcp\config\config.json
  • macOS: ~/Library/Application Support/cursor-mcp/config/config.json
  • Linux: ~/.config/cursor-mcp/config.json

配置示例:

{
    "mcp": {
        "claude": {
            "enabled": true,
            "apiKey": "${CLAUDE_API_KEY}",
            "contextWindow": 100000
        },
        "providers": {
            "github-copilot": {
                "enabled": true,
                "auth": "${GITHUB_TOKEN}"
            }
        }
    },
    "autoStart": true,
    "maxInstances": 4,
    "windowArrangement": "grid",
    "logging": {
        "level": "info",
        "file": "cursor-mcp.log"
    }
}

安装

视窗

# Run as Administrator
Invoke-WebRequest -Uri "https://github.com/your-org/cursor-mcp/releases/latest/download/cursor-mcp-windows.zip" -OutFile "cursor-mcp.zip"
Expand-Archive -Path "cursor-mcp.zip" -DestinationPath "."
.\windows.ps1

macOS

# Run with sudo
curl -L "https://github.com/your-org/cursor-mcp/releases/latest/download/cursor-mcp-macos.zip" -o "cursor-mcp.zip"
unzip cursor-mcp.zip
sudo ./macos.sh

Linux

# Run with sudo
curl -L "https://github.com/your-org/cursor-mcp/releases/latest/download/cursor-mcp-linux.zip" -o "cursor-mcp.zip"
unzip cursor-mcp.zip
sudo ./linux.sh

用法

基本用法

import { CursorInstanceManager } from 'cursor-mcp'

// Get the instance manager
const manager = CursorInstanceManager.getInstance()

// Start a new Cursor instance
await manager.startNewInstance()

// Get all running instances
const instances = await manager.getRunningInstances()

// Focus a specific instance
await manager.focusInstance(instances[0])

// Close all instances
await manager.closeAllInstances()

窗口管理

import { WindowManager } from 'cursor-mcp'

const windowManager = WindowManager.getInstance()

// Find all Cursor windows
const windows = await windowManager.findCursorWindows()

// Focus a window
await windowManager.focusWindow(windows[0])

// Arrange windows side by side
await windowManager.arrangeWindows(windows, 'sideBySide')

// Minimize all windows
for (const window of windows) {
    await windowManager.minimizeWindow(window)
}

输入自动化

import { InputAutomationService } from 'cursor-mcp'

const inputService = InputAutomationService.getInstance()

// Type text
await inputService.typeText('Hello, World!')

// Send keyboard shortcuts
if (process.platform === 'darwin') {
    await inputService.sendKeys(['command', 'c'])
} else {
    await inputService.sendKeys(['control', 'c'])
}

// Mouse operations
await inputService.moveMouse(100, 100)
await inputService.mouseClick('left')
await inputService.mouseDrag(100, 100, 200, 200)

运作原理

桥梁建筑

此工具充当Cursor和MCP服务器之间的中间件层:

  1. 光标集成:

- 监视Cursor的文件系统事件 - 捕获编辑器状态和上下文 - 将响应注入编辑器 - 管理窗口和流程自动化

  1. MCP协议转换:

- 将Cursor的内部事件转换为MCP协议消息 - 将MCP响应转换为与游标兼容的操作 - 维护会话状态和上下文 - 处理身份验证和安全

  1. 服务器通信:

- 连接到Claude的桌面应用程序MCP服务器 - 将请求路由到适当的AI提供商 - 管理与多个MCP的并发连接 - 处理回退和错误恢复

graph LR
    A[Cursor Editor]  B[Cursor MCP Bridge]
    B  C[Claude Desktop MCP]
    B  D[GitHub Copilot MCP]
    B  E[Custom AI MCPs]

工作流示例

  1. 代码完成请求:
   // 1. Cursor Event (File Change)
   // When user types in Cursor:
   function calculateTotal(items) {
     // Calculate the total price of items|   {
     return total + (item.price * item.quantity);
   }, 0);`

   // 5. Cursor Integration
   // Bridge injects the code at cursor position
  1. 代码重构:
   // 1. Cursor Event (Command)
   // User selects code and triggers refactor command
   const oldCode = `
     if (user.age >= 18) {
       if (user.hasLicense) {
         if (car.isAvailable) {
           rentCar(user, car);
         }
       }
     }
   `

   // 2. Bridge Translation
   const event = {
     type: 'refactor_request',
     context: {
       selection: oldCode,
       command: 'simplify_nesting'
     }
   }

   // 3. MCP Protocol Message
   await mcpServer.call('refactor_code', {
     code: event.context.selection,
     style: 'simplified',
     maintain_logic: true
   })

   // 4. Response Translation
   const response = `
     const canRentCar = user.age >= 18 
       && user.hasLicense 
       && car.isAvailable;
     
     if (canRentCar) {
       rentCar(user, car);
     }
   `

   // 5. Cursor Integration
   // Bridge replaces selected code
  1. 多文件上下文:
   // 1. Cursor Event (File Dependencies)
   // When user requests help with a component

   // 2. Bridge Translation
   const event = {
     type: 'context_request',
     files: {
       'UserProfile.tsx': '...',
       'types.ts': '...',
       'api.ts': '...'
     },
     focus_file: 'UserProfile.tsx'
   }

   // 3. MCP Protocol Message
   await mcpServer.call('analyze_context', {
     files: event.files,
     primary_file: event.focus_file,
     analysis_type: 'component_dependencies'
   })

   // 4. Response Processing
   // Bridge maintains context across requests

集成方法

  1. 文件系统监控:
   import { FileSystemWatcher } from 'cursor-mcp/watcher'

   const watcher = new FileSystemWatcher({
     paths: ['/path/to/cursor/workspace'],
     events: ['change', 'create', 'delete']
   })

   watcher.on('change', async (event) => {
     const mcpMessage = await bridge.translateEvent(event)
     await mcpServer.send(mcpMessage)
   })
  1. 窗口集成:
   import { CursorWindow } from 'cursor-mcp/window'

   const window = new CursorWindow()

   // Inject AI responses
   await window.injectCode({
     position: cursorPosition,
     code: mcpResponse.code,
     animate: true  // Smooth typing animation
   })

   // Handle user interactions
   window.onCommand('refactor', async (selection) => {
     const mcpMessage = await bridge.createRefactorRequest(selection)
     const response = await mcpServer.send(mcpMessage)
     await window.applyRefactoring(response)
   })
  1. 上下文管理:
   import { ContextManager } from 'cursor-mcp/context'

   const context = new ContextManager()

   // Track file dependencies
   await context.addFile('component.tsx')
   await context.trackDependencies()

   // Maintain conversation history
   context.addMessage({
     role: 'user',
     content: 'Refactor this component'
   })

   // Send to MCP server
   const response = await mcpServer.send({
     type: 'refactor',
     context: context.getFullContext()
   })

安全

  • 基于令牌的AI服务安全身份验证
  • 加密通信渠道
  • 沙盒执行环境
  • 细粒度权限控制

需求

视窗

  • Windows 10或更高版本
  • Node.js 18或更高版本
  • 安装的管理员权限

macOS

  • macOS 10.15(Catalina)或更高版本
  • Node.js 18或更高版本
  • Xcode命令行工具
  • 终端的访问权限

Linux

  • X11显示服务器
  • Node.js 18或更高版本
  • Xdotool
  • libxtst开发
  • libpng++-dev
  • 编译工具

发展

设置

# Clone the repository
git clone https://github.com/your-org/cursor-mcp.git
cd cursor-mcp

# Install dependencies
npm install

# Build the project
npm run build

# Run tests
npm test

运行测试

# Run all tests
npm test

# Run specific test suite
npm test -- window-management

# Run with coverage
npm run test:coverage

贡献

我们欢迎捐款!请查看我们的 贡献指南 了解详情。

许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。

支持

致谢

目录标签

目录标签

代码生成TypeScriptClaudeAI集成本地部署编辑器自动化多实例管理协议桥接

支持客户端

Claude DesktopClaudeCursor

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP