Skip to main content

Integrating your MCP server with UpsQuad

For: the owner or operator of an MCP server that an UpsQuad customer (a tenant) wants its agents to use. Not for: people connecting their own agent to UpsQuad. That is a different handout: Connecting your agent to the UpsQuad Model Gateway.

The handout describes what UpsQuad does on the wire today, and it says plainly where something is limited or not built yet.

1. What UpsQuad is to your server​

UpsQuad is an MCP client. A tenant registers your server's URL with UpsQuad and attaches it to one or more of its teams. From then on, when one of that team's agents decides to use one of your tools, the agent does not talk to you. It asks UpsQuad's team gateway, which checks who the agent is and whether it may make this call, and only then calls your server itself. You see one well-behaved MCP client, UpsQuad, calling on behalf of many governed agents.

UpsQuad holds your credentials; the agents never see them. Whatever you hand over (a static token, or an OAuth client secret) is stored in UpsQuad's vault and attached by the gateway to the outgoing request. The agent's own UpsQuad token is never forwarded to you. The one exception is deliberate and opt-in: in the OAuth 2.0 token-exchange mode, your authorization server receives the agent's UpsQuad token so that it can verify the agent's identity (section 4.4). That token still never reaches your MCP endpoint itself.

2. Status at a glance​

AreaState today
The gateway calling your server, in all four modes belowLive on UpsQuad's beta-dev environment. All four modes passed an end-to-end run there against test servers on 2026-10-30.
ProductionGated. Production does not yet have the platform signing key and issuer that the gateway needs, and the gateway is switched off by default. Ask your UpsQuad contact for the date.
Token exchange: per-agent identity federation (cross-app access / ID-JAG) and trust of the tenant's own identity providerParked. Not implemented. Token exchange today means "trust UpsQuad's issuer" (section 4.4).
A token endpoint behind a private certificate authorityDev only. Production trusts public CAs only.
Your tool descriptions and input schemas reaching the agentNot yet. They are captured at registration, but agents currently see the tool name plus a generic "object" schema (section 3.5).
Automatic refresh of your tool listNone. Your tool list is captured at specific moments only (section 3.5).
Authenticated discoverySupported since 2026-11-21 in bearer and oauth2 client_credentials modes: the registration capture sends your credential. In token_exchange mode, and when the tenant makes per-agent credentials mandatory, a registration has no agent to act for, so it sends none and discovery must stay open. The one exception is an OAuth client with no secret (section 3.5).

3. Protocol expectations​

3.1 Transport​

  • MCP streamable HTTP, JSON-RPC 2.0, over POST to the one URL you give us. We never open a GET event stream and never send DELETE.
  • You may answer a request with application/json (one JSON-RPC response object) or text/event-stream. UpsQuad's agent runtime reads the last data: frame that parses as a JSON object, so finish a stream with the response itself.
  • No server-to-client requests. The gateway advertises no client capabilities: no sampling, no elicitation, no roots. A server that needs them will not work.
  • Protocol version: we send "protocolVersion": "2025-06-18". We do not check the version you return.
  • We call the URL as registered, path included. If the registered URL has no query string, the calling client's query string (if any) is appended; if it has one, it is kept and the client's is dropped. We never follow redirects (section 5).

3.2 The three moments you will see traffic​

MomentWhat arrives at your serverAuthorization header?Our timeout
Registration capture (the tenant registers your server, changes its URL, or approves it for a team while no tool list has been captured yet)initialize, then notifications/initialized, then tools/listYes, on all three, in bearer and oauth2 client_credentials modes. No in none and token_exchange modes, or when per-agent credentials are mandatory (section 3.5)8 s for all three, including any token request
Session open (UpsQuad's agent runtime currently does this before every tool call, for every server attached to the calling agent's team)initialize onlyYes, the same credential as on the tool call, in bearer and oauth2 modes; none in none mode15 s
Tool calltools/call, carrying the Mcp-Session-Id you issued at session openYes, in bearer and oauth2 modes; none in none mode55 s, including the whole streamed response

That is the entire surface. tools/list is not forwarded to you at run time: the gateway answers it from the tool list it captured at registration. ping and notifications from the agent are also answered by the gateway itself.

3.3 initialize​

