---
title: "Connect an MCP server"
description: "Connect a remote MCP server to HolaClaw Server, sign in to it when it needs OAuth, grant its tools to an agent, and keep the connection healthy."
updated: 2026-11-17
canonical: https://holaclaw.ai/docs/server/connectors
---

A connector is one connection to one remote MCP server, kept under an id you choose, such as `tracker`. You connect it once, signing in to the service if it needs a sign-in, and then grant it to the agents that may use it. Every tool of the server reaches those agents as `<id>.<tool>`, for example `tracker.create_issue`.

A connector acts as the account that signed in when it was connected, whoever is talking to the agent. Connectors speak Streamable HTTP and offer tools only.

Commands are written as `holaclaw …`. Run them [the way your deployment does](/docs/server/choose-a-deployment#where-things-are). Every key of `connectors.toml` is in the [connectors.toml reference](/docs/server/connectors-toml).

## Before you start

- **The daemon is running.** Every `holaclaw connectors` command talks to it: the daemon does the discovery, the sign-in, token refresh and health checks.
- **You have admin access.** On the daemon's machine, the commands use the control socket, which is admin by its file permissions. From another machine, pass the daemon's address with `--addr` (or `HOLACLAW_ADDR`) and an admin token in `HOLACLAW_TOKEN`.
- **You have the server's URL**, its Streamable HTTP endpoint. It must be `https`, or plain `http` on a loopback address such as `127.0.0.1`.
- **For a server that needs a sign-in**, you have an account on the service and a browser. The browser can be on any machine.

## Step 1: Check the server

`inspect` asks the server what it is, without connecting it. Nothing is stored.

```sh
holaclaw connectors inspect https://mcp.example.com/mcp
```

An open server, with no sign-in, answers with its name and tools:

```
url: https://open.example.com/mcp
open: yes, no sign-in needed
server: example-weather 1.4.0

tools (2):
  forecast  read      Get the weather forecast for a place
  report    external  Send a weather report to a subscriber
```

The second column is the tool's risk class, `read` or `external`. See [Policy and trust](#policy-and-trust).

A server that needs a sign-in answers with where you sign in, the scopes it offers, and a `client identity` line that says what you need to do before you connect it:

| `client identity` | Meaning | What you do |
| --- | --- | --- |
| `cimd` | HolaClaw names itself with its published client metadata. The consent screen says "HolaClaw". | Nothing. |
| `dcr` | HolaClaw registers itself with the server when you create the connector. | Nothing. |
| `pre-registered (…)` | The server accepts only apps created in its own console. | Create an app there, then pass `--client-id`. See [A pre-registered app](#a-pre-registered-app). |

## Step 2: Connect it

Choose an id: lowercase letters, digits and `-`, at most 32 characters, and not the name of a built-in tool or group such as `memory` or `files`. The id becomes the prefix of every tool name.

### An open server

```sh
holaclaw connectors create weather https://open.example.com/mcp
```

It connects at once and prints `weather: connected to example-weather`.

### A server that needs a sign-in

This works wherever the daemon runs, with the browser on any machine.

1. Create the connector:

   ```sh
   holaclaw connectors create tracker https://mcp.example.com/mcp
   ```

   It prints a sign-in URL, and the time the sign-in expires, 15 minutes later.
2. Open the URL in any browser and sign in with the account the connector should act as. Approve the consent screen.
3. The browser goes to `http://127.0.0.1:26500/callback?code=…&state=…` and shows an error page, because nothing listens there. That is expected.
4. Copy the whole address from the address bar and pass it to `code`, in single quotes, since it contains `&` and `?`:

   ```sh
   holaclaw connectors code tracker 'http://127.0.0.1:26500/callback?code=…&state=…'
   ```

   It prints the server and the scopes you got, such as `tracker: connected to Example Tracker, scopes issues:read issues:write`. If they are wrong, sign in again with [reconnect](#reconnect).

Whoever opens the sign-in URL binds their account to the connector, so do not share it while it is valid.

### Receive the sign-in on this machine

With `--listen`, the command receives the browser's redirect itself and waits until the connector is connected. It needs the browser on the same machine as the command, or a tunnel to it.

```sh
holaclaw connectors create tracker https://mcp.example.com/mcp --listen
```

It opens the browser when it can, or prints the URL for you to open. It listens on `127.0.0.1`, on the first free port from 26500 to 26504.

When you run the command over SSH and the browser is on your laptop, forward the five ports from the laptop, since the command takes the first free one:

```sh
ssh -L 26500:127.0.0.1:26500 -L 26501:127.0.0.1:26501 -L 26502:127.0.0.1:26502 -L 26503:127.0.0.1:26503 -L 26504:127.0.0.1:26504 <host>
```

If you stop waiting with `Ctrl-C`, finish the sign-in in the browser and pass the address it lands on to `holaclaw connectors code`.

### Options

| Flag | What it does |
| --- | --- |
| `--auth none` or `--auth oauth` | States what you expect. A server that disagrees fails the create. Without it, HolaClaw uses what the server answers. |
| `--scopes a,b` | Asks for these scopes only. Without it, HolaClaw asks for every scope the server offers. |
| `--client-id <id>` | Uses an app you created in the service's console. |
| `--client-secret-stdin` | Reads that app's secret from stdin. |
| `--allow-insecure-transport` | Reaches a server on your own network over plain `http`, or over `https` with a certificate that does not verify. Anyone on the way can read the traffic. |

### A pre-registered app

When `inspect` says `pre-registered`, create an OAuth app in the service's console with these five redirect URIs, exactly (`127.0.0.1`, not `localhost`):

```
http://127.0.0.1:26500/callback
http://127.0.0.1:26501/callback
http://127.0.0.1:26502/callback
http://127.0.0.1:26503/callback
http://127.0.0.1:26504/callback
```

Then pass its id, and pipe its secret in if the console gave you one, so it never lands on the command line:

```sh
holaclaw connectors create corp https://mcp.example.com/mcp --client-id <client id> --client-secret-stdin < corp-mcp-secret
```

The client id goes to `connectors.toml`. The tokens and the secret go to `auth.toml`, which no API answer, trace or prompt shows.

## Step 3: See the result

```sh
holaclaw connectors list
holaclaw connectors show tracker
```

`list` shows every connector with its state, server, number of tools, scopes and last check. `show` adds the sign-in details and each tool with its risk class. In the tool list, `asks` means every call of that tool needs a person's approval, and `[cut]` means the server's description was over 400 tokens and the agent sees it shortened.

| State | Meaning |
| --- | --- |
| `pending` | Just created, or loaded at start and not checked yet. |
| `authorizing` | A sign-in is open and waiting for its code. |
| `connected` | Working. |
| `degraded` | Checks are failing. Calls still try. |
| `expired` | The sign-in is dead. Calls fail until you reconnect. |

`holaclaw status` lists every connector that is not `connected`.

## Step 4: Grant it to an agent

Create the connector before you name it in an agent: `holaclaw check` refuses an agent that names a connector that does not exist.

1. Edit the agent's `agent.toml`, `agents/main/agent.toml` for the default agent. Add a `connectors` line among the top-level keys, above the first table such as `[models]`:

   ```toml title="agents/main/agent.toml"
   version    = 1
   tools      = ["memory", "files", "fetch", "attach", "task.create"]
   connectors = ["tracker", "weather"]

   [models]
   chat = "default"
   ```

   Do not put a connector id in `tools`. `check` reports that as `CFG010`.
2. Check the config:

   ```sh
   holaclaw check --offline
   ```

3. Restart the daemon. It reads `agent.toml` only at start.

The agent now has every tool of each granted connector. Agents granted the same connector share its sign-in. When the server changes its tool list, HolaClaw picks it up on its own, with no restart.

> [!TIP] Watch the context cost
> Every connector tool adds its schema and description to every request the agent makes. `holaclaw prompt-size --agent main` shows how many tokens the connectors take. Over a quarter of the chat model's window, `check` warns `BUD002`.

## Policy and trust

A connector tool goes through the same policy as every other tool. See the [policy in agent.toml](/docs/server/agent-toml#policy).

- **Risk class.** A tool the server marks read-only is `read`. Every other tool is `external`, including every tool of a server that sets no hints.
- **Class policy.** With the defaults, the owner's `read` and `external` calls run without asking. Guests have `external = "deny"`, so they can only use `read` tools.
- **Destructive tools.** A tool the server marks destructive shows `asks` in `show`: every call needs a person's approval, whatever the policy says. A `deny` still wins, and a scheduled task, with nobody to ask, is denied.

To tighten or loosen one connector or one of its tools, add keys to `[policy.tools]`. The more specific key wins. Quote every key:

```toml title="agents/main/agent.toml"
[policy.tools]
"weather"             = "allow"   # every tool of the connector
"tracker"             = "ask"     # every tool of tracker…
"tracker.list_issues" = "allow"   # …but this one runs unasked
"tracker.close_issue" = "deny"    # and this one never runs
```

An override never lifts a class `deny`, and for guests it can only tighten. `check` refuses a key that names no connector, but not a misspelled tool name, which silently matches nothing.

### Trust

Every connector result reaches the model marked as untrusted content, and is scored for whether it tries to steer the agent. With `taint_escalates = true` in the agent's policy, a high score turns the next `external` calls into approvals. See [Untrusted content](/docs/server/security#untrusted-content).

For a server whose content only you write, set `trusted = true` on its entry in `connectors.toml` by hand and restart. Its results are still marked as untrusted, but never scored. `check` notes every trusted connector as `CON004`.

> [!WARNING]
> Do not trust a server whose content other people can write: an issue tracker outsiders file issues in, a shared wiki, a mailbox or a chat. Text planted there is what the scoring exists to catch.

## Reconnect

`reconnect` opens a new sign-in on an existing connector. It works like `create`, with or without `--listen`:

```sh
holaclaw connectors reconnect tracker
holaclaw connectors code tracker '<address>'
```

The old sign-in keeps serving the agents until the new one is done. If you abandon it, the connector returns to its previous state after 15 minutes.

Reconnect when:

- **The connector is `expired`.** The service revoked or expired the sign-in. Every call answers the agent that the connector needs to be reconnected by an admin, so the agent can tell the person.
- **You want other scopes.** `--scopes issues:read` asks for these instead, and saves them to `connectors.toml`. Without `--scopes`, reconnect keeps the connector's scopes.
- **You changed the URL by hand.** The tokens belong to the old URL.
- **You wrote an OAuth entry by hand.** It has no sign-in yet, and shows `expired` with `needs_reconnect`.

For a pre-registered app, reconnect reuses the stored secret. If the service or the client id changed, pass the secret again with `--client-secret-stdin`.

The daemon rewrites `connectors.toml` whole when it changes it. Entries and keys are kept, comments are not. It never writes through a symlink: when `connectors.toml` is one (managed by Nix or your dotfiles, for example), add or remove entries in the file it points to, restart, then `reconnect`.

## Health

The daemon checks every connector when it starts and then every 10 minutes: it pings the server, refreshes the access token when it is due, and refreshes the tool list.

- **Three failed checks in a row** move a connector to `degraded`. Calls keep trying, and a failed call answers the agent with an error it can read.
- **One successful check** moves it back to `connected`. You do not have to do anything when a server comes back.
- **A refresh the service rejects** moves it to `expired` at once. Reconnect it.
- **An open server that starts asking for a sign-in** becomes `degraded` with `open_server_unauthorized`. Delete it and create it again.

There is no command to force a check. Restart the daemon, or, for an open server, run `holaclaw connectors reconnect <id>`, which runs one check.

## Delete

```sh
holaclaw connectors delete tracker
```

It asks first. Type `yes` to remove the entry in `connectors.toml`, the sign-in in `auth.toml` and the cached tools. `--yes` skips the question for scripts.

Then remove the id from `connectors` and from `[policy.tools]` in every agent that names it. Until you do, the config does not load: the daemon refuses to start, and `check` reports `CFG006` and `CFG010`.

## When something goes wrong

| You see | What to do |
| --- | --- |
| `detail` `intent_expired` | The sign-in was not finished within 15 minutes. Reconnect and finish in time. |
| `detail` `state_mismatch`, or `state mismatch` | The address came from an older sign-in. Start again and paste the newest one. |
| `detail` `refresh_rejected`, `unauthorized` or `needs_reconnect` | Reconnect. |
| `detail` `ping_failed`, `tools_list_failed` or `server_unreachable` | Usually passes on its own. Check the URL and that the server is up. |
| `detail` `descriptions_truncated` | Nothing to fix: a description was over 400 tokens and is shortened. |
| `detail` `config_write_failed` | `connectors.toml` or `auth.toml` could not be written, or is a symlink. |
| `id in use` | Pick another id, or reconnect or delete the existing one. |
| `discovery failed: oauth: no client identity available` | The server needs a [pre-registered app](#a-pre-registered-app). |
| `server does not use the requested auth` | Drop `--auth`. |
| `not the address the browser landed on` | Copy the whole address again, in single quotes. |
| `--listen: ports 26500 to 26504 on 127.0.0.1 are all in use` | Free a port, or run without `--listen`. |

Every connector rule of `holaclaw check` is in the [check rules reference](/docs/server/check-rules).

## Related

- [connectors.toml reference](/docs/server/connectors-toml)
- [agent.toml reference](/docs/server/agent-toml)
- [Security and hardening](/docs/server/security)
- [Popular MCP servers](/docs/guides/popular-mcp-servers)

