Connect an MCP server
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.
- Server
- Connectors
- MCP
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. Every key of connectors.toml is in the connectors.toml reference.
Before you start
- The daemon is running. Every
holaclaw connectorscommand 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(orHOLACLAW_ADDR) and an admin token inHOLACLAW_TOKEN. - You have the server's URL, its Streamable HTTP endpoint. It must be
https, or plainhttpon a loopback address such as127.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.
holaclaw connectors inspect https://mcp.example.com/mcpAn 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 subscriberThe second column is the tool's risk class, read or external. See 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. |
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
holaclaw connectors create weather https://open.example.com/mcpIt 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.
Create the connector:
Terminalholaclaw connectors create tracker https://mcp.example.com/mcpIt prints a sign-in URL, and the time the sign-in expires, 15 minutes later.
Open the URL in any browser and sign in with the account the connector should act as. Approve the consent screen.
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.Copy the whole address from the address bar and pass it to
code, in single quotes, since it contains&and?:Terminalholaclaw 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.
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.
holaclaw connectors create tracker https://mcp.example.com/mcp --listenIt 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:
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/callbackThen pass its id, and pipe its secret in if the console gave you one, so it never lands on the command line:
holaclaw connectors create corp https://mcp.example.com/mcp --client-id <client id> --client-secret-stdin < corp-mcp-secretThe 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
holaclaw connectors list
holaclaw connectors show trackerlist 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.
Edit the agent's
agent.toml,agents/main/agent.tomlfor the default agent. Add aconnectorsline among the top-level keys, above the first table such as[models]:agents/main/agent.tomltomlversion = 1 tools = ["memory", "files", "fetch", "attach", "task.create"] connectors = ["tracker", "weather"] [models] chat = "default"Do not put a connector id in
tools.checkreports that asCFG010.Check the config:
Terminalholaclaw check --offlineRestart the daemon. It reads
agent.tomlonly 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.
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.
- Risk class. A tool the server marks read-only is
read. Every other tool isexternal, including every tool of a server that sets no hints. - Class policy. With the defaults, the owner's
readandexternalcalls run without asking. Guests haveexternal = "deny", so they can only usereadtools. - Destructive tools. A tool the server marks destructive shows
asksinshow: every call needs a person's approval, whatever the policy says. Adenystill 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:
[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 runsAn 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.
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:
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:readasks for these instead, and saves them toconnectors.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
expiredwithneeds_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
expiredat once. Reconnect it. - An open server that starts asking for a sign-in becomes
degradedwithopen_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
holaclaw connectors delete trackerIt 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. |
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.
Related
Was this page helpful?
