# Connect OpenCode

OpenCode: The full authenticated connector.

Where it runs: OpenCode in the terminal.

## Add the connector

1. Add the server to opencode.json (project) or ~/.config/opencode/opencode.json. A remote server is `type: "remote"`; OpenCode handles the sign-in on its own:

`opencode.json`:

```json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "sleeperhit": {
      "type": "remote",
      "url": "https://sleeperhit.studio/mcp"
    }
  }
}
```
2. Sign in. OpenCode asks the first time a tool is used; to sign in up front, run:

```text
opencode mcp auth sleeperhit
```
3. Running OpenCode where a browser sign-in cannot finish? Use an API key from Dashboard → Developers instead, and turn the sign-in off for this server:

`opencode.json`:

```json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "sleeperhit": {
      "type": "remote",
      "url": "https://sleeperhit.studio/mcp",
      "oauth": false,
      "headers": { "Authorization": "Bearer {env:SLEEPERHIT_API_KEY}" }
    }
  }
}
```

## Signing in

On a 401, OpenCode reads the server's OAuth metadata, registers itself, and opens the Sleeper Hit sign-in in your browser. Tokens are kept in ~/.local/share/opencode/mcp-auth.json.

The connector itself needs no API key. A brand-new account is confirmed once at signup (18 or older, Terms and Privacy accepted); see [Any other client](connect-any.md) for what a generic client must support.

## Good to know

- The browser sign-in hands back to OpenCode on this computer; on a remote machine or in a container, use the API-key config instead.

## Sources for these steps

- https://opencode.ai/docs/mcp-servers

The connector URL on this page is the production one; stage members can use `https://stage.sleeperhit.studio/mcp` the same way. The same steps, plus every other MCP client, are on the [connector page](/mcp) on the app host.