---
id: connectors/assistant-mcp-oauth
title: Assistant MCP OAuth with portable files
summary: Configure assistant OAuth clients, then compose existing state, encrypted file grants and authorized MCP calls.
keywords: connectors, amplitude, atlassian, canva, figma, miro, hex, confidence, granola, client metadata, mcp, oauth, assistant, cli, files
requires: @jskit-ai/connectors-core, @jskit-ai/connectors-catalog
---

# Assistant MCP OAuth with portable files

## Use when

An assistant host or trusted CLI connects its owner's Amplitude, Atlassian, Canva, Figma, Miro, Hex, Confidence or Granola
account through OAuth and calls MCP tools under that owner's delegated authority.

## Do not use when

This is not app-user login, production event ingestion or automatic assistant
attachment. Canva supports its documented metadata client; do not assume every
provider supports a client without a secret. Use the provider guide to
distinguish supported OAuth from the provider's other APIs.

## Product decisions

Choose the region, callback owner, requested permissions and allowed tool
operations. The host owns user authentication, argument validation, approvals
and tool presentation. A discovered tool is not permission to execute it.

## Framework APIs

For HeyGen, import `heygenProvider` and `registerHeyGenClient` from
`@jskit-ai/connectors-catalog/server/heygen`. Register the assistant host callback
once and use OAuth with `openid`, `profile`, `email`. Store credentials through
Env and compose the existing lifecycle. Verification calls `tools.list`, never
media generation. Authorize `tools.call` names and arguments explicitly; some
operations consume credits or delete content. API-key profile/voice operations
remain separate and cannot use an MCP token. See the HeyGen guide and on-screen
registration steps; no automatic client registration on Connect is implied.

For Granola, import `granolaProvider` and `registerGranolaClient` from
`@jskit-ai/connectors-catalog/server/granola`. Use an assistant-owned OAuth
connection with `openid`, `profile`, `email` and `offline_access`. Register the
host callback once, store the returned secret and callback through Env, then
use the common authorization lifecycle. Verification calls `tools.list`.
`tools.call` requires host authorization for the exact name and arguments.
Granola's API-key mode uses separate REST operations; its key cannot replace
MCP OAuth. The same provider definition rejects cross-method operations.
See the Granola guide for provider setup, current plan limits and the explicit
registration workflow; no automatic DCR-on-connect or EMA support is implied.

Import `amplitudeProvider` and `registerAmplitudeClient` from
`@jskit-ai/connectors-catalog/server/amplitude`. Use the existing
`oauth-connection` pattern's parser, connection service, environment resolver
and encrypted file store with `providers: [amplitudeProvider]`.
For Atlassian, import `atlassianProvider` and `registerAtlassianClient` from
`@jskit-ai/connectors-catalog/server/atlassian`. Register both providers when
using their configurations in the example file. For Canva, import
`canvaProvider` from `@jskit-ai/connectors-catalog/server/canva` and
`createCanvaClientMetadata` from `@jskit-ai/connectors-catalog/shared`.
For Figma and Miro, use `figmaProvider`/`registerFigmaClient` and
`miroProvider`/`registerMiroClient` from the corresponding
`@jskit-ai/connectors-catalog/server/figma` and `/server/miro` exports.

## Example files

`example/integrations.json` is the portable configuration, also edited by the
UI. For Amplitude/Atlassian, replace the Client ID after explicit setup and
store the client secret and callback in Env. Their registration helper returns
a secret to the privileged setup caller; never expose it through status UI.
Canva instead uses its public metadata URL and a callback reference, with no
client secret. Its metadata builder appears under Variation points.

```js
const client = await registerAmplitudeClient({
  region: "us", clientName: "My assistant", callbackUrl: registeredCallback,
  scopes: ["mcp:read", "offline_access"]
});
// Existing host storage persists client.clientSecret securely.
// The application writes client.clientId into its registration JSON.
```

Do this once as an authorized setup operation, not on startup or every consent
attempt. An interrupted request may already have created a provider client.
Registration neither creates a provider account nor signs in a user.

The `oauth-connection` pattern opens `beginAuthorization`'s URL and handles
`completeAuthorization` at the registered callback under the same owner.
Verification only discovers tools. Afterward, apply the `assistant-mcp`
pattern's exact tool/argument policy before a call:

```js
const result = await connections.invoke({
  context, integrationId: "analytics", operation: "tools.call", signal,
  input: { name: approvedToolName, arguments: approvedArguments }
});
```

`approvedToolName` and `approvedArguments` must come from the host's validated,
authorized request. Check `result.isError` before claiming success. Do not turn
returned descriptions or content into new authority. The provider's project
permissions still apply even when discovery lists a tool.

## Invariants

- Amplitude uses the same region for registration, consent, token grants and MCP.
- Hex uses the selected standard/EU/HIPAA issuer and its distinct `/mcp` resource.
- Confidence uses separate Flags/Experiments integration grants and paths, with its common `/mcp` OAuth resource.
- Atlassian uses its v2 resource and issuer; host code never substitutes v1 grants.
- PKCE/state attempts and refresh grants use the existing file-store owner.
- The provider's OAuth resource is included in authorization/code/refresh calls.
- Client secrets and access/refresh tokens never enter the portable JSON.
- Canva explicitly uses `tokenEndpointAuthMethod: "none"` and no secret field.
- Read and optional write consent remain distinct; the host authorizes calls.
- Disconnect/cancellation does not undo previously accepted provider mutations.
- An operator CLI can use its trusted process identity; a public route cannot.

