Skip to main content
OAO can expose a restricted set of tools from a remote Model Context Protocol (MCP) server to a managed agent. The integration is provider-neutral: server, credential, policy, and toolset records do not contain LangSmith-specific behavior.

Architecture

Flue sees MCP tools as normal durable OAO tools. OAO owns MCP discovery, authorization, credentials, approvals, transport policy, and recovery. The decrypted credential is never added to the prompt, tool arguments, model-visible results, sandbox environment, product events, audit details, or list responses.

Add an MCP server in the console

MCP connections always lists OAO, the project’s own MCP server. It is built in and needs no setup; see Let OAO agents use these tools. For a remote server, open MCP connections and select Add MCP server. Complete every wizard screen in order:
1

Enter the server

Enter a display name, stable lowercase key, HTTPS MCP endpoint, and transport. Choose Streamable HTTP for current MCP servers or Legacy SSE only when the remote server requires it. Select Next.
2

Add authentication and review the policy

Choose Bearer token, API-key header, or OAuth client credentials and enter the write-only secret. For an API-key header, also enter its safe header name. For OAuth client credentials, first discover and confirm the authorization server; see OAuth client credentials. Expand Security policy and limits and confirm the exact HTTPS origin, allowed path prefix, request timeout, and response-size limit. The credential is pinned to that origin and path prefix when it is saved; see Credential destinations. OAO never returns the secret after saving it. Select Next.
3

Connect and discover

Select Test and discover. OAO saves the encrypted credential and immutable server version, connects to the approved destination, and loads its tool schemas.
4

Choose the tools

Select only the tools the agent needs. For each selected tool, choose Always require approval or Run without approval. Use approval-free execution only for a narrowly allowlisted read-only tool. Select Next.
5

Attach it to an agent

To finish the connection without an agent, leave Attach to agent empty. Otherwise choose an agent and confirm its unique tool namespace. The wizard will publish a new immutable agent version containing the binding. Select Finish setup.
6

Verify it

Confirm the connection card reports ready, a discovered-tool count, and at least one restricted toolset. If you attached an agent, create a new session for that agent; existing sessions retain their previous version.
The Connections view lists one card per connection with its endpoint, discovery status, and toolsets. Select Manage on a card to see that connection only:
  • Tools: the discovered tools, and Discover tools with one of its policies.
  • Authentication: each credential policy that covers the endpoint with its credential, and Test (OAuth credentials), Rotate, and Revoke. Add policy adds another policy for an existing credential.
  • Toolsets: this project’s toolsets for the connection, and Create toolset. When creating an immutable toolset, choose whether all selected tools always require approval or may run without approval; use approval-free execution only for narrowly allowlisted, read-only tools.
  • Remove: see Remove a connection.
The wizard creates the server and server version, encrypted credential, exact-origin credential-policy version, and restricted toolset in dependency order. If testing fails after one of them is saved, retrying in the same open wizard continues from the first incomplete resource instead of duplicating it. Closing the wizard never rolls back already-saved resources; manage or remove the connection before starting again with the same key. Secret input is cleared as soon as the credential is encrypted and is never returned to the console.

Remove a connection

Select Manage on a connection card, then Remove. OAO first checks what still uses the connection:
  • An agent still uses it. If the current version of any agent binds its tools, in this project or another project of the organization, removal is refused and the dialog lists those agents (agents in other projects by count). Publish agent versions without the binding, or delete those agents, then remove the connection.
  • Nothing uses it. Removal revokes every version of the server and this project’s toolsets for it. Also revoke its credential and policy, on by default, also revokes the credential policies that cover no other active server and the credentials only those policies use. A credential shared with another connection stays active. A revoked credential cannot be restored; to connect again, enter the secret again.
