MCP-Server-data

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.

Category
Visit Server

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

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

  1. Enter your Gemini API key in the sidebar (get one free at aistudio.google.com/apikey)
  2. Type a question about the store data — e.g., "Show me all products under $50"
  3. Click "Run Query" and watch the AI work!
  4. 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:

  1. Keyword blocking — Queries starting with DELETE, DROP, INSERT, UPDATE, etc. are rejected
  2. Multi-statement detection — Multiple SQL statements separated by ; are individually checked
  3. Result limiting — Maximum 100 rows returned per query
  4. 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

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured