Cover image
Try Now
2025-04-14

3 years

Works with Finder

0

Github Watches

0

Github Forks

0

Github Stars

🚀 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

⚙️ 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

相关推荐

  • av
  • Ejecute sin esfuerzo LLM Backends, API, frontends y servicios con un solo comando.

  • 1Panel-dev
  • 🔥 1Panel proporciona una interfaz web intuitiva y un servidor MCP para administrar sitios web, archivos, contenedores, bases de datos y LLM en un servidor de Linux.

  • WangRongsheng
  • 🧑‍🚀 全世界最好的 llM 资料总结(数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Resumen de los mejores recursos del mundo.

  • rulego
  • ⛓️Rulego es un marco de motor de regla de orquestación de componentes de alta generación de alto rendimiento, de alto rendimiento y de alto rendimiento para GO.

  • Onelevenvy
  • Flock es una plataforma de bajo código de flujo de trabajo para construir rápidamente chatbots, trapo y coordinar equipos de múltiples agentes, impulsados ​​por Langgraph, Langchain, Fastapi y Nextjs.

  • Byaidu
  • Traducción de papel científico en PDF con formatos preservados - 基于 Ai 完整保留排版的 PDF 文档全文双语翻译 , 支持 支持 支持 支持 支持 支持 支持 支持 支持 支持 支持 支持 等服务 等服务 等服务 提供 提供 提供 提供 提供 提供 提供 提供 提供 提供 提供 提供 cli/mcp/docker/zotero

  • n8n-io
  • Plataforma de automatización de flujo de trabajo de código justo con capacidades de IA nativas. Combine el edificio visual con código personalizado, auto-anfitrión o nube, más de 400 integraciones.

  • sigoden
  • Cree fácilmente herramientas y agentes de LLM utilizando funciones Plain Bash/JavaScript/Python.

  • hkr04
  • SDK liviano C ++ MCP (Protocolo de contexto del modelo)

  • RockChinQ
  • 😎简单易用、🧩丰富生态 - 大模型原生即时通信机器人平台 | 适配 Qq / 微信(企业微信、个人微信) / 飞书 / 钉钉 / Discord / Telegram / Slack 等平台 | 支持 Chatgpt 、 Deepseek 、 DiFy 、 Claude 、 Gemini 、 Xai 、 PPIO 、 Ollama 、 LM Studio 、阿里云百炼、火山方舟、 Siliconflow 、 Qwen 、 Moonshot 、 Chatglm 、 SillyTraven 、 MCP 等 LLM 的机器人 / Agente | Plataforma de bots de mensajería instantánea basada en LLM, admite Discord, Telegram, WeChat, Lark, Dingtalk, QQ, Slack

  • dmayboroda
  • Trapo conversacional local con contenedores configurables

    Reviews

    2 (5)
    Avatar
    user_AN1bW5aK
    2025-04-23

    As a dedicated user of mcp-ollama-postgres, I can confidently say that this tool has been a game-changer for my database management tasks. Created by rajeevchandra, its seamless integration with PostgreSQL and user-friendly interface have significantly boosted my productivity. The initial setup was straightforward, and the welcome information provided clear guidance. Highly recommend this for efficient database handling!

    Avatar
    user_htYF6BE7
    2025-04-23

    I've been using the mcp-ollama-postgres app by rajeevchandra and I am thoroughly impressed. The seamless integration with PostgreSQL and the intuitive design have significantly boosted my productivity. The welcome information is clear and helpful, making the initial setup a breeze. Overall, a fantastic tool for any developer working with PostgreSQL databases. Highly recommend!

    Avatar
    user_hY4FVtD0
    2025-04-23

    As a dedicated user of mcp-ollama-postgres, I am thoroughly impressed with this tool. It seamlessly integrates PostgreSQL with Ollama, significantly enhancing my database management workflows. Rajeevchandra has crafted an intuitive and user-friendly experience, making complex operations straightforward. Highly recommended for anyone looking to streamline their database tasks.

    Avatar
    user_JCkvnTQd
    2025-04-23

    As a loyal user of the mcp-ollama-postgres application, I am genuinely impressed by its robust integration and efficiency. Developed by rajeevchandra, this tool seamlessly connects Postgres databases for optimal performance and management. It simplifies complex processes and provides intuitive navigation through its well-designed interface. It's truly an indispensable asset for database administrators and developers alike.

    Avatar
    user_7hh85nC3
    2025-04-23

    As a dedicated user of the mcp-ollama-postgres application, I am thoroughly impressed by its seamless integration and robust functionality. Developed by rajeevchandra, this tool has significantly optimized my database management tasks. The user-friendly interface and reliable performance make it an essential asset for anyone working with PostgreSQL. Highly recommended!