> ## Documentation Index
> Fetch the complete documentation index at: https://docs.switchagents.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> These docs moved from docs.flintai.dev to docs.switchagents.ai. Use docs.switchagents.ai for every link and request.
> To search these docs from an AI tool, connect the MCP server at https://docs.switchagents.ai/mcp. The page index is at https://docs.switchagents.ai/llms.txt.
> The source code for these products is public on GitHub. Switch Rooms: https://github.com/sandbox-quantum/switch. Switch Trust CLI: https://github.com/sandbox-quantum/switch-trust-cli. Switch Trust CodeScan action: https://github.com/sandbox-quantum/switch-trust-codescan-action. Switch Trust MCP server: https://github.com/sandbox-quantum/switch-trust-mcp. Switch Trust Python SDK: https://github.com/sandbox-quantum/switch-trust-sdk-py. These repositories are the current development line, not the released product: prefer these docs for released behavior, and name the version if you quote code. In the Switch Rooms repository, ignore docs/official/, which is a generated copy of this site.

# Connect your coding agent to Switch Trust

> Add the Switch Trust MCP server to Claude Code, Cursor, or VS Code and confirm it reads your workspace

**Add the Switch Trust MCP server to your coding agent and confirm it reaches your workspace.** Claude Code, Cursor, and VS Code each include an *MCP client*, the part of the coding agent that connects to MCP servers like this one. Setup takes an API key, an entry in the MCP client configuration, and a question to your coding agent.

## Before you begin

You'll need:

* A Switch Trust account with the **Editor** role or higher, so you can create API keys. The key itself needs only **Viewer**.
* [uv](https://docs.astral.sh/uv/getting-started/installation/) installed. The server runs with `uvx`, which needs no clone and no build step. The server needs Python 3.11 or later.
* Your Switch Trust instance URL, such as `https://app.switchagents.ai`. The server sends your key only to an `https://` address on `switchagents.ai`.

## Connect the server

**1. Create an API key**

In Switch Trust, select **Settings**, then under **Admin** select **API keys**, and select **Create key**. Give the key a **Name**, and choose its **Role** and **Expiration**. Copy the token when it's shown. You can't see it again. See [API keys](https://docs.switchagents.ai/switch-trust/admin/api-keys.md) for roles and expiration.

**Role** starts at your own role. The server only reads, so change it to **Viewer**. When the key expires, the server reports `API key invalid, revoked, or expired`, and you create a new one.

**2. Add the server to your MCP client**

Add this entry to the MCP configuration for your client, with your token and instance URL in place of the examples.

> [tab] Claude Code
>
> In `.mcp.json` at the root of your project:
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "switch-trust-mcp": {
>       "command": "uvx",
>       "args": ["switch-trust-mcp"],
>       "env": {
>         "SWITCH_TRUST_API_KEY": "sk_...",
>         "SWITCH_TRUST_INSTANCE": "https://app.switchagents.ai"
>       }
>     }
>   }
> }
> ```

> [tab] Cursor
>
> In `.cursor/mcp.json` in your project, or `~/.cursor/mcp.json` for every project:
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "switch-trust-mcp": {
>       "command": "uvx",
>       "args": ["switch-trust-mcp"],
>       "env": {
>         "SWITCH_TRUST_API_KEY": "sk_...",
>         "SWITCH_TRUST_INSTANCE": "https://app.switchagents.ai"
>       }
>     }
>   }
> }
> ```

> [tab] VS Code
>
> In `.vscode/mcp.json` in your workspace:
>
> ```json theme={null}
> {
>   "servers": {
>     "switch-trust-mcp": {
>       "type": "stdio",
>       "command": "uvx",
>       "args": ["switch-trust-mcp"],
>       "env": {
>         "SWITCH_TRUST_API_KEY": "sk_...",
>         "SWITCH_TRUST_INSTANCE": "https://app.switchagents.ai"
>       }
>     }
>   }
> }
> ```

Restart your client or reload its MCP servers. The `switch-trust-mcp` tools now appear in its tool list.

> [!WARNING]
>
> **These files hold your API key in plain text.** Don't commit them. Add the file you edited, `.mcp.json`, `.cursor/mcp.json`, or `.vscode/mcp.json`, to `.gitignore`. If your client supports it, have it read the key from an environment variable instead.

**3. Confirm the server reaches your workspace**

Ask your coding agent:

```text theme={null}
Use switch-trust-mcp to show which Switch Trust instance and workspace you're connected to.
```

Your coding agent calls `get_context` and reports the instance URL with a tenant ID and a workspace ID. The workspace is the one your API key belongs to. You don't configure it.

You now have a coding agent that can read your Switch Trust workspace.

## If the server doesn't connect

The server starts even when its configuration is wrong. It reports the problem as an error the first time your coding agent calls a tool. Find what you see below.

| What you see | What it means | What to do |
| - | - | - |
| The `switch-trust-mcp` tools don't appear at all | Your client couldn't start `uvx` | Check that uv is installed and on the `PATH` your client sees, then restart the client. |
| An error starting `No API key set` | `SWITCH_TRUST_API_KEY` is missing from the `env` block for the server | Add it and reload the server. |
| An error starting `No valid instance URL set` | `SWITCH_TRUST_INSTANCE` is missing, doesn't start with `https://`, isn't on `switchagents.ai`, or has a path, query, or fragment after the address | Use only the address you open Switch Trust at, such as `https://app.switchagents.ai`. |
| An error that includes `API key invalid, revoked, or expired` | Switch Trust rejected the API key | Check that the key is active on the **API keys** page, or create a new one. |
| An error starting `Could not resolve tenant_id/active_workspace_id` | The organization behind the key isn't fully set up | Contact your Switch Trust administrator. |

## Next steps

> [card] [Optimize agents](https://docs.switchagents.ai/switch-trust/mcp/index.md)
>
> Find what's driving the cost of an agent, change it, and prove quality and safety held

> [card] [MCP tools](https://docs.switchagents.ai/switch-trust/mcp/tools.md)
>
> Every tool the server offers and what it returns
