Skip to main content

MCP Server

Swarm ships an MCP (Model Context Protocol) server that connects directly to your AI coding editor. Instead of switching to a browser or terminal, you can test your app from inside Claude Code or Cursor with a single command.

How it works

You (in Claude Code) → "test my signup flow"

Claude calls dev_test → tunnels localhost → runs AI agents

Claude calls dev_watch → gets structured issues

Claude fixes the code → calls dev_test again
The MCP server runs locally via stdio. No remote server needed. It tunnels your localhost via Cloudflare so Swarm’s cloud agents can reach your dev server.

Install

One command adds Swarm MCP to Claude Code:
npx @useswarm/mcp setup
This registers the MCP server with Claude Code. On first use, your browser opens to log in automatically.

Manual setup

If you prefer to configure it yourself:
claude mcp add useswarm -- npx @useswarm/mcp

Other editors

For Cursor or any MCP-compatible editor, add to your MCP config:
{
  "mcpServers": {
    "useswarm": {
      "command": "npx",
      "args": ["@useswarm/mcp"]
    }
  }
}

Authentication

The MCP server uses API keys scoped to your Swarm account. Authentication is handled automatically:
  1. First use — browser opens to log you in, API key is created and stored at ~/.useswarm/config.json
  2. Subsequent uses — stored key is used automatically
You can also manage auth manually:
npx @useswarm/mcp login     # Log in via browser
npx @useswarm/mcp logout    # Clear stored credentials
npx @useswarm/mcp whoami    # Check auth status

Tools

The MCP server exposes 4 tools that form a test-fix-retest loop:

dev_test

Tunnel your localhost and start an AI agent swarm test. Parameters:
ParameterRequiredDescription
targetUrlYesFrontend URL (e.g. http://localhost:3000)
goalYesWhat agents should accomplish (e.g. “complete the signup flow”)
userDescriptionYesTarget audience (e.g. “first-time SaaS users”)
agentCountNoNumber of AI personas (1-20, default 3)
backendUrlNoSeparate backend URL (e.g. http://localhost:8080)
backendPathsNoExtra path prefixes for backend routing (e.g. ["/ws", "/v1"])
authNoLogin credentials for authenticated testing
Example prompt:
Use dev_test to test http://localhost:3000 with goal “sign up and reach the dashboard”. The audience is first-time users.

dev_watch

Poll a running test until it completes, then return structured results. Parameters:
ParameterRequiredDescription
batchIdYesBatch ID returned by dev_test
waitNoPoll up to 3 minutes for completion (default true)
Returns issues sorted by severity with persona attribution, plus a synthesis report. Automatically tears down the tunnel when done.

dev_status

Check the current state of the tunnel and any active test.

dev_close

Manually tear down the active tunnel and clean up.

Split frontend/backend

If your app runs the frontend and backend on separate ports, pass backendUrl and the MCP server starts a reverse proxy automatically:
Use dev_test to test http://localhost:3000 with backend at http://localhost:8080. Goal: “create a new project”.
The proxy routes by path prefix:
PathDestination
/api/*Backend
/auth/*Backend
/graphqlBackend
/trpc/*Backend
Everything elseFrontend

Custom API paths

If your backend uses non-standard paths, pass backendPaths:
Test http://localhost:3000 with backend http://localhost:8080 and extra backend paths /ws and /socket.io. Goal: “send a message in the chat”.

Authenticated testing

Pass login credentials to test flows behind a login page:
Use dev_test on http://localhost:3000 with goal “edit profile settings”. Auth: username test@example.com, password testpass123, login URL http://localhost:3000/login.
Use test-only accounts. Credentials are sent to the Swarm API over HTTPS but should not be production credentials.

The dev loop

The MCP server is designed for an iterative test-fix-retest workflow:
  1. Make a code change
  2. Ask Claude to run dev_test
  3. Ask Claude to run dev_watch for results
  4. Claude reads the issues and fixes the code
  5. Repeat from step 2
Claude handles the full loop automatically. A typical prompt:
Test my app at localhost:3000. The goal is “complete the checkout flow”. If there are issues, fix them and re-test until it passes.

Tunnel providers

The MCP server uses Cloudflare Quick Tunnels by default (free, no account needed). Falls back to ngrok if Cloudflare is unavailable. Install Cloudflare for the best experience:
# macOS
brew install cloudflared

# Linux
curl -fsSL https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 \
  -o /usr/local/bin/cloudflared && chmod +x /usr/local/bin/cloudflared

Framework notes

FrameworkNotes
Next.js / Nuxt / RemixSingle port — no backendUrl needed
React + ExpressUse backendUrl for the Express server
Django / RailsAdd the tunnel URL to ALLOWED_HOSTS / CORS config
Vite with proxyIf Vite proxies API calls, no backendUrl needed