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

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

Configuration

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

More MCP options

Compare MCP servers by category, or browse hosted MCP servers if you prefer an endpoint over a local process.

Maintainer setup documentation.

Recorded tools

Check the linked publisher documentation and your connected client's tool list. Names and availability can vary with the server version and account permissions.

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

How to install the Simple Psql MCP Server

{
  "mcpServers": {
    "postgres": {
      "command": "/path/to/uv",
      "args": [
        "--directory",
        "/path/to/simple-psql-mcp",
        "run",
        "postgres"
      ],
      "env": {
        "DSN": "postgresql://username:password@localhost:5432/my-db",
        "SCHEMA": "public"
      }
    }
  }
}

From the project documentation. Replace placeholders and example paths before connecting.

Configuration

  • Python 3.8+ - uv - Modern Python package manager and installer - npx (included with Node.js) - PostgreSQL database you can connect to
VariableDescriptionRequired
DSNDeclared in the maintainer’s client configuration.Check documentation
SCHEMADeclared in the maintainer’s client configuration.Check documentation

Example prompts to try

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

Frequently asked questions

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 Confirm the tools offered by your installed version in the connected client. Tool availability and permissions depend on the server and account configuration.