- Home
- MCP servers
- PostgreSQL
PostgreSQL
- javascript
1
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": {
"ahmetkca-mcp-server-postgres": {
"command": "npx",
"args": [
"-y",
"@ahmetkca/mcp-server-postgres",
"postgres://user:password@host:5432/database"
]
}
}
}You can deploy and use a multi-tenant MCP server for PostgreSQL that lets you read from multiple tenant schemas securely, introspect schema details, and execute read-only queries across schemas. This guide walks you through practical installation steps, how to run the server locally, and how to use it with MCP clients to explore your PostgreSQL data models.
How to use
Start the MCP server using one of the provided runtime commands, then connect your MCP client to query across tenant schemas in a read-only mode. You will be able to request schema overviews, inspect table structures, and read function definitions across multiple tenants without modifying data.
How to install
Prerequisites you need before installing and running the MCP server:
- Node.js 18+ is required
- A PostgreSQL database to connect to (local or remote)
Recommended installation and initial run flow using npm and npx:
# Install the MCP server globally (recommended)
npm install -g @ahmetkca/mcp-server-postgres
# Run directly with a connection string
npx @ahmetkca/mcp-server-postgres "postgres://user:password@host:port/database"
Additional setup and examples
If you prefer to start via a local command after installation, you can run the server with a direct URL as well.
# Direct execution (local or remote URL)
mcp-server-postgres "postgres://user:password@host:port/database"
Using Claude Desktop (optional)
You can add the MCP server to Claude Desktop by configuring the MCP server entry within the Claude settings. This enables you to invoke the MCP server from Claude alongside other clients.
Available tools
Multi-Tenant Database Query Tool
Executes read-only SQL queries across multiple tenant schemas. Supports complex SQL with JOINs, CTEs, window functions, and aggregations. Runs inside read-only transactions for safety.
List Database Schemas
Discovers all available tenant schemas with statistics like table and function counts to help you understand the multi-tenant layout.
Describe Schema
Provides comprehensive information about a specific tenant schema, including table counts, function definitions, and overall metadata for analysis.