DEV Community

Tsubasa Kanno
Tsubasa Kanno

Posted on

Unlock Advanced Data Analytics in Cursor with Snowflake MCP Server

Introduction

The AI agent revolution in development is truly gaining momentum! The Model Context Protocol (MCP), a standardized protocol from Anthropic, now enables seamless connections between LLMs and various tools and APIs. And exciting news - Snowflake has released their official MCP Server as open source!

While Cortex Search and Cortex Analyst were previously available as individual features, the recent addition of SQL execution capabilities means you can now access Snowflake's analytics environment directly from MCP clients (like Cursor or Claude Desktop). Simply give natural language instructions to your AI agent and complete your data analysis - this is a game-changer for developers!

In this article, I'll walk you through setting up and using the Snowflake-Labs MCP Server with Cursor, explore the analytics possibilities it unlocks, and discuss when to use it versus Snowflake Intelligence. If you're an engineer looking to analyze Snowflake data more efficiently, this guide is for you!

Note: Tools provided by Snowflake-Labs are positioned as community tools and are not officially supported by Snowflake Inc.

Note: This article represents my personal views and not those of Snowflake.

What is Snowflake MCP Server?

Snowflake MCP Server is an official OSS tool that integrates various Snowflake features into the MCP ecosystem. By connecting with MCP clients (Cursor, Claude Desktop, fast-agent, etc.), you can operate Snowflake's powerful data analytics capabilities through AI agents.

Key Features

The current Snowflake MCP Server supports these capabilities:

Feature Category Description
Cortex Search Search unstructured data
Cortex Analyst Analyze structured data using semantic models (including Semantic Views)
SQL Execution Execute LLM-generated SQL queries
Object Management Create, drop, and update databases, schemas, tables, views, warehouses, etc.

Technical Characteristics

  • Local Execution: Current version runs locally, initiated by the MCP client
  • Flexible Permission Management: Fine-grained control over SQL execution permissions (e.g., allowing only SELECT statements)
  • Multi-Service Support: Configure multiple Cortex Search / Cortex Analyst services simultaneously

Choosing Between Snowflake Intelligence and MCP Server

If you're familiar with Snowflake, you might wonder: "We already have Snowflake Intelligence - how should I choose between them?" Here's my perspective:

When Snowflake Intelligence is Better

Aspect Details
Target Users Business users, analysts
Environment Web browser-based GUI
Main Use Cases Enterprise data analysis app deployment, report creation
Advantages Easy setup, intuitive GUI operation. All environments managed by Snowflake for enhanced security
Deployment Easy organization-wide rollout

When Snowflake MCP Server is Better

Aspect Details
Target Users Engineers, developers
Environment Development tools like Cursor, Claude Desktop
Main Use Cases Ad-hoc data analysis during development, CI/CD integration
Advantages Integrates with development workflow, analyze data alongside code
Deployment Individual or team-level usage

In essence: Choose Intelligence for easy enterprise-wide natural language analysis app deployment, and MCP Server for integrating Snowflake analytics into engineering MCP clients. When in doubt, start with the easier-to-adopt Snowflake Intelligence to clarify business expectations, then consider MCP Server as needed.

Setting Up with Cursor

Let's set up the Snowflake MCP Server with Cursor! I'll demonstrate the convenient approach using PAT (Programmatic Access Token).

1. Prerequisites

Installing uvx

To run Snowflake MCP Server, you need uvx, the execution command for the uv Python package management tool. If you haven't installed it yet:

# For macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# Or install with pipx
pipx install uv
Enter fullscreen mode Exit fullscreen mode

After installation, verify success with uvx --version.

Note: uvx is a tool for running Python packages in isolated environments. See uv's official documentation for details.

Generating a PAT

Log into Snowsight and generate a PAT following these steps:

  1. Click your profile icon in the bottom left and select Settings
  2. Navigate to the Authentication section
  3. Click the Generate New Token button
  4. Set the token name and expiration
  5. Select required permissions (role)
  6. Copy the generated token

PAT Generation Screenshot

Note: When generating a PAT, select a role with access to Cortex Search / Cortex Analyst services and the tables you'll analyze.

Important: By default, using a PAT requires a network policy to be configured. Without a network policy setup, PAT authentication may fail. For detailed PAT requirements and configuration, please refer to the official Snowflake documentation.

Preparing Cortex Search / Cortex Analyst

If you plan to use Cortex Search or Cortex Analyst with Snowflake MCP Server, you need to prepare these in advance:

For Cortex Search

You need to create a Cortex Search Service beforehand. Cortex Search Service makes unstructured data (documents, logs, text data, etc.) searchable.

For creation instructions, see the Cortex Search official documentation.

For Cortex Analyst

You need to create a Semantic Model or Semantic View beforehand. These add business context to structured data, enabling natural language query generation (Text2SQL).

Note: Creating Cortex Search Services, Semantic Models, or Semantic Views requires appropriate permissions. After creation, verify that the role specified in your PAT can access them.

Creating the Service Configuration File

Next, create a tools_config.yaml file defining Cortex services and SQL permissions. A template is available on GitHub for reference.

Note: The configuration file format may be updated in the future, so always check the latest template on GitHub.

Here's an example configuration:

# Cortex Search Service configuration
search_services:
  - service_name: "<Your Cortex Search Service name in Snowflake>"
    description: >
      "<Detailed description of your Cortex Search Service>"
    database_name: "<Database containing Cortex Search Service>"
    schema_name: "<Schema containing Cortex Search Service>"
    columns: []
    limit: 10

# Cortex Analyst Service configuration
analyst_services:
  - service_name: "<Custom name for your semantic model or semantic view>"
    semantic_model: "<Full path to semantic model or semantic view in Snowflake>"
    description: >
      "<Detailed description of your semantic model or semantic view>"

# SQL execution permission settings
sql_statement_permissions:
  # - All: True           # Uncomment this line to allow all SQL statements
  - Alter: False          # Whether to allow ALTER statements
  - Command: False        # Whether to allow COMMAND statements
  - Comment: False        # Whether to allow COMMENT statements
  - Commit: False         # Whether to allow COMMIT statements
  - Create: False         # Whether to allow CREATE statements
  - Delete: False         # Whether to allow DELETE statements
  - Describe: True        # Whether to allow DESCRIBE statements
  - Drop: False           # Whether to allow DROP statements
  - Insert: False         # Whether to allow INSERT statements
  - Merge: False          # Whether to allow MERGE statements
  - Rollback: False       # Whether to allow ROLLBACK statements
  - Select: True          # Whether to allow SELECT statements
  - Transaction: False    # Whether to allow TRANSACTION statements
  - TruncateTable: False  # Whether to allow TRUNCATE TABLE statements
  - Unknown: False        # Whether to allow undefined SQL statements
  - Update: False         # Whether to allow UPDATE statements
  - Use: True             # Whether to allow USE statements
Enter fullscreen mode Exit fullscreen mode

Cursor interprets this configuration file to utilize various tools. Therefore, provide as much detail as possible in descriptions to help the AI Agent call the appropriate tools.

2. Configuring Cursor MCP

Configure MCP in Cursor. Open MCP&Integrations settings in Cursor, click "New MCP Server" to open the mcp.json editor:

Cursor MCP Settings Screenshot

Alternatively, you can directly edit the configuration file (~/.cursor/mcp.json):

