postgresql-mcp (Python)
MCP server for PostgreSQL database operations. Works with Claude Code, Claude Desktop, Cursor, and any MCP-compatible client.
This is the Python implementation. A TypeScript implementation with the same
tool set lives in /typescript
and is published to npm as postgresql-mcp.
This file used to be a symlink to the repository root README. That made the published source distribution carry a dangling link, which broke the wheel build — so it is a real file now, deliberately kept short. The full documentation is in the repository README.
Install
pipx install postgresql-mcp
Configure
claude mcp add postgres -s user \
-e POSTGRES_HOST=localhost \
-e POSTGRES_USER=your_user \
-e POSTGRES_PASSWORD=your_password \
-e POSTGRES_DB=your_database \
-- postgresql-mcp
| Variable | Required | Default | Description |
|---|---|---|---|
POSTGRES_HOST |
localhost |
Database host | |
POSTGRES_PORT |
5432 |
Database port | |
POSTGRES_USER |
✅ | Database user | |
POSTGRES_PASSWORD |
✅ | Database password | |
POSTGRES_DB |
✅ | Database name | |
POSTGRES_SSLMODE |
prefer |
SSL mode | |
ALLOW_WRITE_OPERATIONS |
false |
Enable INSERT/UPDATE/DELETE | |
QUERY_TIMEOUT |
30 |
Query timeout in seconds | |
MAX_ROWS |
1000 |
Maximum rows returned per query |
What it provides
- 15 tools — query execution, schema exploration, table analysis, EXPLAIN plans
- 4 prompts — guided workflows for exploration, query building, performance analysis and documentation
- Named databases — select a configured connection per tool call without exposing credentials
- Resources — browsable database structure as markdown
- Read-only by default, with SQL injection prevention and credential protection
See the full documentation for the complete tool reference, security model, and the installation guide for database permissions and remote connections.
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file postgresql_mcp-1.1.0.tar.gz.
File metadata
- Download URL: postgresql_mcp-1.1.0.tar.gz
- Upload date:
- Size: 33.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11cacef2e82c9a5f11a23f265e1adc58ac58f3f2c8c3b1334a3207ea31a82570
|
|
| MD5 |
e85b49cebfda2264c4e38a70aaa781c4
|
|
| BLAKE2b-256 |
ff5c4690217dd117eefcf3cd5717975913bba3d820b07c3271649472babdbecd
|
Provenance
The following attestation bundles were made for postgresql_mcp-1.1.0.tar.gz:
Publisher:
publish.yml on JaviMaligno/postgres_mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
postgresql_mcp-1.1.0.tar.gz -
Subject digest:
11cacef2e82c9a5f11a23f265e1adc58ac58f3f2c8c3b1334a3207ea31a82570 - Sigstore transparency entry: 2334067193
- Sigstore integration time:
-
Permalink:
JaviMaligno/postgres_mcp@7529fdac66162ee1b471be207745d1455d008009 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/JaviMaligno
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7529fdac66162ee1b471be207745d1455d008009 -
Trigger Event:
push
-
Statement type:
File details
Details for the file postgresql_mcp-1.1.0-py3-none-any.whl.
File metadata
- Download URL: postgresql_mcp-1.1.0-py3-none-any.whl
- Upload date:
- Size: 21.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
364080ca7d15518c454f3b7c05f9e1f9d3cad4cda703e715ee820f59e3127546
|
|
| MD5 |
bb132993fddd051088388f88de717d50
|
|
| BLAKE2b-256 |
1f6608fd4a8e62fbb9b7a7440e76928d6ab8d7b257fa7a23faa64f18036d6d92
|
Provenance
The following attestation bundles were made for postgresql_mcp-1.1.0-py3-none-any.whl:
Publisher:
publish.yml on JaviMaligno/postgres_mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
postgresql_mcp-1.1.0-py3-none-any.whl -
Subject digest:
364080ca7d15518c454f3b7c05f9e1f9d3cad4cda703e715ee820f59e3127546 - Sigstore transparency entry: 2334067205
- Sigstore integration time:
-
Permalink:
JaviMaligno/postgres_mcp@7529fdac66162ee1b471be207745d1455d008009 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/JaviMaligno
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7529fdac66162ee1b471be207745d1455d008009 -
Trigger Event:
push
-
Statement type: