Utilizes LangGraph's multi-agent architecture to power intelligent data analysis with specialized agent archetypes including analysts, lineage experts, usage auditors, query optimizers, and metadata curators for enhanced Snowflake operations.
Provides comprehensive tools for Snowflake data operations including database schema exploration, SQL query execution, usage pattern analysis, data lineage tracing, performance monitoring, and metadata management across six specialized datasets for enterprise data analytics.
Snowflake MCP Agent System
Enhanced MCP Snowflake server with LangGraph agentic architecture for intelligent data analysis and querying.
Overview
This system provides:
MCP Server: 20+ specialized tools for Snowflake data operations
Agentic Client: LangGraph-powered multi-agent system with few-shot learning
Session Management: State persistence and intelligent caching
Training Capabilities: Continuous improvement through user feedback
Prerequisites
Python 3.12+
Snowflake account with appropriate permissions
JWT token for authentication (if using corporate endpoints)
Installation
Configuration
Create a .env
file with your Snowflake credentials:
Quick Start
1. Start the MCP Server
Server runs on http://127.0.0.1:8000/mcp
2. Run the Agentic Client
Usage Modes
Interactive Mode (Default)
Chat interface with multi-agent responses and few-shot learning.
Single Query Mode
Batch Processing Mode
Training Mode
Collects positive feedback examples for agent improvement.
Agent Archetypes
The system includes specialized agents:
Analyst: EDA, statistical analysis, trend identification
Lineage Expert: Data flow tracing, impact analysis
Usage Auditor: Resource monitoring, anomaly detection
Query Optimizer: Performance analysis, optimization recommendations
Metadata Curator: Schema documentation, data cataloging
Data Sources
The system analyzes six Snowflake datasets:
AAI_USAGE: User access patterns and resource consumption
AAI_LINEAGE: Source-to-target table mappings
AAI_MD: Table metadata and data product information
AAI_PROFILER: Column-level statistics and data quality metrics
AAI_ACCESS: Role-based permissions and access control
AAI_SQL_ANALYZER: Query execution metadata and performance metrics
API Reference
Core Tools
list_databases()
- List available databaseslist_schemas(database)
- List schemas in databaselist_tables(database, schema)
- List tables in schemarun_query(sql)
- Execute SELECT queries
Analysis Tools
analyze_usage(time_period, business_unit)
- Usage pattern analysisget_lineage(table_name, direction, depth)
- Data lineage tracingidentify_heavy_users(metric, top_n)
- Resource consumption analysisanalyze_slow_queries(threshold_seconds)
- Performance bottleneck identificationget_table_metadata(table_name)
- Comprehensive metadata retrievalrecommend_data_products(analysis_scope)
- Data product recommendations
Session Management
save_feedback(session_id, query, response, feedback_type)
- Training data collectionget_session_history(session_id)
- Query history and statistics
Architecture
Error Handling
Common issues and solutions:
Connection Failed: Verify Snowflake credentials in
.env
JWT Token Invalid: Update
JWT_TOKEN
in environmentImport Errors: Run
pip install -e .
to install dependenciesPort 8000 Busy: Server already running or port in use
Development
Project Structure
Adding New Agents
Create agent class inheriting from
BaseAgent
Define
_get_base_prompt()
methodAdd corresponding MCP tools in
server.py
Update routing logic in
client_refactored.py
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Enables intelligent data analysis and querying of Snowflake databases through specialized AI agents. Features 20+ tools for data operations, lineage tracing, usage analysis, and performance optimization with multi-agent architecture.