The gateway's session-open request, byte for byte (only the line breaks are added):

POST /your/mcp/path HTTP/1.1
Content-Type: application/json
Accept: application/json, text/event-stream
Authorization: Bearer <the credential for your mode, see section 4> (bearer and oauth2 modes only)

{"id":1,"jsonrpc":"2.0","method":"initialize",
"params":{"capabilities":{},"clientInfo":{"name":"upsquad-mcp-group-gateway","version":"1"},"protocolVersion":"2025-06-18"}}

The registration capture sends the same shape, with clientInfo.name set to upsquad-registry-probe and the keys in a different order. It carries Authorization only in the modes section 3.2 lists.

If UpsQuad cannot obtain your credential for the calling agent, it does not send you the initialize. That happens when your token endpoint refuses UpsQuad, or when nothing is stored for that agent. Your server is then left out of that agent's session (section 6.3).

You must answer with a 2xx status and an Mcp-Session-Id response header. That is all the gateway checks: it reads your status and that header and discards the body. If either is missing, your server is left out of that agent's session (section 6.3).

The gateway does not send notifications/initialized on the session it opens before a tool call. Only the registration capture sends it. Your server must accept a tools/call straight after a successful initialize, with no notification in between. Check this first if you use an MCP SDK: some server implementations refuse requests until the notification arrives.

3.4 Sessions​

  • Issue a session id at initialize. Every later tools/call we send you carries that id in Mcp-Session-Id.
  • We never end your sessions. No DELETE is sent upstream. When an agent closes its session with UpsQuad, the gateway only forgets the mapping on its side.
  • The gateway forgets a session 30 minutes after it opened it, whether or not it was used. It never sends you an id older than that, so you may expire idle sessions after 30 minutes.
  • UpsQuad's agent runtime opens a new session before each tool call, so expect many short-lived sessions, mostly unused, at a rate of roughly one per tool call made by any agent on each team that has your server attached. Keep sessions cheap.
  • If you receive an id you do not recognise, answer HTTP 404, as the MCP specification requires. The gateway passes it back to the agent's client, and a spec-compliant client opens a new session.
  • An agent's client can send a tool call without having opened a session. In that case the gateway sends you the tools/call with no Mcp-Session-Id at all. Either serve it, or answer HTTP 400 as the specification allows.

3.5 Your tool list: discovery, naming and capture​

  • Discovery and your credential. Since 2026-11-21 the registration capture sends your credential on initialize, notifications/initialized and tools/list:

    • bearer mode: the token stored for the approving team, or the organisation-wide one.
    • oauth2 client_credentials mode: UpsQuad makes one token request first.

    A registration has no agent acting, so in some cases there is no credential to send:

    • token_exchange mode: there is no agent token to exchange.
    • Per-agent credentials made mandatory by the tenant: a capture never uses one agent's credential. The one exception is an OAuth client with no secret, which needs nothing stored.

    In those cases, and in none mode, the capture sends no Authorization header, and your discovery must stay open. If your server refuses it, the capture fails, no tools are recorded, and your server contributes no tools to any team. If you need your tool list kept private in those cases, keep the endpoint on a private network (section 5) rather than gating discovery.

    If UpsQuad cannot obtain a credential that is configured, it does not call your server, and the capture is recorded as failed. That happens when your token endpoint refuses UpsQuad or the credential store is unavailable. A credential stored or rotated after the tenant approved your server does not start a new capture by itself. The beta-dev test servers accept discovery with or without a credential, and require one for execution.

  • What we capture: result.tools[].name, .description and .inputSchema, from a JSON or SSE response of at most 1 MiB. A JSON-RPC error, a non-2xx status or a timeout all count as a failed capture.

  • How agents see your tools: {server}__{tool}. The prefix is the name the tenant gave your server in UpsQuad (2 to 64 characters, unique within the tenant), then two underscores, then your raw tool name. A server registered as acme-billing with a tool refund is offered to agents as acme-billing__refund. When an agent calls it, the gateway turns the name back into refund before forwarding the call, so your server only ever sees its own names.

  • Model providers limit function names (commonly letters, digits, _ and -, up to 64 characters). Keep your tool names short and plain so that the prefixed name stays within that limit.

  • Descriptions and schemas do not reach the agent yet. Today the gateway offers each tool with a generic {"type": "object"} input schema, and the agent runtime falls back to the description "Tool: {server}__{tool}". Until that changes, choose self-explanatory tool names, validate arguments on your side, and return error text that tells an agent how to correct its call (section 6.1).

  • The capture is not refreshed automatically. It runs when the server is registered, when its URL changes, and when a team approval happens while no tool list has been captured yet. If you add, rename or remove tools, tell the tenant. Until a new capture runs, a new tool is not offered and a removed tool still is.