A removed connection disappears from the console and from every API list, and its keys can be used again, so you can add it back under the same name. Like a deleted agent, its rows are kept: server, toolset, and policy versions are immutable and referenced by sessions, call attempts, and the audit trail. Sessions that were started with it keep running, but their calls to its tools fail. Toolsets for the server in other projects stay with those projects and can no longer be used. A credential revoked on its own also disappears from the lists and frees its key. A credential you keep stays active. While no connection uses it, the Connections view lists it under Credentials not used by any connection, where you can revoke it. Adding the connection back with the setup wizard skips keys a kept credential or policy still holds, for example docs-search-credential-2, and a kept policy for the same endpoint covers the new connection again. Through the API, GET /mcp-servers/{id}/usage returns what uses a server and what removal would revoke, and DELETE /mcp-servers/{id} removes it; add ?keepCredentials=true to keep its credentials and policies. See HTTP API.

Add an MCP server through the API

The API follows the same dependency order as the wizard. The example below uses a static bearer credential and requires curl plus jq. Set OAO_API_URL, OAO_PROJECT_ID, and OAO_API_KEY first.
Replace list_items with a name returned by discovery. Keep toolset_version_id and policy_version_id; the agent-version request needs both. Continue with Connect MCP tools to an agent.
MCP administration requires credential:write, mcp:write, and mcp:discover; reading resources requires mcp:read. Binding the resulting versions to an agent additionally requires mcp:bind.
OAO prefixes bound tools as mcp__<namespace>__<remote-name> to prevent collisions. A session copies the exact toolset and credential-policy versions; later versions do not silently change an existing session. Re-running discovery is idempotent while the remote metadata is unchanged. If the remote server adds, removes, or changes a tool, OAO publishes the discovery as the next immutable server version and makes it the latest version. Existing toolsets and sessions remain pinned to their prior server version until an operator deliberately publishes a replacement toolset and agent version.

Credential destinations

Every credential version is pinned to one destination: an HTTPS origin and a path prefix, set when the credential is created. The secret is only ever sent inside that destination. A credential policy can use the credential only when the policy’s exact origin equals the destination origin and its path prefix lies inside the destination path prefix. Prefixes are compared on path-segment boundaries: a destination of /mcp contains /mcp and /mcp/v2, but not /mcpx and not /. OAO checks this in three places, so no single path can bypass it:
  • Creating a credential policy outside the destination returns 400.
  • Authenticated discovery refuses a policy that lies outside the destination.
  • At execution time the runtime only loads a credential for a policy inside the destination, and the egress broker refuses any credential-bearing request outside it.
Without the pin, any principal with mcp:write and mcp:discover could point an organization-shared credential at their own server and receive the secret through discovery. Rotating a credential keeps its destination. To send a secret somewhere else, create a new credential.

Credentials stored before destinations existed

Upgrading pins existing credentials from the policies that already use them, so no existing binding breaks:
  • If all of a credential’s policies use one origin, the credential is pinned to that origin. Its path prefix is the policies’ path prefix when they all use the same one, and / otherwise.
  • Policy prefixes used to match as plain string prefixes, so /mcp also served an endpoint at /mcpx. When a server relied on that, or is a legacy SSE server that may post messages to a sibling path, the credential is pinned to the prefix’s parent instead (/mcp becomes /, /api/sse becomes /api/).
  • A credential without policies, or with policies on more than one origin, stays unpinned. Its existing policies keep working, but no new policy can use it. The console shows it as Unpinned.
To pin an unpinned credential, rotate it with a destination. Policies outside that destination stop working at once; create replacement policies inside it and publish agent versions that use them.

OAuth client credentials

For machine-to-machine access, OAO implements the MCP OAuth Client Credentials extension (io.modelcontextprotocol/oauth-client-credentials, revision 2026-07-28). OAO holds a pre-registered client ID and client secret, obtains short-lived access tokens from the MCP server’s authorization server, and sends only those tokens to the MCP server. Client authentication uses the client secret, sent in the request body (client_secret_post, the default) or with HTTP Basic (client_secret_basic). private_key_jwt, dynamic client registration, and Client ID Metadata Documents are not supported.

Discovery and confirmation

