Add a referral program with Windsurf

Windsurf was renamed Devin Desktop in June 2026. Cascade still reads workspace rules from .windsurf/rules and MCP servers from one user-level mcp_config.json. There is no project-level MCP file.

01Rules file.windsurf/rules/refref.md

Give Windsurf the RefRef rules

The rules tell the agent where each part of a referral integration belongs: the landing script in the browser, one signup call where your backend creates the account, and the API key only on the server. Save it as .windsurf/rules/refref.md. Devin Desktop also reads .devin/rules.

Cascade reads workspace rules from .windsurf/rules (and .devin/rules after the rename). The RefRef rule uses trigger: model_decision with a description, so Cascade adds it when the task is about signup or referrals. A workspace rule can have at most 12,000 characters; the RefRef rules use about 4,500.

.windsurf/rules/refref.md
---
trigger: model_decision
description: "RefRef referral tracking: landing script, signup call at account creation, server-only API key. Use when you add or change signup, referral, or invite code."
---

# RefRef referral tracking

This app uses RefRef (https://refref.ai) for its referral program. Follow these rules when you add or change referral code.

## Configuration

- Server-only secrets: `REFREF_API_KEY` (a Workspace API key), `REFREF_PROJECT_ID`, and `REFREF_PROGRAM_ID`.
- `REFREF_API_URL` defaults to `https://api.refref.ai`, and `REFREF_ASSETS_URL` to `https://assets.refref.ai`. Read both from configuration, so that a Sandbox or local environment can change them.
- Never put `REFREF_API_KEY` in browser code, in a public variable (`NEXT_PUBLIC_*`, `VITE_*`), in a prompt, in a log, or in a commit.
- Every RefRef call is a backend `POST` with a JSON body that contains `projectId`, and the header `X-Api-Key`. The current schemas are at `GET $REFREF_API_URL/openapi`.

The start of the file. Open the whole file.

Or fetch it from the command line: curl -fsSL --create-dirs https://refref.ai/agents/windsurf/rules.md -o .windsurf/rules/refref.md

02MCP serverConfiguration

Connect Windsurf to RefRef MCP

Optional. With the MCP server, Windsurf can read your Workspaces, Projects, and Programs, and prepare configuration changes for you to approve in the Console. It never sends signups: that is the app code from the rules. See the MCP reference for scopes and approvals.

Configuration: ~/.config/devin/mcp_config.json (formerly ~/.codeium/windsurf/mcp_config.json)

~/.config/devin/mcp_config.json (formerly ~/.codeium/windsurf/mcp_config.json)
{
  "mcpServers": {
    "refref": {
      "serverUrl": "https://mcp.refref.ai/mcp"
    }
  }
}

Sign in

Open the MCP panel in Cascade, refresh, and connect refref. Sign in with your RefRef Console account in the browser. The connection uses your Console sign-in, never a Workspace API key.

Check it

The Cascade MCP panel lists refref and its tools.

  • Cascade can use at most 100 tools in total across servers. Turn off tools you do not need.
  • On Team and Enterprise plans, an admin allowlist can block servers that it does not name.
  • A workspace rule file can have at most 12,000 characters. The RefRef rules use about 4,500.
03PromptsPaste in order

1. Configure the Program through MCP

Optional. Needs the refref MCP server and a Console account with the owner or admin role.

Configure the Program through MCP
Use the refref MCP server. Call get_workflow with workflow="configuration", then list_workspaces. Ask me to choose the Workspace, and use only the Sandbox Project that I confirm. Read its Programs and rules. Propose a referral Program that gives the referrer a reward when a referred person signs up. Ask me for the reward, the currency, and the limits; do not assume them. Return the proposal and its review link. Do not approve or apply it.

2. Add referral tracking to the signup

The rehearsal ran this prompt with "the project instructions" in place of the rules file name, on a Node app whose tests use node --test.

Add referral tracking to the signup
Add RefRef referral tracking to the signup of this app. Follow the RefRef rules in the refref workspace rule (.windsurf/rules/refref.md). Configuration comes from environment variables. Do not add dependencies. Add focused tests and run them.

3. Review the change before you merge it

Run it in a new session, so that the agent reads the diff with fresh context.

Review the change before you merge it
Review the RefRef integration in the current diff against the refref workspace rule (.windsurf/rules/refref.md). Check each item of "Tests to write" and "Do not". Confirm that the signup is sent once, only where the account is created, and that REFREF_API_KEY never reaches the browser. List each problem with its file and line. Change nothing.

Set REFREF_API_KEY, REFREF_PROJECT_ID, and REFREF_PROGRAM_ID in your backend environment. The integration reference has each call, and the auth recipes cover email verification, magic links, and hosted login.

04Rehearsal recordChecks open

What we ran, and what happened

Some checks have not run yet. Treat the open steps as a guide to verify yourself, and record your own results.

pendingConfigure the MCP server and sign in with Windsurf (Devin Desktop)
Not run: Devin Desktop has no CLI, and its OAuth flow for remote MCP servers is not documented.
pendingPrompt 2 and the rules file produce a working signup integration
Not run. Run prompt 2 with .windsurf/rules/refref.md on a test app, then follow A's link as B and check the referral, a repeated sign-in, and the browser bundle.
05QuestionsFAQ
01

Does this work after the rename to Devin Desktop?

Devin Desktop documents the same mcp_config.json format and reads legacy Windsurf paths during the transition. Check the MCP panel after an update: if refref is missing, move the file to ~/.config/devin/mcp_config.json.

02

Is there a project-level MCP file in Windsurf?

No. Cascade reads MCP servers from one user-level mcp_config.json, so the RefRef server is available in every workspace. The rules file is per workspace.

Official references

Start with a Sandbox Project

Create a RefRef account, add a Project, and get the keys that the Windsurf prompts need. Sandbox data never mixes with live data.

Get Started