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
- Create a workflow in the Hydra Dashboard (opens in a new tab)
- Click Deploy
- Select Cursor as the target adapter
- Copy the MCP endpoint URL
2. Configure Cursor
- Open Cursor Settings (
Cmd/Ctrl + ,) - Navigate to Extensions → MCP Servers
- Click Add Server
- 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 ServersYou 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 fileUsing Chat
In Cursor Chat:
Use Hydra to run my Bug Fix workflowWith File References
@hydra Run the Refactoring workflow on @src/auth/login.ts @src/auth/logout.tsAdapter 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
| Option | Type | Description |
|---|---|---|
use_composer | boolean | Use Cursor Composer for edits |
auto_apply | boolean | Automatically apply changes |
show_diff | boolean | Show diff before applying |
Action Mappings
How HMS actions translate to Cursor capabilities:
| HMS Action | Cursor Feature |
|---|---|
analyze_code | @file reference + analysis |
edit_file | Inline diff edit |
edit_files | Multi-file Composer edit |
generate_code | New file generation |
generate_tests | Test file generation |
execute_command | Terminal command |
search_references | @codebase search |
design_architecture | Documentation generation |
review_and_commit | Git 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 functionalityUsing @codebase Search
Reference your entire codebase:
@hydra Analyze @codebase for security vulnerabilities using the Security Audit workflowDiff 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 workflow2. 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 workflowTroubleshooting
MCP Server Not Connecting
- Check the server URL is correct
- Verify your API key
- Restart Cursor
Composer Not Opening
- Ensure
use_composer: trueis set - Try
Cmd/Ctrl + Kmanually
Changes Not Applying
- Check
auto_applysetting - Look for pending diffs in the editor
- Verify you have write permissions
Next Steps
- Try Example Workflows
- Learn about Creating Workflows
- See the HMS Reference