list_databaseLABSCO SUMMARY
Read-only is enforced by which tools exist, not by an instruction the model can ignore.
That is the whole argument for this one: start it with --read-only and there is no write_query, no delete_query and no alter_table on the surface at all, so an agent cannot be talked into one. The EXPLAIN pre-check is the second layer — a CRUD statement is planned and the plan compared before it runs, which catches the accidental full-table update. Being a single Go binary means no runtime to install alongside it. The author is upfront that this is early work and adapted from a MySQL server.
What it is
A Postgres client shipped as one Go binary, with no Node.js or Python runtime to install. Ten tools split between schema work and data work, and two flags that decide how much of that surface exists at all.
What you get
- Schema inspection: the databases on the server, the tables in one, and the structure of a named table (list_database, list_table, desc_table).
- Schema changes from SQL you supply — creating a table, or altering an existing one, where the model is told not to drop a table or a column (create_table, alter_table).
- Reads and writes as separate tools rather than one execute: a read-only query, an insert returning rows affected and the last insert id, an update, and a delete (read_query, write_query, update_query, delete_query).
- A row count for a named table without writing the SQL for it (count_query).
- A read-only mode that exposes only the tools whose names begin with list, read_ or desc_ — the write tools are not present to be called.
- A query-plan check that runs EXPLAIN before a CRUD statement executes and compares the plan against the expected pattern, on by default.
- Tool descriptions localised by a language flag, currently English and Simplified Chinese, with the locale files open to additions.
Requirements
The binary from a release, or go install if you have Go. A Postgres connection string passed as --dsn, and nothing else — no account, no key beyond your own database credentials. Stdio is the default; --t sse with --ip and --port serves it over the network instead. Two flags are worth deciding on before you start: --read-only removes every write tool, and --with-explain-check turns off the EXPLAIN pre-check that is otherwise on. Changing --read-only takes a restart of the server. The author describes the project as a work in progress and not yet ready for production.
Setup effort
One command plus credentials — go install -v github.com/guoling2008/go-mcp-postgres@latest, then supply credentials
USE CASES
Letting an assistant answer questions from a production database
Start it read-only so the write tools are not on the surface to be reached for.
Understanding a schema you inherited
List what is there, describe the tables that look relevant, then count what is actually in them.
Building out a schema during development
Create the tables and alter them as the design settles, from SQL you wrote.
Fixing a data problem you found
The update and delete paths are separate tools, so the intent is explicit in the call.
Avoiding a query that would scan the whole table
The plan is checked with EXPLAIN before the statement runs, unless you turn that off.
10 tools
Listed in project docs. Your client may show a different list.
list_tablecreate_tablealter_tabledesc_tableread_querywrite_queryupdate_querydelete_querycount_queryBEFORE YOU INSTALL
What to know first
Tools you get
10 tools named in the project's documentation.
Requires
go-mcp-postgres on PATH
INSTALLATION
Connect your client
Add the block to your client, or run the command directly.
Server setup
Configuration file
{
"mcpServers": {
"postgres": {
"command": "go-mcp-postgres",
"args": [
"--dsn",
"postgresql://<YOUR_DB_USER>:<YOUR_DB_PASSWORD>@<YOUR_DB_HOST>:<YOUR_DB_PORT>/<YOUR_DB_NAME>"
]
}
}
}go install
go install -v github.com/guoling2008/go-mcp-postgres@latest