MCP Server
Simple PostgreSQL MCP Server
A minimal MCP server that allows executing SQL queries on PostgreSQL databases with configurable read-only or write permissions.
7
GitHub Stars
8/23/2025
Last Updated
MCP Server Configuration
1{
2 "name": "simple-postgresql-mcp",
3 "command": "node",
4 "args": [
5 "/path/to/build/index.js",
6 "postgresql://username:password@localhost: 5432/database_name",
7 "write"
8 ]
9}
JSON9 lines
README Documentation
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
- Clone the repository
git clone https://github.com/perrypixel/Simple-Postgres-MCP cd Simple-Postgres-MCP
- Install dependencies
npm install
- 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 yourbuild
folder.
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
Quick Install
Quick Actions
Key Features
Model Context Protocol
Secure Communication
Real-time Updates
Open Source