# MCP setup

Use this guide when you want to connect an IDE or terminal agent to Swytchcode through MCP. It's the fastest path to a working setup: install the CLI, sign in, initialize your editor, and confirm your AI client can see Swytchcode's tools.

Browse the full, up-to-date list of supported APIs at [swytchcode.com/apis](https://www.swytchcode.com/apis).

### 1. Install the CLI

**npm**

```bash
npm install -g swytchcode
```

**Windows**

```powershell
irm https://cli.swytchcode.com/install.ps1 | iex
```

**macOS / Linux**

```bash
curl -fsSL https://cli.swytchcode.com/install.sh | sh
```

Use `swy` as a shorter alias for `swytchcode`. Verify the install:

```bash
swy --version
```

### 2. Sign in

```bash
swy login
```

This is a device-flow browser login that saves your session to `~/.swytchcode/auth.json`. Sign in before initializing your editor - fetching integrations and connecting provider accounts through your AI client both need an authenticated session. In CI or headless environments, set the `SWYTCHCODE_TOKEN` environment variable instead; the CLI reads it only from the process environment, not `.env` files.

### 3. Initialize Swytchcode for your editor

`swy init --editor= ` does two things at once: it creates `.swytchcode/` and `tooling.json` for the project, and it registers the MCP server for the editor you pick - as a **stdio** subprocess, so there's no daemon or manual URL/port setup for any of the editors below.

**Cursor**

```bash
swy init --editor=cursor
```

Installs the rule file at `.cursor/rules/swytchcode.mdc` and merges the stdio entry into `~/.cursor/mcp.json` automatically.

**Claude Code**

```bash
swy mcp serve --claude
```

Registers the MCP server with Claude Code so it discovers tools automatically. Claude Code is the one editor this doesn't handle via `swy init --editor=`: since its config format isn't meant to be hand-written, this shells out to the `claude` CLI (`claude mcp add`) instead, so you'll need `claude` on your `PATH`.

**Windsurf**

```bash
swy init --editor=windsurf
```

Automatically merges the stdio entry into `~/.codeium/windsurf/mcp_config.json`. If you'd rather configure it by hand, open **Settings → MCP Servers** and add a new server with command `swy mcp serve` and transport `stdio`.

**Copilot**

```bash
swy init --editor=copilot
```

This writes `.vscode/mcp.json` and `.github/copilot-instructions.md` so Copilot can connect.

**Gemini CLI**

```bash
swy init --editor=gemini
```

This writes `GEMINI.md` and merges the MCP server into `~/.gemini/settings.json` so Gemini CLI can connect.

**Codex**

```bash
swy init --editor=codex
```

This writes `AGENTS.md` and merges the MCP server into `~/.codex/config.toml` so Codex can connect.

**Hermes**

```bash
swy init --editor=hermes
```

This writes `AGENTS.md` (shared with Codex) and merges the MCP server into `~/.hermes/config.yaml` so Hermes can start it automatically.

**OpenClaw**

```bash
swy init --editor=openclaw
```

This writes `OPENCLAW.md` and merges the MCP server into `~/.openclaw/settings.json` so OpenClaw can connect.

Re-running `init` with a different `--editor` later is safe - it warns about any orphaned files left over from the previous choice.

### 4. Other MCP clients

Every editor above is wired up automatically by `swy init --editor= `. If you're connecting a different MCP-compatible client, or need a specific transport, run the server directly:

```bash
# Standard I/O (recommended for desktop editors)
swy mcp serve

# HTTP transport (remote/shared server)
swy mcp serve --transport http --port 5476

# Daemon (background) mode
swy mcp serve --transport http --port 5476 -d
```

Then point your client at the equivalent of:

```json
{
"mcpServers": {
"swytchcode": {
"command": "swy",
"args": ["mcp", "serve"]
}
}
}
```

### 5. Confirm the connection

Ask your editor or agent:

```text
Connect GitHub and show me the tools available from the Swytchcode MCP server.
```

If the tools show up and it can list them, the MCP server is wired up correctly. If nothing appears, check that the project you initialized is the one open in your editor and that the CLI is signed in (`swy whoami`).

## Where to go next

- [Zoom via MCP](https://github.com/swytchcodehq/swytchcode-examples/tree/main/zoom-swytchcode-demo) - Drives Zoom entirely through Swytchcode as an MCP server in Claude, Cursor, Codex, Copilot, or Windsurf.
- [MCP Overview](https://docs.swytchcode.com/cli/mcp/) - Learn how the built-in MCP server works and how it exposes your trusted tools to AI coding assistants.
- [CLI Overview](https://docs.swytchcode.com/cli/overview/) - Understand how the Swytchcode CLI manages projects, integrations, authentication, and tool execution behind MCP.
- [Authentication](https://docs.swytchcode.com/cli/authentication/) - Connect your Swytchcode account and securely manage provider credentials for tool execution.
- [MCP Reference](https://docs.swytchcode.com/reference/mcp-reference/) - Explore the complete MCP server configuration, commands, and supported options.