3.6 tools/call: exactly what arrives​

POST /your/mcp/path HTTP/1.1
Content-Type: application/json
Accept: application/json, text/event-stream
Mcp-Session-Id: <the id YOU issued at initialize>
Authorization: Bearer <the credential for your mode, see section 4>
X-Idempotency-Key: <hex digest; present when the calling runtime sends one>

{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"refund","arguments":{"amount":12.5,"customer_id":"c_123"}}}
  • Headers we send are only these: Content-Type, Accept, Mcp-Session-Id, Mcp-Protocol-Version and Last-Event-Id (each only when the calling client sent one), X-Idempotency-Key, and Authorization. In none mode there is no Authorization header at all. Go's HTTP client adds its own transport headers, such as its default User-Agent. We set no product User-Agent, so do not allow-list on it.
  • X-Idempotency-Key is a stable key per logical tool call, sent by UpsQuad's own agent runtime. The gateway already uses it to suppress duplicate deliveries on its side. Honour it too if your tool has side effects and you can.
  • The body is the agent's JSON-RPC request with only params.name rewritten to your raw tool name. Everything else in params is passed through untouched. The id is the agent's; UpsQuad's runtime always uses 1.
  • Your response is passed back to the agent unchanged: status, headers (except hop-by-hop headers) and body. Section 6 says how agents react to it.
  • Request bodies are capped at 4 MiB.

3.7 What we never send, and how to tell callers apart​

  • Never the agent's UpsQuad token, and never the agent's cookies. The Authorization header is built by the gateway from your credential and nothing else.
  • No caller-identity headers: no tenant, team, agent or user id.
  • If you need to know which agent is calling, pick one of these:
    • Per-agent bearer tokens. The tenant stores one token per agent and can make that mandatory (section 4.2). Each agent then reaches you with its own token.
    • Token exchange. Your authorization server sees the agent's signed UpsQuad identity (org_id, unit_id, agent_id) and can put it into the token it issues (section 4.4).
    • Client credentials tells you only "this tenant's UpsQuad", never which agent.

4. Per auth mode: what you provide, what you configure​

ModeYou hand the tenantWhat your MCP endpoint receives on session open and tools/call (registration capture: section 3.2)
nonethe URLno Authorization header
bearerthe URL, plus one static token (or one per team, or per agent)Authorization: Bearer <that token>
oauth2 + client_credentialsthe URL, your token endpoint, a client_id and secret registered for UpsQuad, and the audience and/or resource (plus an optional scope)Authorization: Bearer <token your AS issued to UpsQuad>; one token request per session open and one per tool call
oauth2 + token_exchangeas for client_credentials (a secret is optional), plus your AS trusting UpsQuad's issuerAuthorization: Bearer <token your AS issued in exchange for the agent's UpsQuad token>; one exchange per session open and one per tool call. The registration capture sends nothing in this mode: keep discovery open

In every mode, the gateway authenticates and governs the agent before it contacts you. A call that UpsQuad refuses, for example because the agent's clearance is too low, the tool is not in its allowlist, or a policy denies or holds it for human approval, never reaches you and never causes a token request.

There are no other modes. UpsQuad does not support API-key headers, HTTP Basic to the MCP endpoint, mutual TLS, OAuth authorization-code or refresh-token flows towards your server, or discovery of your authorization server from metadata. Your token endpoint URL is entered by hand.

4.1 none: no credential​

  • You provide: the URL.
  • You configure: nothing. Your server must serve tools/call without an Authorization header.
  • Acceptable when your tools are harmless or public, or when your server sits on a private network that only UpsQuad can reach (a pinned private range, section 5) and enforces nothing itself. Remember that you cannot tell callers apart in this mode.

