Back to Home
karthikingithub icon

pagila-mcp

Verified Safe

by karthikingithub

Overview

A Streamlit-based chatbot that allows users to query a PostgreSQL database using natural language, leveraging Google's Gemini API for SQL generation and the Model Context Protocol (MCP) for secure database execution.

Installation

Run Command
streamlit run app.py

Environment Variables

  • GEMINI_API_KEY
  • PGHOST
  • PGUSER
  • PGPASSWORD
  • PGDATABASE
  • LOG_DIR

Security Notes

The server uses environment variables for sensitive database credentials. It implements a blacklist and 'SELECT' query enforcement for `run_pagila_query` and `execute_sql` methods. Parameterized queries are used where applicable (`execute_sql`). Crucially, the README strongly recommends configuring a read-only PostgreSQL database user as the primary security defense, which is excellent practice. The MCP server runs locally as a subprocess, reducing direct network exposure. No 'eval' or similar dynamic code execution is observed.

Similar Servers

Stats

Interest Score0
Security Score9
Cost ClassLow
Stars0
Forks0
Last Update2026-01-03

Tags

ChatbotSQL GenerationNatural LanguagePostgreSQLGemini API