---
title: "Connect your agent"
description: "Give your agent VMs of its own, from any MCP client, the CLI or the REST API. One connection, then it builds and ships on its own."
canonical_url: "https://docs.ghostdock.ai/getting-started/connect"
---
# Connect your agent

> Give your agent VMs of its own, from any MCP client, the CLI or the REST API. One connection, then it builds and ships on its own.

Connect once, and your agent has machines of its own. It creates a VM when it needs one, builds and
runs anything in it, puts it on the internet, and lets it vanish when the work is done. You don't
provision anything.

Ghostdock meets your agent where it already lives: **MCP** in chat apps, the **CLI** anywhere there
is a shell, the **REST API** for everything else. Every way in has the same tools and the same
[skills](#skills), so nothing your agent learns is tied to one of them.

## Pick your way in

<table>
<thead>
  <tr>
    <th>
      You are…
    </th>
    
    <th>
      Use
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      In Claude, ChatGPT, Cursor or another app that connects to MCP servers, on desktop, web or mobile
    </td>
    
    <td>
      <a href="#mcp">
        MCP
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      An agent with a shell and internet access (Claude Code, Codex, a script)
    </td>
    
    <td>
      <a href="#cli">
        CLI
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      CI, or a headless agent that cannot open a browser
    </td>
    
    <td>
      an <a href="#api-tokens">
        API token
      </a>
      
       with the CLI, MCP or REST
    </td>
  </tr>
</tbody>
</table>

All of them need a Ghostdock account: [sign up at ghostdock.ai](https://ghostdock.ai).

## MCP

The server URL:

```text
https://ghostdock.ai/mcp
```

Add it as a remote MCP server in your client. Most clients take an entry like this:

```json [mcp.json]
{
  "mcpServers": {
    "ghostdock": {
      "url": "https://ghostdock.ai/mcp"
    }
  }
}
```

The first connection opens a consent page in your browser. Approve it there: no password or token
ever goes into the client. Connect once in a desktop or web app, and the same connection follows
you to that app on your phone.

To see which clients are connected, or to revoke one, sign in and go to
[Account settings → MCP](https://ghostdock.ai/user/settings/account/mcp).

<tip>

Ask your agent: *"Which Ghostdock organizations can you use?"* It calls `organization_list`, and
the answer proves the connection works.

</tip>

## CLI

Run it without installing:

```bash [Terminal]
npx ghostdock --help
```

If you will use it more than once, install it. You get the short name `gdock`, tab completion and
faster runs:

<code-group>

```bash [Homebrew]
brew install brainchimps/tap/ghostdock
```

```bash [Script]
curl -fsSL https://ghostdock.ai/install.sh | sh
```

```bash [npm]
npm install -g ghostdock
```

</code-group>

Log in. The CLI prints a link to open in your browser; approve it there:

```bash [Terminal]
ghostdock login start    # prints the browser link at once
ghostdock login finish   # after you approve it
```

Check that it works:

```bash [Terminal]
ghostdock organization list
```

Output is for people by default. **Agents and scripts pass --json**: stdout then holds exactly one
JSON document, and notices and errors go to stderr.

The full CLI guide, for people and agents: [ghostdock.ai/cli.md](https://ghostdock.ai/cli.md).
Every command with its flags: [ghostdock.ai/cli-reference.md](https://ghostdock.ai/cli-reference.md).

## API tokens

For CI and agents that cannot open a browser. An organization owner or admin creates a token under
**Organization settings → API tokens**. A token acts only in its organization, and only within the
scopes it was given.

<code-group>

```bash [CLI]
GHOSTDOCK_TOKEN=<token> GHOSTDOCK_ORG=<org> npx ghostdock vm list
```

```bash [REST]
curl -X POST https://ghostdock.ai/api/v1/tools/vm_list \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"organization": "<org>"}'
```

</code-group>

Over MCP, send the same token as the header `Authorization: Bearer <token>`.

The REST API is every tool as `POST /api/v1/tools/<tool>`. Its OpenAPI 3.1 description:
[ghostdock.ai/openapi.json](https://ghostdock.ai/openapi.json).

## Skills

Your agent doesn't start from zero. Ghostdock ships skills: short guides that teach an agent how to
do a job well, such as creating a VM or publishing a site. Agents find and read them on their own.

- **MCP:** as resources. The index is `skill://index.json`.
- **CLI:** `ghostdock skill list`, then for example `ghostdock skill get vm`.

## Next

You're docked. [Create your first VM](https://docs.ghostdock.ai/getting-started/first-vm).


## Sitemap

See the full [sitemap](https://docs.ghostdock.ai/sitemap.md) for all pages.
