SC

sailay1996/cursor-agent-mcp

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

21 stars 7 forks 品質 59 トレンド 0

Cursor-agent MCP:Claudeコード内のコスト効率の高いリポジトリ分析と編集.

概要

カーソルエージェント CLI をラップし、複数の Claude フレンドリー ツールを公開するモデルコンテキスト プロトコル (MCP) サーバを固め、チャット、リポジトリ 分析、コード検索、計画などのツールを拡張します。 コアの実装: カーソル-agent-mcp/server.js テストハーネス: カーソル-agent-mcp/test client.mjs パッケージマニフェスト: カーソル-agent-mcp/package.json この MCP は、ホスト (例えば、Claude Code) からカーソルエージェント CLI に重なる “thinking” と repo-aware タスクをオフロードする存在です。 CLI の処理の分析/計画/調査をフォーカス、プロンプト ベースの指示にすることで、次のことができます。 - スコープは、ワークスペース全体をストリーミングするのではなく、必要なファイル/パスだけに動作します。 - 環境(または呼び出しごと)で費用対効果の高いモデルを選択し、ホストのコンテキストを小さく保ちます。 - output format("text" | "markdown" | "json") による応答の動性を制御し、特化したプロンプトを設定します。 - 一般的なチャットではなくターゲットを絞った出力を生成する特殊なツール(分析、検索、計画、編集)を使用してください.

概要(AI 翻訳)

[[cursor-agentをラップする最小限、強化されたモデルコンテキストプロトコル(MCP)サーバーは、複数のClaudeフレンドリーツールを、チャット、レポジトリ分析、コード検索、計画などを公開します。

コアの実装: カーソル-agent-mcp/server.js テストハーネス: カーソル-agent-mcp/test client.mjs パッケージマニフェスト: カーソル-agent-mcp/package.json

目的: トークンの使用量とClaudeコードのコストを削減

この MCP は、ホスト (例えば、Claude コード) から cursor-agent までの重なる “思考” とリポジトリのタスクをオフロードする存在です。 CLI の処理の分析/計画/調査をフォーカス、プロンプト ベースの指示にすることで、次のことができます。

  • スコープは、ワークスペース全体をストリーミングするのではなく、必要なファイル/パスだけに動作します。
  • 環境(または呼び出しごと)で費用対効果の高いモデルを選択し、ホストのコンテキストを小さく保ちます。
  • [output_format(「テキスト」 | 「マークダウン」 | 「json」) による応答の動性を制御し、プロンプトを合わせます。
  • 一般的なチャットではなく、ターゲット出力を生成する特殊なツール([analyze]])、[search、[[[plan]]])を使用します。

コストコントロールのヒント

  • 精密な規模:
  • [[include/exclude]] globs を [cursor_agent_search_repo] に [[paths]]] に置換します.

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

Cursor Agent MCP Server

Minimal, hardened Model Context Protocol (MCP) server that wraps the cursor-agent CLI and exposes multiple, Claude‑friendly tools for chat, repository analysis, code search, planning, and more.

Core implementation: cursor-agent-mcp/server.js Test harness: cursor-agent-mcp/test_client.mjs Package manifest: cursor-agent-mcp/package.json

Purpose: reduce token usage and cost in Claude Code

This MCP exists to offload heavy “thinking” and repo‑aware tasks from the host (e.g., Claude Code) to the cursor-agent CLI. By letting the CLI handle analysis/planning/search with focused, prompt‑based instructions, you can:

  • Scope work to only the needed files/paths instead of streaming the entire workspace.
  • Choose a cost‑effective model via environment (or per call) and keep the host’s context small.
  • Control response verbosity through output_format (“text” | “markdown” | “json”) and tailored prompts.
  • Use specialized tools (analyze, search, plan, edit) that produce targeted outputs rather than general chat.

Cost‑control tips

  • Prefer precise scopes:
    • Use include/exclude globs with cursor_agent_search_repo and curated paths for cursor_agent_analyze_files.
  • Pick output formats intentionally:
    • Use "text" or "markdown" for concise answers. Reserve "json" only when you truly need structured output (it’s usually larger).
  • Select a model that matches the task:
    • Set CURSOR_AGENT_MODEL to a cost‑effective default; override per tool call only when necessary.
  • Avoid unnecessary echo/debug:
    • CURSOR_AGENT_ECHO_PROMPT=1 is helpful during setup, but disables it later to save tokens in host logs.
    • Keep DEBUG_CURSOR_MCP off in normal use; it writes diagnostics to stderr (not counted in host tokens, but noisy).
  • Control runtime instead of idle‑kill:
    • Keep CURSOR_AGENT_IDLE_EXIT_MS="0" so valid runs aren’t cut mid‑generation. Bound cost/time with CURSOR_AGENT_TIMEOUT_MS and focused prompts.
  • Use cursor_agent_raw thoughtfully:
    • It’s powerful and can stream detailed sessions; for cheapest usage, prefer the focused tools with concise prompts and "text" output.

Features

  • Multi‑tool surface modeled after “verb-centric” CLIs
  • Works well in Claude Code and other MCP hosts
  • Safe process spawn (no shell), robust timeout handling
  • Optional prompt echoing for easy debugging inside hosts
  • Configurable defaults via environment variables (model, force, timeouts, executable path)
  • Backward‑compatible legacy tool for single‑shot chat

Requirements

  • Node.js 18+ (tested up to Node 22)
  • A working cursor-agent CLI in your PATH or at an explicit location
  • Provider credentials configured for your chosen model (e.g., via the CLI’s own mechanism)

Installation

  1. Clone or download this repository.

  2. Install dependencies for the MCP server:

cd ./cursor-agent-mcp
npm ci        # or: npm install
GitHub で README 全文を見る

インストール

This server does not publish a one-line install command.

Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "cursor-agent": { "command": "node", "args": ["/abs/path/to/cursor-agent-mcp/server.js"], "env": { "CURSOR_AGENT_ECHO_PROMPT": "1", "CURSOR_AGENT_FORCE": "true", "CURSOR_AGENT_PATH": "/home/you/.local/bin/cursor-agent", "CURSOR_AGENT_MODEL": "gpt-5", "CURSOR_AGENT_IDLE_EXIT_MS": "0", "CURSOR_AGENT_TIMEOUT_MS": "60000" } } } }