Guides
Using with Cursor

Using Hydra with Cursor

Integrate Hydra workflows with Cursor IDE for streamlined AI-assisted editing.

Overview

Cursor uses the Composer pattern for executing Hydra workflows. The Composer is optimized for multi-file editing with inline diffs.

Setup

1. Deploy Your Workflow

  1. Create a workflow in the Hydra Dashboard (opens in a new tab)
  2. Click Deploy
  3. Select Cursor as the target adapter
  4. Copy the MCP endpoint URL

2. Configure Cursor

  1. Open Cursor Settings (Cmd/Ctrl + ,)
  2. Navigate to Extensions → MCP Servers
  3. Click Add Server
  4. Configure:
    • Name: Hydra
    • URL: Your MCP endpoint URL from Dashboard → Deployments

3. Verify Connection

Open the Command Palette (Cmd/Ctrl + Shift + P) and type:

MCP: List Servers

You should see "Hydra" in the list.

Running Workflows

Using Composer

Open Composer (Cmd/Ctrl + K) and invoke your workflow:

@hydra Run the Code Review workflow on the current file

Using Chat

In Cursor Chat:

Use Hydra to run my Bug Fix workflow

With File References

@hydra Run the Refactoring workflow on @src/auth/login.ts @src/auth/logout.ts

Adapter Configuration

Direct Mode (Default)

Executes in the main Cursor context:

{
  "adapters": {
    "cursor": {
      "mode": "direct",
      "config": {
        "use_composer": true,
        "auto_apply": false,
        "show_diff": true
      }
    }
  }
}

Parallel Mode

For workflows with independent steps:

{
  "adapters": {
    "cursor": {
      "mode": "parallel"
    }
  }
}

Configuration Options

OptionTypeDescription
use_composerbooleanUse Cursor Composer for edits
auto_applybooleanAutomatically apply changes
show_diffbooleanShow diff before applying

Action Mappings

How HMS actions translate to Cursor capabilities:

HMS ActionCursor Feature
analyze_code@file reference + analysis
edit_fileInline diff edit
edit_filesMulti-file Composer edit
generate_codeNew file generation
generate_testsTest file generation
execute_commandTerminal command
search_references@codebase search
design_architectureDocumentation generation
review_and_commitGit integration

Example: Refactoring Workflow

Manifest

{
  "name": "Refactoring Workflow",
  "intent": "Refactor code while maintaining functionality",
  "steps": [
    {
      "id": "analyze",
      "name": "Analyze current structure",
      "action": "analyze_code",
      "parameters": {
        "focus": "code smells, duplication, complexity"
      }
    },
    {
      "id": "plan",
      "name": "Plan refactoring",
      "action": "design_architecture",
      "depends_on": ["analyze"]
    },
    {
      "id": "refactor",
      "name": "Apply refactoring",
      "action": "edit_files",
      "depends_on": ["plan"]
    },
    {
      "id": "verify",
      "name": "Run tests",
      "action": "execute_command",
      "depends_on": ["refactor"],
      "parameters": {
        "command": "npm test"
      }
    }
  ],
  "adapters": {
    "cursor": {
      "mode": "direct",
      "config": {
        "use_composer": true,
        "show_diff": true,
        "auto_apply": false
      }
    }
  }
}

Generated Cursor Prompt

# Refactoring Workflow

Refactor code while maintaining functionality

## Files
@src/utils/helpers.ts
@src/components/DataTable.tsx

## Steps

1. **Analyze current structure**
   Review the codebase for code smells, duplication, and complexity.
   Focus on: code smells, duplication, complexity

2. **Plan refactoring**
   Design the refactoring approach.
   Document changes before implementing.

3. **Apply refactoring**
   Use Composer to edit multiple files.
   Show diff before applying each change.
   Wait for confirmation before proceeding.

4. **Run tests**
   Execute: npm test
   Verify all tests pass.

## Instructions
- Show diff for each change
- Wait for approval before applying
- Maintain existing functionality

Using @codebase Search

Reference your entire codebase:

@hydra Analyze @codebase for security vulnerabilities using the Security Audit workflow

Diff Preview

With show_diff: true, Cursor shows changes before applying:

// src/auth/login.ts
- function login(user, pass) {
+ async function login(user: string, pass: string): Promise<AuthResult> {
    // ...
  }

You can:

  • Accept - Apply the change
  • Reject - Skip this change
  • Edit - Modify before applying

Auto-Apply Mode

For trusted workflows, enable auto-apply:

{
  "config": {
    "auto_apply": true
  }
}
⚠️

Use auto-apply carefully! Always review changes in version control.

Best Practices

1. Reference Specific Files

@hydra Fix bugs in @src/api/handlers.ts using the Bug Fix workflow

2. Use Composer for Multi-file Changes

{
  "config": {
    "use_composer": true
  }
}

3. Keep Diffs Visible for Review

{
  "config": {
    "show_diff": true,
    "auto_apply": false
  }
}

4. Combine with @codebase for Context

@hydra @codebase Run the Documentation workflow

Troubleshooting

MCP Server Not Connecting

  • Check the server URL is correct
  • Verify your API key
  • Restart Cursor

Composer Not Opening

  • Ensure use_composer: true is set
  • Try Cmd/Ctrl + K manually

Changes Not Applying

  • Check auto_apply setting
  • Look for pending diffs in the editor
  • Verify you have write permissions

Next Steps