# Agent setup

## Connect an agent

The easiest setup is **Nib → Set up agents…**. Select Claude Code, Codex, or Claude Desktop and click Apply. Nib preserves the rest of each config and creates a `.bak` backup before changing an existing file.

The installed MCP command is:

```text
command: /Applications/Nib.app/Contents/MacOS/Nib
args:
  - /Applications/Nib.app/Contents/Resources/mcp-shim/shim.js
  - --agent
  - <agent-name>
env:
  ELECTRON_RUN_AS_NODE: "1"
```

Use `claudeCodeCLI`, `codexCLI`, or `claudeDesktop` for `<agent-name>`. The shim launches Nib automatically when the app is closed and then connects over its local Unix socket.

### Claude Code or Claude Desktop JSON

```json
{
  "mcpServers": {
    "nib": {
      "command": "/Applications/Nib.app/Contents/MacOS/Nib",
      "args": [
        "/Applications/Nib.app/Contents/Resources/mcp-shim/shim.js",
        "--agent",
        "claudeCodeCLI"
      ],
      "env": { "ELECTRON_RUN_AS_NODE": "1" },
      "type": "stdio"
    }
  }
}
```

For Claude Desktop, change the agent value to `claudeDesktop`.

### Codex TOML

```toml
[mcp_servers.nib]
command = "/Applications/Nib.app/Contents/MacOS/Nib"
args = ["/Applications/Nib.app/Contents/Resources/mcp-shim/shim.js", "--agent", "codexCLI"]
startup_timeout_sec = 120
tool_timeout_sec = 300

[mcp_servers.nib.env]
ELECTRON_RUN_AS_NODE = "1"
```

Restart the agent after changing its MCP configuration.

## Per-agent values

| Agent | `--agent` value |
|-------|-------------------|
| Claude Code | `claudeCodeCLI` |
| Codex | `codexCLI` |
| Claude Desktop | `claudeDesktop` |

Paths must use `/Applications/Nib.app` — never `node_modules`.

## After changing config

Restart the agent. If tools are missing, rerun **Nib → Set up agents…**.
