Simple Psql MCP Server

This is a template project for those looking to build their own MCP servers. I designed it to be dead simple to understand and adapt - the code is

Local serverstdioPython

What is the Simple Psql MCP MCP server?

This is a template project for those looking to build their own MCP servers. I designed it to be dead simple to understand and adapt - the code is straightforward with MCP docs attached so you can quickly get up to speed. Exposed over MCP by the simple psql mcp mcp server, that capability becomes something an assistant can invoke while it works, not something you go and do afterwards.

What it actually does

Model Context Protocol (MCP) is a standard way for LLMs to interact with external tools and data. In a nutshell:

  • execute_query - Run SQL queries against your database
  • test_connection - Verify the database connection is working
  • db://tables - List of all tables in the schema
  • db://tables/{table_name} - Schema information for a specific table
  • db://schema - Complete schema information for all tables in the database
  • Query generation templates

Its toolset

Everything the assistant can do here goes through one of these:

  • execute_query — Run SQL queries against your database
  • test_connection — Verify the database connection is working

Configuration

You will need one environment variable: SCHEMA. Keep credentials in your client's env block or a secrets manager rather than in a file you might commit.

  • Python 3.8+ - uv - Modern Python package manager and installer - npx (included with Node.js) - PostgreSQL database you can connect to

Adding it to your client

The server ships on npm as @modelcontextprotocol/inspector, so your MCP client can launch it on demand — there is no separate build step. Add the server block to your client's configuration, restart it, and the tools register themselves.

When to reach for it

This sits in the database access group, where several servers overlap in what they claim to do but differ sharply once you actually set them up. Simple Psql MCP's toolset — execute_query, test_connection — is a fair guide to whether it matches your workflow. It is maintained by NetanelBollag; worth a glance at recent repository activity before you build anything load-bearing on it.

We check each listing at SyncDev against the project's documentation before it goes live — if something here drifts out of date, it is a bug worth reporting.

Caveats

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the simple psql mcp mcp server does with a few real requests.

Available tools

ToolWhat it does
execute_queryRun SQL queries against your database
test_connectionVerify the database connection is working

How to install the Simple Psql MCP MCP server

{
  "mcpServers": {
    "simple-psql": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/inspector"],
      "env": {
        "SCHEMA": "your-value"
      }
    }
  }
}

Add to claude_desktop_config.json, then restart Claude Desktop.

Configuration

  • Python 3.8+ - uv - Modern Python package manager and installer - npx (included with Node.js) - PostgreSQL database you can connect to
VariableDescriptionRequired
SCHEMAConfiguration value read at startup.Optional

Example prompts to try

  • Use Simple Psql MCP to execute query.
  • Use Simple Psql MCP to test connection.

Frequently asked questions

It connects Simple Psql MCP to MCP-compatible AI assistants such as Claude and Cursor, exposing 2 tools (execute_query, test_connection) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Simple Psql MCP directly.