MCP Pg Schema MCP Server

MCP server for getting schema information from a PostgreSQL database

Local serverstdio

What is the MCP Pg Schema MCP server?

Mcp pg schema mcp server connects MCP Pg Schema to AI assistants that speak the Model Context Protocol. MCP server for getting schema information from a PostgreSQL database.

What MCP Pg Schema does

A Model Context Protocol server that provides read-only access to PostgreSQL databases. This server enables LLMs to inspect database schemas and execute read-only queries.

Tools it exposes

Once connected, the assistant can call these 4 tools directly:

  • query — Execute read-only SQL queries against the connected database
  • Input — sql (string): The SQL query to execute
  • Tools — The Tools tool exposed by this server
  • Resources — The server provides schema information for each table in the database:

Installing the mcp pg schema mcp server

Setup follows the standard MCP pattern: clone or install the server, then register it in your client's configuration file and restart the client. The configuration snippets on this page cover Claude Desktop, Claude Code and Cursor.

Where it fits

Database servers turn schema archaeology and ad-hoc reporting into conversation, which is why they tend to be the second or third server people install. MCP Pg Schema sits in that group, and the shape of its toolset — query, Input, Tools among others — tells you what it is really for. Worth comparing against the other databases servers in this directory before you commit to one, since several overlap in scope but differ sharply in setup cost and permissions.

Practical notes

  • This server runs locally, so it operates with whatever access your machine and its credentials already have. Scope that deliberately rather than by default.
  • Maintained by vinsidious.
  • MCP clients ask for confirmation before each tool call by default. Keep that on while you learn what the mcp pg schema mcp server actually does with your data.
  • Every entry in this directory is reviewed by hand before it goes live, and details are checked against the project's own documentation.

Available tools

ToolWhat it does
queryExecute read-only SQL queries against the connected database
Inputsql (string): The SQL query to execute
ToolsThe Tools tool exposed by this server.
ResourcesThe server provides schema information for each table in the database:

How to install the MCP Pg Schema MCP server

{
  "mcpServers": {
    "postgres": {
      "command": "docker",
      "args": [
        "run", 
        "-i", 
        "--rm", 
        "mcp/postgres", 
        "postgresql://host.docker.internal:5432/mydb"]
    }
  }
}

Configuration as documented by the project. Restart the client after saving.

Example prompts to try

  • Use MCP Pg Schema to query.
  • Use MCP Pg Schema to Input.
  • Use MCP Pg Schema to Tools.

Frequently asked questions

It connects MCP Pg Schema to MCP-compatible AI assistants such as Claude and Cursor, exposing 4 tools (query, Input, Tools, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with MCP Pg Schema directly.