JUHE API Marketplace
rajeevchandra avatar
MCP Server

SQL Query MCP Server

A FastMCP server that enables natural language querying of PostgreSQL databases through LLM integration, allowing users to generate SQL queries from plain English and visualize the results.

3
GitHub Stars
11/22/2025
Last Updated
No Configuration
Please check the documentation below.
  1. Home
  2. MCP Servers
  3. mcp-ollama-postgres

README Documentation

πŸš€ 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]

πŸ“¦ 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 --build
  • Access 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

Quick Actions

View on GitHubView All Servers

Key Features

Model Context Protocol
Secure Communication
Real-time Updates
Open Source

Boost your projects with Wisdom Gate LLM API

Supporting GPT-5, Claude-4, DeepSeek v3, Gemini and more.

Enjoy a free trial and save 20%+ compared to official pricing.

Learn More
JUHE API Marketplace

Accelerate development, innovate faster, and transform your business with our comprehensive API ecosystem.

JUHE API VS

  • vs. RapidAPI
  • vs. API Layer
  • API Platforms 2025
  • API Marketplaces 2025
  • Best Alternatives to RapidAPI

For Developers

  • Console
  • Collections
  • Documentation
  • MCP Servers
  • Free APIs
  • Temp Mail Demo

Product

  • Browse APIs
  • Suggest an API
  • Wisdom Gate LLM
  • Global SMS Messaging
  • Temp Mail API

Company

  • What's New
  • Welcome
  • About Us
  • Contact Support
  • Terms of Service
  • Privacy Policy
Featured on Startup FameFeatured on Twelve ToolsFazier badgeJuheAPI Marketplace - Connect smarter, beyond APIs | Product Huntai tools code.marketDang.ai
Copyright Β© 2025 - All rights reserved