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.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
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
Query Postgres, MySQL, SQL Server, Oracle, BigQuery, ClickHouse and Redshift from your AI client.
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
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 gradedqualityBmaintenanceEnables 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.706 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-
- AlicenseNot gradedqualityDmaintenanceEnables read-only interaction with PostgreSQL databases, allowing natural language queries for listing schemas, tables, describing columns, and executing SELECT/WITH statements.84 npmMIT