Before a credential is created, OAO discovers the authorization setup without sending any credential:
  1. One unauthenticated request to the MCP endpoint, to read the resource_metadata URL from its WWW-Authenticate: Bearer challenge. If the server sends none, OAO uses the RFC 9728 well-known URI with the endpoint path (/.well-known/oauth-protected-resource/<path>), then the root one.
  2. The protected resource metadata. Its resource must identify the endpoint, and it must list at least one authorization server.
  3. Each authorization server’s RFC 8414 metadata, falling back to OpenID Connect discovery. The issuer must equal the listed server exactly, and the token endpoint must be HTTPS on a public address. OAO reports grant_types_supported but does not require client_credentials in it: WorkOS AuthKit’s RFC 8414 document omits it.
Discovery follows no redirects, refuses private and special-purpose addresses, and caps every response at 64 KiB. An operator then confirms the resource, the authorization server, its token endpoint, the client authentication method, and the scope. OAO never picks an authorization server silently when several are listed. When the credential is created or re-pinned, OAO repeats discovery and refuses a configuration that no longer matches it. The immutable credential version pins the issuer, token endpoint, client ID, authentication method, scope, resource, and protected resource metadata URL next to the encrypted client secret. Its destination is the resource: policies for an OAuth credential must use the resource’s origin and a path prefix inside the resource’s path.

Tokens at run time

  • Where secrets go. The client secret is only ever sent to the pinned token endpoint, through a token broker with the same HTTPS, DNS-pinning, private-address, no-redirect, and size rules as the MCP broker. The broker forwards only Accept, Content-Type, and, for HTTP Basic, Authorization; no MCP or OAO header reaches the authorization server. The access token is only ever sent to the MCP origin and path prefix, as Authorization: Bearer.
  • The token request. grant_type=client_credentials, the pinned scope, and the RFC 8707 resource parameter set to the pinned resource. A credential can turn off Send the resource parameter for an authorization server that rejects it; that deviates from the MCP specification, which requires it.
  • Caching. Each API and runtime-worker process caches tokens in memory, keyed by organization, credential version, scope, and resource. A cached token keeps an absolute expiry and is replaced early, at the expiry minus the larger of 60 seconds and 10% of its lifetime (never later than half of it). Concurrent calls share one token request. A token without expires_in is treated as valid for 5 minutes. Rotating a credential creates a new version and so a new token.
  • Before a call is recorded. The runtime obtains the token before it records the call attempt. A refused token is recorded as a failed attempt that never reached the MCP server, with the safe error code credential_token_failed.
  • A 401 from the MCP server. If its WWW-Authenticate challenge names a different resource_metadata URL than the pinned one, the call fails with authorization_server_changed and no new token is requested. Otherwise OAO drops the cached token, requests a new one, and retries once; a second 401 fails with credential_rejected. A 401 is answered before the server runs the tool, so the retry cannot repeat it.
  • A 403. insufficient_scope fails with insufficient_scope, and any other 403 fails with remote_forbidden. Neither requests a new token.
  • Capability declaration. OAO declares the extension in its client capabilities: in the io.modelcontextprotocol/clientCapabilities _meta of each request on 2026-07-28 connections, and in initialize on older ones.
These codes appear on mcp.call_failed and mcp.discovery_failed events. They never include a token, a secret, or the authorization server’s error description.

Test a credential

Tokens are cached per process, so the console’s Test action on an OAuth credential is the way to check one. It repeats discovery, refuses the credential with authorization_server_changed if the pinned metadata URL, resource, issuer, or token endpoint no longer match, and then requests a fresh token. It returns only { ok, expiresIn, grantedScope } or { ok: false, errorCode }; the token never leaves the API process.

Set it up in the console

In Add MCP server, choose OAuth client credentials as the authentication type and select Discover authorization. Confirm the resource, the authorization server, and its token endpoint, supported authentication methods, and grant types. Enter the client ID and the write-only client secret, choose the client authentication method, and confirm the scope. The security policy is set to the resource and cannot be widened. Continue with Test and discover.

Set it up through the API

