# Ticket 5.8 — MCP (Model Context Protocol) Support

**Phase**: 5 — OpenCode-Specific Features
**Priority**: Low
**Depends on**: 1.4

## Description

Expose OpenCode's MCP server management through the relay UI. MCP allows connecting external tools and knowledge sources. The UI should show connected MCP servers and allow managing them.

## Acceptance Criteria

### AC1: Display connected MCP servers

```gherkin
Given OpenCode has MCP servers configured
When the user opens the settings/tools panel
Then it lists all connected MCP servers
And each shows: name, status (connected/disconnected), tool count
```

### AC2: MCP server details

```gherkin
Given an MCP server "code-analysis" is connected
When the user clicks on it
Then it shows:
  - Server name and URL
  - Available tools provided by this server
  - Connection status and uptime
```

### AC3: MCP OAuth flow support

```gherkin
Given an MCP server requires OAuth authentication
When the user initiates connection
Then the relay opens the OAuth flow in a new window
And on success, the server appears as connected
```

## Testable Components

| Component | Test Type | What to Assert |
|-----------|-----------|----------------|
| MCP list parsing | Unit | Parses /mcp/ response into server list with status |
| Server list rendering | E2E | All MCP servers shown with connection status |
| Server details | E2E | Clicking server shows tools and connection info |
| OAuth flow | E2E | Auth button opens auth window, callback completes connection |

## Reference

- OpenCode MCP: `../opencode/packages/opencode/src/mcp/`
- OpenCode MCP API: `/mcp/*` routes in server.ts
