Skip to main content
Glama
perrypixel

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

Related MCP server: pg-mcp

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:

Available Tools

1 tool
execute_queryC

Execute SQL queries on PostgreSQL database

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesSQL query to execute
readOnlyNoIf true, only allows read-only queries (SELECT, EXPLAIN, etc.)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Execute SQL queries' implies mutation capability, it doesn't address critical behavioral aspects like authentication requirements, transaction handling, error behavior, rate limits, or what happens with destructive queries. The description is too minimal for a database query tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with a single, clear sentence that states exactly what the tool does. There's zero wasted language or unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a database query execution tool with no annotations and no output schema, the description is insufficient. It doesn't explain what kind of results to expect, error handling, transaction behavior, or security implications. The minimal description leaves too many critical questions unanswered.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage, the schema already documents both parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema, so it meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Execute SQL queries') and target resource ('PostgreSQL database'), providing a specific verb+resource combination. However, without sibling tools to differentiate from, it cannot achieve the highest score for sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, prerequisites, or specific contexts. It simply states what the tool does without any usage instructions or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

B3/5.0
Disambiguation5/5

With only one tool, there is no possibility of ambiguity or overlap between tools. The single tool has a clear and distinct purpose, making it impossible for an agent to misselect between tools.

Naming Consistency5/5

Since there is only one tool, it inherently follows a consistent naming pattern. The tool name 'execute_query' uses a clear verb_noun structure, and there are no other tools to cause inconsistency.

Tool Count2/5

A single tool for a PostgreSQL server is too few for the apparent scope, as it lacks basic operations like listing tables, inserting data, or managing connections. This minimal set will likely cause agent failures due to incomplete functionality.

Completeness1/5

The tool surface is severely incomplete for a PostgreSQL server. It only provides query execution, missing essential CRUD operations, schema management, and other database interactions, leaving significant gaps that will hinder agent workflows.

Maintenance

ActivityInactive
ResponsivenessUnresponsive

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
    A production-ready MCP server that enables safe, read-only SQL SELECT queries against PostgreSQL databases with built-in security validation. It features connection pooling, automatic row limits, and structured logging to ensure secure and reliable database interactions.
    29
    ISC
  • A
    license
    B
    quality
    D
    maintenance
    A lightweight Postgres MCP server for safe database exploration and query analysis, read-only by default, with multi-database support.
    4
    4
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    An open-source MCP server for PostgreSQL schema introspection and guarded read-only queries. It enables MCP clients to discover schemas, tables, columns, indexes, relationships, and safe queryable data from a configured PostgreSQL database.
    13
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    A cross-platform MCP server for querying and introspecting PostgreSQL databases with SSH tunnel support, featuring multi-layered query safety and read-only enforcement.
    23
    MIT

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

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