Architecture
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.
- 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.
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.
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 requirescurl plus jq. Set
OAO_API_URL, OAO_PROJECT_ID, and OAO_API_KEY first.
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.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.
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
/mcpalso 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 (/mcpbecomes/,/api/ssebecomes/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.
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:- One unauthenticated request to the MCP endpoint, to read the
resource_metadataURL from itsWWW-Authenticate: Bearerchallenge. 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. - The protected resource metadata. Its
resourcemust identify the endpoint, and it must list at least one authorization server. - Each authorization server’s RFC 8414 metadata, falling back to OpenID Connect
discovery. The
issuermust equal the listed server exactly, and the token endpoint must be HTTPS on a public address. OAO reportsgrant_types_supportedbut does not requireclient_credentialsin it: WorkOS AuthKit’s RFC 8414 document omits it.
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, asAuthorization: Bearer. - The token request.
grant_type=client_credentials, the pinnedscope, and the RFC 8707resourceparameter 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_inis 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-Authenticatechallenge names a differentresource_metadataURL than the pinned one, the call fails withauthorization_server_changedand no new token is requested. Otherwise OAO drops the cached token, requests a new one, and retries once; a second 401 fails withcredential_rejected. A 401 is answered before the server runs the tool, so the retry cannot repeat it. - A 403.
insufficient_scopefails withinsufficient_scope, and any other 403 fails withremote_forbidden. Neither requests a new token. - Capability declaration. OAO declares the extension in its client
capabilities: in the
io.modelcontextprotocol/clientCapabilities_metaof each request on 2026-07-28 connections, and ininitializeon older ones.
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 withauthorization_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.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. SetforwardCallContext: 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, andtools/listwithout the call headers and refuse atools/callwithout 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_callaggregate 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, andx-oao-* headers before injecting the configured secret.
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 asX-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.
