pgmcp

hirotake111/pgmcp

3.1

If you are the rightful owner of pgmcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This is a Model Context Protocol (MCP) server designed to fetch table definitions from a PostgreSQL database.

pgmcp

MCP server capable of fetching table definitions from a PostgreSQL database.

Features

  • Connects to a PostgreSQL server using a connection string provided via environment variable.
  • Provides an API to fetch table definitions (schemas) from the database.

Getting Started

  1. Install dependencies

    bun install
    
  2. Set the environment variable
    Create .env file in the root directory of this repository. Set a environment variable POSTGRES_URL in it.

  3. Run the server

    bun run index.ts
    

Usage

Once the server is running, you can fetch table definitions via the API.

  • Endpoint: /api/tables
    Method: GET
    Response:
    [
      {
        "table_name": "users",
        "columns": [
          { "name": "id", "type": "integer", "nullable": false },
          { "name": "email", "type": "text", "nullable": false }
        ]
      },
      ...
    ]
    

Tech Stack

  • Bun (runtime, server)
  • Bun.sql (PostgreSQL client)

Development