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 "Deploy 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 Server show 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
Inputs: query (required), readOnly.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
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.
Related MCP Connectors
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
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.MIT
- 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.9 npm1MIT
- 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.13 npmMIT