mcp-server-postgres
Model Context Protocol Server for PostgreSQL databases. This server enables LLMs to inspect database schemas and execute read-only queries.
Features
- Read-only access to PostgreSQL databases
- Schema inspection capabilities
- Safe query execution within READ ONLY transactions
- Docker support
- NPM package available
Installation
Using Docker
# Build the Docker image
make docker
# Run with Docker
docker run -i --rm mcp/postgres postgresql://host:port/dbname
Installing via Smithery
To install PostgreSQL Database Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @yuru-sha/mcp-server-postgres --client claude
Usage
With Claude Desktop
Add the following configuration to your claude_desktop_config.json
:
{
"mcpServers": {
"postgres": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"mcp/postgres",
"postgresql://host:port/dbname"
]
}
}
}
Note: When using Docker on macOS, use host.docker.internal
if the PostgreSQL server is running on the host network.
Connection URL Format
postgresql://[user][:password]@host[:port]/database
Replace /database
with your database name.
Development
# Initial setup
make setup
# Build the project
make build
# Format code
make format
# Run linter
make lint
License
This project is released under the MIT License.
Security
This server enforces read-only access to protect your database. All queries are executed within READ ONLY transactions.
For enhanced security, we recommend creating a read-only user.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
PostgreSQL Database Server
Project Details
- yuru-sha/mcp-server-postgres
- MIT License
- Last Updated: 5/7/2025
Recomended MCP Servers
Rad Security MCP Server
MCP server for getting schema information from a PostgreSQL database
An open-source agent toolkit that auto-syncs SDK versions, docs, and examples—built for seamless integration with LLMs, and AI...
Generate mermaid diagram and chart with AI MCP dynamically.
A versatile MCP-compliant web content fetching tool that supports multiple modes (browser/node), formats (HTML/JSON/Markdown/Text), and intelligent proxy detection,...
rocketreach-mcp-server
Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
An MCP server for Home Assistant
mcp metabase
This is an MCP server that allows you to directly download transcripts of YouTube videos.
Community MCP server for hyprctl