LabscoMCP early access ↗
chan00012MCP SERVER

PostgreSQL Kotlin MCP Server

Explore a PostgreSQL database and run SELECTs against staging, release or production; writes are refused.

by chan00012 ↗Relational SQL DatabasesCommunity

LABSCO SUMMARY

Read-only by construction, which is what makes pointing it at production reasonable.

Only SELECT is permitted, so the worst outcome is a slow query rather than a changed row. The relationship and JOIN-suggestion tools do the work that usually costs several failed attempts against an unfamiliar schema, and the environment argument keeps staging and production in the same conversation.

What it is

A PostgreSQL server built on the Kotlin MCP SDK, with read-only query execution, schema and relationship discovery, and HikariCP connection pooling.

What you get

  • SELECT queries executed and returned in table format; anything else is refused (postgres_query)
  • Every table in the database (postgres_list_tables)
  • A table's columns with data types, constraints and relationship indicators (postgres_get_table_schema)
  • Primary keys, foreign keys, what references a table, and its unique constraints (postgres_get_relationships)
  • JOIN conditions and example queries suggested from those relationships (postgres_suggest_joins)
  • Database name, version, driver and connection details (postgres_get_database_info), plus pool status and health metrics (postgres_connection_stats)
  • An environment argument on most tools, choosing staging, release or production

Requirements

JDK 21 and Gradle 8.10 to build the jar, and a PostgreSQL user with SELECT permission. The database.properties already in the repository reads each environment's JDBC URL, username and password from POSTGRES_* environment variables when the server starts. Staging is the default, and at least one environment must be set.

Setup effort

Build from source — git clone https://github.com/chan00012/postgres-kotlin-mcp.git