Skip to content
Use case

Query a Postgres database from Claude

A Postgres MCP server gives your assistant a live connection to a database, so it can list tables, read column types, and run the queries it writes instead of guessing at your schema. That makes it practical to ask for a weekly revenue breakdown, debug a slow query with EXPLAIN, or draft a migration that matches the tables you actually have. Most servers accept a standard connection string, and several can be locked to read-only. Start with a read-only role on a replica before you point one at production, and check which tools can write.

241 matching serversRanked by trust score
Try it

Example prompts

Paste one into Claude, Cursor, or any MCP client once a matching server is installed.

  • List the tables in the public schema and describe how orders relate to customers.

  • How many users signed up each week over the last three months?

  • Run EXPLAIN ANALYZE on this query and tell me which index would speed it up.

  • Draft a migration that adds a nullable archived_at column to the projects table.

Top matches

MCP servers for Postgres queries

The 12 strongest of 241 matching servers. Servers that name the topic directly come first.

More tagged #Postgres
  • Trust score 65 of 100, Good

    ohmyho.st

    by amerged-org · TypeScript

    Operate ohmyho.st hosting from your coding agent: deploy GitHub apps, Postgres, mail, domains.

    Registry
    0 stars—/wk weekly downloads— tools
  • Trust score 64 of 100, Good

    Read-only health checks and data questions for SQL Server and PostgreSQL, with your saved profiles.

    Registry
    3 stars—/wk weekly downloads— tools
  • Supabase logo
    Trust score 63 of 100, Good

    MCP server for interacting with the Supabase platform

    OfficialRegistryRemote
    — stars—/wk weekly downloads— tools
  • Trust score 57 of 100, Fair

    mcp-ssh-manager

    by bvisible · JavaScript

    SSH for AI agents: commands, files, backups and health, with approval, a vault and an audit trail

    Registry
    520 stars807/wk weekly downloads— tools
  • Trust score 55 of 100, Fair

    guardvibe

    by goklab · TypeScript

    Deterministic security layer your AI can't be. 634 rules, 39 tools, CLI + doctor + host audit.

    Registry
    6 stars1.7K/wk weekly downloads— tools
  • Trust score 55 of 100, Fair

    Provision and connect third-party dev services (Supabase, Vercel, and more) from your coding agent.

    Registry
    — stars—/wk weekly downloads— tools
  • Trust score 55 of 100, Fair

    Finds authorization holes in Next.js + Supabase apps and live Supabase databases. No API key.

    Registry
    — stars—/wk weekly downloads— tools
  • Trust score 55 of 100, Fair

    Read-only diagnostics: Loki, Prometheus, PostgreSQL, Redis, BullMQ, Docker and GitHub.

    Registry
    — stars—/wk weekly downloads— tools
  • Trust score 55 of 100, Fair

    Postgres backend your coding agent builds over MCP; destructive actions wait for a person.

    RegistryRemote
    — stars—/wk weekly downloads— tools
  • Jam SQL Studio logo
    Trust score 55 of 100, Fair

    Jam SQL Studio

    Unknown author

    Lets AI agents query SQL Server, PostgreSQL, MySQL, Oracle and SQLite via the Jam SQL Studio app.

    Registry
    — stars—/wk weekly downloads— tools
Setup

How to set it up

  1. Pick a server. ohmyho.st is the strongest match. Check its tools and the API keys it needs on its page.
  2. Copy the config for your client. Open the install guide for Claude Desktop, Claude Code, Cursor, or VS Code, and paste the generated block into the client's config file. The client guides show where each config file lives.
  3. Restart and try a prompt. Restart the client so it loads the server, then paste one of the example prompts above.
FAQ

Questions about Postgres queries

What is the best MCP server for Postgres queries?

ohmyho.st ranks first here with a trust score of 65/100, followed by codeDB Lens (64) and Supabase (63). Servers that name the topic directly come first, each group ordered by the public trust score, which nobody can pay for. See the methodology for how it is calculated.

How do I set up ohmyho.st in Claude or Cursor?

Open the install guide for Claude Desktop or Cursor, copy the generated config into the client's config file, add any API keys the server asks for, then restart the client. The client guides cover VS Code, Claude Code, Windsurf, and more.

Can I use a hosted server instead of installing one locally?

4 of the 12 servers listed here can connect remotely over HTTP, so there is nothing to run on your machine: Supabase, PostgreSQL MCP by InsightfulPipe, Backenly, and others. The rest run locally over stdio.

How many MCP servers can do this?

MCPpedia lists 241 published servers that match this use case. This page shows the 12 strongest matches; thin and duplicate listings are left out.

Keep exploring
All use cases