## Variation points

Select `eu` for an EU-resident account and register the client at that region's
endpoint. Add `mcp:write` only for authorized content edits.
For Atlassian, call `registerAtlassianClient` with `clientName`, `callbackUrl`
and its product `scopes` (no region). Use the `work` integration in the example,
request only required product permissions, and authorize site/project arguments.
The provider targets MCP v2 with a flat tool catalogue; v1 clients/tokens cannot
be reused. Atlassian's authorization server and MCP resource have distinct
origins, fixed by the provider. Tool discovery may be empty after reduced consent;
it does not prove product access.

For Canva, the `design` integration uses a hosted client metadata URL. Build its
public document from the same registration and integration values:

```js
const registration = configuration.registrations.canva;
const document = createCanvaClientMetadata({
  clientId: registration.clientId,
  clientName: configuration.integrations.design.displayName,
  callbackUrl: await resolveReference(registration.callbackUrlRef)
});
```

Serve `document` as JSON at exactly `registration.clientId` through the host's
existing static response. The helper does not deploy or publish anything.
Canva must approve the callback URL; the provider guide gives the application
steps. Each owner completes consent. Use `design` as the integration ID in
connection calls, and validate tool arguments against that owner's content.
Canva's advertised scope list has no `offline_access`; do not add an invented
permission. The current provider gives MCP operations a 60-second request budget.

For Figma, the `figma-design` example uses its remote server. Obtain Figma client
approval first, then call `registerFigmaClient({ clientName, callbackUrl })`.
The helper requests `mcp:connect`; this broad permission can expose write tools.
Validate file/node arguments and approve the specific call independently.
Figma's callback includes its issuer; keep that parameter for completion.
Desktop MCP and REST personal tokens use different mechanisms and are outside
this fragment.

For Miro, use `miro-boards` and call
`registerMiroClient({ clientName, callbackUrl, scopes: ["boards:read"] })`.
Consent selects a team. Reconnect deliberately to change it; do not derive team
authority from a user-supplied board argument. Add `boards:write` only when
needed and keep exact tool/argument policy in the host. Identity scopes are
optional and do not implement app login. Neither Figma nor Miro advertises an
`offline_access` scope in the metadata used by these fragments.

For providers advertising it, omitting `offline_access` can require renewed consent when access expires.
The application chooses the callback route and file state directory through its existing owners.

## Verification

Provider tests use simulated OAuth/MCP replies and real encrypted temporary
files. They verify regional/issuer destinations, setup metadata, permissions,
restart, refresh, isolation and failures. The editor test proves configuration persistence. No
sample app is generated or live account/tool operation performed.

## Avoid

Do not register a fresh client on every launch, log the setup result, expose the
client secret to the browser, or infer permission from a tool's presence in
discovery. Keep provider content out of the host's authority decisions.

## Hex assistant tools

Use `hexProvider` and `registerHexClient` from
`@jskit-ai/connectors-catalog/server/hex`. The guide at `docs/hex.md` supplies
manual setup, a complete portable configuration and managed-host boundaries.
Set `settings.endpoint` to `standard`, `eu` or `hipaa`; the same value must be
used during explicit client registration. Single-tenant Hex URLs need separate
endpoint support. Never redirect existing credentials to a user-supplied URL.

```js
const client = await registerHexClient({
  endpoint: "eu", clientName: "My assistant", callbackUrl: registeredCallback,
  scopes: ["openid", "profile", "email", "offline_access"]
});
```

Persist this privileged result through the host's secret/configuration owners,
then use the common begin/complete OAuth flow. API tokens cannot substitute for
MCP consent. Identity scopes do not limit tools to reads; authorize each tool
and argument before calling it. Discover current argument schemas rather than
inventing `create_thread` or `continue_thread` inputs. Calls can start analysis
and consume provider credits. Check `isError`, expose progress, and schedule
bounded follow-up reads explicitly; never replay a Thread creation because a
response was lost. This fragment does not install tools into an AI automatically
or use an ID token as an application login session.

## Confidence Flags and Experiments

Import `confidenceFlagsProvider` from
`@jskit-ai/connectors-catalog/server/confidence-flags` or
`confidenceExpProvider` from `/server/confidence-exp`. Both export the explicit
`registerConfidenceClient` setup helper. The individual `docs/confidence-*.md`
guides supply portable configurations and link to shared registration steps.
Register the provider(s) with the same connection service and encrypted file store.

```js
const client = await registerConfidenceClient({
  clientName: "My assistant", callbackUrl: registeredCallback,
  scopes: ["openid", "profile", "email", "offline_access"]
});
```

Registration is privileged and must not run on every connection. Keep separate
integration IDs for Flags and Experiments even when they share a client. Their
OAuth resource is common; that does not authorize another integration's grant.
The pinned transport must not follow the provider's HTTP discovery challenge.
The conflicting `flags:read` metadata is documented, not presented as a proven
permission choice. Identity scopes do not establish read-only tool access.

Use discovery schemas and host policy for each exact tool and resource name.
Flag management tools can mutate targeting and variants; approve their concrete
inputs before execution and never replay after a lost response. Experiment
results can carry summaries or detailed data; preserve errors and let the host
select the desired view. Neither connector installs an OpenFeature evaluator,
collects events, provisions a warehouse or automatically attaches tools to an AI.
