Skip to content
Back to search

mcp

MCP Server for Snowflake including Cortex AI, object management, SQL orchestration, semantic view consumption, and more

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/snowflake-labs--mcp/badge.svg)](/listings/snowflake-labs--mcp)

HTML

<a href="/listings/snowflake-labs--mcp"><img src="/api/listings/snowflake-labs--mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Service Configuration

A simple configuration file is used to drive all tooling. An example can be seen at [services/configuration.yaml](services/configuration.yaml) and a template is below. The path to this configuration file will be passed to the server and the contents used to create MCP server tools at startup.

**Cortex Services**

Many Cortex Agent, Search, and Analyst services can be added. Ideal descriptions are both highly descriptive and mutually exclusive. Only the explicitly listed Cortex services will be available as tools in the MCP client.

**Other Services**

Other services include tooling for [object management](object-management), [query execution](sql-execution), and [semantic view usage](semantic-view-querying). These groups of tools can be enabled by setting them to True in the `other_services` section of the configuration file.

**SQL Statement Permissions**

The `sql_statement_permissions` section ensures that only approved statements are executed across any tools with access to change Snowflake objects. The list contains SQL expression types. Those marked with True are permitted while those marked with False are not permitted. Please see [SQL Execution](#sql-execution) for examples of each expression type.

agent_services: # List all Cortex Agent services
  - service_name: <service_name>
    description: > # Describe contents of the agent service
      <Agent service that ...>
    database_name: <database_name>
    schema_name: <schema_name>
  - service_name: <service_name>
    description: > # Describe contents of the agent service
      <Agent service that ...>
    database_name: <database_name>
    schema_name: <schema_name>
search_services: # List all Cortex Search services
  - service_name: <service_name>
    description: > # Describe contents of the search service
      <Search services that ...>
    database_name: <database_name>
    schema_name: <schema_name>
  - service_name: <service_name>
    description: > # Describe contents of the search service
      <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: > # Describe contents of the analyst service
      <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: > # Describe contents of the analyst service
      <Analyst service that ...>
other_services: # Set desired tool groups to True to enable tools for that group
  object_manager: True # Perform basic operations against Snowflake's most common objects such as creation, dropping, updating, and more.
  query_manager: True # Run LLM-generated SQL managed by user-configured permissions.
  semantic_manager: True # Discover and query Snowflake Semantic Views and their components.
sql_statement_permissions: # List SQL statements to explicitly allow (True) or disallow (False).
  # - All: True # To allow everything, uncomment and set All: True.
  - Alter: True
  - Command: True
  - Comment: True
  - Commit: True
  - Copy: True
  - Create: True
  - Delete: True
  - Describe: True
  - Drop: True
  - Insert: True
  - Merge: True
  - Rollback: True
  - Select: True
  - Transaction: True
  - TruncateTable: True
  - Unknown: False # To allow unknown or unmapped statement types, set Unknown: True.
  - Update: True
  - Use: True

> [!NOTE] > Previous versions of the configuration file supported specifying explicit values for columns and limit for each Cortex Search service. Instead, these are now exclusively dynamic based on user prompt. If not specified, a search service's default search_columns will be returned with a limit of 10.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 652 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # [DEPRECATED] Snowflake Cortex AI Model Context Protocol (MCP) Server
  2. > [!CAUTION]
  3. > **This project is deprecated and no longer maintained.** Please migrate to the official [Snowflake MCP Server](https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-agents-mcp). The official server is actively developed, fully supported by Snowflake, and continues to add new features.
  4. This community MCP server previously provided tooling for Snowflake Cortex AI, object management, and SQL orchestration. It is no longer supported. For all new and existing use cases, please use the official [Snowflake MCP Server](https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-agents-mcp) instead.
  5. ---
  6. <details>
  7. <summary>Legacy documentation (for reference only)</summary>
  8. The MCP server supported the below capabilities:
  9. - **[Cortex Search](https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-search/cortex-search-overview)**: Query unstructured data in Snowflake as commonly used in Retrieval Augmented Generation (RAG) applications.
  10. - **[Cortex Analyst](https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-analyst)**: Query structured data in Snowflake via rich semantic modeling.
  11. - **[Cortex Agent](https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-agents)**: Agentic orchestrator across structured and unstructured data retrieval
  12. - **Object Management**: Perform basic operations against Snowflake's most common objects such as creation, dropping, updating, and more.
  13. - **SQL Execution**: Run LLM-generated SQL managed by user-configured permissions.
  14. - **[Semantic View Querying](https://docs.snowflake.com/en/user-guide/views-semantic/overview)**: Discover and query Snowflake Semantic Views
  15. # Getting Started
  16. ## Service Configuration
  17. A simple configuration file is used to drive all tooling. An example can be seen at [services/configuration.yaml](services/configuration.yaml) and a template is below. The path to this configuration file will be passed to the server and the contents used to create MCP server tools at startup.
  18. **Cortex Services**
  19. Many Cortex Agent, Search, and Analyst services can be added. Ideal descriptions are both highly descriptive and mutually exclusive.
  20. Only the explicitly listed Cortex services will be available as tools in the MCP client.
  21. **Other Services**
  22. Other services include tooling for [object management](object-management), [query execution](sql-execution), and [semantic view usage](semantic-view-querying).
  23. These groups of tools can be enabled by setting them to True in the `other_services` section of the configuration file.
  24. **SQL Statement Permissions**
  25. The `sql_statement_permissions` section ensures that only approved statements are executed across any tools with access to change Snowflake objects.
  26. The list contains SQL expression types. Those marked with True are permitted while those marked with False are not permitted. Please see [SQL Execution](#sql-execution) for examples of each expression type.
  27. ```
  28. agent_services: # List all Cortex Agent services
  29. - service_name: <service_name>
  30. description: > # Describe contents of the agent service
  31. <Agent service that ...>
  32. database_name: <database_name>
  33. schema_name: <schema_name>
  34. - service_name: <service_name>
  35. description: > # Describe contents of the agent service
  36. <Agent service that ...>
  37. database_name: <database_name>
  38. schema_name: <schema_name>
  39. search_services: # List all Cortex Search services
  40. - service_name: <service_name>
  41. description: > # Describe contents of the search service
  42. <Search services that ...>
  43. database_name: <database_name>
  44. schema_name: <schema_name>
  45. - service_name: <service_name>
  46. description: > # Describe contents of the search service
  47. <Search services that ...>
  48. database_name: <database_name>
  49. schema_name: <schema_name>
  50. analyst_services: # List all Cortex Analyst semantic models/views
  51. - service_name: <service_name> # Create descriptive name for the service
  52. semantic_model: <semantic_yaml_or_view> # Fully-qualify semantic YAML model or Semantic View
  53. description: > # Describe contents of the analyst service
  54. <Analyst service that ...>
  55. - service_name: <service_name> # Create descriptive name for the service
  56. semantic_model: <semantic_yaml_or_view> # Fully-qualify semantic YAML model or Semantic View
  57. description: > # Describe contents of the analyst service
  58. <Analyst service that ...>
  59. other_services: # Set desired tool groups to True to enable tools for that group
  60. object_manager: True # Perform basic operations against Snowflake's most common objects such as creation, dropping, updating, and more.
  61. query_manager: True # Run LLM-generated SQL managed by user-configured permissions.
  62. semantic_manager: True # Discover and query Snowflake Semantic Views and their components.
  63. sql_statement_permissions: # List SQL statements to explicitly allow (True) or disallow (False).
  64. # - All: True # To allow everything, uncomment and set All: True.
  65. - Alter: True
  66. - Command: True
  67. - Comment: True
  68. - Commit: True
  69. - Copy: True
  70. - Create: True
  71. - Delete: True
  72. - Describe: True
  73. - Drop: True
  74. - Insert: True
  75. - Merge: True
  76. - Rollback: True
  77. - Select: True
  78. - Transaction: True
  79. - TruncateTable: True
  80. - Unknown: False # To allow unknown or unmapped statement types, set Unknown: True.
  81. - Update: True
  82. - Use: True
  83. ```
  84. > [!NOTE]
  85. > Previous versions of the configuration file supported specifying explicit values for columns and limit for each Cortex Search service. Instead, these are now exclusively dynamic based on user prompt. If not specified, a search service's default search_columns will be returned with a limit of 10.
  86. ## Connecting to Snowflake
  87. The MCP server uses the [Snowflake Python Connector](https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-connect) for all authentication and connection methods. **Please refer to the official Snowflake documentation for comprehensive authentication options and best practices.**
  88. **The MCP server honors the RBAC permissions assigned to the specified role (as passed in the connection parameters) or default role of the user (if no role is passed to connect).**
  89. Connection parameters can be passed as CLI arguments and/or environment variables. The server supports all authentication methods available in the Snowflake Python Connector, including:
  90. - Username/password authentication
  91. - Key pair authentication
  92. - OAuth authentication
  93. - Single Sign-On (SSO)
  94. - Multi-factor authentication (MFA)
  95. ### Connection Parameters
  96. Connection parameters can be passed as CLI arguments and/or environment variables:
  97. | Parameter | CLI Arguments | Environment Variable | Description |
  98. |-----------|--------------|---------------------|-------------|
  99. | Account | --account | SNOWFLAKE_ACCOUNT | Account identifier (e.g. xy12345.us-east-1) |
  100. | Host | --host | SNOWFLAKE_HOST | Snowflake host URL |
  101. | User | --user, --username | SNOWFLAKE_USER | Username for authentication |
  102. | Password | --password | SNOWFLAKE_PASSWORD | Password or programmatic access token |
  103. | Role | --role | SNOWFLAKE_ROLE | Role to use for connection |
  104. | Warehouse | --warehouse | SNOWFLAKE_WAREHOUSE | Warehouse to use for queries |
  105. | Passcode in Password | --passcode-in-password | - | Whether passcode is embedded in password |
  106. | Passcode | --passcode | SNOWFLAKE_PASSCODE | MFA passcode for authentication |
  107. | Private Key | --private-key | SNOWFLAKE_PRIVATE_KEY | Private key for key pair authentication |
  108. | Private Key File | --private-key-file | SNOWFLAKE_PRIVATE_KEY_FILE | Path to private key file |
  109. | Private Key Password | --private-key-file-pwd | SNOWFLAKE_PRIVATE_KEY_FILE_PWD | Password for encrypted private key |
  110. | Authenticator | --authenticator | - | Authentication type (default: snowflake) |
  111. | Connection Name | --connection-name | - | Name of connection from connections.toml (or config.toml) file |
  112. > [!WARNING]
  113. > **Deprecation Notice**: The CLI arguments `--account-identifier` and `--pat`, as well as the environment variable `SNOWFLAKE_PAT`, are deprecated and will be removed in a future release. Please use `--account` and `--password` (or `SNOWFLAKE_ACCOUNT` and `SNOWFLAKE_PASSWORD`) instead.
  114. # Transport Configuration
  115. The MCP server supports multiple transport mechanisms. For detailed information about MCP transports, see [FastMCP Transport Protocols](https://gofastmcp.com/deployment/running-server#transport-protocols).
  116. | Transport | Description | Use Case |
  117. |-----------|-------------|----------|
  118. | `stdio` | Standard input/output (default) | Local development, MCP client integration |
  119. | `sse` (legacy) | Server-Sent Events | Streaming applications |
  120. | `streamable-http` | Streamable HTTP transport | Container deployments, remote servers |
  121. ## Usage
  122. ```bash
  123. # Default stdio transport
  124. uvx snowflake-labs-mcp --service-config-file config.yaml
  125. # HTTP transport with custom endpoint
  126. uvx snowflake-labs-mcp --service-config-file config.yaml --transport streamable-http --endpoint /my-endpoint
  127. # For containers (uses streamable-http on port 9000)
  128. uvx snowflake-labs-mcp --service-config-file config.yaml --transport streamable-http --endpoint /snowflake-mcp
  129. ```
  130. ## Transport Customizations
  131. Server customizations available for `sse` and `streamable-http` transports:
  132. | Parameter | CLI Argument | Environment Variable | Default |
  133. |-----------|--------------|---------------------|------------------|
  134. | Host | --server-host | SNOWFLAKE_MCP_HOST | "0.0.0.0"
  135. | Port | --port | SNOWFLAKE_MCP_PORT | 9000
  136. | Endpoint | --endpoint | SNOWFLAKE_MCP_ENDPOINT | /mcp
  137. | Debug Logging | --verbose | SNOWFLAKE_MCP_VERBOSE | false
  138. Example:
  139. ```bash
  140. export SNOWFLAKE_MCP_ENDPOINT="/my-mcp"
  141. uvx snowflake-labs-mcp --service-config-file config.yaml --transport streamable-http
  142. ```
  143. # Using with MCP Clients
  144. 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 examples for local installation. For connecting to containerized deployments, see [Connecting MCP Clients to Containers](#connecting-mcp-clients-to-containers).
  145. ## [Claude Desktop](https://support.anthropic.com/en/articles/10065433-installing-claude-for-desktop)
  146. 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:
  147. - macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  148. - Windows: %APPDATA%\Claude\claude_desktop_config.json
  149. Set the path to the service configuration file and configure your connection method:
  150. ```json
  151. {
  152. "mcpServers": {
  153. "mcp-server-snowflake": {
  154. "command": "uvx",
  155. "args": [
  156. "snowflake-labs-mcp",
  157. "--service-config-file",
  158. "<path_to_file>/tools_config.yaml",
  159. "--connection-name",
  160. "default"
  161. ]
  162. }
  163. }
  164. }
  165. ```
  166. ## [Cursor](https://www.cursor.com/)
  167. Register the MCP server in Cursor by opening Cursor and navigating to Settings -> Cursor Settings -> MCP. Add the below:
  168. ```json
  169. {
  170. "mcpServers": {
  171. "mcp-server-snowflake": {
  172. "command": "uvx",
  173. "args": [
  174. "snowflake-labs-mcp",
  175. "--service-config-file",
  176. "<path_to_file>/tools_config.yaml",
  177. "--connection-name",
  178. "default"
  179. ]
  180. }
  181. }
  182. }
  183. ```
  184. Add the MCP server as context in the chat.
  185. <img src="https://sfquickstarts.s3.us-west-1.amazonaws.com/misc/mcp/Cursor.gif" width="800"/>
  186. For troubleshooting Cursor server issues, view the logs by opening the Output panel and selecting Cursor MCP from the dropdown menu.
  187. ## [fast-agent](https://fast-agent.ai/)
  188. Update the `fastagent.config.yaml` mcp server section with the configuration file path and connection name:
  189. ```yaml
  190. # MCP Servers
  191. mcp:
  192. servers:
  193. mcp-server-snowflake:
  194. command: "uvx"
  195. args: ["snowflake-labs-mcp", "--service-config-file", "<path_to_file>/tools_config.yaml", "--connection-name", "default"]
  196. ```
  197. <img src="https://sfquickstarts.s3.us-west-1.amazonaws.com/misc/mcp/fast-agent.gif" width="800"/>
  198. ## Microsoft Visual Studio Code + GitHub Copilot
  199. For prerequisites, environment setup, step-by-step guide and instructions, please refer to this [blog](https://medium.com/snowflake/build-a-natural-language-data-assistant-in-vs-code-with-copilot-mcp-and-snowflake-cortex-ai-04a22a3b0f17).
  200. <img src="https://sfquickstarts.s3.us-west-1.amazonaws.com/misc/mcp/dash-dark-mcp-copilot.gif"/>
  201. ## [Codex](https://github.com/openai/codex)
  202. Register the MCP server in codex by adding the following to `~/.codex/config.toml`
  203. ```toml
  204. [mcp_servers.mcp-server-snowflake]
  205. command = "uvx"
  206. args = [
  207. "snowflake-labs-mcp",
  208. "--service-config-file",
  209. "<path_to_file>/tools_config.yaml",
  210. "--connection-name",
  211. "default"
  212. ]
  213. ```
  214. After editing, the snowflake mcp should appear in the output of `codex mcp list` run from the terminal.
  215. # Container Deployment
  216. Deploy the MCP server as a container for remote access or production environments. This guide provides step-by-step instructions for both Docker and Docker Compose deployments.
  217. ## Docker Deployment
  218. Follow these steps to deploy the MCP server using Docker:
  219. ### Step 1: Prepare Configuration File
  220. Create a directory for MCP configuration and copy the template:
  221. ```bash
  222. mkdir -p ${HOME}/.mcp/
  223. cp services/configuration.yaml ${HOME}/.mcp/tools_config.yaml
  224. ```
  225. ### Step 2: Configure Services
  226. Edit the configuration file to match your environment:
  227. ```bash
  228. # Edit the configuration file as needed
  229. # Update service names, database/schema references, and enable desired features
  230. nano ${HOME}/.mcp/tools_config.yaml
  231. ```
  232. ### Step 3: Build Container Image
  233. Build the Docker image from the provided Dockerfile:
  234. ```bash
  235. docker build -f docker/server/Dockerfile -t mcp-server-snowflake .
  236. ```
  237. ### Step 4: Set Environment Variables
  238. Configure your Snowflake connection parameters. Choose one of the following authentication methods:
  239. **Username/Password Authentication:**
  240. ```bash
  241. export SNOWFLAKE_ACCOUNT=<your_account>
  242. export SNOWFLAKE_USER=<your_username>
  243. export SNOWFLAKE_PASSWORD=<your_password>
  244. ```
  245. **Key Pair Authentication:**
  246. ```bash
  247. export SNOWFLAKE_ACCOUNT=<your_account>
  248. export SNOWFLAKE_USER=<your_username>
  249. export SNOWFLAKE_PRIVATE_KEY="$(cat <path_to_private_key.p8>)"
  250. export SNOWFLAKE_PRIVATE_KEY_FILE_PWD=<your_key_password>
  251. ```
  252. ### Step 5: Run Container
  253. Start the container with your configuration and environment variables:
  254. **For Username/Password Authentication:**
  255. ```bash
  256. docker run -d \
  257. --name mcp-server-snowflake \
  258. -p 9000:9000 \
  259. -e SNOWFLAKE_ACCOUNT=${SNOWFLAKE_ACCOUNT} \
  260. -e SNOWFLAKE_USER=${SNOWFLAKE_USER} \
  261. -e SNOWFLAKE_PASSWORD=${SNOWFLAKE_PASSWORD} \
  262. -v ${HOME}/.mcp/tools_config.yaml:/app/services/tools_config.yaml:ro \
  263. mcp-server-snowflake
  264. ```
  265. **For Key Pair Authentication:**
  266. ```bash
  267. docker run -d \
  268. --name mcp-server-snowflake \
  269. -p 9000:9000 \
  270. -e SNOWFLAKE_ACCOUNT=${SNOWFLAKE_ACCOUNT} \
  271. -e SNOWFLAKE_USER=${SNOWFLAKE_USER} \
  272. -e SNOWFLAKE_PRIVATE_KEY="${SNOWFLAKE_PRIVATE_KEY}" \
  273. -e SNOWFLAKE_PRIVATE_KEY_FILE_PWD=${SNOWFLAKE_PRIVATE_KEY_FILE_PWD} \
  274. -v ${HOME}/.mcp/tools_config.yaml:/app/services/tools_config.yaml:ro \
  275. mcp-server-snowflake
  276. ```
  277. ### Step 6: Verify Deployment
  278. Check that the container is running and accessible:
  279. ```bash
  280. # Check container status
  281. docker ps
  282. # Check container logs
  283. docker logs mcp-server-snowflake
  284. # Test endpoint (should return MCP server info)
  285. curl http://localhost:9000/snowflake-mcp
  286. ```
  287. ## Docker Compose Deployment
  288. Follow these steps for a simplified deployment using Docker Compose:
  289. ### Step 1: Prepare Configuration File
  290. Create the configuration directory and copy the template:
  291. ```bash
  292. mkdir -p ${HOME}/.mcp/
  293. cp services/configuration.yaml ${HOME}/.mcp/tools_config.yaml
  294. ```
  295. ### Step 2: Configure Services
  296. Edit the configuration file to match your environment:
  297. ```bash
  298. # Update service configurations as needed
  299. nano ${HOME}/.mcp/tools_config.yaml
  300. ```
  301. ### Step 3: Set Environment Variables
  302. Configure your Snowflake connection parameters:
  303. ```bash
  304. export SNOWFLAKE_ACCOUNT=<your_account>
  305. export SNOWFLAKE_USER=<your_username>
  306. # For username/password auth:
  307. export SNOWFLAKE_PASSWORD=<your_password>
  308. # For key pair auth, also set:
  309. # export SNOWFLAKE_PRIVATE_KEY="$(cat <path_to_private_key.p8>)"
  310. # export SNOWFLAKE_PRIVATE_KEY_FILE_PWD=<your_key_password>
  311. ```
  312. ### Step 4: Start Services
  313. Launch the container using Docker Compose:
  314. ```bash
  315. docker-compose up -d
  316. ```
  317. ### Step 5: Verify Deployment
  318. Check that the services are running:
  319. ```bash
  320. # Check service status
  321. docker-compose ps
  322. # View logs
  323. docker-compose logs
  324. # Test endpoint
  325. curl http://localhost:9000/snowflake-mcp
  326. ```
  327. ## Connecting MCP Clients to Containers
  328. Once your MCP server is running in a container, you can connect various MCP clients to it. The connection configuration is the same across all clients - only the configuration format differs.
  329. **Connection URL Format:**
  330. - Local deployment: `http://localhost:9000/snowflake-mcp`
  331. - Remote deployment: `http://<hostname>:<port>/snowflake-mcp`
  332. ### Claude Desktop
  333. Add this to your `claude_desktop_config.json`:
  334. ```json
  335. {
  336. "mcpServers": {
  337. "mcp-server-snowflake": {
  338. "url": "http://localhost:9000/snowflake-mcp"
  339. }
  340. }
  341. }
  342. ```
  343. ### Cursor
  344. Add this to your MCP settings in Cursor (Settings -> Cursor Settings -> MCP):
  345. ```json
  346. {
  347. "mcpServers": {
  348. "mcp-server-snowflake": {
  349. "url": "http://localhost:9000/snowflake-mcp"
  350. }
  351. }
  352. }
  353. ```
  354. ### fast-agent
  355. Add this to your `fastagent.config.yaml`:
  356. ```yaml
  357. # MCP Servers
  358. mcp:
  359. servers:
  360. mcp-server-snowflake:
  361. url: "http://localhost:9000/snowflake-mcp"
  362. ```
  363. **Notes:**
  364. - For remote deployments, replace `localhost:9000` with your server's hostname and port
  365. - Ensure your firewall allows connections on port 9000 (or your configured port)
  366. - For production deployments, consider using HTTPS and proper authentication
  367. # Cortex Services
  368. Instances of Cortex Agent (in `agent_services` section), Cortex Search (in `search_services` section), and Cortex Analyst (in `analyst_services` section) of the configuration file will be served as tools. Leave these sections blank to omit such tools.
  369. Only Cortex Agent objects are supported in the MCP server. That is, only Cortex Agent objects pre-configured in Snowflake can be leveraged as tools. See [Cortex Agent Run API](https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-agents-run#streaming-responses) for more details.
  370. Ensure all services have accurate context names for service name, database, schema, etc. Ideal descriptions are both highly descriptive and mutually exclusive.
  371. The `semantic_model` value in analyst services should be a fully-qualified semantic view OR semantic YAML file in a Snowflake stage:
  372. - For a semantic view: `MY_DATABASE.MY_SCHEMA.MY_SEMANTIC_VIEW`
  373. - For a semantic YAML file: `@MY_DATABASE.MY_SCHEMA.MY_STAGE/my_semantic_file.yaml` (**Note the `@`.**)
  374. # Object Management
  375. The MCP server includes dozens of tools narrowly scoped to fulfill basic operation management. It is recommended to use Snowsight directly for advanced object management.
  376. The MCP server currently supports **creating**, **dropping**, **creating or altering**, **describing**, and **listing** the below object types.
  377. **To enable these tools, set `object_manager` to True in the configuration file under `other_services`.**
  378. ```
  379. - Database
  380. - Schema
  381. - Table
  382. - View
  383. - Warehouse
  384. - Compute Pool
  385. - Role
  386. - Stage
  387. - User
  388. - Image Repository
  389. ```
  390. Please note that these tools are also governed by permissions captured in the configuration file under `sql_statement_permissions`.
  391. Object management tools to create and create or alter objects are governed by the `Create` permission. Object dropping is governed by the `Drop` permission.
  392. It is likely that more actions and objects will be included in future releases.
  393. # SQL Execution
  394. The general SQL tool will provide a way to execute generic SQL statements generated by the MCP client. Users have full control over the types of SQL statement that are approved in the configuration file.
  395. Listed in the configuration file under `sql_statement_permissions` are [sqlglot expression types](https://sqlglot.com/sqlglot/expressions.html). Those marked as False will be stopped before execution. Those marked with True will be executed (or prompt the user for execution based on the MCP client settings).
  396. **To enable the SQL execution tool, set `query_manager` to True in the configuration file under `other_services`.**
  397. **To allow all SQL expressions to pass the additional validation, set `All` to True.**
  398. Not all Snowflake SQL commands are mapped in sqlglot and you may find some obscure commands have yet to be captured in the configuration file.
  399. **Setting `Unknown` to True will allow these uncaptured commands to pass the additional validation.** You may also add new expression types directly to honor specific ones.
  400. Below are some examples of sqlglot expression types with accompanying Snowflake SQL command examples:
  401. | SQLGlot Expression Type | SQL Command |
  402. |------------------------|-------------|
  403. | Alter | `ALTER TABLE my_table ADD COLUMN new_column VARCHAR(50);` |
  404. | Command | `CALL my_procedure('param1_value', 123);`<br/>`GRANT ROLE analyst TO USER user1;`<br/>`SHOW TABLES IN SCHEMA my_database.my_schema;` |
  405. | Comment | `COMMENT ON TABLE my_table IS 'This table stores customer data.';` |
  406. | Commit | `COMMIT;` |
  407. | Create | `CREATE TABLE my_table ( id INT, name VARCHAR(255), email VARCHAR(255) );`<br/>`CREATE OR ALTER VIEW my_schema.my_new_view AS SELECT id, name, created_at FROM my_schema.my_table WHERE created_at >= '2023-01-01';` |
  408. | Delete | `DELETE FROM my_table WHERE id = 101;` |
  409. | Describe | `DESCRIBE TABLE my_table;` |
  410. | Drop | `DROP TABLE my_table;` |
  411. | Error | `COPY INTO my_table FROM @my_stage/data/customers.csv FILE_FORMAT = (TYPE = CSV SKIP_HEADER = 1 FIELD_DELIMITER = ',');`<br/>`REVOKE ROLE analyst FROM USER user1;`<br/>`UNDROP TABLE my_table;` |
  412. | Insert | `INSERT INTO my_table (id, name, email) VALUES (102, 'Jane Doe', 'jane.doe@example.com');` |
  413. | Merge | `MERGE INTO my_table AS target USING (SELECT 103 AS id, 'John Smith' AS name, 'john.smith@example.com' AS email) AS source ON target.id = source.id WHEN MATCHED THEN UPDATE SET target.name = source.name, target.email = source.email WHEN NOT MATCHED THEN INSERT (id, name, email) VALUES (source.id, source.name, source.email);` |
  414. | Rollback | `ROLLBACK;` |
  415. | Select | `SELECT id, name FROM my_table WHERE id < 200 ORDER BY name;` |
  416. | Transaction | `BEGIN;` |
  417. | TruncateTable | `TRUNCATE TABLE my_table;` |
  418. | Update | `UPDATE my_table SET email = 'new.email@example.com' WHERE name = 'Jane Doe';` |
  419. | Use | `USE DATABASE my_database;` |
  420. # Semantic View Querying
  421. Several tools support the discovery and querying of [Snowflake Semantic Views](https://docs.snowflake.com/en/user-guide/views-semantic/overview) and their components.
  422. Semantic Views can be **listed** and **described**. In addition, you can **list their metrics and dimensions**.
  423. Lastly, you can **[query Semantic Views](https://docs.snowflake.com/en/user-guide/views-semantic/querying)** directly.
  424. **To enable these tools, set `semantic_manager` to True in the configuration file under `other_services`.**
  425. # Troubleshooting
  426. ## Running MCP Inspector
  427. The [MCP Inspector](https://modelcontextprotocol.io/docs/tools/inspector) is a powerful debugging tool that provides a web interface to interact with your MCP server directly. It's essential for troubleshooting configuration issues, testing tools, and validating your setup.
  428. ### Basic Inspector Usage
  429. Launch the inspector with your MCP server configuration:
  430. ```bash
  431. npx @modelcontextprotocol/inspector uvx snowflake-labs-mcp --service-config-file <path_to_file>/tools_config.yaml --connection-name "default"
  432. ```
  433. ### What the Inspector Shows You
  434. Once launched, the inspector will open a web interface where you can:
  435. 1. **View Available Tools**: See all MCP tools loaded from your configuration file
  436. 2. **Test Tool Execution**: Call tools directly with custom parameters to verify they work
  437. 3. **Inspect Resources**: View any resources exposed by the server
  438. 4. **Debug Connection Issues**: See detailed error messages if connection fails
  439. 5. **Validate Configuration**: Ensure your service configurations are properly loaded
  440. ### Common Troubleshooting Scenarios
  441. **Configuration File Issues:**
  442. - If tools don't appear, check your `tools_config.yaml` syntax
  443. - Verify that service names and database/schema references are correct
  444. - Ensure `other_services` are set to `True` for the tool groups you want
  445. **Connection Problems:**
  446. - Verify your Snowflake connection parameters are correct
  447. - Check that your role has the necessary permissions for the services you've configured
  448. - For key pair authentication, ensure your private key is properly formatted
  449. **Tool Execution Errors:**
  450. - Use the inspector to test individual tools with known-good parameters
  451. - Check the server logs for detailed error messages
  452. - Verify that the underlying Snowflake objects (databases, schemas, services) exist
  453. ### Alternative Debugging Methods
  454. **Using Cursor MCP Logs:**
  455. - Open Output panel in Cursor
  456. - Select "Cursor MCP" from the dropdown
  457. - View real-time logs as you interact with the MCP server
  458. **Command Line Debugging:**
  459. Enable debug logging with `--verbose` or set `SNOWFLAKE_MCP_VERBOSE=true`:
  460. ```bash
  461. uvx snowflake-labs-mcp --service-config-file <path_to_file>/tools_config.yaml --connection-name "default" --verbose
  462. ```
  463. # FAQs
  464. #### How do I connect to Snowflake?
  465. - The MCP server supports all connection methods supported by the Snowflake Python Connector.
  466. See [Connecting to Snowflake with the Python Connector](https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-connect) for more information.
  467. #### I'm receiving a tool limit error/warning.
  468. - While LLMs' support for more tools will likely grow, you can hide tool groups by setting them to False in the configuration file.
  469. Only listed Cortex services will be made into tools as well.
  470. #### Can I use a Programmatic Access Token (PAT) instead of a password?
  471. - Yes. Pass it to the CLI flag --password or set as environment variable SNOWFLAKE_PASSWORD.
  472. #### How do I try this?
  473. - 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](https://modelcontextprotocol.io/introduction) for more information.
  474. #### Where is this deployed? Is this in Snowpark Container Services?
  475. - 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.
  476. #### I'm receiving permission errors from my tool calls.
  477. - If using a Programmatic Access Tokens, note that they 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.
  478. #### How many Cortex Search or Cortex Analysts can I add?
  479. - 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.
  480. #### Help! I'm getting an SSLError?
  481. - If your account name contains underscores, try using the dashed version of the URL.
  482. - Account identifier with underscores: `acme-marketing_test_account`
  483. - Account identifier with dashes: `acme-marketing-test-account`
  484. #### How do I run the MCP server in a container for multiple users?
  485. - Deploy using Docker or Docker Compose as shown in the [Container Deployment](#container-deployment) section. The containerized server runs on HTTP and can handle multiple concurrent MCP client connections. Configure your environment variables for authentication and mount your configuration file as a read-only volume.
  486. #### Why aren't my Cortex services showing up as tools?
  487. - Verify that your configuration file syntax is correct (use MCP Inspector to validate)
  488. - Ensure the service names, database names, and schema names match exactly what exists in Snowflake
  489. - Check that your role has access to the specified databases and schemas
  490. - Confirm that the Cortex services actually exist in the specified locations
  491. #### Can I use different authentication methods for different environments?
  492. - Yes. You can set environment variables differently for each deployment, use different connection names in your connections.toml file, or pass different CLI arguments. The server supports all Snowflake Python Connector authentication methods including username/password, key pairs, OAuth, and SSO.
  493. #### How do I limit which SQL statements can be executed?
  494. - Use the `sql_statement_permissions` section in your configuration file. Set specific statement types to `True` (allow) or `False` (deny). For maximum security, only enable the statement types you actually need. Set `Unknown` to `False` to block unrecognized statement types.
  495. #### The MCP server is slow to start up. Is this normal?
  496. - Initial startup can take a few seconds as the server connects to Snowflake and validates your configuration. Subsequent tool calls should be much faster. If startup takes more than 30 seconds, check your network connection to Snowflake and verify your authentication credentials.
  497. </details>
  498. <!-- mcp-name: io.github.Snowflake-Labs/mcp -->

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.