io.github.arifulislamat/database-mcp-postgres

السجل الرسمي البيانات وقواعدها

MCP server for PostgreSQL. Read-only by default, row caps, timeouts, secrets never logged.

التثبيت

أضف هذا إلى إعدادات MCP في عميلك (Claude Desktop: claude_desktop_config.json، وCursor: ‏.cursor/mcp.json، ويستخدم VS Code وغيره الصيغة نفسها «mcpServers»).

NPM package @database-mcp/postgres
Claude Code
claude mcp add database-mcp-postgres -e 'POSTGRES_HOST=<POSTGRES_HOST>' -e 'POSTGRES_USER=<POSTGRES_USER>' -e 'POSTGRES_PASSWORD=<your postgres_password>' -e 'POSTGRES_DATABASE=<POSTGRES_DATABASE>' -- npx -y @database-mcp/postgres@0.5.0
إعداد JSON (Claude Desktop وCursor وVS Code)
{
    "mcpServers": {
        "database-mcp-postgres": {
            "command": "npx",
            "args": [
                "-y",
                "@database-mcp/postgres@0.5.0"
            ],
            "env": {
                "POSTGRES_HOST": "<POSTGRES_HOST>",
                "POSTGRES_USER": "<POSTGRES_USER>",
                "POSTGRES_PASSWORD": "<your postgres_password>",
                "POSTGRES_DATABASE": "<POSTGRES_DATABASE>"
            }
        }
    }
}

متغيرات البيئة

  • POSTGRES_HOST إلزامي Database host
  • POSTGRES_USER إلزامي Database user (a read-only user is recommended)
  • POSTGRES_PASSWORD سري Database password (or use POSTGRES_PASSWORD_FILE)
  • POSTGRES_DATABASE إلزامي Database name
PYPI package database-mcp-postgres
Claude Code
claude mcp add database-mcp-postgres -e 'POSTGRES_HOST=<POSTGRES_HOST>' -e 'POSTGRES_USER=<POSTGRES_USER>' -e 'POSTGRES_PASSWORD=<your postgres_password>' -e 'POSTGRES_DATABASE=<POSTGRES_DATABASE>' -- uvx database-mcp-postgres==0.2.0
إعداد JSON (Claude Desktop وCursor وVS Code)
{
    "mcpServers": {
        "database-mcp-postgres": {
            "command": "uvx",
            "args": [
                "database-mcp-postgres==0.2.0"
            ],
            "env": {
                "POSTGRES_HOST": "<POSTGRES_HOST>",
                "POSTGRES_USER": "<POSTGRES_USER>",
                "POSTGRES_PASSWORD": "<your postgres_password>",
                "POSTGRES_DATABASE": "<POSTGRES_DATABASE>"
            }
        }
    }
}

متغيرات البيئة

  • POSTGRES_HOST إلزامي Database host
  • POSTGRES_USER إلزامي Database user (a read-only user is recommended)
  • POSTGRES_PASSWORD سري Database password (or use POSTGRES_PASSWORD_FILE)
  • POSTGRES_DATABASE إلزامي Database name
CARGO package database-mcp-rs-postgres

متغيرات البيئة

  • POSTGRES_HOST إلزامي Database host
  • POSTGRES_USER إلزامي Database user (a read-only user is recommended)
  • POSTGRES_PASSWORD سري Database password (or use POSTGRES_PASSWORD_FILE)
  • POSTGRES_DATABASE إلزامي Database name

التوثيق

مأخوذ من ملف README للمشروع على GitHub ويُحدَّث أسبوعيًا. تفتح الروابط على GitHub.

المحتويات
  1. database-mcp
  2. Packages
  3. Design principles
  4. Quick start
  5. Contributing
  6. License

database-mcp

MCP servers that give AI clients safe, structured access to SQL databases.

One installable package per database engine, in TypeScript (npm), Python (PyPI), and Rust (crates.io). Every package exposes the same minimal two-tool surface, execute_sql and search_objects, with guardrails on by default: read-only mode, row caps, and statement timeouts.

Packages

All three lines are published and pass the same language-agnostic conformance suite against real databases in CI, so behavior is identical regardless of language. Every engine is also listed on the MCP Registry with all three install options: npm, PyPI, and cargo.

Rust crates are named database-mcp-rs-<engine> because the plain names are taken on crates.io; the command each one installs is still database-mcp-<engine>. Go is planned.

Design principles

  • Two tools, no more. A tiny tool surface keeps the model's context window clean. search_objects progressively discloses schema: call it with no arguments to list tables, with a table name to get columns, indexes, and foreign keys.
  • Safe by default. Read-only mode is enforced in two layers: a conservative SQL guard, plus a session-level read-only setting in the database itself. Rows are capped (default 1000) and statements time out (default 30s).
  • Configured at launch, never via chat. Connection details come from flags, a YAML config file, or environment variables. Credentials are never accepted through a tool call.
  • Secrets never appear in logs. Passwords live in non-printable secret types, DSNs are sanitized before logging, and a redaction filter guards the log boundary.

Quick start

Pick your engine's package; each README has the full config surface. SQLite via npm:

{
  "mcpServers": {
    "sqlite": {
      "command": "npx",
      "args": ["-y", "@database-mcp/sqlite", "--dsn", "/absolute/path/to/database.db"]
    }
  }
}

Or via PyPI: use "command": "uvx" and "args": ["database-mcp-sqlite", "--dsn", "/absolute/path/to/database.db"].

Or as a native binary, with no Node or Python runtime: run cargo install database-mcp-rs-sqlite, then use "command": "database-mcp-sqlite" with the same args minus the package name.

Flags, environment variables, and YAML config are identical across all three lines.

Networked engines take credentials from the environment (MYSQL_*, MARIADB_*, POSTGRES_*/DATABASE_URL, LIBSQL_URL/LIBSQL_AUTH_TOKEN), *_FILE mounted secrets, or a YAML file via --config. Never from a chat prompt.

Contributing

See CONTRIBUTING.md. The short version: the conformance suite is the definition of done. A change is mergeable only when conformance/run.mjs passes against every affected server.

License

MIT

الأسئلة الشائعة

ما هو io.github.arifulislamat/database-mcp-postgres؟

MCP server for PostgreSQL. Read-only by default, row caps, timeouts, secrets never logged.

كيف أثبّت io.github.arifulislamat/database-mcp-postgres؟

يعمل على جهازك. في Claude Code: claude mcp add database-mcp-postgres -e 'POSTGRES_HOST=<POSTGRES_HOST>' -e 'POSTGRES_USER=<POSTGRES_USER>' -e 'POSTGRES_PASSWORD=<your postgres_password>' -e 'POSTGRES_DATABASE=<POSTGRES_DATABASE>' -- npx -y @database-mcp/postgres@0.5.0. وفي العملاء الآخرين، الصق إعداد JSON من هذه الصفحة في إعدادات MCP الخاصة بهم.

هل يحتاج io.github.arifulislamat/database-mcp-postgres إلى مفتاح API؟

نعم. يتطلب POSTGRES_HOST, POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DATABASE، وتضبطها في إعداداته.

هل io.github.arifulislamat/database-mcp-postgres مفتوح المصدر؟

نعم. شيفرته متاحة على GitHub بترخيص MIT.

من يصون io.github.arifulislamat/database-mcp-postgres؟

ينشره arifulislamat. يدرجه AI.tn لكنه لا يصونه ولا يوصي به.

من سجل MCP الرسمي. الإدراج ليس توصية: راجع شيفرة الخادم وصلاحياته قبل منحه الوصول إلى بياناتك.