> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.rubrichq.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.rubrichq.io/_mcp/server.

# Setup and configuration

## Before you start

* **Node.js 20 or later.** Check with `node --version`. Get it from [nodejs.org](https://nodejs.org) if needed.
* **A RubricHQ API key** from **Settings → API Keys → Create key**, created in the workspace you want your assistant to use.

The server runs on your computer: your client starts it with `npx -y @rubrichq/mcp-server`, which downloads the latest version the first time.

> **Note**
>
> Because the server runs on your computer, it works in desktop and terminal apps (Claude Desktop, Claude Code, Cursor, VS Code, Codex, Windsurf, Gemini CLI). It isn't available in claude.ai in the browser or in the Claude mobile apps yet.

## Clients

#### Claude Code

```bash
claude mcp add rubrichq --scope user \
  -e RUBRICHQ_API_KEY=your_api_key \
  -- npx -y @rubrichq/mcp-server
```

* `--scope user` makes RubricHQ available in every project. Use `--scope project` to share it with your team through `.mcp.json` (then don't commit the key; see [Keeping your key safe](#keeping-your-key-safe)).
* Check it with `claude mcp list`, or `/mcp` inside a session.
* Remove it with `claude mcp remove rubrichq`.

#### Claude Desktop

1. Open **Settings → Developer → Edit Config**. This opens `claude_desktop_config.json`:
   * macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
   * Windows: `%APPDATA%\Claude\claude_desktop_config.json`

2. Add RubricHQ under `mcpServers` (keep any servers already there):

   ```json
   {
     "mcpServers": {
       "rubrichq": {
         "command": "npx",
         "args": ["-y", "@rubrichq/mcp-server"],
         "env": { "RUBRICHQ_API_KEY": "your_api_key" }
       }
     }
   }
   ```

3. Quit Claude Desktop completely (not just the window) and open it again. RubricHQ appears in the tools menu of the message box.

#### Cursor

Add RubricHQ to `~/.cursor/mcp.json` for all projects, or `.cursor/mcp.json` for one project:

```json
{
  "mcpServers": {
    "rubrichq": {
      "command": "npx",
      "args": ["-y", "@rubrichq/mcp-server"],
      "env": { "RUBRICHQ_API_KEY": "your_api_key" }
    }
  }
}
```

Open **Cursor Settings → MCP** and check RubricHQ shows a green dot. Tools are used in Agent mode.

#### VS Code

Add this to `.vscode/mcp.json` in your project, or run **MCP: Open User Configuration** for all projects:

```json
{
  "inputs": [
    { "type": "promptString", "id": "rubrichq-key", "description": "RubricHQ API key", "password": true }
  ],
  "servers": {
    "rubrichq": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@rubrichq/mcp-server"],
      "env": { "RUBRICHQ_API_KEY": "${input:rubrichq-key}" }
    }
  }
}
```

VS Code asks for the key the first time the server starts and stores it securely, so the file is safe to commit. Use Copilot Chat in Agent mode.

#### Codex

```bash
codex mcp add rubrichq --env RUBRICHQ_API_KEY=your_api_key -- npx -y @rubrichq/mcp-server
```

Or edit `~/.codex/config.toml`:

```toml
[mcp_servers.rubrichq]
command = "npx"
args = ["-y", "@rubrichq/mcp-server"]
env = { RUBRICHQ_API_KEY = "your_api_key" }
tool_timeout_sec = 300
```

`tool_timeout_sec` gives Co-Pilot answers and waits for runs enough time.

#### Windsurf

Open **Windsurf Settings → Cascade → MCP Servers → View raw config** (`~/.codeium/windsurf/mcp_config.json`) and add:

```json
{
  "mcpServers": {
    "rubrichq": {
      "command": "npx",
      "args": ["-y", "@rubrichq/mcp-server"],
      "env": { "RUBRICHQ_API_KEY": "your_api_key" }
    }
  }
}
```

#### Gemini CLI

Add RubricHQ to `~/.gemini/settings.json`:

```json
{
  "mcpServers": {
    "rubrichq": {
      "command": "npx",
      "args": ["-y", "@rubrichq/mcp-server"],
      "env": { "RUBRICHQ_API_KEY": "your_api_key" }
    }
  }
}
```

Check it with `/mcp` inside Gemini CLI.

## Options

Set these as environment variables next to `RUBRICHQ_API_KEY`.

| Variable                | Default                   | What it does                                                              |
| ----------------------- | ------------------------- | ------------------------------------------------------------------------- |
| `RUBRICHQ_API_KEY`      | required                  | Your API key. Decides the workspace.                                      |
| `RUBRICHQ_READ_ONLY`    | `false`                   | `true` hides every tool that changes data or spends credits.              |
| `RUBRICHQ_API_URL`      | `https://api.rubrichq.io` | Only change this if RubricHQ gave you a different API address.            |
| `RUBRICHQ_WORKSPACE_ID` | read from the key         | Only needed if the server says it can't read the workspace from your key. |

### Read-only mode

With `RUBRICHQ_READ_ONLY=true`, your assistant can list and read agents, scenarios, runs, calls, metrics and past Co-Pilot chats, but it can't create, change, delete, run or re-score anything, and it can't ask Co-Pilot new questions (those spend credits). Useful for exploring, reporting, or giving an assistant to someone who shouldn't run tests.

```json
"env": { "RUBRICHQ_API_KEY": "your_api_key", "RUBRICHQ_READ_ONLY": "true" }
```

## Several workspaces

An API key belongs to one workspace, and the server uses that workspace unless asked otherwise.

* **Add the server once per workspace.** Give each entry its own name and a key from that workspace:

  ```json
  {
    "mcpServers": {
      "rubrichq-acme":   { "command": "npx", "args": ["-y", "@rubrichq/mcp-server"], "env": { "RUBRICHQ_API_KEY": "acme_key" } },
      "rubrichq-globex": { "command": "npx", "args": ["-y", "@rubrichq/mcp-server"], "env": { "RUBRICHQ_API_KEY": "globex_key" } }
    }
  }
  ```

  Then say which one to use: "In Globex, list the agents."
* **Or pass a workspace ID.** Every tool except the Co-Pilot ones accepts `workspace_id`, so you can say "list agents in workspace 44". This works only if the person who created the key is a member of workspace 44; any other workspace answers "not found".
* **Co-Pilot always uses the key's own workspace.** To ask Co-Pilot about another workspace, use a key from that workspace.

## Keeping your key safe

* Your key can do anything in its workspace that the API allows, including spending credits. Treat it like a password.
* Don't commit config files that contain a key. Use VS Code's `inputs` prompt, or set `RUBRICHQ_API_KEY` in your shell profile and leave it out of the config.
* Create a separate key for each person or tool, so you can revoke one without affecting the others.
* Revoke a key any time under **Settings → API Keys**. The assistant loses access immediately.

## Updating

`npx -y @rubrichq/mcp-server` uses the latest published version. To update, restart your client. If you still get an old version, clear npx's cache with `npx clear-npx-cache` and restart.

To pin a version, use `@rubrichq/mcp-server@0.1.0` in `args`.

## Run it from your own code

The server speaks MCP over stdio, so any MCP SDK can start it:

```typescript
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";

const client = new Client({ name: "my-app", version: "1.0.0" });
await client.connect(new StdioClientTransport({
  command: "npx",
  args: ["-y", "@rubrichq/mcp-server"],
  env: { ...process.env, RUBRICHQ_API_KEY: process.env.RUBRICHQ_API_KEY! },
}));

const result = await client.callTool({ name: "list_agents", arguments: {} });
```

For CI pipelines, the [GitHub Action](/documentation/integrations/git-hub-actions-ci-cd) or the [REST API](/api-reference) is usually simpler.