Skip to main content
Glama
arseniytech

MCP PostgreSQL Explorer

by arseniytech

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 public as 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/sdk

  • pg

  • PostgreSQL system catalogs and information_schema

Setup

Install dependencies:

npm install

Set 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.ts

Type Check

npx tsc --noEmit

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

No tool schema history has been recorded yet.

Maintenance

ActivityStale
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables 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
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables 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.
    751
    4
    MIT
  • F
    license
    A
    quality
    D
    maintenance
    Enables AI agents to inspect and query PostgreSQL databases safely, with features like listing tables, retrieving schemas, and running read-only SQL queries.
    3
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables querying and inspecting a PostgreSQL database, including executing SQL queries, listing schemas and tables, and describing table columns.
    -

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