Provides secure read-only access to PostgreSQL databases for executing SQL queries and retrieving schema information.
Created byApr 22, 2025
PostgreSQL MCP Server
A Model Context Protocol server that provides access to PostgreSQL databases. This server enables LLMs to interact with databases to inspect schemas, execute queries, and perform CRUD (Create, Read, Update, Delete) operations on database entries. This repo is an extension of PostgreSQL MCP Server providing functionalities to create tables, insert entries, update entries, delete entries, and drop tables.
Installation
To install the PostgreSQL MCP Server, follow these steps:
Install Docker and Claude Desktop
Clone the repository: git clone https://github.com/vignesh-codes/ai-agents-mcp-pg.git
Run PG Docker container docker run --name postgres-container -e POSTGRES_USER=admin -e POSTGRES_PASSWORD=admin_password -e POSTGRES_DB=mydatabase -p 5432:5432 -d postgres:latest
Open Claude Desktop and connect to the MCP server by updating the mcpServers field in claude_desktop_config.json:
Usage with Claude Desktop
To use this server with the Claude Desktop app, add the following configuration to the "mcpServers" section of your claude_desktop_config.json:
Docker
When running Docker on macOS, use host.docker.internal if the server is running on the host network (e.g., localhost).
Username/password can be added to the PostgreSQL URL with postgresql://user:password@host:port/db-name.
Make sure to restart the claude desktop app after updating the config file.
Features Added
Existing Functionality
query
New Functionality
Create Tables
Insert Entries
Update Entries
Delete Entries
Drop Tables
Resources
The server provides schema information for each table in the database:
Table Schemas (postgres://<host>/<table>/schema)
Sample
Input to Claude Desktop
Output from Claude Desktop
Note: Code block was split into 2 parts due to size limits.
Input to Claude Desktop
Output from Claude Desktop
Note: Code block was split into 2 parts due to size limits.
Input to Claude Desktop
Output from Claude Desktop
Input to Claude Desktop
Output from Claude Desktop
DB ENTRIES
License
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
PostgreSQL MCP Server
A Model Context Protocol server that provides access to PostgreSQL databases. This server enables LLMs to interact with databases to inspect schemas, execute queries, and perform CRUD (Create, Read, Update, Delete) operations on database entries. This repo is an extension of PostgreSQL MCP Server providing functionalities to create tables, insert entries, update entries, delete entries, and drop tables.
Installation
To install the PostgreSQL MCP Server, follow these steps:
Install Docker and Claude Desktop
Clone the repository: git clone https://github.com/vignesh-codes/ai-agents-mcp-pg.git
Run PG Docker container docker run --name postgres-container -e POSTGRES_USER=admin -e POSTGRES_PASSWORD=admin_password -e POSTGRES_DB=mydatabase -p 5432:5432 -d postgres:latest
Open Claude Desktop and connect to the MCP server by updating the mcpServers field in claude_desktop_config.json:
Usage with Claude Desktop
To use this server with the Claude Desktop app, add the following configuration to the "mcpServers" section of your claude_desktop_config.json:
Docker
When running Docker on macOS, use host.docker.internal if the server is running on the host network (e.g., localhost).
Username/password can be added to the PostgreSQL URL with postgresql://user:password@host:port/db-name.
Make sure to restart the claude desktop app after updating the config file.
Features Added
Existing Functionality
query
New Functionality
Create Tables
Insert Entries
Update Entries
Delete Entries
Drop Tables
Resources
The server provides schema information for each table in the database:
Table Schemas (postgres://<host>/<table>/schema)
Sample
Input to Claude Desktop
Output from Claude Desktop
Note: Code block was split into 2 parts due to size limits.
Input to Claude Desktop
Output from Claude Desktop
Note: Code block was split into 2 parts due to size limits.
Input to Claude Desktop
Output from Claude Desktop
Input to Claude Desktop
Output from Claude Desktop
DB ENTRIES
License
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.