claudie-snowflake-mcp-server

iamdhariot/claudie-snowflake-mcp-server

3.1

If you are the rightful owner of claudie-snowflake-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Snowflake MCP Server is a secure and efficient solution for accessing Snowflake databases, allowing AI assistants to execute SQL queries and retrieve data seamlessly.

Tools
1
Resources
0
Prompts
0

Snowflake MCP Server

A Model Context Protocol (MCP) server that provides secure access to Snowflake databases, enabling AI assistants to execute SQL queries and retrieve data.

Features

  • Secure Connection Management: Automatic connection handling with keep-alive and timeout settings
  • SQL Query Execution: Support for both read and write operations with transaction management
  • Error Handling: Comprehensive error handling with detailed logging
  • Data Serialization: Safe JSON serialization of query results including datetime objects

Setup

Prerequisites

  • Python 3.8+
  • Snowflake account with appropriate permissions

Installation

  1. Install required dependencies:
pip install snowflake-connector-python python-dotenv mcp
  1. Create a .env file with your Snowflake credentials:
SNOWFLAKE_USER=your_username
SNOWFLAKE_PASSWORD=your_password
SNOWFLAKE_ACCOUNT=your_account_identifier
SNOWFLAKE_WAREHOUSE=your_warehouse
  1. Make the script executable:
chmod +x snowflake_server.py

Configuration

The server connects to the ATHENAHEALTH.ATHENAONE database by default. Modify the config dictionary in the SnowflakeConnection class to change target database/schema.

Usage

Running the Server

Start the MCP server:

python snowflake_server.py

Available Tools

execute_query

Execute SQL queries on your Snowflake database.

Parameters:

  • query (string): The SQL statement to execute

Examples:

  • SELECT * FROM users LIMIT 10
  • INSERT INTO logs (message, timestamp) VALUES ('test', CURRENT_TIMESTAMP())
  • UPDATE settings SET value = 'new_value' WHERE key = 'config'

Security Notes

  • Credentials are loaded from environment variables only
  • Write operations use transactions with automatic rollback on errors
  • Connection timeouts prevent hanging connections
  • Query logging excludes sensitive data

Error Handling

The server provides detailed error information including:

  • SQL syntax errors with error codes
  • Connection failures with retry logic
  • Query execution timeouts
  • Data serialization issues

Logging

Debug-level logging is enabled by default, tracking:

  • Connection establishment and health
  • Query execution times
  • Row counts and affected records
  • Error details and stack traces