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

# Claude Code

> Connect StackOne MCP to Claude Code using built-in MCP commands.

## Overview

[Claude Code](https://code.claude.com/) is Anthropic's CLI for developers. It provides built-in commands for managing MCP servers.

<Info>
  For complete Claude Code MCP documentation, see the [official MCP guide](https://code.claude.com/docs/en/mcp).
</Info>

## Setup

<Tip>
  The fastest way to get your configuration is directly from the StackOne dashboard — it generates a ready-to-paste `claude mcp add` command.
</Tip>

<Steps>
  <Step title="Get your MCP URL from the dashboard">
    1. Go to **Connectors** in the left nav and open the connector you want to use
    2. Click **Use in Agent** in the top right
    3. On the **Use** tab, click **MCP Server** under "Use with Agent Client"
    4. Select a linked account from the dropdown
    5. Choose **Claude Code** as the client
    6. Copy the generated command

    The command uses a single token URL — no API key encoding required.

    <Tip>
      The token expires after one year. Regenerate it at any time using the refresh button in the MCP tile.
    </Tip>
  </Step>

  <Step title="Add StackOne MCP Server">
    Run the command from the dashboard in your terminal. It looks like this:

    ```bash theme={null}
    claude mcp add \
      --transport http \
      gsheets \
      "https://api.stackone.com/mcp?token={session_token}"
    ```

    <Tip>
      Use short names for easier CLI usage: `gsheets`, `slack`, `hubspot-sales`. You can prefix with `stackone-` or `s1-` if you have other MCP servers, but it's not required.
    </Tip>

    <Accordion title="Alternative: Manual API key setup">
      If you prefer to use your API key and account ID directly, set your encoded API key as an environment variable first:

      <Tabs>
        <Tab title="macOS / Linux">
          ```bash theme={null}
          export STACKONE_AUTH_TOKEN=$(echo -n "{stackone_api_key}:" | base64)
          ```
        </Tab>

        <Tab title="Windows (PowerShell)">
          ```powershell theme={null}
          $env:STACKONE_AUTH_TOKEN = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("{stackone_api_key}:"))
          ```
        </Tab>
      </Tabs>

      Then add the server:

      ```bash theme={null}
      claude mcp add \
        --transport http \
        --header "Authorization: Basic $STACKONE_AUTH_TOKEN" \
        gsheets \
        "https://api.stackone.com/mcp?x-account-id={account_id}"
      ```
    </Accordion>
  </Step>

  <Step title="Verify Connection">
    Check the server status:

    ```bash theme={null}
    claude mcp list
    ```

    <Frame caption="Screenshots show 'stackone-' prefix — this is optional.">
      <img src="https://mintcdn.com/stackone-60/77sEEdKO-IR2XOp6/images/mcp/claude-code-mcp-list.png?fit=max&auto=format&n=77sEEdKO-IR2XOp6&q=85&s=4bc371fc35be224f126d66e30de76659" alt="claude mcp list output showing multiple connected MCP servers" width="1079" height="181" data-path="images/mcp/claude-code-mcp-list.png" />
    </Frame>

    Within a Claude Code session, use the `/mcp` command to view server details and available tools:

    <Frame>
      <img src="https://mintcdn.com/stackone-60/77sEEdKO-IR2XOp6/images/mcp/claude-code-mcp-server-details.png?fit=max&auto=format&n=77sEEdKO-IR2XOp6&q=85&s=1423f74c2f8d1ae3d90101f521a5a6fd" alt="Claude Code /mcp command showing server details including status, URL, capabilities and tool count" width="1654" height="556" data-path="images/mcp/claude-code-mcp-server-details.png" />
    </Frame>

    Select "View tools" to browse available operations:

    <Frame>
      <img src="https://mintcdn.com/stackone-60/77sEEdKO-IR2XOp6/images/mcp/claude-code-mcp-tools.png?fit=max&auto=format&n=77sEEdKO-IR2XOp6&q=85&s=d93dba2b3e2786c6a081d1dc2d7981e8" alt="Claude Code /mcp command showing list of available tools for googlesheets server" width="1334" height="396" data-path="images/mcp/claude-code-mcp-tools.png" />
    </Frame>
  </Step>
</Steps>

## Adding multiple accounts

Get a separate token for each account from the dashboard, then add them as distinct servers:

```bash theme={null}
# Google Sheets account
claude mcp add \
  --transport http \
  gsheets \
  "https://api.stackone.com/mcp?token={google_sheets_session_token}"

# Slack account
claude mcp add \
  --transport http \
  slack \
  "https://api.stackone.com/mcp?token={slack_session_token}"
```

## Scope options

Control where the configuration is stored:

| Scope   | Flag              | Storage Location                    | Use Case                                |
| ------- | ----------------- | ----------------------------------- | --------------------------------------- |
| Local   | (default)         | `.claude.json` in current directory | Project-specific                        |
| Project | `--scope project` | `.mcp.json` at project root         | Team collaboration (version controlled) |
| User    | `--scope user`    | `~/.claude.json`                    | Personal tools across all projects      |

**Example with user scope** (available across all projects):

```bash theme={null}
claude mcp add \
  --transport http \
  --scope user \
  gsheets \
  "https://api.stackone.com/mcp?token={session_token}"
```

## Management commands

```bash theme={null}
claude mcp list                           # View all configured servers
claude mcp get gsheets     # Show details for specific server
claude mcp remove gsheets  # Remove a server
```

## Programmatic integration

For programmatic integration with Anthropic's Claude API, see the [Anthropic SDK Framework Guide](/embed/call-actions/mcp/anthropic-sdk).

## Handling large tool catalogs

If the connector exposes many actions, add the `tool-mode=search_execute` query parameter to the MCP URL in your config. The client then registers just two tools — search + execute — and the agent discovers actions at runtime, so the context footprint stays flat however large the catalog:

```
https://api.stackone.com/mcp?tool-mode=search_execute
```

For a token URL, append it as an extra parameter: `https://api.stackone.com/mcp?token=<session_token>&tool-mode=search_execute`.

See [Tool Discovery](/features/tool-discovery) for how search works, its accuracy, and the other modes.

For example, with API-key auth:

```bash theme={null}
BASE64_KEY=$(echo -n 'YOUR_STACKONE_API_KEY:' | base64 | tr -d '\n')

claude mcp add stackone-bamboohr -- npx -y mcp-remote@latest \
  "https://api.stackone.com/mcp?tool-mode=search_execute" \
  --header "Authorization: Basic $BASE64_KEY" \
  --header "x-account-id: YOUR_ACCOUNT_ID"
```

## Optimize and secure

With your agent connected, use StackOne's platform features to optimize performance and secure every call.

<CardGroup cols={3}>
  <Card title="Search & Execute" icon="magnifying-glass" href="/optimize/search-and-execute">
    Reduce context and save tokens.
  </Card>

  <Card title="Data Sync" icon="arrows-rotate" href="/optimize/data-sync">
    Reduce latency and enable semantic search.
  </Card>

  <Card title="Defender" icon="shield-halved" href="/secure/defender">
    Block prompt injections before they reach your agent.
  </Card>
</CardGroup>
