{
  "markdown": "# db-mcp-server\n\nMCP server for MySQL, PostgreSQL, MongoDB, and SQLite databases. One instance per database, no Docker required.\n\n## Installation\n\n```bash\nuvx db-mcp-server\n```\n\n## Configuration\n\nConfigure via environment variables. Each instance connects to a single database.\n\n### MySQL\n\n| Variable | Required | Default | Description |\n|----------|----------|---------|-------------|\n| `DB_TYPE` | Yes | — | `mysql` |\n| `DB_DATABASE` | Yes | — | Database name |\n| `DB_PASSWORD` | Yes | — | Password |\n| `DB_HOST` | No | `localhost` | Host |\n| `DB_PORT` | No | `3306` | Port |\n| `DB_USER` | No | `root` | User |\n| `DB_MODE` | No | `read-only` | `read-only` or `read-write` |\n\n### PostgreSQL\n\n| Variable | Required | Default | Description |\n|----------|----------|---------|-------------|\n| `DB_TYPE` | Yes | — | `postgresql` |\n| `DB_DATABASE` | Yes | — | Database name |\n| `DB_PASSWORD` | Yes | — | Password |\n| `DB_HOST` | No | `localhost` | Host |\n| `DB_PORT` | No | `5432` | Port |\n| `DB_USER` | No | `postgres` | User |\n| `DB_MODE` | No | `read-only` | `read-only` or `read-write` |\n\n### MongoDB\n\n| Variable | Required | Default | Description |\n|----------|----------|---------|-------------|\n| `DB_TYPE` | Yes | — | `mongodb` |\n| `DB_DATABASE` | Yes | — | Database name |\n| `DB_URL` | Yes | — | Connection URL (`mongodb://...`) |\n| `DB_MODE` | No | `read-only` | `read-only` or `read-write` |\n\n### SQLite\n\n| Variable | Required | Default | Description |\n|----------|----------|---------|-------------|\n| `DB_TYPE` | Yes | — | `sqlite` |\n| `DB_PATH` | Yes | — | Path to `.db` file (local or remote with SSH) |\n| `DB_DATABASE` | No | filename | Display name |\n| `DB_MODE` | No | `read-only` | `read-only` or `read-write` |\n\n### SSH Tunnel (MySQL / PostgreSQL)\n\nOptionally connect through an SSH bastion host. Set `SSH_HOST` to activate.\n\nFor **SQLite over SSH**, the remote `.db` file is downloaded via SFTP before querying. In `read-write` mode, changes are uploaded back on shutdown.\n\n| Variable | Required | Default | Description |\n|----------|----------|---------|-------------|\n| `SSH_HOST` | No | — | SSH bastion host (activates tunneling) |\n| `SSH_PORT` | No | `22` | SSH port |\n| `SSH_USER` | No | Current OS user | SSH username |\n| `SSH_KEY` | No | — | Path to private key (`~/.ssh/id_rsa`) |\n| `SSH_PASSWORD` | No | — | SSH password (if no key) |\n\nAt least one of `SSH_KEY` or `SSH_PASSWORD` is required when `SSH_HOST` is set. SSH tunneling is not supported for MongoDB.\n\n## Usage in .mcp.json\n\n### SQLite (local)\n\n```json\n{\n  \"mcpServers\": {\n    \"db-local\": {\n      \"command\": \"uvx\",\n      \"args\": [\"db-mcp-server\"],\n      \"env\": {\n        \"DB_TYPE\": \"sqlite\",\n        \"DB_PATH\": \"/path/to/database.db\"\n      }\n    }\n  }\n}\n```\n\n### SQLite over SSH\n\n```json\n{\n  \"mcpServers\": {\n    \"db-remote\": {\n      \"command\": \"uvx\",\n      \"args\": [\"db-mcp-server\"],\n      \"env\": {\n        \"DB_TYPE\": \"sqlite\",\n        \"DB_PATH\": \"/remote/path/to/database.db\",\n        \"SSH_HOST\": \"server.example.com\",\n        \"SSH_USER\": \"deploy\",\n        \"SSH_KEY\": \"~/.ssh/id_rsa\"\n      }\n    }\n  }\n}\n```\n\n```json\n{\n  \"mcpServers\": {\n    \"db-prod\": {\n      \"command\": \"uvx\",\n      \"args\": [\"db-mcp-server\"],\n      \"env\": {\n        \"DB_TYPE\": \"mysql\",\n        \"DB_MODE\": \"read-only\",\n        \"DB_HOST\": \"db.example.com\",\n        \"DB_PORT\": \"3306\",\n        \"DB_USER\": \"root\",\n        \"DB_PASSWORD\": \"secret\",\n        \"DB_DATABASE\": \"myapp\"\n      }\n    }\n  }\n}\n```\n\n### With SSH tunnel\n\n```json\n{\n  \"mcpServers\": {\n    \"db-behind-bastion\": {\n      \"command\": \"uvx\",\n      \"args\": [\"db-mcp-server\"],\n      \"env\": {\n        \"DB_TYPE\": \"postgresql\",\n        \"DB_HOST\": \"10.0.0.5\",\n        \"DB_PORT\": \"5432\",\n        \"DB_USER\": \"postgres\",\n        \"DB_PASSWORD\": \"secret\",\n        \"DB_DATABASE\": \"myapp\",\n        \"SSH_HOST\": \"bastion.example.com\",\n        \"SSH_USER\": \"deploy\",\n        \"SSH_KEY\": \"~/.ssh/id_rsa\"\n      }\n    }\n  }\n}\n```\n\nFor multiple databases, add multiple instances:\n\n```json\n{\n  \"mcpServers\": {\n    \"db-prod\": {\n      \"command\": \"uvx\",\n      \"args\": [\"db-mcp-server\"],\n      \"env\": { \"DB_TYPE\": \"mysql\", \"DB_DATABASE\": \"prod\", \"...\" : \"...\" }\n    },\n    \"db-analytics\": {\n      \"command\": \"uvx\",\n      \"args\": [\"db-mcp-server\"],\n      \"env\": { \"DB_TYPE\": \"postgresql\", \"DB_DATABASE\": \"analytics\", \"...\" : \"...\" }\n    },\n    \"db-staging\": {\n      \"command\": \"uvx\",\n      \"args\": [\"db-mcp-server\"],\n      \"env\": { \"DB_TYPE\": \"mongodb\", \"DB_DATABASE\": \"staging\", \"...\" : \"...\" }\n    }\n  }\n}\n```\n\n## Tools\n\n### MySQL\n\n- **query** — Execute read-only SQL (SELECT, SHOW, DESCRIBE, EXPLAIN, WITH)\n- **execute** — Execute write SQL (INSERT, UPDATE, DELETE) — requires `DB_MODE=read-write`\n- **describe** — Describe table structure\n- **list_tables** — List all tables\n- **status** — Show connection info\n\n### PostgreSQL\n\n- **query** — Execute read-only SQL (SELECT, SHOW, DESCRIBE, EXPLAIN, WITH)\n- **execute** — Execute write SQL (INSERT, UPDATE, DELETE) — requires `DB_MODE=read-write`\n- **describe** — Describe table structure (column info from information_schema)\n- **list_tables** — List all tables in the public schema\n- **status** — Show connection info\n\n### SQLite\n\n- **query** — Execute read-only SQL (SELECT, SHOW, DESCRIBE, EXPLAIN, WITH)\n- **execute** — Execute write SQL (INSERT, UPDATE, DELETE) — requires `DB_MODE=read-write`\n- **describe** — Describe table structure (PRAGMA table_info)\n- **list_tables** — List all tables\n- **status** — Show connection info\n\n### MongoDB\n\n- **query** — Find documents in a collection\n- **describe** — Collection stats ($collStats)\n- **list_collections** — List all collections\n- **aggregate** — Execute aggregation pipelines ($out/$merge blocked on read-only)\n- **status** — Show connection info\n\n## License\n\nMIT\n\n<!-- mcp-name: io.github.stucchi/db -->\n",
  "bytes": 5797,
  "sha": "ecca55b82da2ce42a653d9be7d6cff92e3ab495f763c064a0d683c44c43948c7",
  "repo_slug": "stucchi/db-mcp-server",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_stucchi_db_a2d1a90c/readme"
}