postgres
⚠️ DEPRECATED - Use https://github.com/neverinfamous/postgresql-mcp instead.
claude mcp add --transport stdio neverinfamous-postgres-mcp npx -y @neverinfamous/postgres-mcp \ --env DB_HOST="localhost (or your database host)" \ --env DB_NAME="your-db (or the target database name)" \ --env DB_PORT="5432 (or your database port)" \ --env DB_USER="postgres (or your database user)" \ --env DB_PASSWORD="your-password (or your database password)"
How to use
This MCP server enables AI assistants to interact with PostgreSQL databases via the Model Context Protocol. Leveraging features like Code Mode, it exposes a comprehensive toolkit of 227 specialized tools (including CRUD operations, JSONB handling, PostGIS, pg_cron, pgvector, and more) inside a secure JavaScript sandbox, allowing agents to reason locally and minimize token usage during tool invocation. The server also offers schema introspection, migration tracking, connection pooling, OAuth 2.1 access control, and an SSE HTTP transport for streaming responses. To use it, configure your environment variables to point at your PostgreSQL instance, start the MCP server, and then issue MCP requests to perform structured database operations through the integrated toolset. Tools can be filtered and grouped to fit your agent’s reasoning budget, while deterministic error handling surfaces actionable context instead of cryptic errors.
How to install
Prerequisites:
- Node.js 18+ and npm (or yarn)
- Access to a PostgreSQL instance with appropriate credentials
Installation steps:
- Install the MCP package (example using npm):
npm install -g @neverinfamous/postgres-mcp
- Prepare environment variables for database access (example in a shell):
export DB_HOST=localhost
export DB_PORT=5432
export DB_USER=postgres
export DB_PASSWORD=your-password
export DB_NAME=your-db
- Run the MCP server via npx (as configured in mcp_config):
npx -y @neverinfamous/postgres-mcp
- (Optional) If you prefer a local development workflow without global installs, you can also run directly from the package in your project:
npm i -D @neverinfamous/postgres-mcp
node ./node_modules/@neverinfamous/postgres-mcp/dist/server.js
- Verify the server is up by hitting the MCP health endpoint or registry entry you’ve configured for your deployment.
Additional notes
Tips and notes:
- Use Code Mode to execute complex multi-step database operations inside a secure JS sandbox, reducing token costs for AI agents.
- Ensure OAuth 2.1 scopes and access controls are properly configured in your environment (read, write, admin, etc.).
- Enable and monitor the HTTP SSE transport endpoints (e.g., /mcp, /health) for remote deployments.
- If you enable extension support (PostGIS, pgvector, etc.), ensure those extensions are installed in the target PostgreSQL instance.
- For production deployments, configure connection pooling health checks and SSL certificate verification as part of your security posture.
- Common issues: invalid DB credentials, network/firewall blocks, insufficient privileges on target schemas, and mismatched PostgreSQL versions between client and server. Debug via deterministic error messages and structured tool responses.
Related MCP Servers
awesome-claude-skills
A curated list of awesome Claude Skills, resources, and tools for customizing Claude AI workflows
ai-guide
程序员鱼皮的 AI 资源大全 + Vibe Coding 零基础教程,分享大模型选择指南(DeepSeek / GPT / Gemini / Claude)、最新 AI 资讯、Prompt 提示词大全、AI 知识百科(RAG / MCP / A2A)、AI 编程教程、AI 工具用法(Cursor / Claude Code / OpenClaw / TRAE / Lovable / Agent Skills)、AI 开发框架教程(Spring AI / LangChain)、AI 产品变现指南,帮你快速掌握 AI 技术,走在时代前沿。本项目为开源文档版本,已升级为鱼皮 AI 导航网站
dbhub
Zero-dependency, token-efficient database MCP server for Postgres, MySQL, SQL Server, MariaDB, SQLite.
coplay-unity-plugin
Unity plugin for Coplay
last9
Last9 MCP Server
prism -rs
Enterprise-grade Rust implementation of Anthropic's MCP protocol