Skip to content

MCP

Register remote MCP client servers so Harbor's chat agent can discover and call tools from external MCP endpoints over Streamable HTTP or legacy SSE.

Requires the mcp permission. Registrations are activation-scoped: Harbor connects while the plugin is enabled and removes them when you dispose the returned handle or the plugin unloads. Plugin-owned servers appear as read-only rows in Settings → AI & MCP with plugin attribution; they are not copied into user MCP settings.

hc.mcp.registerServer(config)

Available since v2.0.0

Signature:(config: PluginMcpServerConfig) => Disposable

ParameterTypeDescription
namestringDisplay name in Settings → AI & MCP
serverURLstringAbsolute HTTP or HTTPS MCP endpoint URL
enabledboolean` (optional)When false, Harbor skips connecting. Defaults to `true
headersPluginMcpHeader[]Optional HTTP headers sent with MCP client requests
iconstring` (optional)Optional square icon as a data:image/...;base64,... URI for settings rows

Discovered tools are prefixed with mcp__ in the chat agent tool list, using the same naming scheme as user-configured MCP client servers.

typescript
hc.mcp.registerServer({
  name: 'WordPress',
  icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==',
  serverURL: 'https://public-api.wordpress.com/wpcom/v2/mcp/v1',
  enabled: true,
  headers: [{ key: 'Authorization', value: 'Bearer token' }]
});