PostgreSQL MCP Server (Enhanced)
Overview
PostgreSQL MCP Server (Enhanced) is a Model Context Protocol server that provides both read and write access to PostgreSQL databases, allowing LLMs to inspect database schemas, execute queries, modify data, and manage database schema objects.
To use the server, configure it with your PostgreSQL database connection details and execute commands through the provided API for querying, modifying data, and managing schemas.
- Read and write access to PostgreSQL databases - Schema management capabilities - Support for executing SQL queries and modifying data - Transaction handling for data modifications
- Executing complex SQL queries for data retrieval.
- Modifying records in a PostgreSQL database.
- Creating and managing database schemas and objects.
Add to your AI client
Use these steps to connect PostgreSQL MCP Server (Enhanced) in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.
Cursor
Add this to your .cursor/mcp.json file in your project root, then restart Cursor.
.cursor/mcp.json
{
"mcpServers": {
"enhanced-postgres-mcp-server-garethcott": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-enhanced-postgres-mcp-server-garethcott"
]
}
}
}Claude Desktop
Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"enhanced-postgres-mcp-server-garethcott": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-enhanced-postgres-mcp-server-garethcott"
]
}
}
}Claude Code
Add this to your project's .mcp.json file. Claude Code will detect it automatically.
.mcp.json (project root)
{
"mcpServers": {
"enhanced-postgres-mcp-server-garethcott": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-enhanced-postgres-mcp-server-garethcott"
]
}
}
}VS Code (Copilot)
Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.
.vscode/mcp.json
{
"servers": {
"enhanced-postgres-mcp-server-garethcott": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-enhanced-postgres-mcp-server-garethcott"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"enhanced-postgres-mcp-server-garethcott": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-enhanced-postgres-mcp-server-garethcott"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"enhanced-postgres-mcp-server-garethcott": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-enhanced-postgres-mcp-server-garethcott"
]
}
}
}FAQ
Can I use this server for read-only operations?
Yes, it supports read-only operations as well as write operations.
Is there a way to manage database schemas?
Yes, the server includes features for creating and modifying tables, functions, triggers, and indexes.
How does the server handle security?
The server uses transactions for data modifications and parameterized queries to prevent SQL injection.7:["$","div",null,{"className":"container mx-auto flex flex-col gap-4","children":["$L26","$L27",["$","$L28",null,{"currentProject":{"id":3282,"uuid":"903add0c-f766-460f-8584-b92d047ebc06","name":"enhanced-postgres-mcp-server","title":"PostgreSQL MCP Server (Enhanced)","description":"","avatar_url":"https://avatars.githubusercontent.com/u/37478006?v=4","created_at":"2025-03-18T14:10:30.074Z","updated_at":"2025-03-18T14:11:06.712Z","status":"created","author_name":"GarethCott","author_avatar_url":"https://avatars.githubusercontent.com/u/37478006?v=4","tags":"[]","category":"developer-tools","is_featured":false,"sort":1,"url":"https://github.com/GarethCott/enhanced-postgres-mcp-server","target":"_self","content":"$29","summary":"$2a","img_url":null,"type":null,"metadata":"{\"star\":\"0\",\"license\":\"View license\",\"language\":\"JavaScript\",\"is_official\":false,\"latest_commit_time\":\"2025-03-18 14:45:37\"}","user_uuid":null,"tools":null,"sse_url":null,"sse_provider":null,"sse_params":null,"is_official":false,"server_command":null,"server_params":null,"server_config":null,"allow_call":false,"is_innovation":false,"is_dxt":false,"dxt_manifest":null,"dxt_file_url":null,"is_audit":false},"randomProjects":[],"currentServerKey":"$undefined"}]]}]