How isaacwasserman/mcp-snowflake-server works
Purpose and Entry Point
This is a Python Model Context Protocol (MCP) server that gives MCP clients such as Claude Desktop controlled access to Snowflake SQL, metadata, and schema/insight resources. The executable server and MCP tool/resource registration are centered in src/mcp_snowflake_server/server.py; package entry-point metadata is expected in pyproject.toml.
Runtime and Deployment
The server runs as a local stdio MCP process, commonly launched through uv/uvx, and can also be containerized through Dockerfile. It targets Snowflake as its external system of record. Credentials and connection defaults can come from CLI/environment configuration or named TOML connections (example_connections.toml). runtime_config.json supplies runtime exclusion policy for database/schema/table discovery.
MCP Server Boundary
src/mcp_snowflake_server/server.py is the protocol-facing boundary. It parses operational flags such as connection selection, write enablement, logging, and tool exclusion; creates the service dependencies; then exposes MCP tools and URI resources. MCP clients never access the Snowflake connector directly.
Snowflake Access Layer
src/mcp_snowflake_server/db_client.py encapsulates Snowflake connection construction, query execution, and metadata discovery. Server handlers delegate read queries, permitted mutations/table creation, and database/schema/table/column inspection to this layer. This isolates Snowflake connector behavior, authentication modes, and result handling from MCP concerns.
Query Safety and Write Control
Read operations are available through the query tool path in src/mcp_snowflake_server/server.py. Write-capable tools are conditionally registered only when explicit write permission is enabled. src/mcp_snowflake_server/write_detector.py classifies or validates SQL intent, forming the key policy boundary that separates SELECT access from allowed INSERT, UPDATE, DELETE, and table-creation operations.
Schema Context Flow
Metadata requests flow MCP handler → database client → Snowflake → serialized tool response. When prefetching is enabled, discovered table schemas are additionally transformed into context://table/{table_name} resources. Filtering configured through runtime_config.json limits what catalog objects enter either tool results or precomputed context.
Insight Memo and Serialization
The server maintains an in-process, dynamically updated memo://insights resource; append_insight updates that memo and triggers resource-visible state changes in src/mcp_snowflake_server/server.py. src/mcp_snowflake_server/serialization.py provides the response boundary for converting Snowflake-native values and rows into MCP-safe structured results.
Main entry points: server.py MCP Server · db_client.py Database Client · serialization.py Response Serialization · runtime_config.json Discovery Exclusions
Components 14
MCP Server
- MCP Server · Parses flags, constructs services, and registers tools and resources.
src/mcp_snowflake_server/server.py - Query Tools · Read SQL path and conditionally registered write tools.
src/mcp_snowflake_server/server.py - Metadata Tools · Database, schema, table, and column discovery.
src/mcp_snowflake_server/server.py - Table Context Resources · Prefetched schemas exposed as context://table/{table_name}.
src/mcp_snowflake_server/server.py - Insight Memo · Dynamically updated memo://insights state.
src/mcp_snowflake_server/server.py
Snowflake Access
- Database Client · Owns connections, execution, and catalog inspection.
src/mcp_snowflake_server/db_client.py - Write Detector · Classifies SQL intent before permitted mutations or table creation.
src/mcp_snowflake_server/write_detector.py - Response Serialization · Converts Snowflake-native values and rows to MCP-safe results.
src/mcp_snowflake_server/serialization.py
Runtime & Deployment
- Discovery Exclusions · Limits catalog objects available to discovery and prefetch.
runtime_config.json - Named Connections · Optional TOML connection defaults.
example_connections.toml - Package Entry Point · Defines executable server metadata.
pyproject.toml - Container Image · Optional containerized server runtime.
Dockerfile
Other components
- MCP Client · Claude Desktop or another MCP consumer.
- Snowflake · System of record for SQL and metadata.
Connections 17
- MCP Client → MCP Server: stdio MCP
- Package Entry Point → MCP Server: launches
- Container Image → MCP Server: runs
- Named Connections → MCP Server: connection defaults
- MCP Server → Query Tools: registers
- MCP Server → Metadata Tools: registers
- MCP Server → Table Context Resources: publishes
- MCP Server → Insight Memo: updates via append_insight
- Query Tools → Write Detector: validates writes
- Query Tools → Database Client: delegates SQL
- Metadata Tools → Database Client: delegates discovery
- Discovery Exclusions → Database Client: filters discovery
- Database Client → Snowflake: connector calls
- Database Client → Response Serialization: rows and values
- Response Serialization → Query Tools: structured results
- Response Serialization → Metadata Tools: structured results
- Metadata Tools → Table Context Resources: prefetched schemas