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

# nut connect

> Access third-party services through Coconut connectors

# `nut connect`

Interact with third-party services — Google Drive, Slack, HubSpot, Figma, Stripe, and more — directly from the CLI through the Coconut Dashboard.

```bash theme={null}
nut connect [options] [command]
```

<Warning>
  **Connectors must be configured on the Coconut Dashboard first.** Before using `nut connect`, visit the [Coconut Dashboard](https://app.coconut.dev) to link your third-party accounts. The CLI acts as a proxy to services you've already authorized — it cannot establish new connections on its own.
</Warning>

<Note>
  `nut connect` is for third-party service connectors. To call peer Coconut MCP tools through the Coconut Dashboard, use [`nut coconut`](/cli/coconut).
</Note>

## Authentication

The `nut connect` command requires a valid callback token to communicate with the Coconut Dashboard. You can provide it in one of two ways:

* **Environment variable (recommended):** Set `COCONUT_CALLBACK_TOKEN` in your shell environment
* **Flag:** Pass `--token <token>` on each invocation

```bash theme={null}
# Set the environment variable once
export COCONUT_CALLBACK_TOKEN="your-token-here"

# Or pass it inline
nut connect list --token "your-token-here"
```

<Tip>
  Add `COCONUT_CALLBACK_TOKEN` to your shell profile (e.g. `.bashrc`, `.zshrc`) or a `.env` file so you don't have to supply it every time.
</Tip>

**Global Options:**

* `-t, --token <token>` — Callback token (defaults to `$COCONUT_CALLBACK_TOKEN`)
* `--host <url>` — Coconut Dashboard base URL (defaults to `$COCONUT_HOST` or `https://app.coconut.dev`)
* `-r, --raw` — Output raw JSON without formatting
* `--json` — Alias for `--raw`

***

## `nut connect list`

List all third-party services currently connected to your Coconut instance.

```bash theme={null}
nut connect list
```

This returns the app slugs you can use with the `proxy` subcommand (e.g. `google_drive`, `slack`, `hubspot`, `figma`, `stripe`).

***

## `nut connect proxy`

Send an authenticated API request to a connected service. Coconut handles authorization headers automatically — you just specify the app, HTTP method, and path.

```bash theme={null}
nut connect proxy [options] <app> <method> <path>
```

**Arguments:**

* `app` — App slug as shown by `nut connect list` (e.g. `google_drive`, `slack`, `hubspot`)
* `method` — HTTP method (`GET`, `POST`, `PUT`, `PATCH`, `DELETE`)
* `path` — API path relative to the service, or a full URL

**Options:**

* `-b, --body <json>` — JSON request body
* `--headers <json>` — Additional headers as a JSON string

### Examples

**Google Drive** — list recent files:

```bash theme={null}
nut connect google_drive GET /drive/v3/files?pageSize=5
```

**Slack** — send a message to a channel:

```bash theme={null}
nut connect slack POST /api/chat.postMessage \
  --body '{"channel": "C0123ABC", "text": "Deployed v2.4.0 🎉"}'
```

**HubSpot** — fetch contacts:

```bash theme={null}
nut connect hubspot GET /crm/v3/objects/contacts?limit=10
```

**Stripe** — retrieve a customer:

```bash theme={null}
nut connect stripe GET /v1/customers/cus_abc123
```

**Custom / unsupported apps** — use a full URL as the path:

```bash theme={null}
nut connect my_app GET https://api.example.com/v1/items
```

***

## How It Works

When you run `nut connect`, the CLI proxies your request through the Coconut Dashboard, which injects the necessary OAuth or API credentials that were configured on the Dashboard. This means:

1. **You never handle raw API keys** for connected services — credentials stay in the Coconut Dashboard.
2. **Any service available on the Dashboard** can be accessed from the CLI, scripts, or agent workflows.
3. **Agents can call connectors** during task execution to read from or write to external systems (e.g. pulling data from Google Sheets, creating issues in Linear, posting updates to Slack).

***

## Use in Agent Workflows

Connected services are especially powerful when combined with `nut code` or other agent-driven commands. An agent can leverage connectors to:

* **Pull context** from tools like Notion, Confluence, or Google Docs before implementing a task
* **Push results** to Slack, email, or project management tools when work is complete
* **Read and write data** from CRMs, databases, or storage services as part of automated pipelines

***

## Troubleshooting

<AccordionGroup>
  <Accordion title="'Unauthorized' or 'missing token' error">
    Make sure `COCONUT_CALLBACK_TOKEN` is set in your environment or that you're passing `--token`. You can verify the variable is set with `echo $COCONUT_CALLBACK_TOKEN`.
  </Accordion>

  <Accordion title="Service not appearing in list">
    The service must be connected on the Coconut Dashboard first. Visit the [Coconut Dashboard](https://app.coconut.dev), navigate to your instance's connector settings, and authorize the service.
  </Accordion>

  <Accordion title="Request returns an unexpected error from the service">
    Double-check the API path and method against the service's own documentation. `nut connect` proxies your request as-is — the error is coming from the upstream API.
  </Accordion>
</AccordionGroup>

<Note>
  Connector availability and supported services depend on your Coconut plan and the integrations enabled on the Dashboard.
</Note>

***

## Compatibility Note

The legacy `nut connect coconut ...` command path still works as a deprecated compatibility shim for peer-Coconut MCP calls, but it emits:

```text theme={null}
Warning: "nut connect coconut" is deprecated. Use "nut coconut" instead.
```

Use [`nut coconut`](/cli/coconut) in new docs, scripts, and agent instructions.
