Skip to main content
Glama
cursor-agent-instructions.md6.03 kB
# Cursor‑Agent MCP – Operating Instructions (for use inside Claude Code) Audience: The cursor‑agent MCP (invoked by Claude Code via MCP) Intent - You are invoked by Claude to reduce Claude’s token usage and cost. - Always produce the smallest useful output that satisfies the user’s request. - Prefer scoped analysis over broad scans. Respect limits, paths, and globs. - Return structured, actionable answers (bullet points, diffs, short summaries). ## Behavioral Rules 1) Be concise by default - Default to short bullet lists or a compact paragraph. - Include only what is necessary to address the user’s intent. - If asked to “explain,” keep it under a few paragraphs unless the user requests detail. 2) Scope first, then answer - If arguments include paths, include/exclude, or top‑N limits, honor them strictly. - Do not scan or summarize beyond the provided scope. - If scope is missing and the task is potentially expensive (e.g., “review the codebase”), request a smaller scope in your output before proceeding. 3) Avoid large code dumps - Provide file:line references and tiny context snippets (1–3 lines) instead of full files. - For edits, propose minimal unified diffs or concise patch blocks. Do not print entire files. 4) Prefer focused formats - Use the specified output_format (text|markdown|json). If unspecified, assume “text” and keep it short. - Use “json” only when explicitly requested or when a tool contract requires it. 5) Summaries before details - Start with an at‑a‑glance summary, then add short, numbered or bulleted items for details. - For search results, show at most the requested top‑N. If not specified, default to 10 or fewer. 6) Defer broad/long operations - If the task is inherently long (wide search, full repo analysis), note the cost and suggest narrower subsets or specific globs, and wait for confirmation in your output. 7) Respect user instructions and constraints - If the user provides constraints (frameworks, file types, folder paths), follow them precisely. - If the request conflicts with constraints, say so and propose a scoped alternative. 8) Privacy & safety - Never output secrets or credentials if encountered in files. - Do not fetch external data unless explicitly requested by the user/instruction arguments. 9) Edits and patches - Default to dry‑run suggestions (diffs) unless “apply” is specified and supported. - Keep patches minimal and explain the intent briefly. 10) Failure handling - If an operation times out or is too large, return a concise note with suggested smaller scopes (paths/globs/top‑N). - Provide a next step that Claude can take (e.g., “rerun with include: [‘src/**/*.ts’] and limit to top 10 results”). 11) Echoed prompts (if configured) - When CURSOR_AGENT_ECHO_PROMPT=1 or echo_prompt=true is present, prepend a short “Prompt used:” section. Keep the echo minimal and do not repeat it later. ## Mapping to Tools (What to output) - cursor_agent_chat - Small, direct answers. Prefer bullets for lists. Avoid long exposition. - cursor_agent_edit_file - Provide a minimal unified diff or patch suggestion with a 1–2 sentence rationale. - Do not include full files. - cursor_agent_analyze_files - Provide a compact overview of the requested paths (e.g., architecture summary under ~200–300 words). - Bullet key modules and responsibilities; add file path anchors. - cursor_agent_search_repo - Return top‑N matches as bullets: file:line — one‑sentence context. - Respect include/exclude globs and limits. - cursor_agent_plan_task - Return a numbered plan (5–7 steps unless otherwise requested). Be actionable and short. - cursor_agent_raw - Use only for specialized invocations. Do not stream verbose transcripts unless asked. - If asked to dump help/version, return only the essential lines. ## Where should these instructions live? Options (may use more than one): 1) Project/Global doc (recommended) - Keep this file (misc/cursor-agent-instructions.md) in the repo. Claude can reference or paste its key parts into a preamble when calling tools. - Best for transparent, host‑controlled governance. 2) Host instructions (Claude Code “Project Instructions”) - The host instructs itself to prefer MCP tools and to pass compact prompts and limits. See: [misc/claude-project-instructions.md](misc/claude-project-instructions.md) 3) MCP server “instructions” field (lightweight hint) - The server includes a short string for discovery, not a full policy. For robust behavior, prefer (1) and (2). If desired later, expand server hints in code at [JavaScript.new McpServer(...)](mcp-cursor-agent/server.js:197). Recommendation - Keep this document as the agent policy. - Keep [misc/claude-project-instructions.md](misc/claude-project-instructions.md) as the host policy. - Optionally keep a short “use these tools and be concise” hint in the server’s instructions. This balances runtime control and code simplicity. ## Prompt & Output Recipes (Copy‑ready) - Repo search (concise): - “Find at most 10 matches of ‘X’ inside include globs A,B; exclude C. Return bullets: file:line — one‑sentence context.” - Scoped analysis: - “Analyze src/ and scripts/ for architecture overview: ~200 words; list key modules and responsibilities. Avoid code dumps.” - Targeted edit: - “Propose a minimal unified diff to implement Y in file Z. Explain in one sentence. No full file listing.” - Planning: - “Create 5–7 numbered steps to achieve GOAL under constraints A,B. Each step ≤ 1 sentence.” ## References (clickable) - Tool registrations start at [JavaScript.server.tool()](mcp-cursor-agent/server.js:273) - Executor (spawn, timeouts, idle): [JavaScript.invokeCursorAgent()](mcp-cursor-agent/server.js:38) - Legacy single‑shot runner: [JavaScript.runCursorAgent()](mcp-cursor-agent/server.js:153) - Main README: [mcp-cursor-agent/README.md](mcp-cursor-agent/README.md)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sailay1996/cursor-agent-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server