Pg
An MCP server to query any Postgres database in natural language.
An MCP server to query any Postgres database in natural language.
暂未识别到可直接复制的 MCP 配置,请查看 GitHub README。后台管理员可以补充配置。
[](https://github.com/subnetmarco/pgmcp/actions/workflows/ci.yml) [](https://goreportcard.com/report/github.com/subnetmarco/pgmcp) [](https://opensource.org/licenses/Apache-2.0) # PGMCP - PostgreSQL Model Context Protocol Server PGMCP connects AI assistants to **any PostgreSQL database** through natural language queries. Ask questions in plain English and get structured SQL results with automatic streaming and robust error handling. **Works with**: Cursor, Claude Desktop, VS Code extensions, and any [MCP-compatible client](https://modelcontextprotocol.io/) ## Quick Start PGMCP connects to **your existing PostgreSQL database** and makes it accessible to AI assistants through natural language queries. ### Prerequisites - PostgreSQL database (existing database with your schema) - OpenAI API key (optional, for AI-powered SQL generation) ### Basic Usage ```bash # Set up environment variables export DATABASE_URL="postgres://user:password@localhost:5432/your-existing-db" export OPENAI_API_KEY="your-api-key" # Optional # Run server (using pre-compiled binary) ./pgmcp-server # Test with client in another terminal ./pgmcp-client -ask "What tables do I have?" -format table ./pgmcp-client -ask "Who is the customer that has placed the most orders?" -format table ./pgmcp-client -search "john" -format table ``` Here is how it works: ``` 👤 User / AI Assistant │ │ "Who are the top customers?" ▼ ┌─────────────────────────────────────────────────────────────┐ │ Any MCP Client │ │ │ │ PGMCP CLI │ Cursor │ Claude Desktop │ VS Code │ ... │ │ JSON/CSV │ Chat │ AI Assistant │ Editor │ │ └─────────────────────────────────────────────────────────────┘ │ │ Streamable HTTP / MCP Protocol ▼ ┌─────────────────────────────────────────────────────────────┐ │ PGMCP Server │ │ │ │ 🔒 Security 🧠 AI Engine 🌊 Streaming │ │ • Input Valid • Schema Cache • Auto-Pagination │ │ • Audit Log • OpenAI API • Memory Management │ │ • SQL Guard • Error Recovery • Connection Pool │ └─────────────────────────────────────────────────────────────┘ │ │ Read-Only SQL Queries ▼ ┌─────────────────────────────────────────────────────────────┐ │ Your PostgreSQL Database │ │ │ │ Any Schema: E-commerce, Analytics, CRM, etc. │ │ Tables • Views • Indexes • Functions │ └─────────────────────────────────────────────────────────────┘ External AI Services: OpenAI API • Anthropic • Local LLMs (Ollama, etc.) Key Benefits: ✅ Works with ANY PostgreSQL database (no assumptions about schema) ✅ No schema modifications required ✅ Read-only access (100% safe) ✅ Automatic streaming for large results ✅ Intelligent query understanding (singular vs plural) ✅ Robust error handling (graceful AI failure recovery) ✅ PostgreSQL case sensitivity support (mixed-case ta...
⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的...
GitHub's official MCP Server
🚀Vite+Vue3+Gin拥有AI辅助的基础开发平台,企业级业务AI+开发解决方案,内置mcp辅助服务,内置skills管理,支持TS和JS混用。它...
Your API ⇒ Paid MCP. Instantly.
MCP Toolbox for Databases is an open source MCP server for databases.
MCP server to provide Figma layout information to AI coding agents like Cursor