Labsco
MCP SERVER

PostgreSQL

by leixiaotian1

Point an assistant at a PostgreSQL database and let it read, write, create tables and read query plans — with the write path sitting in a tool of its own.

Relational SQL Databases
Summary
A Postgres connection with the write switch on its own tool.

Everything an assistant needs to work a database — list the tables, read rows, read the plan — with the operations that change data in a tool you can withhold.

What it is

A Go server that puts a PostgreSQL database behind five MCP tools. Reads, writes, table creation and query plans are each a separate tool, so a client can be given the SELECT path without being given the rest.

What you get
  • read_query runs a SELECT and returns rows — the read path is a tool of its own
  • write_query runs INSERT, UPDATE and DELETE, so granting writes is a separate decision from granting reads
  • create_table takes a CREATE TABLE statement, so schema changes happen in the same session
  • list_tables lists the user-created tables, optionally filtered to one schema
  • explain_query returns the execution plan for a query before you commit to running it
  • Speaks stdio, Server-Sent Events and streamableHttp, so it fits local and remote client setups alike
Requirements

Go 1.23 or later and a PostgreSQL server you can reach. Connection settings come from a .env file.