
SQLGenius
STDIOAI-powered SQL assistant converting natural language to BigQuery SQL queries using MCP
AI-powered SQL assistant converting natural language to BigQuery SQL queries using MCP
SQLGenius is an intelligent SQL assistant that helps you query your BigQuery database using natural language. Built with MCP (Model Context Protocol), Vertex AI's Gemini Pro, and Streamlit.
Watch SQLGenius in action! Here's a quick demo of how to use the application:
In this demo, you can see:
cd sql_mcp_server
pip install -r requirements.txt
.env.example
file to .env
and fill in your configuration:cp .env.example .env
.env
:PROJECT_ID=your-project-id
DATASET_ID=your-dataset-id
GOOGLE_APPLICATION_CREDENTIALS=path/to/your/service-account.json
VERTEX_AI_LOCATION=us-central1
streamlit run streamlit_app.py
The MCP server will start automatically when the Streamlit app launches
Use the tabs to:
Ask questions in plain English and get SQL results:
Write and execute SQL queries directly:
SELECT * FROM orders WHERE order_date > '2023-01-01' ORDER BY total_amount DESC LIMIT 10
SQLGenius uses the Model Context Protocol (MCP) to expose tools that enable:
The architecture consists of:
The following MCP tools are available:
execute_nl_query
: Execute a natural language queryexecute_sql_query
: Execute a raw SQL querylist_tables
: List all available tablesget_table_schema
: Get schema for a specific tableTo add custom tools to the MCP server:
register_tools()
method in sql_mcp_server.py
@self.tool()
decoratorContributions are welcome! Please feel free to submit a Pull Request.