Snowflake Cortex AI MCP Server

Snowflake Cortex AI MCP Server

Integrates Snowflake Cortex AI features like Cortex Search and Analyst into the MCP ecosystem, enabling retrieval-augmented generation and structured data analysis. It also provides tools for chat completions and agentic orchestration using Snowflake-hosted large language models.

Category
访问服务器

README

Snowflake Cortex AI Model Context Protocol (MCP) Server

<a href="https://emerging-solutions-toolbox.streamlit.app/"> <img src="https://github.com/user-attachments/assets/aa206d11-1d86-4f32-8a6d-49fe9715b098" alt="image" width="150" align="right";"> </a>

This Snowflake MCP server provides tooling for Snowflake Cortex AI features, bringing these capabilities to the MCP ecosystem. When connected to an MCP Client (e.g. Claude for Desktop, fast-agent, Agentic Orchestration Framework), users can leverage these Cortex AI features.

The MCP server currently supports the below Cortex AI capabilities:

  • Cortex Search: Query unstructured data in Snowflake as commonly used in Retrieval Augmented Generation (RAG) applications.
  • Cortex Analyst: Query structured data in Snowflake via rich semantic modeling.
  • Cortex Complete: Simple chat-completion with optional parameters using a number of available LLMs
  • Cortex Agent: (Coming Soon) Agentic orchestrator across structured and unstructured data retrieval

Getting Started

Service Configuration

A simple configuration file is used to create tooling for the various Cortex AI features. An example can be seen at services/service_config.yaml and a template is below. Many Cortex Search and Cortex Analyst services can be added. Ideal descriptions are both highly descriptive and mutually exclusive. The path to this configuration file will be passed to the server and the contents used to create MCP server tools at startup.

cortex_complete: # Set default model if one is not specified by user in Cortex Copmlete tool
  default_model: "snowflake-llama-3.3-70b"
search_services: # List all Cortex Search services
  - service_name: "<service_name>"
    description: > # Should start with "Search service that ..."
      "<Search services that ...>"
    database_name: "<database_name>"
    schema_name: "<schema_name>"
  - service_name: "<service_name>"
    description: > # Should start with "Search service that ..."
      "<Search services that ...>"
    database_name: "<database_name>"
    schema_name: "<schema_name>"
analyst_services: # List all Cortex Analyst semantic models/views
  - service_name: "<service_name>" # Create descriptive name for the service
    semantic_model: "<semantic_yaml_or_view>" # Fully-qualify semantic YAML model or Semantic View
    description: > # Should start with "Analyst service that ..."
      "<Analyst service that ...>"
  - service_name: "<service_name>" # Create descriptive name for the service
    semantic_model: "<semantic_yaml_or_view>" # Fully-qualify semantic YAML model or Semantic View
    description: > # Should start with "Analyst service that ..."
      "<Analyst service that ...>"

Snowflake Account Identifier

A Snowflake username and account identifier will be necessary to connect. From Snowsight, select your user name and Connect a tool to Snowflake to obtain your Snowflake account identifier. This will be passed to the server at startup.

Programmatic Access Token Authentication

The MCP server uses Snowflake Programmatic Access Token (PAT) for authentication. Follow the instructions to generate a new PAT for a given user. Be sure to copy the token - it will be passed to the server at startup.

[!IMPORTANT] PATs do not use secondary roles. Either select a specific role that has access to all desired services and their related objects OR select Any of my roles.

Using with MCP Clients

The MCP server is client-agnostic and will work with most MCP Clients that support basic functionality for MCP tools and (optionally) resources. Below are some examples.

Claude Desktop

To integrate this server with Claude Desktop as the MCP Client, add the following to your app's server configuration. By default, this is located at

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Set the path to the service configuration file and values for environment variables SNOWFLAKE_PAT, SNOWFLAKE_ACCOUNT, and SNOWFLAKE_USER.

{
  "mcpServers": {
    "mcp-server-snowflake": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/Snowflake-Labs/mcp",
        "mcp-server-snowflake",
        "--service-config-file",
        "<path to file>/service_config.yaml"
      ]
      "env": {
        "SNOWFLAKE_PAT": "<programmatic_access_token>",
        "SNOWFLAKE_ACCOUNT": "<account-identifier>",
        "SNOWFLAKE_USER": "<username>"
      }
    }
  }
}

Cursor

Register the MCP server in cursor by opening Cursor and navigating to Settings -> Cursor Settings -> MCP. Add the below.

{
  "mcpServers": {
    "mcp-server-snowflake": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/Snowflake-Labs/mcp",
        "mcp-server-snowflake",
        "--service-config-file",
        "<path to file>/service_config.yaml",
        "--account-identifier",
        "<account-identifier>",
        "--username",
        "<username>",
        "--pat",
        "<programmatic_access_token>"
      ]
    }
  }
}

Add the MCP server as context in the chat.

<img src="./images/Cursor.gif" width="800" height="500"/>

For troubleshooting Cursor server issues, view the logs by opening the Output panel and selecting Cursor MCP from the dropdown menu.

fast-agent

Update the fastagent.config.yaml mcp server section with an updated path to the configuration file.

# MCP Servers
mcp:
    servers:
        mcp-server-snowflake:
            command: "uvx"
            args: ["--from", "git+https://github.com/Snowflake-Labs/mcp", "mcp-server-snowflake", "--service-config-file", "<path to file>/service_config.yaml"]

Update the fastagent.secrets.yaml mcp server section with environment variables.

mcp:
    servers:
        mcp-server-snowflake:
            env:
                SNOWFLAKE_PAT: <add-PAT>
                SNOWFLAKE_ACCOUNT: <add-snowflake-account-identifier>
                SNOWFLAKE_USER: <add-snowflake-username>

<img src="./images/fast-agent.gif" width="800" height="500"/>

Troubleshooting

Running MCP Inspector

MCP Inspector is suggested for troubleshooting the MCP server. Run the below to launch the inspector. Be sure to set values for service config file, SNOWFLAKE_ACCOUNT, SNOWFLAKE_USER, and SNOWFLAKE_PAT are set accordingly.

npx @modelcontextprotocol/inspector uvx --from "git+https://github.com/Snowflake-Labs/mcp" mcp-server-snowflake --service-config-file "<path_to_file>/service_config.yaml" --account-identifier $SNOWFLAKE_ACCOUNT --username $SNOWFLAKE_USER --pat $SNOWFLAKE_PAT

FAQs

How do I try this?

  • The MCP server is intended to be used as one part of the MCP ecosystem. Think of it as a collection of tools. You'll need an MCP Client to act as an orchestrator. See the MCP Introduction for more information.

Where is this deployed? Is this in Snowpark Container Services?

  • All tools in this MCP server are managed services, accessible via REST API. No separate remote service deployment is necessary. Instead, the current version of the server is intended to be started by the MCP client, such as Claude Desktop, Cursor, fast-agent, etc. By configuring these MCP client with the server, the application will spin up the server service for you. Future versions of the MCP server may be deployed as a remote service in the future.

I'm receiving permission errors from my tool calls.

  • Programmatic Access Tokens do not evaluate secondary roles. When creating them, please select a single role that has access to all services and their underlying objects OR select any role. A new PAT will need to be created to alter this property.

How many Cortex Search or Cortex Analysts can I add?

  • You may add multiple instances of both services. The MCP Client will determine the appropriate one(s) to use based on the user's prompt.

Bug Reports, Feedback, or Other Questions

Please add issues to the GitHub repository.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选