dlh-snowflake-mcp-server

tabaghak/dlh-snowflake-mcp-server

3.1

If you are the rightful owner of dlh-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 dayong@mcphub.com.

DLH Snowflake MCP Server is a Model Context Protocol server designed to facilitate interaction with Snowflake databases using secure eternalbrowser authentication.

Tools
6
Resources
0
Prompts
0

DLH Snowflake MCP Server

A Model Context Protocol (MCP) server that provides tools for interacting with Snowflake databases using eternalbrowser authentication.

Features

  • Test Connection: Verify connection to Snowflake and get current user/role information
  • Execute Queries: Run SQL queries against your Snowflake database
  • Schema Exploration: List databases, schemas, tables, and columns
  • Table Metadata: Get detailed information about specific tables
  • Secure Authentication: Uses Snowflake's eternalbrowser authentication for secure login

Tools Provided

  1. test_connection: Test the connection to Snowflake and display connection info
  2. execute_query: Execute arbitrary SQL queries with optional parameters
  3. get_schemas: List available databases and schemas
  4. get_tables: List tables in a specific database/schema
  5. get_columns: Get column information for a specific table
  6. describe_table: Get detailed metadata for a specific table

Installation

  1. Clone this repository
  2. Install dependencies:
    npm install
    
  3. Copy the environment configuration:
    cp .env.example .env
    
  4. Edit .env with your Snowflake connection details
  5. Build the project:
    npm run build
    

Configuration

Set the following environment variables (or add them to your .env file):

  • SNOWFLAKE_ACCOUNT: Your Snowflake account identifier (required)
  • SNOWFLAKE_USERNAME: Your Snowflake username (required)
  • SNOWFLAKE_DATABASE: Default database to connect to (optional)
  • SNOWFLAKE_SCHEMA: Default schema to use (optional)
  • SNOWFLAKE_WAREHOUSE: Default warehouse to use (optional)
  • SNOWFLAKE_ROLE: Default role to assume (optional)

Authentication

This server uses Snowflake's EXTERNALBROWSER authentication method, which will open a web browser for you to authenticate with your Snowflake credentials. Make sure you have access to a web browser on the machine where this server is running.

Usage

Setting Up Environment Variables

Before running the server, you'll need to configure your Snowflake connection details. You can either:

  1. Use environment variables (recommended for development):

    # Copy the example environment file
    cp .env.example .env
    
    # Edit .env with your details
    # SNOWFLAKE_ACCOUNT=your_account.region
    # SNOWFLAKE_USERNAME=your_username
    # etc.
    
  2. Set environment variables directly:

    set SNOWFLAKE_ACCOUNT=your_account.region
    set SNOWFLAKE_USERNAME=your_username
    # etc.
    

Running the Server

For development:

npm run dev

For production:

npm run build
npm start

Using with Claude Desktop

To use this server with Claude Desktop, add the following configuration to your claude_desktop_config.json:

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

{
  "mcpServers": {
    "snowflake": {
      "command": "node",
      "args": ["D:\\absolute\\path\\to\\dlh-snowflake-mcp-server\\build\\index.js"],
      "env": {
        "SNOWFLAKE_ACCOUNT": "your_account.region",
        "SNOWFLAKE_USERNAME": "your_username",
        "SNOWFLAKE_DATABASE": "your_database",
        "SNOWFLAKE_SCHEMA": "your_schema",
        "SNOWFLAKE_WAREHOUSE": "your_warehouse"
      }
    }
  }
}

Important: Use the absolute path to your build/index.js file.

Example Queries

Once connected, you can use the server to:

  • Test your connection: "Test my Snowflake connection"
  • Run queries: "Execute this SQL query: SELECT * FROM my_table LIMIT 10"
  • Explore schema: "Show me all the databases and schemas"
  • Get table info: "What tables are in the PUBLIC schema?"
  • Describe tables: "Describe the structure of the CUSTOMERS table"

Development

Building

npm run build

Cleaning

npm run clean

Debugging in VS Code

You can debug this MCP server using VS Code:

  1. Build the project: npm run build
  2. The server is configured in .vscode/mcp.json
  3. Use the VS Code MCP extension to connect and test

Security Notes

  • This server uses eternalbrowser authentication for secure access to Snowflake
  • Never commit your .env file or expose your Snowflake credentials
  • The server logs to stderr to avoid interfering with MCP communication
  • All SQL queries are executed with your authenticated user's permissions

Troubleshooting

  1. Authentication Issues: Make sure you can access a web browser and that your Snowflake account supports eternalbrowser authentication
  2. Connection Timeouts: Check your network connection and firewall settings
  3. Permission Errors: Ensure your Snowflake user has the necessary permissions for the operations you're trying to perform
  4. Environment Variables: Double-check that all required environment variables are set correctly
  5. Build Issues: Make sure TypeScript compiles successfully with npm run build

License

ISC