Tools, resources and prompts are all demonstrated against one small domain, which is exactly what is missing from most MCP examples — and the bundled docs make the fork path short. Take the author's warning literally though: the only guard on a query is that it begins with SELECT, so this belongs on a scratch database, not on anything with customers in it.
A template project that happens to be a working PostgreSQL MCP server. It demonstrates all three MCP primitives against a real database: tools that execute queries, resources that expose the schema, and prompts that generate query templates. The code is kept straightforward with the MCP documentation bundled alongside it, so it can be read end to end and adapted into your own server.
- SQL run against your database, and a connection check for when nothing is coming back — `execute_query`, `test_connection`
- Schema browsable as resources rather than queries: every table in the schema, one table's structure, or the whole schema at once — `db://tables`, `db://tables/{table_name}`, `db://schema`
- Prompt templates for query generation and analytical query building
- A worked example database: a script that starts a PostgreSQL container pre-populated with sample users and addresses tables
- A config generator script that writes the client configuration from your DSN and schema name, rather than editing JSON by hand
- A layout intended to be copied: add a directory under `/src`, implement the server, add it to `[project.scripts]` in `pyproject.toml`
A PostgreSQL database you can reach, and its DSN. Python 3.8+, the `uv` package manager, and `npx` from Node.js for the MCP Inspector. Create the environment with `uv venv` and install from `requirements.txt`. Two environment variables carry the configuration: `DSN` in the form `postgresql://username:password@hostname:port/database`, and `SCHEMA`, typically `public`. The client runs it as `uv --directory /path/to/simple-psql-mcp run postgres`; the pyproject is `simple-psql-mcp` 1.0.0 with a `postgres` entry point. The author's own security note is blunt: the server checks that a query starts with SELECT and nothing beyond that is guaranteed, so do not point it at a production database.
