MCP PostgreSQL Explorer
Provides tools for exploring a PostgreSQL database schema and running read-only queries, including listing tables, describing table columns and constraints, executing SELECT queries, and retrieving foreign key relationships.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP PostgreSQL Explorerlist all tables in the public schema"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP PostgreSQL Explorer
MCP PostgreSQL Explorer is a TypeScript MCP server that lets AI clients explore a PostgreSQL database schema and run read-only queries.
This is my first project of this kind. I am a computer science student building it to learn how MCP servers, TypeScript, PostgreSQL introspection, and database tooling work together.
Features
Lists base tables in a PostgreSQL schema.
Describes table columns, data types, defaults, nullability, and constraints.
Runs
SELECT-only queries.Lists foreign key relationships between tables.
Uses
publicas the default schema, with an optional schema override.
Related MCP server: MCP PostgreSQL Server
Tools
list_tables
Lists base tables in a schema.
Default:
{
"schema": "public"
}describe_table
Describes a table in a schema.
{
"schema": "public",
"table": "users"
}execute_query
Runs a read-only PostgreSQL query.
{
"query": "SELECT * FROM users LIMIT 10",
"params": []
}The tool rejects mutations, semicolons, and non-SELECT statements.
get_relationships
Lists foreign key relationships for tables in a schema.
{
"schema": "public"
}Tech Stack
TypeScript
Node.js
@modelcontextprotocol/sdkpgPostgreSQL system catalogs and
information_schema
Setup
Install dependencies:
npm installSet your database connection string:
export DATABASE_URL="postgres://user:password@localhost:5432/database_name"On Windows PowerShell:
$env:DATABASE_URL="postgres://user:password@localhost:5432/database_name"Run
npx tsx src/index.tsType Check
npx tsc --noEmitThis server cannot be deployed
Maintenance
Related MCP Connectors
Generate, fix, explain and run read-only SQL on PostgreSQL, MySQL and SQL Server
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
- dataOAuthco.thinair
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to safely interact with PostgreSQL databases through read-only operations, providing schema discovery, table inspection, and query execution capabilities with structured context awareness.MIT
- AlicenseNot gradedqualityCmaintenanceEnables secure read-only access to PostgreSQL databases, allowing users to list tables, query schemas, execute SELECT statements, and inspect table structures through natural language interactions.306 npm4MIT
- FlicenseAqualityDmaintenanceEnables AI agents to inspect and query PostgreSQL databases safely, with features like listing tables, retrieving schemas, and running read-only SQL queries.3-
- FlicenseNot gradedqualityDmaintenanceEnables querying and inspecting a PostgreSQL database, including executing SQL queries, listing schemas and tables, and describing table columns.-