Workflows

Windsurf

Set up Stable Baseline's MCP server in Windsurf to automatically generate and maintain living documentation for your codebase.

What You'll Get

MCP Tools

Full access to Stable Baseline's documentation tools directly in Windsurf's Cascade AI

Bespoke Documentation

AI-generated docs tailored to your specific codebase and architecture

AGENTS.md Integration

Auto-sync rules injected into your AGENTS.md so Cascade keeps docs updated

Project Configuration

Workspace, project, and folder structure created in Stable Baseline automatically

Step 1: Add the MCP Server

Before you begin, you'll need a Stable Baseline API key. Visit the MCP Setup Guide to create one from your workspace settings.

Option A: Via Windsurf Settings UI

  1. Open Windsurf Settings (Cmd + , on Mac, Ctrl + , on Windows/Linux)
  2. Navigate to CascadeMCP Servers
  3. Click Add Server and select Raw JSON
  4. Paste the configuration below
Windsurf Config
{
  "mcpServers": {
    "stablebaseline-mcp": {
      "serverUrl": "https://api.stablebaseline.io/functions/v1/cloud-serve/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

Replace YOUR_API_KEY with your actual Stable Baseline API key.

Option B: Edit Config File Directly

Open the MCP config file at:

  • macOS/Linux: ~/.codeium/windsurf/mcp_config.json
  • Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json

Using environment variables? Windsurf supports env var interpolation with the ${env: VAR_NAME} syntax:

Windsurf Config (Env Var)
{
  "mcpServers": {
    "stablebaseline-mcp": {
      "serverUrl": "https://api.stablebaseline.io/functions/v1/cloud-serve/mcp",
      "headers": {
        "Authorization": "Bearer ${env:STABLE_BASELINE_API_KEY}"
      }
    }
  }
}

Set the STABLE_BASELINE_API_KEY environment variable in your shell profile.

After saving, restart Windsurf or refresh the MCP connection. You should see the Stable Baseline server listed with a connected status.

Note: Windsurf uses serverUrl (not url) for remote HTTP servers. This is different from Cursor's configuration format.

Step 2: Generate Your Documentation

Once the MCP server is connected, open Windsurf's Cascade panel and type:

Type into Cascade
Run the sb-setup prompt from the stablebaseline-mcp server

Cascade will walk you through an interactive setup process to generate documentation for your project.

What it does

The sb-setup prompt runs a 9-step process:

  1. Verifies MCP Connection — Confirms the Stable Baseline server is reachable and authenticated
  2. Resolves Workspace & Project — Finds or creates your Stable Baseline workspace and project
  3. Scans Your Codebase — Analyzes project structure, tech stack, dependencies, and architecture
  4. Checks for Existing Docs — Detects if documentation already exists in Stable Baseline and offers to augment, replace, or cancel
  5. Creates Folder Structure — Organizes documentation into logical folders matching your codebase
  6. Generates Documents — Writes comprehensive docs for each area of your codebase
  7. Adds Diagrams — Creates architecture and flow diagrams using Mermaid, PlantUML, or other supported formats
  8. Configures AGENTS.md — Adds auto-sync rules to your project's AGENTS.md file (augments existing content — never removes what's already there)
  9. Summary & Next Steps — Provides a summary of everything created with links to view in Stable Baseline

What Gets Documented

Architecture

High-level system design, component relationships, data flow

API & Integrations

Endpoints, external services, authentication flows

Data Model

Database schemas, relationships, migrations

Frontend

Component hierarchy, state management, routing

Backend

Server logic, middleware, business rules

DevOps

Build pipeline, deployment, environment configuration

Auth & Identity

Authentication, authorization, user management

The exact documentation structure is determined dynamically based on your codebase. No two projects get the same output.

How Auto-Sync Works

After setup, your AGENTS.md file will contain rules that tell Windsurf's Cascade when to update documentation.

File PatternDocumentation ImpactAction
src/components/**UI components and patternsUpdate "Frontend Patterns"
src/lib/api/**API client and integrationsUpdate "API & Integrations"
supabase/migrations/**Database schema changesUpdate "Data Model"
src/hooks/**Custom hooks and state logicUpdate "Frontend Patterns"

Whenever Cascade modifies files matching these patterns, it will automatically update the corresponding Stable Baseline documentation using the sb-sync prompt.

File Structure

Your Stable Baseline Project
├── Architecture/
│   ├── High Level Overview
│   └── System Architecture Diagram
├── Frontend/
│   ├── Component Hierarchy
│   ├── State Management
│   └── Routing & Navigation
├── Backend/
│   ├── API Endpoints
│   ├── Business Logic
│   └── Middleware & Auth
├── Data Model/
│   ├── Database Schema
│   └── Entity Relationships
└── DevOps/
    ├── Build & Deploy
    └── Environment Config

This is an example. Your actual structure will be tailored to your specific project.

Try It

Once setup is complete, try these example prompts in Windsurf's Cascade:

"Document the authentication flow in our API"

"Add a sequence diagram showing the checkout process"

"Update the database schema docs after the latest migration"

"Create a new doc explaining our caching strategy"

Regenerate Documentation

To regenerate your entire documentation from scratch:

Type into Cascade
Run the sb-setup prompt

The setup process will detect existing documentation and ask whether you want to augment (add to existing), replace (start fresh), or cancel.

Other Prompts Available

PromptDescription
sb-setupFull project onboarding — scans codebase, creates docs, configures auto-sync
sb-syncSync AGENTS.md rules — augments existing content, never removes
sb-create-docCreate a new document in Stable Baseline
sb-create-diagramCreate a diagram (Mermaid, PlantUML, BPMN, GraphViz, etc.)
sb-edit-docEdit an existing document with targeted patches
sb-manage-imagesUpload, update, or delete images in documents
sb-manage-dataManage data files for Vega/Vega-Lite statistical visualizations