# OpenCode Setup

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

OpenCode supports remote MCP server configuration and OAuth. It can prompt for OAuth automatically when the server is first used.

Core MCP server URL:

```text
https://core.gradien.ai/mcp
```

## Recommended Setup

Run the guided installer:

```bash
npx -y @gradien/core-agent-setup install --base-url https://core.gradien.ai --yes --harness opencode
```

Prefer remote MCP plus OAuth. Do not paste long-lived connector keys into OpenCode config unless OAuth is impossible and you intentionally choose that fallback.

## Verify

Check the configured MCP servers:

```bash
opencode mcp list
```

If Core is unauthenticated, stale, or unable to load tools, start the OAuth flow:

```bash
opencode mcp auth core
```

If `opencode mcp auth core` says Core already has valid credentials, do not re-authenticate unless you intentionally want to replace those credentials. Continue with:

```bash
opencode mcp debug core
```

If OpenCode still reports `needs_auth` after valid credentials, use one clean reset:

```bash
opencode mcp logout core
opencode mcp auth core
```

Then restart OpenCode or start a fresh OpenCode session.
