Windsurf
End-to-end guide for connecting Windsurf to Loop — MCP server setup, Cascade rules, and a complete dispatch walkthrough.
Windsurf
This guide walks you through connecting Windsurf to Loop so that Cascade (Windsurf's AI agent) can claim tasks, create issues, ingest signals, and close the feedback loop — all from inside the IDE.
By the end you will have:
- The Loop MCP server running in Windsurf with 9 agent tools
- A Cascade rule that teaches the agent how to use Loop
- A working dispatch cycle — claim a task, do the work, report the outcome
This guide assumes you have a running Loop API (local or hosted) and a valid LOOP_API_KEY.
See the Quickstart if you need to set that up first.
Prerequisites
- Windsurf installed (version 1.6+ recommended for MCP support)
- Node.js 20+ (for
npx) - Loop API running at
http://localhost:5667(or your hosted URL) - API key starting with
loop_
Install the MCP server
Create a .windsurf/mcp.json file in your project root:
{
"mcpServers": {
"loop": {
"command": "npx",
"args": ["-y", "@dork-labs/loop-mcp"],
"env": {
"LOOP_API_KEY": "<your-api-key>",
"LOOP_API_URL": "http://localhost:5667"
}
}
}
}Replace <your-api-key> with your actual Loop API key.
Do not commit your API key. Add .windsurf/mcp.json to .gitignore, or use
environment variable references if your Windsurf version supports them.
After saving the file, restart Windsurf or reload the window. Windsurf discovers MCP servers automatically from this config file.
Verify the connection
Open the Cascade chat panel and ask:
What Loop tools do you have available?Cascade should list all 9 tools: loop_get_next_task, loop_complete_task, loop_create_issue, loop_update_issue, loop_list_issues, loop_get_issue, loop_ingest_signal, loop_create_comment, and loop_get_dashboard.
If the tools do not appear:
- Check that
.windsurf/mcp.jsonis in the project root (not a subdirectory) - Verify your API key is valid — run
curl -H "Authorization: Bearer YOUR_KEY" http://localhost:5667/healthin a terminal - Restart Windsurf completely (not just reload)
- Check the Windsurf output panel for MCP connection errors
Add a Cascade rule for Loop context
Windsurf supports project-level rules via .windsurfrules in your project root. Create this file to give Cascade persistent context about Loop:
# Loop Integration
This project uses Loop (looped.me) as its autonomous improvement engine.
Loop manages issues, signals, and dispatch for AI agents.
## Workflow
When asked to work on Loop tasks, follow the dispatch loop:
1. Call `loop_get_next_task` to claim the highest-priority issue
2. Read the hydrated prompt in the response — it contains full instructions
3. Execute the work described in the prompt
4. Use `loop_create_comment` to post progress updates on the issue
5. Call `loop_complete_task` with an outcome summary when done
6. If you discover new bugs or tasks, use `loop_create_issue` to add them
## Issue types
signal | hypothesis | plan | task | monitor
## Status values
triage | backlog | todo | in_progress | done | canceled
## Priority levels
0 = none | 1 = urgent | 2 = high | 3 = medium | 4 = low
## Key behaviors
- Always read the full prompt from `loop_get_next_task` before starting work
- Post at least one comment before completing a task
- When ingesting signals, set severity based on user impact
- Use `loop_get_dashboard` to check system health before long work sessionsWindsurf loads .windsurfrules automatically for every Cascade conversation in the project.
Unlike MCP tools (which give Cascade actions), rules give Cascade knowledge about how to
use those actions effectively.
Run the dispatch loop
With everything configured, try the full dispatch cycle. In Cascade, say:
Get my next Loop task and work on it.Cascade will:
- Call
loop_get_next_taskto claim an issue - Read the hydrated prompt with full instructions
- Execute the work (write code, investigate, etc.)
- Post a progress comment via
loop_create_comment - Complete the task with
loop_complete_task
If the dispatch queue is empty, Cascade will tell you there are no tasks available. You can seed the queue by ingesting a signal:
Ingest a Loop signal: source "manual", type "bug_report", severity "high",
payload: { "message": "404 on /api/users endpoint", "method": "GET" }This creates a signal and a linked triage issue that will appear in the dispatch queue.
Explore the dashboard
Ask Cascade to check the system health:
Show me the Loop dashboard — how many issues are open and what's in the queue?Cascade calls loop_get_dashboard and returns issue counts by status, active goals, and the dispatch queue depth.
Recommended Cascade prompts
These prompts work well with the Loop MCP tools in Windsurf:
| Prompt | What it does |
|---|---|
| "Get my next Loop task and work on it" | Full dispatch cycle: claim, execute, complete |
| "List all open Loop issues" | Calls loop_list_issues with status filter |
| "Create a Loop issue: Fix the broken auth flow" | Creates a task issue with the given title |
| "Ingest a signal about the login error rate spike" | Ingests a signal and creates a triage issue |
| "Show me Loop issue #42" | Retrieves full issue details with comments and labels |
| "What's the Loop system health?" | Calls loop_get_dashboard for metrics |
| "Complete Loop task [id] — fixed the redirect bug" | Marks the issue done with an outcome summary |
Project-level vs global configuration
Project-level (recommended): Place .windsurf/mcp.json in your project root. The MCP server is scoped to that project and uses that project's API key.
Global: If you want Loop available across all Windsurf projects, place the config in your global Windsurf settings directory. The exact location varies by OS:
- macOS:
~/.windsurf/mcp.json - Linux:
~/.windsurf/mcp.json - Windows:
%USERPROFILE%\.windsurf\mcp.json
Global configuration shares the same API key across all projects. Use project-level configuration if different projects connect to different Loop instances.
Troubleshooting
"Tool not found" errors
Cascade cannot see the MCP tools. Verify:
.windsurf/mcp.jsonexists in the project root and is valid JSON- The
commandisnpx(notnodeor a file path) - Windsurf has been restarted since adding the config
- Node.js 20+ is on your PATH
Authentication failures
The MCP server connects but tools return 401 errors:
- Check that
LOOP_API_KEYin the config starts withloop_ - Verify the key works:
curl -H "Authorization: Bearer YOUR_KEY" http://localhost:5667/api/issues - Ensure
LOOP_API_URLpoints to the correct Loop API instance
Empty dispatch queue
loop_get_next_task returns no tasks:
- Check that issues exist:
loop_list_issueswith statustodoorbacklog - Issues in
triagestatus are not dispatched — they need to be moved totodofirst - Blocked issues are skipped — check for unresolved blocking relations
- Ingest a test signal to seed the queue
MCP server crashes
If the server exits unexpectedly:
- Check the Windsurf output panel for error messages
- Run the server manually to see the error:
LOOP_API_KEY=your-key LOOP_API_URL=http://localhost:5667 npx @dork-labs/loop-mcp - Ensure
@dork-labs/loop-mcpcan be downloaded (check network/proxy settings)
Next steps
- MCP Tools Reference — Complete parameter documentation for all 9 tools
- MCP Troubleshooting — Deeper debugging for MCP connectivity issues
- Concepts — Understand how signals, issues, dispatch, and prompts work together
- Writing Templates — Create prompt templates that guide agent behavior