Skip to main content

haltsql-mcp

The safe drop-in replacement for @modelcontextprotocol/server-postgres. Same query(sql) tool, same positional connection string, plus column, tenant and function guardrails, a row cap and a statement timeout.

haltsql-mcp --local-policy policy.yaml postgresql://agent_ro@localhost/mydb

Or with Docker (includes the haltsql CLI; no central server needed):

docker run -i --rm --read-only -v "$PWD:/config:ro" ghcr.io/haltsql/haltsql-mcp \
  postgresql://agent_ro@host.docker.internal/mydb      # /config/policy.yaml is picked up

Build it with docker build -f clients/mcp/Dockerfile . from the repository root, and see scripts/mcp-docker-smoke.sh for the end-to-end test.

An MCP server that lets an agent query PostgreSQL only through HaltSQL: every SQL string is verified against your policy, then exactly that string runs with server-bound parameters in a read-only transaction (row cap, statement_timeout).

Tools: query(sql), explain_denial(sql), list_tables(), describe_policy(). The tenant comes from server configuration (stdio) or the authenticated bearer token (streamable HTTP), never from tool arguments.

pip install ../python .   # Python 3.10+
HALTSQL_URL=http://127.0.0.1:8080 HALTSQL_TOKEN=... \
HALTSQL_MCP_DATABASE_URL=postgresql://agent_ro@db/app \
HALTSQL_MCP_CONTEXT='{"tenant_id":"acme"}' haltsql-mcp

See docs/mcp.md for configuration, the tokens file, and examples. haltsql-mcp --help lists every flag.

Tests

python3 -m venv .venv && .venv/bin/pip install -e ../python -e '.[test,yaml]'
.venv/bin/pytest -q

Metadata

Release files for haltsql-mcp 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for haltsql-mcp 0.0.1
File Size Uploaded Provenance Actions
haltsql_mcp-0.0.1.tar.gz 22.0 kB With provenance Details for haltsql_mcp-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for haltsql-mcp 0.0.1
File Interpreter ABI Platform Actions
haltsql_mcp-0.0.1-py3-none-any.whl Python 3 none any Details for haltsql_mcp-0.0.1-py3-none-any.whl

Total release size: 39.4 kB

Release files / haltsql_mcp-0.0.1.tar.gz

Download URL haltsql_mcp-0.0.1.tar.gz
Size 22.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c37879c901f2fcb5e1dfa4dab8db005908c7e534f8ca3a20e519ce98bed51720
BLAKE2b-256 checksum
How to use checksums
14f3ec1bcd3750468aaf075c3580b8fda13c96dd8577a4614e83946feb6098c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / haltsql_mcp-0.0.1-py3-none-any.whl

Download URL haltsql_mcp-0.0.1-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dbddef824decbf0815d48bac1a2b955155f09e59437db36067bb2d8e38554df5
BLAKE2b-256 checksum
How to use checksums
ff1f17d417524e0b9220fd45ba2ea04a9aa0de7baa2a932e1647a7de23f06f54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Security for haltsql-mcp 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for haltsql_mcp-0.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page