LoopLoop
Guides

Connect CLI

Use npx @dork-labs/loop-connect to connect any project to Loop in one interactive command.

Connect CLI

The Connect CLI is a one-command setup tool that wires your project to Loop. It validates your API key, selects or creates a project, detects your agent environment, and writes the necessary configuration files — all in a single interactive flow.

Quick start

Run the CLI with npx from any project directory:

npx @dork-labs/loop-connect

The interactive wizard walks you through three steps:

  1. API key — enter your loop_-prefixed key (validated against the Loop API)
  2. Project — select an existing project or create a new one
  3. File generation — configuration files are written based on your detected environment

What it detects

The CLI scans your working directory for known agent environments and writes configuration files for each one it finds:

Detected file/directoryWritten fileContents
(always).env.localLOOP_API_KEY and LOOP_API_URL
CLAUDE.md or .mcp.json.mcp.jsonMCP server entry for @dork-labs/loop-mcp
CLAUDE.mdCLAUDE.md (appended)Loop context block with skill instructions
.cursor/.cursor/rules/loop.mdcCursor rules for Loop-aware AI assistance
.openhands/.openhands/microagents/loop.mdOpenHands microagent for Loop integration

Files that already exist with the correct content are skipped. Conflicts (e.g., a different LOOP_API_KEY already set) are reported but not overwritten.

CLI flags

FlagShortDefaultDescription
--api-keyProvide the API key non-interactively
--api-urlhttps://app.looped.meLoop API base URL (override for self-hosted instances)
--yes-yfalseNon-interactive mode (skip all prompts)

Non-interactive mode

Use --yes with --api-key for CI or scripted setups. In this mode the CLI validates the key, selects the first available project, and writes files without prompting:

npx @dork-labs/loop-connect --yes --api-key loop_abc123...

If the key is invalid or no projects exist, the CLI exits with a non-zero code.

Self-hosted instances

Point the CLI at your own Loop deployment by passing --api-url:

npx @dork-labs/loop-connect --api-url http://localhost:5667

This sets LOOP_API_URL in .env.local and configures the MCP server entry to point at your custom URL.

Run the wizard

npx @dork-labs/loop-connect

You are prompted for your API key. The key is masked during entry and validated against the Loop API before proceeding.

Select a project

If projects exist, you see a selection list. Choose an existing project or select "Create new project" to create one inline.

If the API is unreachable (e.g., network error), you can continue anyway — files are written with the key you provided, and the project can be created later.

Review the summary

After writing files, the CLI prints a summary showing what was written, what was skipped, and what was not detected:

  Files written

  /path/to/.env.local         — LOOP_API_KEY, LOOP_API_URL
  /path/to/.mcp.json          — MCP server config
  /path/to/CLAUDE.md          — Loop context block (appended)
  .cursor/rules/              — Skipped (not detected)
  .openhands/                 — Skipped (not detected)

  Connected to project: my-project

Verify the connection

Open the dashboard to confirm your project is connected:

open https://app.looped.me/issues

Or test the API directly:

source .env.local
curl "$LOOP_API_URL/api/issues" \
  -H "Authorization: Bearer $LOOP_API_KEY"
const res = await fetch(`${process.env.LOOP_API_URL}/api/issues`, {
  headers: {
    "Authorization": `Bearer ${process.env.LOOP_API_KEY}`,
  },
});
const data = await res.json();
console.log(data);

Gitignore reminder

The CLI checks whether .env.local is listed in your .gitignore. If it is not, the summary includes a warning. Add it to prevent committing your API key:

echo '.env.local' >> .gitignore

Never commit .env.local to version control. It contains your Loop API key.

Next steps

  • Agent Integration — Configure your specific AI agent (Claude Code, Cursor, Windsurf, OpenHands).
  • Agent Polling Loop — Build an autonomous polling loop that continuously pulls work from Loop.
  • Writing Templates — Author prompt templates that control what agents see at dispatch time.