Sponsor MCPSafe10 founding slots
Registry/Data Gateway MCP Server

Data Gateway MCP Server

Verified

Production-minded Python MCP server for safe read-only PostgreSQL access by AI agents

go
automation
1stars
Scanned Oct 2, 2026
RepositoryGITHUB
Automated scan (limited checks) · 2026-10-02

This grade comes from an automated MCPSafe scan of the server's JavaScript, TypeScript and Python source on 2026-10-02. It read the whole repository (16 files). It checks for leaked credentials, shell or code injection from function inputs, unsafe deserialization, malware signatures, install-time scripts, and weak password handling. It does not check for path traversal, server-side request forgery, prompt injection in tool descriptions, network exposure, SQL injection, cross-site scripting, or vulnerable dependencies. It has not been manually reviewed, and the code may have changed since the scan.

A+100%
Scanned 1w ago

Excellent Security

Vulnerabilities Found
0Crit
0High
0Med
0Low
0Info

Trust Score 72

Usable with caution
Trust grade B

Trust is stricter than security: it combines reviewed security, MCP capability risk, supply-chain metadata, quality, popularity, freshness, and penalties for unknowns.

Security
100
MCP risk
78
Supply chain
80
Maintenance
58
Docs
88
Freshness
80
Risk traits
Filesystem access
Network/API access
Database access
Why it scores well
  • • No reviewed severe vulnerabilities published
  • • Good documentation surface
  • • Solid supply-chain metadata
  • • Recently scanned
What reduces confidence
  • • Missing/unclear license
  • • MCP risk traits: Filesystem access, Network/API access, Database access

Security ScoreA+

100
out of 100

Vulnerabilities Found

0
Crit
0
High
0
Medi
0
Low
0
Info
Last scanned: 10/2/2026

Quality ScoreC

58
out of 100
58
Maint.
3
Popular
88
Docs
72
Compat
Maintenance58%
Popularity3%
Documentation88%
Compatibility72%

Maintenance58

Unknown
Commit Frequency65%
Release Frequency35%
Issue Response80%

Popularity3

1
Stars
0
Downloads
0
Forks
Stars Score8%
Downloads Score0%
Forks Score0%

Documentation88

README Quality90%

Available Documentation

API DocsExamplesChangelog

Compatibility72

MCP Spec Compliance80%
Transport Support75%

Features

TypeScript

Supported Transports

STDIO

Vulnerabilities(0)

This grade comes from an automated scan. Individual findings from automated scans are not published.

READMEData Gateway MCP Server

View source

mcp-data-gateway

![CI](https://github.com/Ali-Chaghou/mcp-data-gateway/actions/workflows/ci.yml)

![Pages](https://github.com/Ali-Chaghou/mcp-data-gateway/actions/workflows/pages.yml)

A production-minded MCP server that lets AI agents

query a PostgreSQL database through a small set of controlled, read-only tools.

The core idea: agents never get raw database access. Every interaction goes through

explicitly designed tools with validated inputs and a read-only SQL guard, backed by

a least-privilege database role as the authoritative enforcement layer.

Status: reference implementation with fixed MCP tools, read-only PostgreSQL
access, JSON-safe output, audit logging, live-DB integration, container image,
and documentation build covered by CI. See
docs/project-plan.md.

mcp-data-gateway architecture

The gateway exposes a fixed, read-only MCP tool surface backed by a SELECT-only

PostgreSQL role.

Why

Giving an LLM agent a database connection string is easy — and dangerous. This project

demonstrates a safer pattern:

  • Read-only by design — three independent layers: tool design, a SQL validation

guard as defense-in-depth, and a least-privilege database role as the authoritative

control. The guard is a deny-by-default first filter, not a full SQL parser; the

database role/session (SELECT-only, default_transaction_read_only) is what

ultimately enforces read-only and table access. See SECURITY.md.

  • Small, purposeful tool surface — schema inspection, row lookup, and aggregate

stats. No generic "run any SQL" escape hatch for write operations.

  • Boring, auditable stack — Python 3.12, psycopg, PostgreSQL, Docker Compose.

The demo dataset is the classic Titanic passenger list: small, well-known, and

low-risk to expose publicly.

For what this deliberately does not provide — and what a real deployment would

still need — see Production considerations.

Quickstart

Requires Python 3.12+, Docker, and make.

sh
cp .env.example .env        # defaults work for local development
make up                     # start PostgreSQL via Docker Compose
make install                # create venv and install dependencies
make load-data              # create the schema, load sample data, set up the reader role
make smoke                  # verify end to end (incl. that direct writes are refused)
make run                    # start the MCP server on stdio

make load-data connects as the local admin (POSTGRES_*) only for setup: it

creates the passengers table with a small deterministic sample, then creates

the gateway_reader role with SELECT-only access. The server itself connects

via DATABASE_URL, which points at gateway_reader — never the admin user. The

script is idempotent, so you can re-run it safely.

To use with an MCP-capable client, register the server with a stdio transport

pointing at python -m mcp_data_gateway.server.

Repository layout

plaintext
src/mcp_data_gateway/
  server.py            # MCP server entrypoint (stdio); registers the tools
  config.py            # environment-based configuration
  db.py                # connection handling; read-only session, timeout, row cap
  audit.py             # structured audit logging boundary
  serialization.py     # JSON-safe output boundary
  tools/               # the agent-facing tools
    schema.py          #   describe tables and columns
    passengers.py      #   look up passenger rows
    stats.py           #   aggregate statistics
  security/
    readonly_sql.py    # read-only SQL guard
scripts/               # data loading and smoke test
tests/                 # pytest suite
docs/                  # architecture, security, operations, decisions

Documentation

Full documentation lives in `docs/` and is published with MkDocs

at <https://ali-chaghou.github.io/mcp-data-gateway/>:

sh
make docs               # build the site into site/
make docs-serve         # preview locally with live reload

Development

sh
make test               # run pytest
make lint               # ruff check + format check
make audit              # bandit + pip-audit
pre-commit install      # enable git hooks

CI runs these on every push and pull request, alongside a strict MkDocs build with

an internal link check, the opt-in live-DB integration tests (which prove the

read-only role and that direct writes are refused), and a container image build

that also checks the image runs as a non-root user. See

Validation for what each check proves.

Engineering conventions are described in

docs/engineering-process.md; design decisions are

captured as ADRs in docs/decision-records/.

License

MIT

Embed Security Badge

Add this badge to your README or documentation

Data Gateway MCP Server MCPSafe Security
[![Data Gateway MCP Server MCPSafe Security](https://api.mcpsafe.org
/api/badge/ali-chaghou-mcp-data-gateway.svg)](https://mcpsafe.org/registry/ali-chaghou-mcp-data-gateway)
Need more customization options?Badge Documentation

Server Information

Source
GITHUB
Language
go
Transport
STDIO
Added
Aug 2, 2026
Updated
Oct 1, 2026