---
name: iblai-connect-snowflake
description: "Read and write Snowflake data through the Snowflake SQL API; Snowflake-managed MCP server (Cortex) and expose it to an ibl.ai agent as an MCP tool. Use when the user asks an agent to work with Snowflake data, or to set up a Snowflake MCP connection on ibl.ai."
metadata:
  kind: guide
---

# Snowflake connector for AI agents

> A starting point maintained on ibl.ai at https://ibl.ai/developer/connectors/snowflake — not part of the iblai/vibe repository. Checked against Snowflake's documentation on October 20, 2026; test it against your own Snowflake setup before you rely on it.

Snowflake holds an organization's analytical data in databases, schemas, tables and views, plus semantic models, search services and Cortex AI objects governed by roles.

## Auth & conventions

- **API:** Snowflake SQL API; Snowflake-managed MCP server (Cortex) (REST). The SQL API submits SQL (queries, DDL, DML, multiple statements, stored procedure calls), checks status and cancels statements. Cortex Analyst and Cortex Search are exposed through the managed MCP server.
- **Base URL:** https://{account_identifier}.snowflakecomputing.com/api/v2/statements
- **Access:** Issued by your administrator. An account administrator creates a user or service user, assigns a role and sets up OAuth, a key pair or a programmatic access token. Queries run with that role's privileges.
- **Auth:** OAuth (Snowflake OAuth or External OAuth); Key-pair JWT; Programmatic access token; Workload identity federation. Send Authorization: Bearer with the token; optional X-Snowflake-Authorization-Token-Type (OAUTH, KEYPAIR_JWT). Key-pair JWTs are signed with the user's private key and include the public key fingerprint.
- **Limits:** Statements may run asynchronously; poll by statementHandle. Timeout defaults to STATEMENT_TIMEOUT_IN_SECONDS. HTTP 429 means too many requests; retry with requestId and retry=true to avoid running a statement twice.
- Keep Snowflake credentials in environment variables or the ibl.ai credential store. Never print a token in chat and never commit one to a file.
- Destructive or outward-facing calls are marked **Confirm with the user first** — do.

## Reads

- **SQL query results** — POST /api/v2/statements with a SELECT; bind variables via the bindings field.
- **Statement status** — GET /api/v2/statements/{statementHandle} polls a long-running statement and returns results.
- **Natural-language analytics** — Cortex Analyst generates SQL from a question (managed MCP server tool).
- **Unstructured search** — Cortex Search services search documents and text (managed MCP server tool).

## Writes

- **DML** — INSERT, UPDATE, DELETE and MERGE through the SQL API. **Confirm with the user first.**
- **DDL and provisioning** — Create tables, users and roles through the SQL API, subject to role privileges. **Confirm with the user first.**
- **Cancel statement** — Cancel a running statement by its handle.

## Expose it to an ibl.ai agent (MCP)

Snowflake publishes an official MCP server, Snowflake-managed MCP server (https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-agents-mcp). Register it below as-is, or host your own server that wraps the calls in this skill.

First install the ibl.ai platform skills and connect your organization (writes `IBLAI_ORG`, `IBLAI_USERNAME` and `IBLAI_API_KEY` to `.env`):

```bash
npx skills add iblai/vibe --all
# then, in your coding agent:
/iblai-api-login
```

Every call below sends `Authorization: Api-Token $IBLAI_API_KEY`.

1. **Register the server** — `POST https://api.iblai.app/dm/api/ai-mentor/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME/mcp-servers/` with `name`, `url`, `transport` (`sse` | `websocket` | `streamable_http`) and `auth_type` (`none` | `token` | `oauth2`). Capture the returned `id`.
   - For an API key or service credential use `auth_type=token` with `auth_scope=platform` for one key across the organization, or scope it to a single agent for one key per agent.
2. **Create the connection** — `POST https://api.iblai.app/dm/api/ai-mentor/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME/mcp-server-connections/` with `server`, `scope` (`platform` | `mentor` | `user`), `auth_type`, and either `credentials` + `authorization_scheme` or a `connected_service` id for OAuth. Credentials are masked on read; never send a masked value back.
3. **Enable it on the agent** — `GET https://api.iblai.app/dm/api/ai-mentor/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME/mentors/{agent_id}/settings/`, add `mcp-tool` to `tool_slugs` and the server id to `mcp_servers`, then `PATCH` the full lists back. They are replaced, not merged.

Full reference: https://ibl.ai/developer/platform/mcp/mcp-connections and the `/iblai-api-agent-mcp` skill.

## Example prompts

- "What was net revenue by region last quarter, and how did it compare to the prior quarter?"
- "Show the top 20 customers by lifetime value from the ANALYTICS.SALES schema"
- "Search our support transcripts for complaints about the new billing page"
- "Which tables in the FINANCE database were modified in the last 7 days?"

## Guardrails

- Warehouses often hold customer records, financial data and other regulated data (PII, PHI, cardholder data) depending on what the organization loads; access follows role grants.
- Request the narrowest Snowflake scopes or role the task needs, and prefer a read-only credential for agents that only answer questions.
- Return the fields the user asked for, not whole records; do not paste personal data into chat that the user did not request.
- Before any write, show the user exactly what will change and wait for a yes.
- Respect the documented limits above: page through results and back off on rate-limit responses instead of retrying in a loop.

## References

- Snowflake SQL API: https://docs.snowflake.com/en/developer-guide/sql-api/index
- Authenticating to the SQL API: https://docs.snowflake.com/en/developer-guide/sql-api/authenticating
- Snowflake-managed MCP server: https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-agents-mcp
- Snowflake-managed MCP server: https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-agents-mcp
- This connector on ibl.ai: https://ibl.ai/developer/connectors/snowflake
- ibl.ai MCP server connections: https://ibl.ai/developer/platform/mcp/mcp-connections
