# Connect Cursor

> Step-by-step: add PicX as an MCP server in Cursor via .cursor/mcp.json.

Cursor reads MCP server configuration from a JSON file — either project-scoped or global.

## Steps

1. Create or open `.cursor/mcp.json` in your project root (or `~/.cursor/mcp.json` for a global config that applies to every project).
2. Add a `picx` entry:

   ```json
   {
     "mcpServers": {
       "picx": {
         "url": "https://mcp.picxstudio.com/",
         "headers": { "Authorization": "Bearer pxsk_YOUR_KEY" }
       }
     }
   }
   ```

3. Replace `pxsk_YOUR_KEY` with a real key from [API Keys](/docs/developer-tools/api-keys). Or omit the `headers` block entirely and connect over OAuth — Cursor opens a browser sign-in on first connect, no key in the file.
4. Save the file. Cursor picks up MCP config changes automatically — reopen the MCP panel (or restart Cursor) to confirm PicX's 19 tools appear.

> [!TIP]
> Ask Cursor's agent to "generate an image of a red apple on a white background" to verify end-to-end. A successful call charges real credits, so this is a real (if small) spend, not a dry run.

## Common mistakes

> [!CAUTION]
> The URL must be the bare root — `https://mcp.picxstudio.com/` — not `.../mcp` or `.../sse`. Those paths don't exist on the server.

> [!WARNING]
> If `.cursor/mcp.json` already has other `mcpServers` entries, merge the `picx` key into the existing object rather than replacing the file — overwriting it removes every other MCP server you've configured.

## Project-scoped vs. global config

| Location | Applies to |
| --- | --- |
| `<project>/.cursor/mcp.json` | Only that project |
| `~/.cursor/mcp.json` | Every project opened in Cursor |

Use the project-scoped file if different projects need different PicX API keys (e.g. separate dev/prod accounts); use the global file if one key covers all your work.

## FAQ

### Does Cursor need to restart to pick up config changes?

Usually not — Cursor watches `mcp.json` and reconnects automatically. If tools don't appear after a save, reopen the MCP panel or restart as a fallback.

### Can I use environment variable substitution for the API key instead of a literal string?

Not in the `mcp.json` file itself — Cursor's MCP config doesn't support `${VAR}` substitution for header values. Store the literal key in the file and keep the file out of version control (add `.cursor/mcp.json` to `.gitignore` if it contains a real key).
