pagila-mcp
Verified Safeby 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
streamlit run app.pyEnvironment 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
MCP-PostgreSQL-Ops
The MCP server provides professional operations, monitoring, and management capabilities for PostgreSQL databases using natural language queries.
enhanced-postgres-mcp-server
This server acts as a Model Context Protocol interface for PostgreSQL, enabling LLMs to query data, modify records, and manage database schema objects with read and write capabilities.
mcp-postgres
Provides a read-only Model Context Protocol (MCP) server for AI tools (like Claude Code, Cursor) to query a PostgreSQL database directly.
postgrest-mcp
A PostgREST MCP (Model Context Protocol) server that uses OAuth2 for authentication and integrates with PostgREST APIs.