Token导航 LogoToken导航TokenDH.com
MCP Knowhub logo
数据服务未说明官方级别未说明来源级核验

MCP Knowhub

MCP Server

通过自然语言查询PostgreSQL数据库并提供自动可视化的MCP服务器。

工具数

4

提示词数

0

GitHub Stars

0

资源数

0
数据分析数据可视化PostgreSQLClaude自然语言处理Claude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

Joemon-Jesudas

提供方

Joemon-Jesudas

最后核验

2026/5/17 20:20

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

MCP PostgreSQL Server - Project Files Summary

This project provides a Model Context Protocol (MCP) server that enables natural language querying of PostgreSQL databases through Claude Desktop. Instead of writing SQL, users can ask questions in plain English and receive both textual answers and automatic visualizations.


📁 Files Created

1. mcp_postgres_server.py

Purpose: Main MCP server implementation with visualization support Description:

  • FastMCP server with PostgreSQL integration
  • Uses SQLAlchemy for database operations
  • Provides 4 tools for database interaction
  • Supports natural language query processing
  • Automatic chart generation from query results**
  • Read-only access (SELECT queries only)
  • Connection pooling and error handling

Key Features:

  • list_tables(): List all database tables
  • describe_table(): Get table schema details
  • execute_query(): Run SQL SELECT queries
  • generate_visualization(): Create charts from SQL results

NEW Visualization Capabilities:

  • Auto-detects best chart type (bar, line, pie, scatter)
  • Analyzes data structure (numeric, text, date columns)
  • Intelligent chart selection based on query intent
  • Returns chart specifications for rendering

2. requirements.txt

Purpose: Python package dependencies Contents:

  • fastmcp>=2.2.0
  • sqlalchemy>=2.0.0
  • psycopg2-binary>=2.9.0
  • python-dotenv>=1.0.0

Installation: pip install -r requirements.txt or uv add -r requirement.txt


3. .env

Purpose: Environment configuration

Variables:

  • DB_HOST: PostgreSQL host (default: localhost)
  • DB_PORT: PostgreSQL port (default: 5432)
  • DB_NAME: Database name
  • DB_USER: Database username
  • DB_PASSWORD: Database password

4. claude_desktop_config.json

Purpose: Claude Desktop MCP configuration Description: Configuration template for connecting Claude Desktop to the MCP server

Usage:

  1. Copy contents to Claude's config file:

- macOS: ~/Library/Application Support/Claude/claude_desktop_config.json - Windows: %APPDATA%\Claude\claude_desktop_config.json

  1. Update the absolute path to mcp_postgres_server.py
  2. Update database credentials in env section
  3. Restart Claude Desktop

Example Questions to Try

- "What tables are in my database?" - "Describe the customers table" - "Show me the database schema" - "How many customers do I have?" - "What's the total revenue this year?" - "Show me the latest transactions" - "List down first 20 records in 'table_name' - "Who has the highest spend in 2025?" - "Show monthly sales trend" - "Compare revenue by region" - "What's the distribution of customers by city?" - "Is there a relationship between price and quantity?"

🎉 Summary

Your MCP PostgreSQL server now provides:

✅ Natural language database queries ✅ Automatic SQL generation ✅ Safe, read-only access ✅ Complete schema inspection ✅ Automatic chart generation ✅ Visual insights alongside text

Result: Users can now explore data through both conversation AND visualization!

OUTPUT: Some real examples that i tried : https://claude.ai/share/5872cc68-4123-4c92-9bbd-cced2725a48e


目录标签

目录标签

数据分析数据可视化PostgreSQLClaude自然语言处理Python本地部署数据库查询SQL生成

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

4

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP