- Home
- MCP servers
- PostgreSQL
PostgreSQL
- javascript
4
GitHub Stars
javascript
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"vinsidious-mcp-pg-schema": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"mcp/postgres",
"postgresql://host.docker.internal:5432/mydb"
]
}
}
}This MCP server provides read-only access to PostgreSQL databases, enabling you to inspect table schemas and run safe read-only queries. It is designed for large language models (LLMs) to explore database structures and retrieve data without modifying anything.
How to use
You can connect to this MCP server from your MCP client (or Claude Desktop) using the provided stdio configurations. The server exposes a query tool that runs SQL queries inside a read-only transaction and automatically returns the results. Use it to explore table schemas, review columns and data types, and fetch data for analysis or validation. Remember, all queries run in READ ONLY mode, so you can safely inspect data without affecting the database.
How to install
Prerequisites you will need before starting:
Docker (optional) if you prefer running the server in a container. Node and npm/yarn are required if you plan to use NPX to execute the MCP server locally.
Install and run using Docker
{
"mcpServers": {
"postgres": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"mcp/postgres",
"postgresql://host.docker.internal:5432/mydb"]
}
}
}
Install and run using NPX
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-postgres",
"postgresql://localhost/mydb"
]
}
}
}
Notes and tips
-
Replace
/mydbor the host in the PostgreSQL URL with your actual database name and host. If you are using Docker on macOS and the server is running on the host network, usehost.docker.internalas the host in the connection string. -
The server exposes a way to fetch table schemas in JSON format for each table, including column names and data types. This helps you understand the structure of your database before composing read-only queries.
Available tools
query
Execute read-only SQL queries against the connected PostgreSQL database. Each query runs inside a READ ONLY transaction to prevent any data modification.