MCP and external OAuth
Snowflake MCP servers accept your identity provider's tokens
Tested end to end: tool discovery, SQL execution and live RBAC enforcement.
Kevin Keller · kevinkeller.org
Why it matters
Enterprise agents must use existing identity
- MCP is becoming the standard way for agents to reach data and tools
- Snowflake's managed MCP servers expose tools like
SYSTEM_EXECUTE_SQL - Enterprises need agents to log in through Okta, Entra ID, Ping or their own server
- External OAuth makes that possible
The flow
The token carries the user and the role
- The agent obtains a JWT from your identity provider
- It sends the token to the MCP server as a Bearer
- Snowflake validates the signature against the RSA public key
- The
scpclaimsession:role:<ROLE>maps to a Snowflake role - RBAC applies to every tool call
Setup
Four pieces on the Snowflake side
- An External OAuth security integration
- A token source: your IdP, or a test UDF that signs JWTs
- The managed MCP server with its tool specification
USAGEgrants on database, schema and MCP server for the token's role
What was tested
All three tests passed
| Test | Result |
|---|---|
Tool discovery (tools/list) | 200 OK, tool schema returned |
Tool invocation (tools/call) | 200 OK, SQL executed |
RBAC: revoke USAGE, call again | Error: "does not exist or not authorized" |
The critical result
RBAC is enforced in real time, not just at token validation
Revoke the grant and the very next call fails. Re-grant and it works again.
Gotchas
Learned the hard way
| Issue | Fix |
|---|---|
| Error 391902 | Always send Accept: application/json |
| Auth failure returns HTTP 200 | Check the JSON-RPC error body |
| "Server doesn't exist" | Token role needs USAGE |
Tool ignores statement | Use sql as the argument |
| Underscores in hostname | Use hyphens |
Zero Trust implications
No backdoor, no bypass
- Identity: tokens validated against the integration's public key
- Authorisation: the role claim maps to Snowflake RBAC
- Network: network policies and PrivateLink still apply
- Audit and governance: calls in
QUERY_HISTORY; masking and row access apply
Takeaway
External AI agents get the same governance as any other Snowflake client.
Kevin Keller · kevinkeller.org