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 "Install 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: Enterprise PostgreSQL MCP 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 installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/arseniytech/MCPPostgreSQLExplorer'
If you have feedback or need assistance with the MCP directory API, please join our Discord server