postgres-mcp-server

postgres-mcp-server

0

This project provides an MCP server to query a PostgreSQL database for product information using SQL. It is designed to integrate with MCP clients like AI assistants, allowing them to execute read-only queries on a product database.

PostgreSQL Products MCP Server

A Model Context Protocol (MCP) server designed for interacting with a PostgreSQL database that contains product information. It enables clients, such as AI assistants, to query the database using SQL.

Prerequisites

  • Node.js (v18 or later recommended)
  • npm or yarn
  • Access to a PostgreSQL database with the products schema.

Installation

  1. Clone the repository and navigate to the directory.
  2. Install dependencies using npm or yarn.

Building

Compile the TypeScript code to JavaScript to create an executable file in the build/ directory.

Configuration

Configuration requires setting PostgreSQL connection details via environment variables. These variables include: PGHOST, PGPORT, PGUSER, PGPASSWORD, and PGDATABASE.

Usage

The server enables running SQL queries by providing the tool run_sql_query that executes read-only SQL SELECT statements against the configured products database.