Skip to content

Connecting agents

An agent needs two things: a way to reach https://<your server>/mcp, and a token for the user it works as.

The token

The MCP server only accepts personal access tokens (clapat_...) sent as Authorization: Bearer <token>. A browser session never authenticates an MCP request.

  • With the CLI bridge, clarive login makes the token and keeps it in the CLI's profile; nothing else to do.
  • Connecting directly, make a token for the agent:

clarive auth create-token --description "claude code on my laptop" --permissions write --expires-days 90

A user administrator can also make one for a service user on the server with cla api-token --user <user> -c <config>.

The agent can do whatever the token's user can do, no more. Choose:

Token When
Your own write token Your personal agent, doing your work with you watching
A read token (--read-only or --permissions read) Letting an agent explore, answer questions and write reports without changing anything
A token of a dedicated user Unattended agents and automations: give that user only the roles the job needs

Give each agent its own token with a clear description, so its calls are told apart in the audit events and it can be revoked alone.

Claude Code

Through the CLI bridge (recommended):

clarive login --url https://clarive.example.com
claude mcp add clarive -- clarive mcp

Directly over HTTP:

claude mcp add --transport http clarive https://clarive.example.com/mcp \
    --header "Authorization: Bearer clapat_0123456789abcdef"

claude mcp add stores the server for the current project only, privately (--scope local, the default). --scope user makes it available in every project; --scope project writes it to .mcp.json at the project root, to share with the team through git. A shared .mcp.json must not hold a token: use the bridge, which reads each person's own CLI profile, or let Claude Code read the token from each person's environment:

{
  "mcpServers": {
    "clarive": { "command": "clarive", "args": ["mcp"] }
  }
}
{
  "mcpServers": {
    "clarive": {
      "type": "http",
      "url": "https://clarive.example.com/mcp",
      "headers": { "Authorization": "Bearer ${CLARIVE_TOKEN}" }
    }
  }
}

Check it in Claude Code with /mcp (status and tools), or from the shell with claude mcp list and claude mcp get clarive.

Claude Desktop

Claude Desktop runs local MCP servers from its configuration file: ~/Library/Application Support/Claude/claude_desktop_config.json on macOS and %APPDATA%\Claude\claude_desktop_config.json on Windows (Settings › Developer › Edit Config opens it).

{
  "mcpServers": {
    "clarive": { "command": "/usr/local/bin/clarive", "args": ["mcp"] }
  }
}

Use the full path of clarive: desktop applications do not see the PATH of your shell. Restart Claude Desktop after editing the file.

Cursor

In ~/.cursor/mcp.json (every project) or .cursor/mcp.json (one project):

{
  "mcpServers": {
    "clarive": { "command": "clarive", "args": ["mcp"] }
  }
}

or, directly:

{
  "mcpServers": {
    "clarive": {
      "url": "https://clarive.example.com/mcp",
      "headers": { "Authorization": "Bearer clapat_0123456789abcdef" }
    }
  }
}

VS Code

VS Code's GitHub Copilot harness, the default for chat sessions, reads MCP servers from ~/.copilot/mcp-config.json (every workspace; $COPILOT_HOME/mcp-config.json when that is set) or from .mcp.json at the workspace root, under a top-level mcpServers key. The GitHub Copilot CLI reads the same files.

Through the bridge, which keeps the token in the CLI profile:

{
  "mcpServers": {
    "clarive": {
      "type": "stdio",
      "command": "clarive",
      "args": ["mcp", "--namespaces", "api,job,topic"],
      "tools": ["*"]
    }
  }
}

Or directly, with the token in an environment variable. The Copilot harness does not prompt for secrets, and it only expands the braced ${NAME} form (a bare $NAME stays literal):

{
  "mcpServers": {
    "clarive": {
      "type": "http",
      "url": "https://clarive.example.com/mcp?namespaces=api,job,topic",
      "headers": { "Authorization": "Bearer ${CLARIVE_TOKEN}" },
      "tools": ["*"]
    }
  }
}

VS Code sends at most 128 tools with a chat request, and Clarive has a few hundred, so narrow the list with namespaces as above, or use compact mode (see Options).

A .vscode/mcp.json with servers and inputs (a promptString asking for the token) is the format of VS Code's Local harness, which is deprecated. It still works there, but new setups should use the files above.

OpenAI Codex CLI

In ~/.codex/config.toml:

[mcp_servers.clarive]
command = "clarive"
args = ["mcp"]

Any other client

  • A client that runs local (stdio) MCP servers: the command is clarive mcp, plus the options below.
  • A client that speaks Streamable HTTP: the URL is https://<your server>/mcp with the header Authorization: Bearer <token>.

Clients that only support OAuth for remote servers (Microsoft Copilot Studio, Microsoft 365 Copilot agents, VS Code without a header) connect with the URL alone: each user signs in to Clarive and allows the client. See Microsoft Copilot and OAuth.

Options: fewer tools, read only

The full tool list has a few hundred tools. Some clients, and some models, work better with fewer. Three options narrow it, as flags of clarive mcp or as query parameters of the URL:

Bridge flag URL What the agent gets
--compact /mcp?mode=compact Only api_search, api_describe, api_namespaces and a generic clarive_call. The agent searches for the operation it needs, reads its parameters and calls it by name
--namespaces job,topic /mcp?namespaces=job,topic Only the tools of those namespaces
--read-only /mcp?read_only=1 Only the tools that change nothing; a write call is refused even through clarive_call

They combine: clarive mcp --namespaces job,topic,rule --read-only. A read token always gets the read-only list, whatever the options say. See Tools for the namespaces.

Several servers or users

Add one MCP server per CLI profile:

clarive login --profile test --url https://clarive-test.example.com
clarive login --profile prod --url https://clarive.example.com --read-only

claude mcp add clarive-test -- clarive mcp --profile test
claude mcp add clarive-prod -- clarive mcp --profile prod --read-only

The agent sees the tools of each server under its own server name, so it can compare them ("is this rule the same in test and prod?") without mixing them up.

How the bridge behaves

clarive mcp reads JSON-RPC messages on stdin, one per line, posts each to <server>/mcp with the profile's token and writes each answer as one line on stdout. Diagnostics go to stderr; add --debug to log every request.

  • Up to 8 requests run at the same time, so a long tool call (a remote command, a rule run) does not hold up the others; answers come back matched by their ids.
  • Tool calls have no time limit of their own unless you pass --timeout. Your client may have one: raise it if long calls are cut short.
  • Every request gets an answer, even when the server fails before reading it: an expired token answers each request with an error asking you to run clarive login.
  • It stops at once on Ctrl-C or when the client closes it.