MCP-Server-data
Enables AI agents to query a SQLite database using natural language through the Model Context Protocol (MCP). Includes security guardrails that block destructive SQL operations.
README
⨠Gemini + MCP Playground
An AI agent that uses Google Gemini and the Model Context Protocol (MCP) to securely interact with data and tools.
Built with Streamlit, Gemini, Agno, and a custom MCP server ā no Docker needed!
š Why This Project?
This showcases AI Engineering skills:
| Skill | How It's Shown |
|---|---|
| AI Agent Architecture | Google Gemini + Agno agent that decides which tools to call |
| MCP Protocol | Custom MCP server with read-only SQL tools + security guardrails |
| Security Engineering | Guards blocking dangerous queries (DELETE, DROP, etc.) |
| Full-Stack AI | Streamlit UI + AI backend + local database |
| Practical Features | One-click CSV/JSON/Markdown export |
⨠Features
- Natural Language Queries ā Ask questions in plain English about a sample e-commerce database
- Custom MCP Server ā A local server that translates AI requests into safe database queries
- š Security Guardrails ā Only SELECT queries allowed; all modifications blocked
- Multiple Export Formats ā Download results as CSV, JSON, or Markdown with one click
- AI-Assisted Export ā Just say "export this as CSV" and the AI handles it
- Tool Transparency ā See exactly which tools the AI calls and what SQL it writes
š§ How It Works
You: "Show me all products over $50"
ā
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Streamlit Web App (github_agent.py) ā
ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā Gemini (Google AI) ā ā
ā ā ⢠Understands your question ā ā
ā ā ⢠Decides which tool to call ā ā
ā ā ⢠Formats the answer ā ā
ā āāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāāā ā
ā ā MCP Protocol ā
ā ā¼ ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā MCP Server (db_mcp_server.py) ā ā
ā ā ⢠Validates query (read-only?) ā ā
ā ā ⢠Runs SELECT on SQLite DB ā ā
ā ā ⢠Returns formatted results ā ā
ā āāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāāā ā
ā ā ā
ā ā¼ ā
ā āāāāāāāāāāāāāāāā ā
ā ā store.db ā (SQLite file) ā
ā āāāāāāāāāāāāāāāā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
š Quick Start
Requirements
- Python 3.8+
- Gemini API Key ā Get one free at aistudio.google.com/apikey
No Docker. No GitHub token. No OpenAI key.
Installation
# 1. Install dependencies
pip install -r requirements.txt
# 2. Generate the sample database
python seed_db.py
# 3. Start the app
streamlit run github_agent.py
Usage
- Enter your Gemini API key in the sidebar (get one free at aistudio.google.com/apikey)
- Type a question about the store data ā e.g., "Show me all products under $50"
- Click "Run Query" and watch the AI work!
- Export results using the download buttons below the response
š¬ Example Queries
Try asking the AI:
š "Show me all products sorted by price"
š "Which customers have placed the most orders?"
š "What's the total revenue from last month?"
š "Show me orders that haven't shipped yet"
š "Export all products as CSV"
š "How many customers do we have from each city?"
š Project Structure
| File | Purpose |
|---|---|
github_agent.py |
Main Streamlit app ā UI + AI agent connection |
db_mcp_server.py |
Custom MCP server ā read-only SQL tools + export |
seed_db.py |
Script to generate the sample database |
store.db |
SQLite database with sample e-commerce data |
requirements.txt |
Python dependencies |
exports/ |
Folder where exported files are saved (created on first export) |
šļø Database Schema
The sample database (store.db) contains 5 tables with 30 orders, 25 products, and 10 customers:
| Table | Description |
|---|---|
categories |
Product categories (Electronics, Clothing, Books, etc.) |
products |
Items for sale with prices and stock |
customers |
Customer information |
orders |
Orders placed with status (delivered, shipped, etc.) |
order_items |
Individual products within each order |
š Security Guardrails
The MCP server has layers of protection:
- Keyword blocking ā Queries starting with
DELETE,DROP,INSERT,UPDATE, etc. are rejected - Multi-statement detection ā Multiple SQL statements separated by
;are individually checked - Result limiting ā Maximum 100 rows returned per query
- Read-only export ā Export tool also validates queries before writing files
š ļø Tech Stack
| Technology | Role |
|---|---|
| Streamlit | Web UI framework |
| Google Gemini | AI model (via google-generativeai) |
| Agno | AI agent framework |
| MCP | Model Context Protocol (tool communication standard) |
| SQLite | Local database (built into Python) |
š License
This project is for educational purposes. Built as a demonstration of AI Agent + MCP architecture.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.