Ericzakariasson Pg

Databases

MCP Server for Postgres.

Your AI app calls the Ericzakariasson Pg MCP server, which does the databases work and sends the result back to the chat.

About Ericzakariasson Pg

Ericzakariasson Pg is a community MCP server from ericzakariasson, filed in our directory under databases. MCP Server for Postgres.

The README for Ericzakariasson Pg lists one tool, which your AI app can call once the server is connected.

At a glance

Publisher
ericzakariasson (community)
Runs
See the README for setup
Written in
TypeScript
License
MIT
GitHub stars
178

Tools Ericzakariasson Pg gives your AI app

  • queryExecute SQL queries.

Tool names as the Ericzakariasson Pg README lists them. Your AI app shows the live list once Ericzakariasson Pg is connected.

How to set up Ericzakariasson Pg

  1. Follow the install steps in the Ericzakariasson Pg README; it is written in TypeScript, so have that toolchain ready.
  2. Check the Ericzakariasson Pg README for keys or settings; the registry lists none that Ericzakariasson Pg requires.
  3. Add Ericzakariasson Pg to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the Ericzakariasson Pg tools to confirm the connection.
  5. Run one read-only task with Ericzakariasson Pg first, such as a call to query, before you allow anything that writes or sends.

Ericzakariasson Pg compared with similar servers

  • Faucet by faucetdb has fewer GitHub stars than Ericzakariasson Pg (178 against 178); both are community servers, and both run locally.
  • DuckDB by ktanaka101 has fewer GitHub stars than Ericzakariasson Pg (178 against 178); both are community servers, and both run locally. The DuckDB README lists 1 tools to Ericzakariasson Pg's 1.
  • Garmin Givemydata by nrvim has fewer GitHub stars than Ericzakariasson Pg (177 against 178); both are community servers, and both run locally.

Before you connect Ericzakariasson Pg

  • Give Ericzakariasson Pg its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each Ericzakariasson Pg tool call until you trust what it does with them.
  • Treat text that Ericzakariasson Pg fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for Ericzakariasson Pg on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for Ericzakariasson Pg

How marketing and sales teams put Ericzakariasson Pg to work, by company size. Pick the size closest to yours and start Ericzakariasson Pg on one use case.

Small business

  • A small business with its own app can ask Ericzakariasson Pg plain questions about customers and orders, without writing SQL.
  • Owners can use Ericzakariasson Pg to pull a list of customers who haven't bought in 90 days and plan a win-back email.
  • Ericzakariasson Pg runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Marketing analysts can connect Ericzakariasson Pg to answer campaign questions from the warehouse directly, instead of waiting on the data team's queue.
  • Lifecycle teams can use Ericzakariasson Pg to build audience lists from product data and check counts before a send.
  • Start with query, the tool Ericzakariasson Pg lists first, and add more once the team trusts the results.

Enterprise

  • Enterprises should point Ericzakariasson Pg at a read replica with a read-only role, so agents query freely without risk to production data.
  • Data teams can expose curated views through Ericzakariasson Pg, so marketing gets self-serve answers without access to raw customer tables.
  • Ericzakariasson Pg is a community server, so have security review the code and pin a version before Ericzakariasson Pg touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

Ericzakariasson Pg README

From ericzakariasson/pg-mcp-server on GitHub, shared under its MIT license. Images are left out; the original has them.

README.md

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

Installation

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"
      }
    }
  }
}

Configuration

  • 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)

Usage

Transports
  • Default transport is stdio. Switch to HTTP with the --transport flag.
  • HTTP mode serves the MCP Streamable HTTP endpoint at /mcp on PORT (default 3000).
  • Clients that support Streamable HTTP should connect to http://localhost:3000/mcp.

Start commands:

# stdio transport (default, via installed CLI)
pg-mcp-server --transport=stdio

# http transport
pg-mcp-server --transport=http
Tools
  • query - Execute SQL queries
    { "sql": "SELECT * FROM users WHERE active = true LIMIT 10" }
    
Resources
  • postgres://tables - List all tables
  • postgres://table/{schema}/{table} - Get table schema and sample data
Example Prompts

Here's an example prompt to test if your MCP server is working:

Show me the first 5 users from the database

Data Analysis & Notebooks

For data analysis and exploration, I've added a Cursor rule for using the MCP server together with notebooks in .cursor/rules/notebooks.mdc:

Quick Start with Docker

# 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

Development

# 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"
      }
    }
  }
}

Releases

This repo auto-creates a GitHub Release when you push a tag that matches the version in package.json:

  1. Update CHANGELOG.md and bump the version in package.json.
  2. Commit the changes on main (or your release branch).
  3. Create and push a matching tag:
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.

License

MIT - see LICENSE

Questions about Ericzakariasson Pg

What is the Ericzakariasson Pg MCP server?

MCP Server for Postgres. Ericzakariasson Pg is maintained by ericzakariasson on GitHub at ericzakariasson/pg-mcp-server, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the Ericzakariasson Pg MCP server?

Ericzakariasson Pg doesn't publish a one-line install in the MCP registry, so follow the setup steps in its README on GitHub (ericzakariasson/pg-mcp-server). Like most servers, Ericzakariasson Pg ends with a command or URL you paste into your AI app's MCP config.

Does Ericzakariasson Pg need an API key?

The registry lists no required keys for Ericzakariasson Pg. Check the Ericzakariasson Pg README for optional settings, and expect a remote server to ask you to sign in the first time you connect.

Is Ericzakariasson Pg an official MCP server?

No. Ericzakariasson Pg is a community server maintained by ericzakariasson. Community servers can be excellent; read the code and the open issues before you give Ericzakariasson Pg access to company data.

What license is Ericzakariasson Pg under?

Ericzakariasson Pg is released under the MIT license, according to its GitHub repository. The license covers the code of Ericzakariasson Pg; the service it connects to has its own terms.