🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

db-gateway

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

db-gateway

MCP server that lets AI agents query and operate 8 databases (MySQL, PostgreSQL, Redshift, MongoDB, Redis, DynamoDB, Elasticsearch, Kafka) with 145+ tools

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

DB Gateway MCP Server

English | 한국어

An MCP server that gives AI agents direct access to your databases — 145+ tools across 8 engines.

The point is that the agent reads your schema itself instead of you pasting DDL into a prompt:

You: "Find users who signed up last month and never placed an order"

  1. mysql_get_all_schemas          → reads every table definition
  2. mysql_get_table_relationships  → finds the users ↔ orders foreign key
  3. mysql_execute_query            → runs the LEFT JOIN
EngineToolsEngineTools
MySQL16Redis21
PostgreSQL16DynamoDB13
Redshift27Elasticsearch19
MongoDB14Kafka19

Quick Start

Requires Node.js 18+. Register it with your MCP client — no install step:

{
  "mcpServers": {
    "db-gateway": {
      "command": "npx",
      "args": ["-y", "db-gateway"],
      "env": {
        "DBS": "mysql,redis",
        "MYSQL": "mysql://<user>:<password>@<host>:3306/<database>?alias=dev&default=true",
        "REDIS": "redis://:@<host>:6379/0?alias=dev&default=true"
      }
    }
  }
}

DBS decides which engines are enabled — only those tools get registered.

Connection strings

One string per engine. Semicolons separate multiple instances.

VariableFormat
MYSQLmysql://<user>:<password>@<host>:<port>/<db>?alias=name
POSTGRESQLpostgresql://<user>:<password>@<host>:<port>/<db>?alias=name&ssl=true
REDISredis://:<password>@<host>:<port>/<db-index>?alias=name
MONGODBmongodb://<user>:<password>@<host>:<port>/<db>?alias=name
REDSHIFTredshift://<user>:<password>@<host>:<port>/<db>?alias=name&ssl=true
ELASTICSEARCHelasticsearch://<user>:<password>@<host>:<port>?alias=name, or http(s)://<host>:<port>?alias=name
KAFKAkafka://<user>:<password>@<broker>:<port>,<broker2>:<port>?alias=name&mechanism=plain

alias is required. It is how tools address a specific instance — omit it and that engine fails to connect.

Several instances of the same engine — separate their connection strings with a semicolon. The agent picks one by passing an alias argument to any tool; default=true marks the one used when no alias is given:

MYSQL="mysql://<user>:<password>@<dev-host>:3306/<db>?alias=dev&default=true;mysql://<user>:<password>@<prod-host>:3306/<db>?alias=prod"

DynamoDB is the exception — it takes DYNAMODB_REGION, DYNAMODB_ACCESS_KEY_ID, and DYNAMODB_SECRET_ACCESS_KEY instead. See .env.example for every option.

Read-Only Mode

READ_ONLY=true hides write tools from the tool list entirely and restricts *_execute_query to SELECT-style statements.

Register production as a second MCP server with this flag on. The agent then cannot modify production data — the write tools do not exist as far as it can see.

"db-gateway-prod": {
  "command": "npx",
  "args": ["-y", "db-gateway"],
  "env": { "READ_ONLY": "true", "DBS": "mysql", "MYSQL": "..." }
}

Documentation

  • Tool Reference — all 145+ tools, by engine
  • Connection Management — pooling, health checks, and why connectionLimit multiplies per session
  • Deployment — SSE mode, Nginx, PM2, sharing one gateway across a team

License

MIT

Keywords

mcp

FAQs

Package last updated on 06 Aug 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts