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

  1. The agent obtains a JWT from your identity provider
  2. It sends the token to the MCP server as a Bearer
  3. Snowflake validates the signature against the RSA public key
  4. The scp claim session:role:<ROLE> maps to a Snowflake role
  5. 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
  • USAGE grants on database, schema and MCP server for the token's role

What was tested

All three tests passed

TestResult
Tool discovery (tools/list)200 OK, tool schema returned
Tool invocation (tools/call)200 OK, SQL executed
RBAC: revoke USAGE, call againError: "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

IssueFix
Error 391902Always send Accept: application/json
Auth failure returns HTTP 200Check the JSON-RPC error body
"Server doesn't exist"Token role needs USAGE
Tool ignores statementUse sql as the argument
Underscores in hostnameUse 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.

Read the full article

Kevin Keller · kevinkeller.org