SQL Query MCP Server
Utilized for visualizing and documenting the prompt-to-SQL workflow in the application
Integrates with Ollama to translate natural language queries into SQL, enabling non-technical users to query databases without SQL knowledge
Enables querying PostgreSQL databases with both raw SQL and natural language queries, with results available for analysis, charting, and export
Powers the user interface with interactive dashboards for visualizing query results, generating charts, and exporting data to CSV
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@SQL Query MCP Servershow me the top 5 customers by total sales this month"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
🚀 MCP-Powered Streamlit Dashboard with Ollama + PostgreSQL
A modern data analysis tool that lets you:
Query your PostgreSQL database with natural language
Run SQL manually or generate it using LLMs (Ollama)
Analyze data with charts, statistics, and export to CSV
🧠 Prompt-to-SQL Flow
graph TD
A[🧑 User types a data question] --> B[Streamlit sends prompt to Ollama API]
B --> C[Ollama generates SQL query as text]
C --> D[Streamlit extracts the SQL]
D --> E[Streamlit sends SQL to MCP server]
E --> F[MCP executes query on PostgreSQL]
F --> G[Results returned to Streamlit]
G --> H[📊 Results shown + Chart + CSV Export]Related MCP server: PostgreSQL MCP AI Explorer
📦 Architecture
Streamlit – UI + charting
MCP (FastMCP) – Tools/resources for SQL query and table listing
PostgreSQL – Stores your company data
Ollama – LLM that translates natural language prompts to SQL
📌 Features
✅ Natural language → SQL
✅ Charting (bar/line/time series)
✅ CSV download
✅ Statistical summary
✅ Prompt explainability with raw output
✅ Auto-detect date/time fields
✅ LLM integration with llama3 (configurable)
🛠️ Getting Started
git clone <this-repo>
cd postgres-mcp-server
docker-compose up --buildAccess UI: http://localhost:8501
MCP API: http://localhost:3333/mcp
⚙️ Env Configuration
MCP_API_URL=http://mcp-server:3333/mcp
OLLAMA_URL=http://ollama:11434/api/generate📤 Prompt Example
“List departments with average salary > 50000”
👉 Translated to SQL:
SELECT department, AVG(salary) FROM employees GROUP BY department HAVING AVG(salary) > 50000;Why is this a good use case for MCP?
🔗 MCP makes it dead simple to expose structured tools like SQL queries to LLMs. 🎯 Agents can discover and call your tools without hardcoding logic. 💬 You get the best of both worlds — interpretability, flexibility, and control.
Whether you're building internal tools, research dashboards, or intelligent agents — this pattern is reusable, secure, and 100% local.
📄 License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityDmaintenanceA FastMCP server that provides natural language interaction with MS SQL databases, enabling users to query data, list tables, describe structures, and execute database operations through a conversational AI interface.Last updated
- Flicense-qualityDmaintenanceA Model Context Protocol server that enables natural language data exploration and visualization for PostgreSQL databases. It allows users to convert questions into SQL queries and interact with data through a Streamlit web interface featuring automated chart generation.Last updated
- AlicenseAqualityAmaintenanceAn MCP server that gives AI agents direct read-only access to PostgreSQL databases, enabling natural language analytics through tools for schema exploration, querying, trend analysis, and data quality checks.Last updated115MIT
- Flicense-qualityDmaintenanceEnables natural language queries to PostgreSQL by converting questions to SQL using Google Gemini and executing via FastMCP.Last updated
Related MCP Connectors
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
GibsonAI MCP server: manage your databases with natural language
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/rajeevchandra/mcp-ollama-postgres'
If you have feedback or need assistance with the MCP directory API, please join our Discord server