# Connect Claude Code to Onsite

> Add Onsite to Claude Code with one command, sign in from the terminal, and ask about your sites while you work.

Add Onsite to Claude Code with one command. It's then available in every project on your computer.

## Before you start

- An Onsite account on a team with an active plan.
- Claude Code installed and signed in.

## Add Onsite

<Steps>
  <Step title="Add the server">
    In a terminal, run:

    ```bash
    claude mcp add --scope user --transport http onsite https://onsite.so/mcp
    ```

    `--scope user` makes Onsite available in all your projects. Leave it out to add Onsite to the current project only.
  </Step>
  <Step title="Sign in to Onsite">
    Start Claude Code, type `/mcp`, choose **onsite**, and select **Authenticate**. Onsite opens in your browser.

    If no browser opens, run this instead and open the link it prints:

    ```bash
    claude mcp login onsite --no-browser
    ```
  </Step>
  <Step title="Choose a team and allow access">
    Sign in with Google, or with a code sent to your email. If you're on more than one team, pick the one Claude Code should use, then select **Allow**.
  </Step>
</Steps>

<Tip>
  In Onsite, [**Settings › MCP**](https://onsite.so/settings/mcp) has this command ready to copy: choose **Claude Code** and select **Copy command**.
</Tip>

## Check it worked

Run `claude mcp list`. Onsite shows as connected. Then ask in Claude Code:

<Prompt>
  Using Onsite, show me the sites I can access.
</Prompt>

## Use a token instead of signing in

If you can't sign in from this computer, for example on a remote server, use a token. Create one in [**Settings › MCP**](https://onsite.so/settings/mcp) under **Connected apps and tokens**, then run:

```bash
claude mcp add --transport http onsite https://onsite.so/mcp \
  --header "Authorization: Bearer <your-onsite-token>"
```

A token lasts 90 days. Keep it private, and revoke it in **Settings › MCP** when you no longer need it.

## If something goes wrong

<AccordionGroup>
  <Accordion title="claude mcp list shows Needs authentication">
    You added Onsite but haven't signed in yet. Type `/mcp` in Claude Code, choose **onsite**, and select **Authenticate**.
  </Accordion>
  <Accordion title="A server called onsite already exists">
    Run `claude mcp get onsite` to see where it points. If it isn't `https://onsite.so/mcp`, remove it with `claude mcp remove onsite` and add it again.
  </Accordion>
  <Accordion title="Claude Code shows the wrong team's sites">
    Each connection uses one team. Run `claude mcp logout onsite`, then sign in again and pick the other team. See [Manage connections](/mcp/manage-connections#switch-to-another-team).
  </Accordion>
  <Accordion title="It worked before and now it doesn't">
    A connection lasts 90 days, and stops if you revoke it or leave the team. Sign in again with `/mcp`. See [Troubleshooting](/mcp/troubleshooting).
  </Accordion>
</AccordionGroup>

## Related

<CardGroup cols={2}>
  <Card title="What you can ask" icon="lightbulb" href="/mcp/ask">
    Example questions to try next.
  </Card>
  <Card title="Manage connections" icon="key-round" href="/mcp/manage-connections">
    Tokens, teams and disconnecting.
  </Card>
</CardGroup>
