A Model Context Protocol (MCP) server that enables seamless integration with Snowflake Cortex Agents and Analysts. This server allows you to query your Snowflake data using natural language through VS Code, Claude Desktop, or any MCP-compatible client.
This repo is specifically designed for VS Code/Copilot version.
- Python 3.11 or higher
- UV package manager (
pip install uv) - VS Code with MCP extension (Setup Link)
- Access to a Snowflake account with Cortex features enabled
- Cortex Agent created in your Snowflake account
- First install the MCP CLI (uv) and bootstrap your project:
curl -LsSf https://astral.sh/uv/install.sh | sh - Configure and create your Cortex Agents project:
git clone https://github.com/xero-internal/snowflake-mcp-hackathon.git cd snowflake-mcp-hackathon # Create and activate venv uv venv source .venv/bin/activate # macOS/Linux # Install MCP SDK and HTTP client uv add "mcp[cli]" httpx
-
Clone and setup the project:
uv sync
-
Configure environment variables:
cp .env.template .env # Edit .env with your Snowflake configuration -
Configure VS Code MCP settings:
-
First follow this page to set up your MCP Client on VS Code: https://xero.atlassian.net/wiki/spaces/EngX/pages/270817986206/Setup+GitHub+Copilot+on+VS+Code
-
Add to your VS Code
mcp.json(Command Palette → "MCP: Edit Configuration"):
{ "servers": { "cortex-agent": { "command": "/opt/homebrew/bin/uv", "args": [ "--directory", "<absolute-path-to-snowflake-mcp-hackathon-foloder>", "run", "python", "server.py" ] } } } -
The MCP server provides comprehensive logging to help you debug, monitor, and analyze all interactions with Snowflake Cortex Agents.
The server automatically generates two types of log files in the utils/logs/ directory:
-
Protocol Logs (
mcp_protocol_YYYYMMDD_HHMMSS.log)- Records all MCP tool requests and responses
- Includes request arguments, response data, and execution times
- Perfect for debugging and monitoring tool usage
- Human-readable format with clear separators
-
Debug Logs (
mcp_server_detailed_YYYYMMDD_HHMMSS.log)- Detailed technical logs including internal server operations
- Python stack traces for errors
- System-level debugging information
View logs directly in terminal:
# View latest protocol log
tail -f utils/logs/mcp_protocol_*.log
# View all logs from today
cat utils/logs/mcp_protocol_$(date +%Y%m%d)_*.log
# Search for specific tool usage
grep -n "run_cortex_agent" utils/logs/mcp_protocol_*.logOpen log files directly in VS Code for syntax highlighting and search:
code utils/logs/