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

> ## Agent Instructions
> These are the docs for Sevalla, a platform for deploying applications, databases, static sites, object storage and load balancers. The dashboard is at https://app.sevalla.com.
> Bold text in steps is an exact dashboard label.
> To act on a Sevalla account, prefer the Sevalla MCP server (https://mcp.sevalla.com/mcp, see https://docs.sevalla.com/ai-agents/overview.md), then the Sevalla CLI (https://docs.sevalla.com/developer-tools/cli.md), then the REST API (https://api-docs.sevalla.com, OpenAPI spec at https://api.sevalla.com/v3/openapi.json).
> Every page index is at https://docs.sevalla.com/llms.txt.

# OpenCode

> Connect OpenCode to the Sevalla MCP server in opencode.json, sign in with OAuth or an API key, check the connection, and remove it.

OpenCode connects to the [Sevalla MCP server](/ai-agents/overview) at `https://mcp.sevalla.com/mcp` as a remote server. Once connected, OpenCode can deploy, read logs and metrics, and manage your Sevalla services from the same session.

## Before you begin

* A Sevalla account and a company to work in.
* OpenCode installed. See the [OpenCode MCP docs](https://opencode.ai/docs/mcp-servers) for its own options.

## Add the server

<Steps>
  <Step title="Add Sevalla">
    Add Sevalla under `mcp` in `~/.config/opencode/opencode.json` (all projects) or in `opencode.json` at the root of a project (that project only):

    ```json ~/.config/opencode/opencode.json theme={null}
    {
      "$schema": "https://opencode.ai/config.json",
      "mcp": {
        "sevalla": {
          "type": "remote",
          "url": "https://mcp.sevalla.com/mcp",
          "enabled": true
        }
      }
    }
    ```

    OpenCode merges both files. When they set the same key, the project file wins.
  </Step>

  <Step title="Sign in">
    Run:

    ```bash theme={null}
    opencode mcp auth sevalla
    ```

    Your browser opens the Sevalla dashboard: pick the company and the permissions, then click **Authorize** ([what each choice means](/ai-agents/overview#sign-in-with-oauth)). OpenCode stores the token in `~/.local/share/opencode/mcp-auth.json`.
  </Step>
</Steps>

## Check the connection

Run `opencode mcp list` to see `sevalla` and its status, and `opencode mcp auth list` to see whether it's signed in. Start OpenCode and ask "List my Sevalla services".

## Use an API key instead

To skip OAuth, turn it off for the server and send an [API key](/developer-tools/api-keys) in a header. `{env:SEVALLA_API_KEY}` reads the key from an environment variable, so the file holds no secret:

```json ~/.config/opencode/opencode.json theme={null}
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "sevalla": {
      "type": "remote",
      "url": "https://mcp.sevalla.com/mcp",
      "oauth": false,
      "headers": {
        "Authorization": "Bearer {env:SEVALLA_API_KEY}"
      }
    }
  }
}
```

## Remove the server

Sign out, then delete the `sevalla` entry from `opencode.json`:

```bash theme={null}
opencode mcp logout sevalla
```

To keep the entry but stop OpenCode from using it, set `"enabled": false`.

Removing the server doesn't delete the API key that sign-in created. To revoke it, [delete the key](/developer-tools/api-keys#delete-an-api-key) under **Tools** > **API keys**.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.