Postgres MCP Server
A Model Context Protocol server for PostgreSQL databases. Enables LLMs to query and analyze PostgreSQL databases through a controlled interface.
https://github.com/user-attachments/assets/6571c20c-91c9-4a6e-8332-13b587b79fbf
Potencia tu agente
Instalación del publicador. No es un endpoint de PlugMCP.
Host a copy with our keys and logs.
Aún no hay una versión empaquetada en el registro. Sigue el README del repositorio.
¿URL remota o un comando en tu máquina? En qué se diferencian las dos instalaciones
Ejecutar en PlugMCP
A new server you create. It is not this listing's official endpoint. Use the publisher install when you want their URL and their credentials.
AbrirDel publicador
A Model Context Protocol server for PostgreSQL databases. Enables LLMs to query and analyze PostgreSQL databases through a controlled interface.
https://github.com/user-attachments/assets/6571c20c-91c9-4a6e-8332-13b587b79fbf
MCP Server for Postgres
Add to your MCP client settings:
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["--yes", "pg-mcp-server", "--transport", "stdio"],
"env": {
"DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/postgres"
}
}
}
}
DATABASE_URL - PostgreSQL connection string (required)DANGEROUSLY_ALLOW_WRITE_OPS - Enable writes (default: false)DEBUG - Enable debug logging (default: false)PG_SSL_ROOT_CERT - Optional path to a TLS CA bundle (e.g., AWS RDS global bundle)--transport flag./mcp on PORT (default 3000).http://localhost:3000/mcp.Start commands:
# stdio transport (default, via installed CLI)
pg-mcp-server --transport=stdio
# http transport
pg-mcp-server --transport=http
query - Execute SQL queries
{ "sql": "SELECT * FROM users WHERE active = true LIMIT 10" }
postgres://tables - List all tablespostgres://table/{schema}/{table} - Get table schema and sample dataHere's an example prompt to test if your MCP server is working:
Show me the first 5 users from the database
For data analysis and exploration, I've added a Cursor rule for using the MCP server together with notebooks in .cursor/rules/notebooks.mdc:
# Start PostgreSQL with sample data
bun run db:start
# Test with MCP Inspector
bun run inspector
# Stop PostgreSQL
bun run db:stop
Sample tables included: users, products, orders, order_items
# Clone and install
git clone https://github.com/ericzakariasson/pg-mcp-server.git
cd pg-mcp-server
bun install
# Run (stdio transport)
bun run index.ts -- --transport=stdio
DEBUG=true bun run index.ts -- --transport=stdio
# Run (http transport)
bun run index.ts -- --transport=http
DEBUG=true bun run index.ts -- --transport=http
bun test # Run tests
Use local build in MCP client settings:
bun run build:js
{
"mcpServers": {
"postgres": {
"command": "node",
"args": ["/absolute/path/to/pg-mcp-server/lib/index.js", "--transport", "stdio"],
"env": {
"DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/postgres"
}
}
}
}
This repo auto-creates a GitHub Release when you push a tag that matches the version in package.json:
CHANGELOG.md and bump the version in package.json.main (or your release branch).VERSION=$(jq -r .version package.json)
git tag v"$VERSION"
git push origin v"$VERSION"
The GitHub Actions workflow will validate that the tag (e.g. v0.1.0) matches package.json, then use gh to create a release with generated notes, and publish to npm.
MIT - see LICENSE
MCP Server for Postgres
Herramientas
Aún no hay lista de herramientas. Los servidores remotos la reciben tras la primera comprobación de estado.
Preguntas frecuentes
Copia en esta página la configuración stdio para Cursor, Claude Desktop, Claude Code o VS Code. Usa la instalación del publicador, no un proxy de PlugMCP.
Este registro no indica ninguna variable de entorno obligatoria.
Pg se ejecuta localmente por stdio.
Última comprobación: 2026-10-27. MCP Server for Postgres