Skip to main content
Glama

Simple PostgreSQL MCP Server

by perrypixel

Simple PostgreSQL MCP Server

A minimal Model Context Protocol (MCP) server for executing SQL queries on PostgreSQL databases with configurable permissions.

Features

  • Execute SQL queries with optional read-only or write access
  • Server-level mode (read-only/write) configurable via command line
  • Returns structured results with metadata
  • Simple setup using a PostgreSQL connection string

Getting Started

  1. Clone the repository
    git clone https://github.com/perrypixel/Simple-Postgres-MCP cd Simple-Postgres-MCP
  2. Install dependencies
    npm install
  3. Build the project
    npm run build

MCP Configuration

Add the following to your MCP client configuration (mcp.json):

Write Mode (default)

{ "mcpServers": { "simple-postgresql-mcp": { "command": "node", "args": [ "/path/to/build/index.js", "postgresql://username:password@localhost:5432/database_name", "write" ] } } }

Read-Only Mode

{ "mcpServers": { "simple-postgresql-mcp": { "command": "node", "args": [ "/path/to/build/index.js", "postgresql://username:password@localhost:5432/database_name", "readonly" ] } } }

Note: Update the path in the configuration to point to the index.js file inside your build folder.

Usage

  1. Copy the appropriate MCP configuration (read-only or write mode) to your tool’s mcp.json (e.g., Cursor, Windsurf, Copilot, etc.).
  2. Start your MCP client. The server is now ready to use!

Support

If you find this tool helpful, you can support the development by:

  • Buying me a coffee at https://ko-fi.com/perrypixel
  • UPI to kevinp@apl
-
security - not tested
F
license - not found
-
quality - not tested

A minimal MCP server that allows executing SQL queries on PostgreSQL databases with configurable read-only or write permissions.

  1. Features
    1. Getting Started
      1. MCP Configuration
        1. Write Mode (default)
        2. Read-Only Mode
      2. Usage
        1. Support

          Related MCP Servers

          • -
            security
            A
            license
            -
            quality
            An MCP server that connects to Supabase PostgreSQL databases, exposing table schemas as resources and providing tools for data analysis through SQL queries.
            Last updated -
            JavaScript
            MIT License
          • A
            security
            A
            license
            A
            quality
            An MCP server that provides read-only access to MySQL databases.
            Last updated -
            4
            419
            17
            JavaScript
            MIT License
            • Linux
            • Apple
          • -
            security
            A
            license
            -
            quality
            A template project for building custom MCP servers that enables direct access to PostgreSQL databases, allowing SQL query execution and schema information retrieval through the Model Context Protocol.
            Last updated -
            3
            Python
            MIT License
            • Apple
            • Linux
          • -
            security
            -
            license
            -
            quality
            An MCP server that allows working with MySQL databases by providing tools for executing read-only SQL queries, getting table schemas, and listing database tables.
            Last updated -
            1
            JavaScript

          View all related MCP servers

          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/perrypixel/Simple-Postgres-MCP'

          If you have feedback or need assistance with the MCP directory API, please join our Discord server