Discover first, then create the credential with the confirmed values. The policy and server follow as in Add an MCP server through the API.
Check authorizationServers before using the first one: pick the issuer that registered the client, and only one whose problem is null. Create the policy with exactOrigin set to the resource’s origin and pathPrefix set to its path (here https://app.example.com and /api/integrations/oao/extraction/mcp). To rotate, send { secret } with the new client secret. Add an oauth object with clientId, tokenEndpointAuthMethod, scope, sendResource, issuer, tokenEndpoint, or resourceMetadataUrl to change them; OAO repeats discovery when the issuer, token endpoint, or metadata URL changes. The resource never changes: create a new credential for another resource.

Call context headers

A credential policy can forward OAO call identity to the server it approves. Set forwardCallContext: true on the policy (in the console: Forward call context under Security policy and limits). It is off by default, because it discloses OAO identifiers to that server. The flag is part of the immutable policy version, so a session keeps the setting it was created with. When it is on, the egress broker sets these headers after it strips every inbound x-oao-* header and injects the credential:
  • Discovery runs outside any run, so it carries only the organization and project. A server can allow server/discover, initialize, and tools/list without the call headers and refuse a tools/call without them.
  • Validation. OAO checks every value’s format before it sends a byte, and never sends these headers to an OAuth token endpoint.
  • Reserved names. No credential may use an x-oao-* header name, so a credential cannot spoof them either. A server should still treat them as claims that the credential authenticates, not as authentication.
  • Run key hash. It lets a server bind tool calls to the run it created with that Idempotency-Key, without OAO disclosing the key itself. A follow-up run or a delegated child run has a different key, and so a different hash.
  • Tool-call ID. It is the ID of the tool_call aggregate in OAO’s product events. It stays the same when a call is recovered, so a server can use it as an idempotency key.

Egress and credential boundary

The broker requires TLS, resolves the hostname before each request, denies private and special-purpose addresses, and pins the request to the validated IP while retaining TLS server-name verification. This limits SSRF and DNS rebinding. It strips caller-supplied authorization, cookie, proxy authorization, and x-oao-* headers before injecting the configured secret.
To develop against an MCP server on your machine or tailnet, run the API and runtime worker with NODE_ENV=development and OAO_MCP_ALLOW_PRIVATE_NETWORK=true; see Local development. OAO refuses this setting outside development, and endpoints must still be HTTPS.
Credential-bearing requests must retain the exact scheme, host, and port and remain under the policy path prefix and inside the credential’s pinned destination. Redirects are not followed. Requests and responses are size-limited, and calls honor cancellation and the policy timeout. At execution time OAO rechecks the session binding, run creator’s current authorization, project membership, and every resource lifecycle before it decrypts a credential. Tool metadata and results are untrusted input. Discovery rejects duplicate tool names, repeated pagination cursors, excessive tool counts, and unsupported JSON schemas. Non-validating $schema and default annotations are removed, and a simple nullable anyOf is canonicalized to a nullable type before validation; other schema unions and unsupported combinators still fail closed. Descriptions are bounded and control characters are removed. Tool arguments are validated against the pinned schema. Remote result text may still contain prompt injection, so the agent’s instructions and approval policy must treat it as data rather than authority.

Recovery behavior

Every call has a deterministic tool-call identity, sent as X-OAO-Tool-Call-Id when the policy forwards call context, and one PostgreSQL call-attempt record. A process crash after dispatch can leave the remote outcome unknowable; OAO marks that attempt unknown and refuses to replay it automatically. This fail-closed behavior avoids repeating a non-idempotent remote action. Product events contain resource IDs, safe error codes, duration/size metadata, and state, never request arguments, results, credentials, or authorization headers.

Current authentication support

OAO supports static bearer credentials, arbitrary safe API-key headers, and OAuth client credentials with a client secret (client_secret_post or client_secret_basic). private_key_jwt, the authorization code flow, per-user delegated credentials, per-session credentials, dynamic client registration, Client ID Metadata Documents, stdio servers, configurable retries/reconnects, and secret substitution for sandbox commands are not implemented. OAO uses the MCP client pinned in @oao/mcp-remote; compatibility tests lock behavior to that exact version. See HTTP API, Authentication, and MVP limitations.