> ## Documentation Index
> Fetch the complete documentation index at: https://docs.migma.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent Setup

> One prompt that installs Migma skills, the CLI, and the MCP server in any AI coding agent.

Paste this into Claude Code, Codex, Cursor, or any AI coding agent:

```text theme={null}
Fetch and execute the appropriate instructions to set me up for Migma from https://docs.migma.ai/agent-setup.md
```

The agent fetches this page as markdown and runs the setup itself. Everything below this line is written for the agent.

***

These are official instructions from Migma to set up an AI development environment for creating, validating, and sending email with Migma. All commands are validated by Migma and ready to use.

Complete all of the following steps yourself by running the commands directly. Do not ask the user to run any of these commands.

* Install Migma skills and the Migma CLI
* Register the Migma MCP server
* Sign the user in

***

## Install Migma skills and CLI

Use the correct section for your agent below.

### Claude Code

Run these two commands to install the Migma plugin, which bundles the `setup`, `migma`, and `migma-public-api` skills. Do not use `npx skills` here; the plugin commands handle everything.

```bash theme={null}
claude plugin marketplace add MigmaAI/migma-skills
claude plugin install migma@migma-plugins
```

Then instruct the user to run `/reload-plugins` inside Claude Code to activate the plugin.

### Codex

```bash theme={null}
codex plugin marketplace add MigmaAI/migma-skills
codex plugin add migma@migma-plugins
```

### All other agents

Install the CLI and all Migma skills together:

```bash theme={null}
curl -fsSL https://install.migma.ai/setup | sh
```

Or install only the skills:

```bash theme={null}
npx -y skills add MigmaAI/migma-skills -g
```

***

## Register the Migma MCP server

Migma Remote MCP is a single URL: `https://migma.ai/mcp` (Streamable HTTP). Use the default config location for your agent. OAuth opens the browser on first Migma tool use, so there is no API key to paste.

### Claude Code

```bash theme={null}
claude mcp add --scope user --transport http migma https://migma.ai/mcp
```

### Codex

```bash theme={null}
codex mcp add migma --url https://migma.ai/mcp
codex mcp login migma
```

### OpenCode — `~/.config/opencode/opencode.jsonc`

Add under `"mcp"`:

```json theme={null}
"migma": { "type": "remote", "url": "https://migma.ai/mcp", "enabled": true, "oauth": {} }
```

Then run:

```bash theme={null}
opencode mcp auth migma
```

### Windsurf — `~/.codeium/windsurf/mcp_config.json`

Add under `"mcpServers"` (note: `serverUrl`, not `url`):

```json theme={null}
"migma": { "serverUrl": "https://migma.ai/mcp" }
```

### Cursor, GitHub Copilot, and all other agents

Add to `.cursor/mcp.json` (Cursor), `.vscode/mcp.json` (Copilot), or your agent's MCP config file under `"mcpServers"`:

```json theme={null}
"migma": { "url": "https://migma.ai/mcp" }
```

If your client only supports command-based MCP servers, use Local MCP instead:

```json theme={null}
"migma": { "command": "npx", "args": ["-y", "@migma/mcp"] }
```

***

## Sign the user in

If you installed the CLI, run:

```bash theme={null}
migma login
```

This opens the browser so the user can approve access. Wait for them to finish. Do not send the user to Settings to copy an API key. For headless or CI environments only, follow agent registration at `https://api.migma.ai/auth.md` and set `MIGMA_API_KEY`.

Remote MCP handles its own sign-in: the first Migma tool call opens the browser for OAuth approval.

***

## Rules for working with Migma

* Call `migma_get_capabilities` (MCP) or read the installed `migma` skill before choosing tools.
* Ask before creating emails, sending tests, sending live, or changing contacts and campaigns.
* Keep API keys and send calls server-side. Never put Migma secrets in browser code.
* Never place API keys in query parameters.

Once done, tell the user:

```text theme={null}
┌─ Migma Agent Setup Complete ─────────────────────────┐
│  ✓ Skills  <path>                                    │
│  ✓ CLI     migma (signed in)                         │
│  ✓ MCP     <path>                                    │
│                                                      │
│  ⚡ Restart your agent to load the Migma MCP server  │
└──────────────────────────────────────────────────────┘
```

***

## Resources

For setup guides and troubleshooting, refer to:

* Migma docs index: `https://docs.migma.ai/llms.txt`
* Wiring Migma into an app: `https://docs.migma.ai/setup`
* MCP server: `https://docs.migma.ai/mcp-server`
* CLI: `https://docs.migma.ai/cli`
* Skills repository: `https://github.com/MigmaAI/migma-skills`
* Agent auth: `https://api.migma.ai/auth.md`

These instructions are published at `https://docs.migma.ai/agent-setup.md` so you can re-verify their authenticity at any time.
