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: MCP SQL Server
π¦ 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
Resources
Looking for Admin?
Admins can modify the Dockerfile, update the server description, and track usage metrics. If you are the server author, to access the admin panel.