# Claude Code

Connect Claude Code to Valakes so it can work on your SSH servers through the agent tools, under the host policies you set.

Source: https://docs.valakes.com/agents/claude-code/

Last updated: 2026-11-25

Claude Code reaches Valakes through a small program called the bridge, `valakes-mcp` (`valakes-mcp.exe` on Windows). It ships inside the app, needs no Node.js on your machine, and ignores `NODE_OPTIONS` and Node command-line flags, so an environment variable cannot start a debugger inside it. You register the bridge with Claude Code once. After that Claude Code has the Valakes tools as an MCP server named `valakes`.

## Turn on the API and create the agent

These four steps are the same for every client, and the other pages in this group start from them.

1. Open Settings, then **Agent API**, and turn on **Let agents use Valakes through a local server on this computer**. Valakes asks you to confirm. The API is off until you do.
2. The vault must be unlocked, because the API starts only with an unlocked vault. If the screen locks or the computer sleeps, Valakes locks the vault and stops the API, and the Agents panel says "API waiting for the vault to unlock" with an **Unlock and start** button. The API does not start again by itself when the computer wakes: press the button, or turn the API off and on.
3. In the Agents panel press **Connect an agent** and give the agent a name you will recognise in the approval queue, such as "Claude Code on laptop".
4. Valakes shows the setup text for your client and the path of the token file. The token is written once to `agents/<handle>.token` in Valakes' data folder, readable only by you, and it is shown nowhere else: not in the window, not on the clipboard, not in a snippet.

The handle is eight letters and digits and is not a secret. The commands below contain the handle and the path of the bridge, and never the token: the bridge reads the token from its file by itself. Do not paste a token into a configuration file, a prompt or a chat.

## Register the bridge

The **Connect an agent** wizard shows the exact command for your computer, with a copy button. It has this shape, with your own handle in place of `k3m9q2xa`.

Windows (PowerShell):

```powershell
claude mcp add valakes --scope user --env VALAKES_AGENT=k3m9q2xa -- "C:\Program Files\Valakes\resources\bin\valakes-mcp.exe"
```

macOS:

```sh
claude mcp add valakes --scope user --env VALAKES_AGENT=k3m9q2xa -- "/Applications/Valakes.app/Contents/Resources/bin/valakes-mcp"
```

Press **Test connection** in the wizard and start Claude Code. The wizard then shows when Valakes saw the agent's first call that passed the whole gate (token, active agent, rate limit), which tool it called and whether the call succeeded. Only Valakes can see that, because the wizard never calls the API itself.

### The same entry in `.mcp.json`

You can put the entry in a `.mcp.json` file instead. Windows:

```json
{
  "mcpServers": {
    "valakes": {
      "command": "C:\\Program Files\\Valakes\\resources\\bin\\valakes-mcp.exe",
      "args": [],
      "env": {
        "VALAKES_AGENT": "k3m9q2xa"
      }
    }
  }
}
```

macOS:

```json
{
  "mcpServers": {
    "valakes": {
      "command": "/Applications/Valakes.app/Contents/Resources/bin/valakes-mcp",
      "args": [],
      "env": {
        "VALAKES_AGENT": "k3m9q2xa"
      }
    }
  }
}
```

## Check that it works

```sh
claude mcp list
```

The list should show `valakes` as connected. Then ask Claude Code to call `list_hosts`. It should return the hosts you have opened to agents and no others, because every host starts with agent access set to Off.

If the bridge prints one line and exits, the line says why.

- **"Valakes is not running"**: start the app and turn the API on, or press **Unlock and start** if the Agents panel says it waits for the vault.
- **"The server could not prove itself"**: the program at the port did not know your token. Do not work around it. Check that Valakes is the process running and restart it. If the message stays, rotate the agent's token in the Agents panel and treat the old token file as exposed.
- **A message about the token file**: create the agent in Valakes first, or check that the file belongs to you alone.
- **"Valakes could not unlock its vault: check Settings, Credentials and vault"**: Valakes is running, but unlocking failed when the agent was looked up. Open Settings, **Credentials and vault** to see the state, use any part of Valakes that needs the vault, and try again. **Unlock and start** does not help here.
- **"Valakes is busy: try again in a moment"**: the app answered the proof request with "too many requests" twice in a row. Wait a moment and start the agent again.

## What Claude Code can do

Claude Code acts only through ten tools, and what it may do on a host depends on the access level you gave that host: Off, Read-only, Approve writes or Full. Nothing it sends can change a policy, approve a request, read the audit log or reveal a credential. Read [how agents work](https://docs.valakes.com/agents/) for the tools, the four levels and the approval queue, and the [security FAQ](https://docs.valakes.com/security-faq/) for the limits.

Claude Code sends what it reads, including command output, to its own model provider, and Valakes cannot control that. If an agent must not be able to change a server whatever it runs, give it a server account that cannot. The other ways to connect are [Codex](https://docs.valakes.com/agents/codex/), [Cursor](https://docs.valakes.com/agents/cursor/), [other MCP clients](https://docs.valakes.com/agents/mcp-clients/) and the [REST API](https://docs.valakes.com/agents/rest-api/).
