External account linking for messaging users
Status: available as a broker contract and explicit DM commands. A provider must implement this contract before users can link accounts. Linking alone does not authorize tool queries; a provider opts into linked-user queries separately. Formation owns verified messaging identity and delivery. The application owns login, consent, account/workspace selection, link custody and revocation. An application-specific workspace is opaque to Formation. This contract can be implemented by any operator; no particular application is built into the runtime.Configure an agent’s MCP connection
The operator API accepts session or operator-token authentication and enforces access to the owning agent, like the existing MCP routes:GET /api/agents/{slug}/mcp/providers/{provider}/account-linkingPUT /api/agents/{slug}/mcp/providers/{provider}/account-linkingDELETE /api/agents/{slug}/mcp/providers/{provider}/account-linking
version is the current MCP connection version from the provider list. A mutation
increments that version; reload the list before another mutation. A stale version
returns 409. DELETE accepts { "version": 8 }. GET and mutation responses contain
account_linking: { endpoint, credential_present }, or null when absent, never
the token. Omitting the token preserves it only at the same endpoint. Changing
endpoint requires an explicitly supplied token. Configuration is API-only in this
iteration; the settings UI does not yet expose a broker editor.
Tokens are 32–256 non-space printable ASCII characters, authenticate one agent,
and are encrypted in the existing agent-owned secrets store, including master-key
rotation support. Never reuse a token to identify multiple agents. The application
must bind its token to permitted agent and MCP connection identities. Removing the
MCP connection removes the local broker configuration and its credential; the
provider remains responsible for expiring/revoking external links and sessions.
DM interaction
/connectionslists this agent’s enabled connections with account linking./connectopens sign-in or shows the active connection. Disconnect it before linking a different workspace./connectionchecks the current link./disconnectasks for confirmation before revoking access. The confirmation names the provider so a change to the configured connections cannot redirect it.
Broker protocol v1
Formation POSTs JSON to the exact configured public HTTPS endpoint, withAuthorization: Bearer <agent broker token>. It refuses redirects, private IPs,
ambient proxy credentials and non-HTTPS destinations. Requests time out after
20 seconds; JSON responses are bounded to 16 KiB. Upstream errors/bodies are not
shown to users or models.
start, status, disconnect. No message body, display name, email,
service URL, application user credential or model-selected identity is sent.
The request ID hashes the versioned action and complete source/connection context
and stays stable on recovery. Brokers must enforce idempotency across replicas
and retries: a repeated start cannot create another independent session; a replayed
disconnect cannot revoke a subsequent link. Retain mutation idempotency records
for at least as long as the deployment can retry/recover a run. If a recovered
start’s session has expired, return expired rather than silently mint another one.
A fresh human command has a fresh message ID and can start a new operation.
Authenticate the caller before trusting any fields. Match agent_id and
provider_id against the credential’s configured authority. Key external links by
agent, provider, connector installation/namespace/type, tenant and sender. Directory
ID is additional evidence, not an implicit replacement for the sender key. Do not
link by email or display name. Conversation/message context binds the linking
session to its origin; it is not itself proof of application access.
A start response may return:
/connection. There is no public Formation completion callback or
background polling in v1. The broker reports authoritative current status:
status also accepts pending, disconnected or expired. start may return
connected, disconnected or expired without a URL. A broker should return
connected on start if an active link already exists. The optional display
fields describe only the existing link for the verified identity. Provide a
public HTTPS image without redirects for the logo. The runtime does not fetch
it. disconnect succeeds only
with { "state": "disconnected" }, after actual revocation. Other action/state
combinations and unexpected login URLs produce a fixed invalid-response notice.
Only the optional display fields are rendered alongside runtime-owned copy. Connection notices never claim
the link grants data-query access.
Boundary with OAuth, memory and tool execution
Existing MCP OAuth connects an agent-owned acting account. This broker flow links a messaging user to additional application permission restrictions. It neither overwrites the MCP credential with a human token nor merges Formation actors/private-memory identities. No application identity mapping enters prompts. Login URLs are ordinary retained outbound DM content, not tool authority; never interpret historical notices or copied URLs as current connection status. Read delegated MCP contract separately. The existing generic-connector execution checks remain unchanged. The optional execution extension binds each tool execution to verified sender, application user, selected scope, conversation and command/run, enforces live membership/revocation, and retains restricted evidence. Account linking alone must never fall back to agent-wide human data authority. Shared-conversation disclosure policy requires its own design and acceptance.Delegated tool execution is a separate capability
Providers can opt into the linked messaging execution extension described in delegated MCP queries. Account linking alone does not authorize data queries: the provider must implement identity proof, credential custody and live user/workspace permission checks. Tools without the extension continue to refuse messaging execution promptly as an unsupported context.Broker admission lanes
Formation sendsX-Formation-Account-Link-Action with the same action as the JSON
body (start, status, disconnect or version-2 authorize-query). Brokers can
use this authenticated request hint to budget work before reading a bounded body,
reserving a separate lane for disconnect. Validate that the header matches the
parsed action; the header is not an authorization grant. Existing brokers may
ignore it. A broker accepting older runtimes without the header should document
its legacy admission budget and cannot promise query-independent revocation
capacity on that shared lane.