{"id":28328835,"url":"https://github.com/dynamike/snowflake-mcp-server","last_synced_at":"2025-07-09T20:05:50.567Z","repository":{"id":283519648,"uuid":"948510921","full_name":"dynamike/snowflake-mcp-server","owner":"dynamike","description":"MCP Server for connecting to Snowflake with read-only questions","archived":false,"fork":false,"pushed_at":"2025-04-28T19:38:02.000Z","size":146,"stargazers_count":7,"open_issues_count":2,"forks_count":6,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-22T10:15:54.922Z","etag":null,"topics":["modelcontextprotocol","snowflake"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dynamike.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-14T13:17:25.000Z","updated_at":"2025-06-17T19:55:45.000Z","dependencies_parsed_at":"2025-05-26T08:44:04.393Z","dependency_job_id":"dd9ea793-2d69-4e24-a139-75d119acc8e5","html_url":"https://github.com/dynamike/snowflake-mcp-server","commit_stats":null,"previous_names":["dynamike/mcp-server-snowflake"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/dynamike/snowflake-mcp-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dynamike%2Fsnowflake-mcp-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dynamike%2Fsnowflake-mcp-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dynamike%2Fsnowflake-mcp-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dynamike%2Fsnowflake-mcp-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dynamike","download_url":"https://codeload.github.com/dynamike/snowflake-mcp-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dynamike%2Fsnowflake-mcp-server/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261273967,"owners_count":23133843,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["modelcontextprotocol","snowflake"],"created_at":"2025-05-26T08:31:04.258Z","updated_at":"2025-06-24T10:31:42.245Z","avatar_url":"https://github.com/dynamike.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MCP Server for Snowflake\n\nA Model Context Protocol (MCP) server for performing read-only operations against Snowflake databases. This tool enables Claude to securely query Snowflake data without modifying any information.\n\n## Features\n\n- Flexible authentication to Snowflake using either:\n  - Service account authentication with private key\n  - External browser authentication for interactive sessions\n- Connection pooling with automatic background refresh to maintain persistent connections\n- Support for querying multiple views and databases in a single session\n- Support for multiple SQL statement types (SELECT, SHOW, DESCRIBE, EXPLAIN, WITH)\n- MCP-compatible handlers for querying Snowflake data\n- Read-only operations with security checks to prevent data modification\n- Support for Python 3.12+\n- Stdio-based MCP server for easy integration with Claude Desktop\n\n## Available Tools\n\nThe server provides the following tools for querying Snowflake:\n\n- **list_databases**: List all accessible Snowflake databases\n- **list_views**: List all views in a specified database and schema\n- **describe_view**: Get detailed information about a specific view including columns and SQL definition\n- **query_view**: Query data from a view with an optional row limit\n- **execute_query**: Execute custom read-only SQL queries (SELECT, SHOW, DESCRIBE, EXPLAIN, WITH) with results formatted as markdown tables\n\n## Installation\n\n### Prerequisites\n\n- Python 3.12 or higher\n- A Snowflake account with either:\n  - A configured service account (username + private key), or\n  - A regular user account for browser-based authentication\n- [uv](https://github.com/astral-sh/uv) package manager (recommended)\n\n### Steps\n\n1. Clone this repository:\n   ```\n   git clone https://github.com/yourusername/snowflake-mcp-server.git\n   cd snowflake-mcp-server\n   ```\n\n2. Install the package:\n   ```\n   uv pip install -e .\n   ```\n\n3. Create a `.env` file with your Snowflake credentials:\n\n   Choose one of the provided example files based on your preferred authentication method:\n\n   **For private key authentication**:\n   ```\n   cp .env.private_key.example .env\n   ```\n   Then edit the `.env` file to set your Snowflake account details and path to your private key.\n\n   **For external browser authentication**:\n   ```\n   cp .env.browser.example .env\n   ```\n   Then edit the `.env` file to set your Snowflake account details.\n\n## Usage\n\n### Running with uv\n\nAfter installing the package, you can run the server directly with:\n\n```\nuv run snowflake-mcp\n\n# Or you can be explicit about using stdio transport\nuv run snowflake-mcp-stdio\n```\n\nThis will start the stdio-based MCP server, which can be connected to Claude Desktop or any MCP client that supports stdio communication.\n\nWhen using external browser authentication, a browser window will automatically open prompting you to log in to your Snowflake account.\n\n### Claude Desktop Integration\n\n1. In Claude Desktop, go to Settings → MCP Servers\n2. Add a new server with the full path to your uv executable:\n   ```yaml\n   \"snowflake-mcp-server\": {\n      \"command\": \"uv\",\n      \"args\": [\n         \"--directory\",\n         \"/\u003cpath-to-code\u003e/snowflake-mcp-server\",\n         \"run\",\n         \"snowflake-mcp\"\n      ]\n   }\n   ```\n   \n   Or explicitly specify the stdio transport:\n   \n   ```yaml\n   \"snowflake-mcp-server\": {\n      \"command\": \"uv\",\n      \"args\": [\n         \"--directory\",\n         \"/\u003cpath-to-code\u003e/snowflake-mcp-server\",\n         \"run\",\n         \"snowflake-mcp-stdio\"\n      ]\n   }\n   ```\n3. You can find your uv path by running `which uv` in your terminal\n4. Save the server configuration\n\n### Example Queries\n\nWhen using with Claude, you can ask questions like:\n\n- \"Can you list all the databases in my Snowflake account?\"\n- \"List all views in the MARKETING database\"\n- \"Describe the structure of the CUSTOMER_ANALYTICS view in the SALES database\"\n- \"Show me sample data from the REVENUE_BY_REGION view in the FINANCE database\"\n- \"Run this SQL query: SELECT customer_id, SUM(order_total) as total_spend FROM SALES.ORDERS GROUP BY customer_id ORDER BY total_spend DESC LIMIT 10\"\n- \"Query the MARKETING database to find the top 5 performing campaigns by conversion rate\"\n- \"Compare data from views in different databases by querying SALES.CUSTOMER_METRICS and MARKETING.CAMPAIGN_RESULTS\"\n\n### Configuration\n\nConnection pooling behavior can be configured through environment variables:\n\n- `SNOWFLAKE_CONN_REFRESH_HOURS`: Time interval in hours between connection refreshes (default: 8)\n\nExample `.env` configuration:\n```\n# Set connection to refresh every 4 hours\nSNOWFLAKE_CONN_REFRESH_HOURS=4\n```\n\n## Authentication Methods\n\n### Private Key Authentication\n\nThis method uses a service account and private key for non-interactive authentication, ideal for automated processes.\n\n1. Create a key pair for your Snowflake user following [Snowflake documentation](https://docs.snowflake.com/en/user-guide/key-pair-auth)\n2. Set `SNOWFLAKE_AUTH_TYPE=private_key` in your `.env` file\n3. Provide the path to your private key in `SNOWFLAKE_PRIVATE_KEY_PATH`\n\n### External Browser Authentication\n\nThis method opens a browser window for interactive authentication.\n\n1. Set `SNOWFLAKE_AUTH_TYPE=external_browser` in your `.env` file\n2. When you start the server, a browser window will open asking you to log in\n3. After authentication, the session will remain active for the duration specified by your Snowflake account settings\n\n## Security Considerations\n\nThis server:\n- Enforces read-only operations (only SELECT, SHOW, DESCRIBE, EXPLAIN, and WITH statements are allowed)\n- Automatically adds LIMIT clauses to prevent large result sets\n- Uses secure authentication methods for connections to Snowflake\n- Validates inputs to prevent SQL injection\n\n⚠️ **Important**: Keep your `.env` file secure and never commit it to version control. The `.gitignore` file is configured to exclude it.\n\n## Development\n\n### Static Type Checking\n\n```\nmypy mcp_server_snowflake/\n```\n\n### Linting\n\n```\nruff check .\n```\n\n### Formatting\n\n```\nruff format .\n```\n\n### Running Tests\n\n```\npytest\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## Technical Details\n\nThis project uses:\n- [Snowflake Connector Python](https://docs.snowflake.com/en/developer-guide/python-connector/python-connector) for connecting to Snowflake\n- [MCP (Model Context Protocol)](https://github.com/anthropics/anthropic-cookbook/tree/main/mcp) for interacting with Claude\n- [Pydantic](https://docs.pydantic.dev/) for data validation\n- [python-dotenv](https://github.com/theskumar/python-dotenv) for environment variable management\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdynamike%2Fsnowflake-mcp-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdynamike%2Fsnowflake-mcp-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdynamike%2Fsnowflake-mcp-server/lists"}