This is the by-hand path. It’s also the reference for checking an agent’s work — every
command and expected response is spelled out, so you can compare against what the agent
reported.If you’d rather hand the mechanical parts to a coding agent, the prompt cards are on
Add OAuth to a Xano MCP server, along with the flow
diagram and the “do I even need OAuth?” table. Start there — this page assumes you’ve
already decided you do.
What the spec requires
MCP
2026-07-28 is the current revision. Published on 28 July 2026, it makes
the protocol stateless and is
rolling out across Claude products.
Three changes touch this guide, so track them rather than treating this page as
final:Mcp-Session-Idis gone, along with theinitializehandshake. The proxy’s session round-trip becomes a no-op for2026-07-28clients (harmless), but any Xano-side logic keyed to a session must move to explicit tool arguments.Last-Event-IDand SSE resumability are removed. A broken stream is re-issued as a new request instead of resumed.- DCR is deprecated in favor of Client ID Metadata Documents (CIMD). Dynamic
client registration has been demoted across three revisions: a
SHOULDin2025-06-18, downgraded to aMAYin2025-11-25when CIMD was introduced, and deprecated in2026-07-28. It keeps working for backward compatibility — the spec’s deprecation window is a minimum of twelve months, and Claude still supports it — but new deployments should plan for CIMD.
401 challenge, PKCE,
header-only tokens — is unchanged by 2026-07-28.Step 1 — Turn on user authentication in Xano
1
Set each tool's Authentication to user authentication
Open your MCP server → Connected Tools → set the Authentication column to
user authentication on every tool you want gated.Xano then validates
Authorization: Bearer <user JWT> natively and populates
$auth. No custom token-checking function is needed.2
Retire any auth checks you wrote yourself
Skip this if your tools had no authentication before — the toggle is all you need.Otherwise, native auth replaces whatever you built, and leaving it in place can
reject the users you’re onboarding. Check three places, not just the stack:
- The tool’s stack — a
function.runcall to a custom token-validation function, a token read by hand from an input or header, or apreconditiongating on a shared secret. - Middleware — middleware can be applied to AI tools, so the check may live there rather than in the stack.
- An MCP server trigger — a connection
trigger that validates
toolset.token.
$auth changes behavior; decide that case deliberately.3
Know what the toggle does and does not gate
This setting gates tool calls only. An unauthenticated
initialize still
returns 200. To test whether auth is on, call a tool — a successful
initialize proves nothing.The setting lives in the dashboard, is not represented in XanoScript, and survives
xano workspace push of your tool files.4
Verify auth is enforced
Call a read-only tool against the stream URL with no If you get real data instead, that tool’s Authentication is still Disabled.
Authorization header.
Expected response:Step 2 — Collect your two URLs
Both are covered on the parent page, including where to find them in the dashboard or from the CLI. The shapes, for reference:Use the streaming endpoint. SSE-only endpoints are deprecated and being sunset;
new integrations should use streaming exclusively.
Step 3 — Deploy the Worker
The Worker is four small files.@cloudflare/workers-oauth-provider does all the
OAuth heavy lifting: metadata documents, /token, /register, PKCE enforcement,
token issuance and rotation, and the 401 challenge.
1
Authenticate and create KV storage
2
Deploy to learn your Worker host
3
Set three secrets
Step 4 — Test with the MCP Inspector (optional)
Skip to Step 5 if you’d rather go straight at it with the real client. The Inspector is worth the five minutes, though: it separates “the Worker is broken” from “the client is misconfigured,” which is otherwise hard to tell apart. Either way,initialize succeeding is not a passing test — a tool call returning
rows is.
1
Check discovery and the 401 challenge
WWW-Authenticate header must carry resource_metadata=…. That header is
what tells an OAuth client where to go next; without it the client just fails.2
Open a log tail in one terminal
3
Run the Inspector in another
- Transport Type →
Streamable HTTP - URL →
https://xano-mcp-oauth.<subdomain>.workers.dev/mcp - Authentication →
OAuth - Connect → you are redirected to the Worker login page; sign in with a Xano user-table account.
- List Tools → run a read-only tool.
4
Read the tail
A healthy run looks like this:
Tool Result: Success with real rows means the request reached Xano carrying your
per-user JWT. That is the pass condition.Step 5 — Connect a client
Add a custom connector pointing at:Troubleshooting
Search this table for the literal error text you’re seeing.
Useful commands:
Icons and display name
There is no icon setting on Cloudflare — clients resolve it differently:- Claude surfaces fetch the connector origin root (
/) as HTML and parse<link rel="icon">. Serve HTML at/with a PNG icon link. - MCP Inspector reads
serverInfo.iconsfrom theinitializeresponse.
resourceMetadata.resource_name in src/index.ts.
Connector icons are cached per domain and can be sticky — a removed and re-added
connector may keep showing the fallback avatar. A fresh hostname (rename the Worker
or bind a custom domain) forces a cold fetch.
Limitations
- 24-hour JWT. The Xano user JWT expires in 24h while the OAuth grant lasts
longer, so upstream calls start 401ing and the user re-logs-in. To smooth this
out, add a Xano
POST /auth/refresh(auth="user") and call it fromOAuthProvider’stokenExchangeCallback, writing the fresh JWT intonewProps. - No consent screen as built. This treats a successful login as consent. A
public or multi-tenant deployment needs an explicit consent step with CSRF
protection in
/authorizebeforecompleteAuthorization— there’s a prompt for that on Add a consent screen. - Gate every tool. Only tools set to user authentication are protected.
- One MCP server per Worker as written. To front several, select
XANO_MCP_STREAM_URLby request path and useapiHandlers(a route → handler map) instead of a singleapiHandler.
Next steps
Add OAuth to a Xano MCP server
The overview, the flow diagram, and the prompt cards that do all of this for you.
Connecting Clients
Header-based and URL-based auth for clients that don’t need OAuth.