4.2 bearer: a static token​

  • You provide: a token of 8 to 8192 characters with no control characters (tabs, newlines and the like); leading and trailing whitespace is trimmed when it is stored. The gateway sends it unchanged as Authorization: Bearer <token> on the session-open initialize and on tools/call, and, since 2026-11-21, on the registration capture (section 3.5). If the tenant makes per-agent tokens mandatory, the registration capture sends none, so discovery must then stay open.
  • Grain: the tenant decides where the token applies. It can store one token for its whole organisation, one per team, or one per agent. The most specific one wins: per agent, then per team, then the organisation-wide default. The tenant can also make per-agent tokens mandatory. An agent without its own token is then refused by UpsQuad and never reaches you.
  • Rotation: you issue a new token and the tenant re-uploads it. UpsQuad caches nothing, so the new token is used from the next session open and tool call on. Keep the old token valid until the tenant confirms the switch, then revoke it.
  • Switching modes: a stored bearer token is never reused as an OAuth secret, or the other way round. After a mode change the tenant must upload the credential for the new mode.
  • If no token is stored for the calling agent's grain, UpsQuad refuses the call itself (the agent gets a 403) and sends you nothing.

4.3 oauth2 with client_credentials (RFC 6749 section 4.4)​

You provide, after registering UpsQuad as a client on your authorization server (AS):

FieldRule
token_endpointhttps:// only, with a host and no user-info (refused at configuration otherwise). Use a DNS name: UpsQuad will not call an IP address.
client_idthe client id you issued to UpsQuad for this tenant
client secretstored by the tenant in UpsQuad's vault. It is never in the server's configuration.
audience and/or resourceat least one is required. We send them as given.
scopeoptional, space-delimited

Configure your AS to:

  • Authenticate UpsQuad with HTTP Basic (client_secret_basic). We send Authorization: Basic base64(urlencode(client_id) ":" urlencode(secret)), as RFC 6749 section 2.3.1 describes. We never send the secret in the form body (client_secret_post). If no secret is stored, we send client_id in the form body as a public client.
  • Accept a form with grant_type=client_credentials, plus audience, resource and scope when they are configured.
  • Answer HTTP 200 with a JSON body containing a non-empty access_token. We send that token to your MCP endpoint as Bearer whatever token_type you return. We ignore expires_in.
  • Answer within 10 s, from a certificate issued by a public CA, without redirecting. We do not follow redirects, and anything other than 200 is a failure.
  • Expect one token request per session open and one per tool call, plus one per registration capture. UpsQuad does not cache upstream tokens, so a token you issue is used once. Because the agent runtime opens a session before every tool call, for every server on the team, a tool call made anywhere on a team that has your server attached costs you one token request. A tool call to your server costs one more. Size your AS rate limits for this, and make short-lived tokens cheap to issue.

Grain note. client_id is configured once per registered server. The tenant can store the secret per organisation, per team or per agent, but every grain presents the same client_id. Per-team or per-agent secrets therefore only help if your AS accepts several secrets for one client. In practice, issue one client per tenant registration, and use token exchange if you need per-agent identity.

4.4 oauth2 with token_exchange (RFC 8693)​

This mode is for an AS that wants to know which UpsQuad agent is calling. The gateway sends your AS the agent's own UpsQuad access token as the subject_token, and your AS issues a token for your MCP endpoint in exchange. The fields are the same as in 4.3. A client secret is optional: with one we authenticate with HTTP Basic, without one we send client_id in the form body.

What arrives at your token endpoint:

Form fieldValue
grant_typeurn:ietf:params:oauth:grant-type:token-exchange
subject_tokenthe agent's UpsQuad access token (a JWT, below)
subject_token_typeurn:ietf:params:oauth:token-type:access_token
requested_token_typeurn:ietf:params:oauth:token-type:access_token
audience, resource, scopeas configured, when set
client_idonly when no secret is stored (public client)

No actor_token is sent.

How to verify the subject token:

CheckValue on beta-dev
AlgorithmRS256 only. The JWT header carries typ: JWT and a kid.
Issuer (iss)https://auth-beta.upsquad.ai
Keyshttps://auth-beta.upsquad.ai/.well-known/jwks.json, one RSA key with use: sig and alg: RS256. Discovery metadata is at https://auth-beta.upsquad.ai/.well-known/oauth-authorization-server.
Key rotationThe key set holds one key, served with Cache-Control: public, max-age=300. A rotation replaces it and changes the kid. Select the key by kid, and fetch the set again when you see a kid you do not know.
Lifetimeabout 10 minutes (exp minus iat). Reject an expired token.
Audience (aud)UpsQuad's team gateway, not you: a one-element array such as ["https://auth-beta.upsquad.ai/mcp/team/UNIT_ID"]. Do not require aud to name your AS, or every exchange fails. Do check it: require an aud entry that starts with UpsQuad's team-gateway prefix, https://auth-beta.upsquad.ai/mcp/team/ on beta-dev, so that a token UpsQuad minted for another surface is refused. Your own audience is the audience/resource form field.
SubjectThere is no sub claim. The identity is agent_id, within org_id (the tenant) and unit_id (the team). Map agent_id to your token's subject.
Other claimsazp is always agent-runtime. Agents running outside UpsQuad carry runtime: "external". Agents running inside UpsQuad may carry provenance claims (session_id, human_member_id, runtime_session_id, delegation_purpose). Ignore claims you do not recognise. There is no jti and no nbf.

A decoded example (internal agent; JWT header, then payload; values shortened):

{"alg": "RS256", "kid": "dev-platform-20261023-094112", "typ": "JWT"}
{
"iss": "https://auth-beta.upsquad.ai",
"aud": ["https://auth-beta.upsquad.ai/mcp/team/23735ba8-…"],
"azp": "agent-runtime",
"org_id": "00000000-0000-0000-0000-000000000001",
"agent_id": "6f1c…",
"unit_id": "23735ba8-…",
"runtime_session_id": "…",
"delegation_purpose": "runtime_session",
"iat": 1763200000,
"exp": 1763200600
}

Reply exactly as in 4.3: HTTP 200 with JSON access_token, within 10 s, from a public CA, without redirecting. Expect one exchange per session open and one per tool call (section 4.3 explains the volume). The registration capture sends no exchange in this mode. The exchange carries the agent's token, which is why we refuse a plain-http token endpoint.

What is real and what is parked. The exchange itself is real code and passed end to end on beta-dev against a test AS. What is not built is federation beyond "trust UpsQuad's issuer": there is no cross-app-access / ID-JAG flow, no per-tenant identity-provider trust, and no per-agent identity token for your server beyond what your AS puts in the token it issues. Production has no issuer yet (section 2), so this mode is beta-dev only today. The kid and issuer above are the beta-dev values; production will publish its own.

5. Network​

  • Reachability. Your MCP endpoint, and your token endpoint in oauth2 modes, must be reachable from UpsQuad over TCP, by a DNS hostname. UpsQuad will not call an IP-address URL or a single-label host such as localhost. We resolve the name at connect time and check the address we actually dial, so a DNS answer that changes to a forbidden address is refused.
  • Use https for your MCP endpoint. UpsQuad accepts an http:// URL, but in bearer and oauth2 modes your credential would then cross the network in clear text. The token endpoint must be https.
  • TLS trust. Use a certificate from a public CA. Production has no way to trust a private CA. Beta-dev's private test CA is a development arrangement only.
  • Allow-listing on our side. UpsQuad calls only hosts on the tenant's egress allow-list. When the tenant approves your server for a team, the MCP endpoint's host is added automatically. A token endpoint on a different host is not added automatically. Today an UpsQuad operator adds it by hand. Until then every token request is refused before it leaves UpsQuad, so tell the tenant if your AS is on another hostname.
  • Private upstreams. An MCP server on a private network is reachable only if the tenant's top-level administrator and the team's manager approve a pinned private range, and your server's address must fall inside it. Only RFC 1918 IPv4 (10/8, 172.16/12, 192.168/16) and IPv6 unique-local (fc00::/7) ranges can be pinned. Loopback, link-local, cloud metadata (169.254/16) and 0.0.0.0/8 are never reachable, whatever is approved.
  • Redirects are never followed. A redirect from your MCP endpoint is passed back to the agent as-is. A redirect from your token endpoint is a failed mint.
  • Rate limits. UpsQuad's edge limits apply to callers coming into UpsQuad. On beta-dev they are 30 token mints, 120 team-gateway requests and 120 discovery requests per minute, each shared by all callers. They do not limit our calls to you, and the gateway does not throttle its outbound calls. Size your own limits for the pattern in section 3.2: per tool call, one initialize to every server on the agent's team; in oauth2 modes, one token request to each such server's AS for that initialize, and one more to the called server's AS; then the tools/call itself.
  • We do not publish a source IP range in this handout. If you need one to allow-list UpsQuad, ask your UpsQuad contact.

6. Error contract​

6.1 What to return​

SituationReturnWhy
The tool ran but failed (bad input, business rule, downstream error)HTTP 200, JSON-RPC result with isError: true and a text content block explaining what to changeThe agent reads the text and can correct itself. This is the most useful failure you can return.
Malformed request or unknown toolHTTP 200, JSON-RPC error (-32602 invalid params, -32601 unknown method)The agent sees your error.message.
The credential we sent is missing, invalid or expiredHTTP 401Use only for this. See the retry note in 6.2.
The credential is valid but not allowed to do thisHTTP 403Not retried.
Unknown or expired Mcp-Session-IdHTTP 404Per the MCP specification. A spec-compliant client opens a new session.
OverloadedHTTP 429 or 503, optionally with Retry-AfterPassed back to the agent. Nothing retries automatically.

Everything in your response body may be shown to the agent's model: UpsQuad's runtime shows the agent up to 500 characters of an error body. Never put secrets, tokens or other tenants' data in error text.

6.2 What UpsQuad does with your answer​

Your answerWhat the agent experiencesRetried?
initialize: anything but 2xx with an Mcp-Session-Id, or no answer in 15 sYour server is left out of that agent's session; see 6.3No
tools/call: any HTTP statusPassed through unchanged. UpsQuad's runtime turns a status of 400 or above into a tool error that includes the status and up to 500 characters of your body.Not by the gateway. An agent running outside UpsQuad through UpsQuad's credential helper treats any 401 as its own UpsQuad token expiring, so it fetches a fresh one and repeats the call once. Your 401 can therefore cause one more token request and one more tools/call.
tools/call: JSON-RPC errorYour error.message becomes the tool errorNo
tools/call: resultThe text of your content blocks, joined; isError is honouredNo
tools/call: no connection, TLS failure, or no response headers within 55 sHTTP 502 "upstream unavailable". Once your headers have been sent, the status is already passed through: a body still streaming at 55 s is cut off, and the agent gets a truncated response, not a 502.No
Token endpoint: anything but 200 with access_token, or no answer in 10 sOn a tool call: HTTP 403. At session open: your server is left out of that agent's session (6.3). Your MCP endpoint is not called in either caseNo

UpsQuad records every token it mints for you, every refusal, and every server it had to leave out of a session in the tenant's audit log, with a short reason. Neither tokens nor secrets are ever written there.

6.3 When your server is down​

If your server does not answer initialize properly, it is left out of that agent's session. The agent still gets a session with the team's other servers, your tools are hidden for that session, and a call to one of them gets a "no upstream session for member — initialize first" error. The tenant's audit log records why: refused by egress, a non-2xx status, no session id, an invalid URL, unreachable, or UpsQuad could not obtain your credential for that agent. In the last case UpsQuad did not contact your server at all, and a tool call to it is refused by UpsQuad with a 403. Only when no server on the team answers does the agent's whole session fail, with a 502.

The gateway opens sessions one server after another, so a server that never answers costs every agent on that team up to 15 s per session. Fail fast rather than hang.

7. Worked examples (from UpsQuad's beta-dev test servers)​

These are the requests UpsQuad's beta-dev test servers receive. Secrets are replaced by REDACTED. The hostnames are beta-dev's private aliases. Yours will be your own public or private hostnames.

7.1 none: betadev-smoke-none​

  • Registered URL: http://betadev-smoke-mcp.mcp.internal:9000/ on a pinned private range. Tools: smoke_echo, smoke_escalate_probe.
  • Registration capture: initialize (no Authorization), answered 200 with an Mcp-Session-Id; then notifications/initialized, answered 202; then tools/list with the session id, answered with both tools.
  • Agent offered: betadev-smoke-none__smoke_echo, betadev-smoke-none__smoke_escalate_probe.
  • Per tool call: the session-open initialize from 3.3, then:
POST / HTTP/1.1
Host: betadev-smoke-mcp.mcp.internal:9000
Content-Type: application/json
Accept: application/json, text/event-stream
Mcp-Session-Id: 9f2c… (issued by this server at initialize)

{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"smoke_echo","arguments":{"text":"hi"}}}

There is no Authorization header. This test server goes further and refuses any tools/call that carries one, which proves the agent's own token is never relayed.

  • Governance before it reaches you: a call to smoke_escalate_probe is held by a tenant policy for human approval, and an agent below the server's clearance floor is refused. Neither call arrives at the server.

7.2 bearer: betadev-refund-mcp​

  • Registered URL: http://betadev-refund-mcp.mcp.internal:9000/. Tool: refund(amount, customer_id). A team-wide token is stored in UpsQuad.
  • Execution needs the token; discovery accepts it. Since 2026-11-21 the gateway sends the team token on the registration capture and on the session-open initialize too. This test server answers initialize and tools/list with or without a credential, and answers a tools/call without the right token with HTTP 401 and JSON-RPC -32001.
  • Per tool call:
POST / HTTP/1.1
Host: betadev-refund-mcp.mcp.internal:9000
Content-Type: application/json
Accept: application/json, text/event-stream
Mcp-Session-Id: 4b1e…
Authorization: Bearer REDACTED
X-Idempotency-Key: 3f9a…

{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"refund","arguments":{"amount":12.5,"customer_id":"c_123"}}}
{"jsonrpc": "2.0", "id": 1, "result": {"content": [{"type": "text", "text": "{\"status\": \"success\", \"refund_id\": \"re_…\", \"amount\": 12.5, \"customer_id\": \"c_123\"}"}]}}
  • Mandatory per-agent tokens: a second test server, betadev-smoke-rpa, is configured to require one token per agent, but only a team-wide token is stored. The call is refused inside UpsQuad with a 403 and never reaches the server.

7.3 oauth2 + client_credentials: betadev-refund-oauth2-cc​

  • Configuration: token_endpoint https://fake-as.mcp.internal:8443/token, client_id betadev-fake-as-cc, audience http://betadev-refund-oauth2-mcp.mcp.internal:9000/, grant_type client_credentials, and a team-wide client secret in UpsQuad's vault. The token endpoint's host was added to the allow-list by hand, as section 5 describes.
  • Per tool call, the token request comes first:
POST /token HTTP/1.1
Host: fake-as.mcp.internal:8443
Authorization: Basic REDACTED (base64 of "betadev-fake-as-cc:" + urlencoded secret)
Content-Type: application/x-www-form-urlencoded
Accept: application/json

audience=http%3A%2F%2Fbetadev-refund-oauth2-mcp.mcp.internal%3A9000%2F&grant_type=client_credentials
{"access_token": "REDACTED", "token_type": "Bearer", "expires_in": 300}
  • Then the tool call, shaped like 7.2, with Authorization: Bearer REDACTED carrying the token just issued and "name":"refund_oauth2". The test server checks the token's signature against its authorization server's pinned key, its iss, that aud contains its own URL, and exp. It refuses the static bearer token from 7.2.
  • Session open and registration capture: each is preceded by the same token request, and carries the token it returned. The session-open initialize before a tool call therefore costs one token request of its own.
  • What the test AS refuses, a useful checklist for your own AS: the secret in the form body (client_secret_post), the wrong grant for the client, and an audience it does not serve (invalid_target).

7.4 oauth2 + token_exchange: betadev-refund-oauth2-tx​

  • Configuration: as in 7.3, but with client_id betadev-fake-as-tx, grant_type token_exchange and no secret (a public client). The test AS verifies the subject token against UpsQuad's key set, and pins iss to UpsQuad's issuer.
  • Per tool call:
POST /token HTTP/1.1
Host: fake-as.mcp.internal:8443
Content-Type: application/x-www-form-urlencoded
Accept: application/json

audience=http%3A%2F%2Fbetadev-refund-oauth2-mcp.mcp.internal%3A9000%2F&client_id=betadev-fake-as-tx&grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token=REDACTED&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token

The test AS deliberately does not check the subject token's aud, which names UpsQuad's team gateway (section 4.4). Because the subject token has no sub, the test AS copies agent_id into the sub of the token it issues, together with org_id, unit_id and an RFC 8693 act claim naming the client. It answers 200 with access_token, token_type: Bearer, expires_in: 300 and issued_token_type.

  • Session open: the session-open initialize before a tool call is preceded by its own exchange, with the same form, and carries the token it returned. The registration capture makes no exchange in this mode and sends no credential, so this test server's discovery stays open.
  • Then the tool call, as in 7.3. The test MCP server logs the issued token's jti. Matching that jti against the AS log shows that the server accepted exactly the token issued for that call.

8. Verification checklist​

8.1 Your side, before you hand over anything​

Run these from a machine that reaches your endpoint the way UpsQuad will. Replace $URL with your MCP endpoint.

  1. Discovery. In none and token_exchange modes, or if per-agent credentials will be mandatory, all three must succeed with no Authorization header. In the other modes they must succeed with your credential: add -H "Authorization: Bearer $TOKEN" to each command.

    SID=$(curl -s -D - -o /dev/null "$URL" -H 'Content-Type: application/json' \
    -H 'Accept: application/json, text/event-stream' \
    -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"self-test","version":"1"}}}' \
    | awk -F': ' 'tolower($1)=="mcp-session-id"{print $2}' | tr -d '\r')
    echo "session=$SID" # must be non-empty
    curl -s "$URL" -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
    -H "Mcp-Session-Id: $SID" -d '{"jsonrpc":"2.0","method":"notifications/initialized"}' -o /dev/null -w '%{http_code}\n'
    curl -s "$URL" -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
    -H "Mcp-Session-Id: $SID" -d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'

    The three requests together must finish in well under 8 s, and the tools/list response must be under 1 MiB.

  2. A tool call with no notification first. Open a fresh session (step 1, first command only) and send a tools/call straight away, with the credential for your mode. It must succeed.

  3. Unknown session. Send a tools/call with Mcp-Session-Id: does-not-exist. Expect HTTP 404.

  4. Credential errors (bearer/oauth2): with no token, or a wrong one, expect HTTP 401. With a valid token that lacks permission, expect HTTP 403.

  5. Token endpoint (oauth2): a curl -u "$CLIENT_ID:$SECRET" -d grant_type=client_credentials -d audience=… against your https token endpoint returns HTTP 200 with access_token in under 10 s, with no redirect, and with a certificate that curl trusts without -k. curl -u does not URL-encode; if your client id or secret contains characters that need encoding, encode them first, as UpsQuad does.

  6. Token exchange (token_exchange): your AS fetches https://auth-beta.upsquad.ai/.well-known/jwks.json, accepts RS256 with iss https://auth-beta.upsquad.ai, does not require aud to name itself but does require the team-gateway aud prefix (section 4.4), and does not require sub.

  7. Error text contains no secrets (section 6.1).

8.2 The UpsQuad side (the tenant's administrator, with UpsQuad's help)​

  1. Your server is registered with the URL and auth mode you agreed, and its health shows healthy with your tools listed. An empty tool list means the discovery capture failed (section 3.5).
  2. The server is approved, and approved for each team that should use it.
  3. The credential is stored at the agreed grain: organisation, team or agent. Per-agent tokens are marked mandatory if you require them.
  4. oauth2 only: if your token endpoint is on a different host from your MCP endpoint, an UpsQuad operator has added that host to the tenant's allow-list.
  5. Private upstream only: the private range is approved and pinned, and contains your server's address.
  6. From an agent whose clearance meets the server's floor, tools/list shows {server}__{tool} for every tool, and a real tools/call succeeds. On your side you see the initialize, the tools/call, and, in oauth2 modes, a token request before each of them.
  7. The tenant's audit log shows a minted-upstream-token event (or a no-credential event in none mode) for that call, and no "server left out of session" event for your server.
  8. Negative check: remove or rotate the credential, and confirm the next call is refused (403 from UpsQuad, nothing reaches you) or arrives with the new credential.