{
  "mcpServers": {
    "mcp-server-snowflake": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/Snowflake-Labs/mcp",
        "mcp-server-snowflake",
        "--service-config-file",
        "<Full path to your tools_config.yaml>",
        "--account",
        "<Your Snowflake account identifier>",
        "--user",
        "<Your Snowflake username>",
        "--password",
        "<Your PAT created earlier>"
      ]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Note: For the --account parameter, if your Snowflake account identifier contains underscores like "ORGNAME-AAA_BBB_CCC", change them to hyphens like "ORGNAME-AAA-BBB-CCC".

Note: Set the PAT you generated earlier for the --password parameter. While regular passwords work, using PATs is recommended for security.

3. Verifying Connection

After configuration, click the MCP Server button you created in Cursor's MCP Server settings to start it. When successfully connected, a green indicator lights up on the MCP Server icon, and Snowflake features become available in Cursor's chat interface.

Connection Success Screenshot

Practical Examples

Let's explore data analysis using Snowflake MCP Server from Cursor!

Example 1: Natural Language Data Exploration

Type this in Cursor's chat:

List all Snowflake databases.
Enter fullscreen mode Exit fullscreen mode

MCP Server automatically generates and executes appropriate SQL, returning results:

SNOWFLAKE Database List

1. SALES
Database managing customer sales data

2. CUSTOMER
Database managing customer information
...
Enter fullscreen mode Exit fullscreen mode

The AI Agent generates and executes appropriate SQL within your Snowflake role's permissions and the SQL statements allowed in your tools_config.yaml.

Example 2: Searching Unstructured Data with Cortex Search

When searching for specific information from internal documents:

Summarize the operations manual.
Enter fullscreen mode Exit fullscreen mode

The configured Cortex Search Service is automatically called, returning relevant information:

πŸ“š RetailCorp Operations Manual Summary
🏒 Company Philosophy
Mission: "Delivering exceptional customer experiences through innovation and quality"
Core Values:
Customer-first approach
Operational excellence
Sustainable growth
Employee empowerment
...
Enter fullscreen mode Exit fullscreen mode

Example 3: Complex Analysis Queries

Analyze monthly sales trends for H2 2024 and identify variation factors.
Enter fullscreen mode Exit fullscreen mode

Cortex Analyst interprets the semantic model or semantic view, generates appropriate SQL queries, and Cursor's AI Agent executes them, returning results:

πŸ“Š H2 2024 Sales Analysis Report

πŸ“ˆ Monthly Sales Trends
Month       Sales ($)   MoM Change  Features
July        152,435     -       H2 Start
August      248,291     +62.8%      Peak month
September   201,762     -18.8%      High level maintained
October     149,698     -25.8%      Sales decline
November    145,386     -2.9%       Lowest month
December    292,847     +101.3%     Holiday surge
Total       1,190,419   -       H2 Total

πŸ” Key Variation Factors
1. Seasonal Factors
August: Back-to-school season peak
High-volume sales of electronics and premium products
Product lineup generating $75K per SKU

December: Holiday shopping season
Sales more than doubled from previous month
December 16 ($107,145) and 24 ($106,221) were exceptional days
Black Friday and Cyber Monday impact
...
Enter fullscreen mode Exit fullscreen mode

Best Practices

Permission Configuration Guidelines

Enable secure operations with different permission settings for development and production environments:

  • Development: Allow Select, Describe, Use, Create, Insert, etc.
  • Production: Allow only Select, Describe, Use
  • Admin: Set All: True as needed

Conclusion

Snowflake MCP Server is a revolutionary tool that significantly enhances the developer experience. It delivers particular value through:

  • Development Flow Integration: Analyze data without leaving Cursor
  • Natural Language Operations: Execute complex analysis tasks with natural language instructions to AI Agents without writing SQL
  • Secure Execution Environment: Safe usage through granular permission controls

Having tried it myself, I find it incredibly convenient to complete everything within Cursor without switching tools when wondering "What was that table structure?" or "I need to check sales trends for this period."

While Snowflake Intelligence is a powerful tool for promoting organization-wide data utilization, MCP Server integrated with daily development tools offers different value for engineers and data scientists. By choosing the right tool for each use case, we can achieve more efficient data utilization.

Give Snowflake MCP Server a try today!

Promotion

Snowflake What's New Updates on X

I share Snowflake What's New updates on X. Follow for the latest insights:

English Version

Snowflake What's New Bot (English Version)

Japanese Version

Snowflake's What's New Bot (Japanese Version)

Change Log

(20250901) Initial post

Original Japanese Article

https://zenn.dev/tsubasa_tech/articles/70ab5fb2b5ed99

Top comments (0)