Skip to content

MCP OAuth: No way to configure callback port, breaking Slack MCP and other services with fixed redirect URIs #18955

@dulaj-me

Description

@dulaj-me

Description

OpenCode's remote MCP OAuth config (McpOAuthConfig) only supports clientId, clientSecret, and scope. There's no way to set a callbackPort or redirectUri.
OpenCode uses a random port for the OAuth callback (e.g. http://127.0.0.1:19876/mcp/oauth/callback), but services like Slack MCP (https://mcp.slack.com/mcp) require the redirect URI to exactly match a pre-registered URI. Since the port changes every time, auth always fails with:

redirect_uri did not match any configured URIs
This makes it impossible to use Slack MCP (and likely any remote MCP server that validates redirect URIs against a fixed allowlist).
Claude Code solves this by pinning the callback to port 3118 via a callbackPort config option.

Plugins

No response

OpenCode version

1.3.0

Steps to reproduce

  1. Add Slack MCP to opencode.json:
    "slack": {
    "type": "remote",
    "url": "https://mcp.slack.com/mcp",
    "oauth": {
    "clientId": "1601185624273.8899143856786"
    }
    }
  2. Run opencode mcp auth slack
  3. Browser opens Slack OAuth page
  4. Slack rejects with: redirect_uri did not match any configured URIs. Passed URI: http://127.0.0.1:<random_port>/mcp/oauth/callback

Expected: A callbackPort (or redirectUri) option in McpOAuthConfig so the callback port can be pinned, matching the registered redirect URI.

Screenshot and/or share link

Image

Operating System

macOS 26.3.1 (a)

Terminal

Ghostty

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions