cursor-mcp-server
cursor-mcp-server
CursorのComposer 2(またはGrok 4.5)エージェントにすべてのコード作成を委任するMCPサーバーです。PM/オーケストレーターモデル(このサーバーが作られたセットアップではClaude)がコードを直接書かないように設計されています。コンテキストを読み、作業をスコープ単位のタスクに分割し、CursorのエージェントSDKを呼び出して実際にファイルを生成・編集します。
理由
オーケストレーターワークフローにおいて、Claudeのコンテキストウィンドウは希少リソースです。Claudeが直接書くコードの1行1行は、保持し、読み返し、自身のトークンバジェットを消費する行でもあります。そしてそのバジェットは、タスク記述の複雑さではなく、フィーチャーの規模に応じて拡大します。コード生成をCursorに委任することで、オーケストレーターのコストは出力サイズから切り離されます。cursor_write_codeの呼び出しは、Cursorが最終的に20行を生成するか400行を生成するかにかかわらず、ほぼ同じコストです。
また、Cursorのトークン単価はフロンティア推論モデルよりも大幅に安いため、大量のコード生成をそちらへ移すことは、コンテキストウィンドウのトリックに留まらない複利的な利得をもたらします。
Related MCP server: Cursor Delegate
アーキテクチャ
単一のMCPサーバー(@modelcontextprotocol/sdk)が2つのツールを公開しており、どちらも@cursor/sdkのAgent.prompt()を利用しています:
cursor_write_code- 新規ファイル/フィーチャーの作成を委任cursor_edit_code- 既存ファイルへの編集を委任
両ツールとも以下のフィールドを受け付けます:
フィールド | 必須 | 目的 |
| 必須 | 何を構築・変更するかの明確な説明 |
| 任意 | プロジェクトルートへの絶対パス(デフォルトはサーバーのcwd) |
| 書き込み時のみ | Composerがコンテキストとして読む既存ファイル |
| 編集時のみ | 編集対象ファイルへのパス |
| 任意 | 尊重すべきアーキテクチャ上の決定事項、インターフェース、制約 |
| 任意 |
|
| 任意 |
|
サーバーはこれらのフィールドから単一のプロンプトを構築し、Cursorのエージェントに対して実行します(localモードはあなたのマシン上のworkingDirectory内で実行され、cloudモードはCursorのサンドボックス化されたVM上で実行されます)。
セットアップ
npm install
cp .env.example .env
# edit .env: set CURSOR_API_KEY (Cursor dashboard -> Integrations -> API Keys)
npm run build環境変数
変数 | 値 | デフォルト |
| あなたのCursor APIキー | 必須 |
|
|
|
Claude Code / 任意のMCPクライアントへの登録
MCPクライアントの設定(例:.mcp.jsonまたはclaude mcp add)に追加してください:
{
"mcpServers": {
"cursor-coder": {
"command": "node",
"args": ["/absolute/path/to/cursor-mcp-server/dist/index.js"],
"env": { "CURSOR_API_KEY": "your_cursor_api_key_here" }
}
}
}モデル選択
composer(デフォルト)- Composer 2。明確に仕様化された機械的なタスクに高速かつ信頼性があります:CRUD、スキャフォールディング、小規模な編集、すでに明確なパターンに従う作業などです。grok- Grok 4.5。より高性能で、より高コストです。複雑な推論、難しいリファクタリング、アーキテクチャに影響する変更、またはComposerの実行結果が間違っていた・混乱していた場合に取っておきます。最も難しいケースにはeffort: "high"を使用します。
オーケストレーター契約
このサーバーは、コード生成をこのサーバー経由に強制するシステムプロンプト / CLAUDE.mdと組み合わせて使用することを想定しています:
You are the architect and project manager. Cursor Composer 2 is your
code-writing sub-agent.
- NEVER write code yourself. No code blocks, no file edits.
- For ALL code generation -> call cursor_write_code.
- For ALL code edits -> call cursor_edit_code.
- You MAY read files to understand context before delegating.
- You MAY review Composer's output and ask it to revise via another
tool call.オーケストレーターの役割は変わりません:タスクをスコープ単位のサブタスクに分割し、Composerがコードを書く前にインターフェース/契約を定義し、出力の正確性をレビューし、次に何を構築するかを決定します。実際のコード生成は完全にCursorのエージェントループ内で実行されます。
返ってきた結果は常に独立して再検証してください。 完了メッセージを額面どおり信じないでください。ファイルを開き、テストを実行し、diffを確認してください。サブエージェントが自己申告する「完了」は証拠ではありません。
スクリプト
コマンド | 目的 |
|
|
| TypeScriptを |
| コンパイル済みサーバーを実行 |
ライセンス
MIT - LICENSEを参照してください。
This server cannot be deployed
Maintenance
Related MCP Connectors
AI-powered spec-to-task decomposition and execution orchestration for coding agents.
AI work orchestration for plans, tasks, teams, and coding-agent dispatch.
The AI orchestration agent for modern software teams.
- AxisOAuthdev.useaxis
Coding agents from Claude Code, Cursor and Codex claim jobs and lock files on one shared board.
Related MCP Servers
- AlicenseAqualityAmaintenanceEnables AI assistants to delegate specific tasks to specialized sub-agents (e.g., test-writer, code-reviewer). Supports both Cursor and Claude Code with custom agent definitions.1338 npm98MIT
- AlicenseAqualityAmaintenanceEnables MCP clients like Claude Code and Codex to delegate coding tasks to Cursor's CLI agent, which implements changes in the workspace and returns clean, structured results for review.376 npm4MIT
- AlicenseNot gradedqualityBmaintenanceEnables Claude Code to delegate tasks to Cursor's headless agent, run adversarial reviews, and verify findings with prosecutor/advocate roles.57 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables two-way delegation between Codex and Cursor agents with background jobs, handoff plans, and isolated worktrees, allowing either editor to offload investigation, review, planning, or implementation to the other and continue the same native session later.7 npmApache 2.0