Simple PostgreSQL MCP Server
Provides support for the developer through Ko-fi donations
Allows execution of SQL queries on PostgreSQL databases with configurable read-only or write access permissions, returning structured results with metadata
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Simple PostgreSQL MCP Servershow me the last 10 orders from the orders table"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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
Clone the repository
git clone https://github.com/perrypixel/Simple-Postgres-MCP cd Simple-Postgres-MCPInstall dependencies
npm installBuild 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.jsfile inside yourbuildfolder.
Usage
Copy the appropriate MCP configuration (read-only or write mode) to your tool’s
mcp.json(e.g., Cursor, Windsurf, Copilot, etc.).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
Available Tools
1 toolexecute_queryC
Execute SQL queries on PostgreSQL database
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | SQL query to execute | |
| readOnly | No | If true, only allows read-only queries (SELECT, EXPLAIN, etc.) |
TDQS
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.
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.
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.
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.
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.
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
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.
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.
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.
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
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
- SupabaseOAuthcom.supabase
MCP server for interacting with the Supabase platform
Hosted MCP server for PostgreSQL diagnostics: slow queries, missing indexes, connection pressure.
An MCP server that provides read access to your cloud storage providers, bank accounts and more.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA 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.29ISC
- AlicenseBqualityDmaintenanceA lightweight Postgres MCP server for safe database exploration and query analysis, read-only by default, with multi-database support.44MIT
- AlicenseNot gradedqualityDmaintenanceAn 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.13MIT
- AlicenseNot gradedqualityCmaintenanceA cross-platform MCP server for querying and introspecting PostgreSQL databases with SSH tunnel support, featuring multi-layered query safety and read-only enforcement.23MIT
Appeared in Searches
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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