- HTML 77.8%
- Go 17.6%
- TypeScript 4.6%
| frontend/pages | ||
| frontend_assets | ||
| mcp_templates | ||
| .gitignore | ||
| bootstrap.go | ||
| bootstrap_runtime.go | ||
| bootstrap_test.go | ||
| COPYRIGHT | ||
| go.mod | ||
| go.sum | ||
| host.go | ||
| host_test.go | ||
| integration.frontend.json | ||
| LICENSE | ||
| mcp_call_test.go | ||
| mcp_client.go | ||
| mcp_integration.go | ||
| mcp_oauth_test.go | ||
| mcp_registry.go | ||
| mcp_registry_test.go | ||
| mcp_templates.go | ||
| models.go | ||
| NOTICE | ||
| README.md | ||
MCP Integration
The MCP integration lets each user register one or more remote MCP servers and use discovered MCP tools in bot chats.
What it provides
- MCP server CRUD APIs (
/api/v1/integrations/mcp/servers...) - MCP template library API (
/api/v1/integrations/mcp/templates) - OAuth/token connect flow for supported servers
- Tool discovery and namespaced tool snapshots (
mcp:<integration>:<tool>) - Frontend pages for server management under
/integrations/mcp/servers - Frontend template catalog under
/integrations/mcp/templates
Built-in templates
- Figma MCP (hosted OAuth2)
- Playwright MCP (local no-auth)
- Google Workspace Drive MCP (hosted OAuth2, Docs/Drive read access)
Template-driven auth fields
- OAuth templates can provide
config.auth.connect_fieldsto define UI input fields. - The MCP servers page renders these fields dynamically in the connect dialog.
- If
connect_fieldsis missing, the UI falls back to generic OAuth defaults (client_id,client_secret,redirect_uri).
OAuth redirects and token caching
- The OAuth
redirect_urifollows the server host: an empty or loopback (localhost/127.0.0.1)config.auth.redirect_uriis replaced atauth/startwith<public-base-url>/callback, where the public base URL isPUBLIC_BASE_URLwhen set and otherwise derived from the request'sX-Forwarded-Host/Host+ scheme. A non-loopbackredirect_uriis honoured as-is, so deployments can register a custom callback path. - For providers that support dynamic client registration (eg the hosted Figma
MCP),
client_id/client_secretmay be left empty; a client is registered on first connect and the credentials are persisted with the token so later refreshes work. - Completed credentials (including
refresh_token/expires_in) are cached on the owner-scoped server row (auth_data). When an access token is at/near expiry and arefresh_tokenis present, the integration transparently refreshes and re-persists it during status/discovery and whenever an owner's servers are resolved (eg by the opencode integration), so a previously authorized server keeps working without re-authenticating.
Typical usage
- Open
/integrations/mcp/servers - Add a server with HTTPS URL and transport config
- Connect auth if required
- Discover tools
- Attach integration names in bot config
default_shared_config.integrations
Once attached, discovered tools are merged into the bot tool list.
Bootstrap from open-chat config
MCP servers can be pre-registered at startup so they are usable immediately, without adding them through the UI first. Two equivalent surfaces feed the same idempotent bootstrap implementation:
- backend-level
bootstrap.mcp(owners/owner+servers), and - integration-owned
integrations.mcp.bootstrap_servers/integrations.mcp.bootstrap_default_owners(mapped toOCI_MCP_BOOTSTRAP_SERVERS/OCI_MCP_BOOTSTRAP_DEFAULT_OWNERS).
Every field except name is optional. A built-in template id (template)
supplies the base config, and config is deep-merged on top of it, so an
operator only overrides what they need (typically auth.client_id /
auth.client_secret / auth.redirect_uri). auth.client_id and
auth.client_secret stay optional; OAuth endpoints are filled from the
template or inferred for known hosts.
Existing rows are left untouched on restart unless overwrite: true is set,
which preserves UI-managed configuration and completed OAuth tokens. Optional
auth_data can pre-seed tokens (bearer_token or access_token) and
enabled defaults to true.
bootstrap:
mcp:
owners: [admin]
servers:
- name: google-drive
template: google_workspace_drive
config:
auth:
client_id: "$anchors.google_client_id"
client_secret: "$anchors.google_client_secret"
redirect_uri: "https://chat.example.com/callback"
- name: google-sheets
template: google_workspace_sheets
config:
auth:
client_id: "$anchors.google_client_id"
client_secret: "$anchors.google_client_secret"
anchors:
google_client_id: "123-abc.apps.googleusercontent.com"
google_client_secret: "GOCSPX-..."
The same servers can be declared integration-owned instead:
integrations:
mcp:
bootstrap_default_owners: "admin"
bootstrap_servers:
- name: google-drive
template: google_workspace_drive
config:
auth: { client_id: "...", client_secret: "..." }