Skip to main content
Glama
sailay1996

Cursor Agent MCP Server

by sailay1996

cursor_agent_chat

Chat with an AI agent to analyze code, edit files, and plan tasks using prompts with configurable output formats.

Instructions

Chat with cursor-agent using a prompt and optional model/force/output_format.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYes
output_formatNotext
extra_argsNo
cwdNo
executableNo
modelNo
forceNo
echo_promptNo

Implementation Reference

  • server.js:276-297 (registration)
    Registration of the 'cursor_agent_chat' MCP tool, including name, description, Zod input schema, and inline handler function that normalizes args and calls runCursorAgent.
    server.tool(
      'cursor_agent_chat',
      'Chat with cursor-agent using a prompt and optional model/force/output_format.',
      CHAT_SCHEMA.shape,
      async (args) => {
        try {
          // Normalize prompt in case the host nests under "arguments"
          const prompt =
            (args && typeof args === 'object' && 'prompt' in args ? args.prompt : undefined) ??
            (args && typeof args === 'object' && args.arguments && typeof args.arguments === 'object' ? args.arguments.prompt : undefined);
    
          const flat = {
            ...(args && typeof args === 'object' && args.arguments && typeof args.arguments === 'object' ? args.arguments : args),
            prompt,
          };
    
          return await runCursorAgent(flat);
        } catch (e) {
          return { content: [{ type: 'text', text: `Invalid params: ${e?.message || e}` }], isError: true };
        }
      },
    );
  • Inline handler function for cursor_agent_chat tool. Normalizes input arguments to handle both flat and nested 'arguments' structures from different MCP hosts, then delegates execution to the shared runCursorAgent helper.
    async (args) => {
      try {
        // Normalize prompt in case the host nests under "arguments"
        const prompt =
          (args && typeof args === 'object' && 'prompt' in args ? args.prompt : undefined) ??
          (args && typeof args === 'object' && args.arguments && typeof args.arguments === 'object' ? args.arguments.prompt : undefined);
    
        const flat = {
          ...(args && typeof args === 'object' && args.arguments && typeof args.arguments === 'object' ? args.arguments : args),
          prompt,
        };
    
        return await runCursorAgent(flat);
      } catch (e) {
        return { content: [{ type: 'text', text: `Invalid params: ${e?.message || e}` }], isError: true };
      }
    },
  • Zod schema definitions for cursor_agent_chat: CHAT_SCHEMA requires 'prompt' string and spreads shared COMMON fields for optional CLI options like output_format, model, force, etc.
    const COMMON = {
     output_format: z.enum(['text', 'json', 'markdown']).default('text'),
     extra_args: z.array(z.string()).optional(),
     cwd: z.string().optional(),
     executable: z.string().optional(),
     model: z.string().optional(),
     force: z.boolean().optional(),
     // When true, the server will prepend the effective prompt to the tool output (useful for Claude debugging)
     echo_prompt: z.boolean().optional(),
    };
    
    // Schemas
    const CHAT_SCHEMA = z.object({
     prompt: z.string().min(1, 'prompt is required'),
     ...COMMON,
    });
  • Shared helper invoked by cursor_agent_chat (and other tools) to construct argv from prompt and extra_args, invoke the cursor-agent CLI executable, handle output formatting, debug logging, and optional prompt echoing.
    async function runCursorAgent(input) {
      const source = (input && typeof input === 'object' && input.arguments && typeof input.prompt === 'undefined')
        ? input.arguments
        : input;
    
      const {
        prompt,
        output_format = 'text',
        extra_args,
        cwd,
        executable,
        model,
        force,
      } = source || {};
    
      const argv = [...(extra_args ?? []), String(prompt)];
      const usedPrompt = argv.length ? String(argv[argv.length - 1]) : '';
     
      // Optional prompt echo and debug diagnostics
      if (process.env.DEBUG_CURSOR_MCP === '1') {
        try {
          const preview = usedPrompt.slice(0, 400).replace(/\n/g, '\\n');
          console.error('[cursor-mcp] prompt:', preview);
          if (extra_args?.length) console.error('[cursor-mcp] extra_args:', JSON.stringify(extra_args));
          if (model) console.error('[cursor-mcp] model:', model);
          if (typeof force === 'boolean') console.error('[cursor-mcp] force:', String(force));
        } catch {}
      }
     
      const result = await invokeCursorAgent({ argv, output_format, cwd, executable, model, force });
     
      // Echo prompt either when env is set or when caller provided echo_prompt: true (if host forwards unknown args it's fine)
      const echoEnabled = process.env.CURSOR_AGENT_ECHO_PROMPT === '1' || source?.echo_prompt === true;
      if (echoEnabled) {
        const text = `Prompt used:\n${usedPrompt}`;
        const content = Array.isArray(result?.content) ? result.content : [];
        return { ...result, content: [{ type: 'text', text }, ...content] };
      }
     
      return result;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It mentions 'optional model/force/output_format' but doesn't explain what 'force' does, how the chat interacts with the agent, whether it's stateful, what authentication might be needed, or typical response patterns. For an 8-parameter tool with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise - a single sentence that efficiently states the core functionality. Every word earns its place with no redundancy or unnecessary elaboration. It's front-loaded with the essential action and resource, making it easy to scan and understand at a glance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an 8-parameter tool with no annotations and no output schema, the description is inadequate. It doesn't explain what the tool returns, how errors are handled, what 'cursor-agent' represents, or how this differs from other chat interfaces. Given the complexity implied by multiple optional parameters and sibling tools, more context about the tool's role and behavior is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate but only mentions 'prompt and optional model/force/output_format' - covering just 4 of 8 parameters. It doesn't explain 'extra_args', 'cwd', 'executable', or 'echo_prompt', nor does it provide context for how parameters like 'model' or 'force' affect behavior. The description adds minimal value beyond the bare parameter names.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Chat') and resource ('cursor-agent'), specifying it uses a prompt with optional parameters. It distinguishes from siblings like 'cursor_agent_analyze_files' or 'cursor_agent_edit_file' by focusing on general chat interaction rather than file-specific operations. However, it doesn't explicitly differentiate from 'cursor_agent_raw' which might also involve chat-like functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'cursor_agent_plan_task' or 'cursor_agent_raw'. It mentions optional parameters but doesn't explain scenarios where this chat tool is preferred over other cursor-agent tools for similar tasks. There's no mention of prerequisites, constraints, or typical use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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