Connects dbmcp to MySQL, MariaDB, PostgreSQL, or SQLite in Claude Code or Codex, or fixes a dbmcp server that fails to start. Use when dbmcp tools are missing or failing, or the user wants to change the database, credentials, or config.
33 stars
0 votes
0 copies
0 views
Added November 30, 2026
ai-agentsgoshellbashsqldockergitdatabasebackend
Works with
claude code
cli
mcp
Security analysis
F35/100
criticalAccesses sensitive system or user directories
criticalReads or references SSH private keys
highContains patterns that look like hardcoded API keys
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Setup?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/haymon-ai-setup)
---
name: setup
description: "Connects dbmcp to MySQL, MariaDB, PostgreSQL, or SQLite in Claude Code or Codex, or fixes a dbmcp server that fails to start. Use when dbmcp tools are missing or failing, or the user wants to change the database, credentials, or config."
---
# Set up dbmcp
No request (Codex **Set up**): detect host, ask backend and host or file path.
## Host
Claude Code sets `CLAUDECODE=1`; else Codex (ask if unsure). No plugin tools: need `claude --version` ≥ 2.1.119 or `codex --version` ≥ 0.122.0.
## Config file
Absolute paths; if it exists, change only the asked keys, keep the rest (`privacy.*`, `ssh.*`, TLS, `read_only`); print the path.
```yaml
# yaml-language-server: $schema=https://raw.githubusercontent.com/haymon-ai/dbmcp/v0.23.0/crates/config/assets/dbmcp.schema.json
database:
backend: postgres # mysql | mariadb | postgres | sqlite
host: localhost
port: 5432 # mysql/mariadb: 3306
user: app_reader
name: shop # omit = all databases; sqlite: absolute file path, no host/port/user
```
SSH: `ssh: { host: bastion, user: deploy, key: [REDACTED] }` (bastion in `~/.ssh/known_hosts`; `database.host` as it sees it). TLS: `ssl: true`, `ssl_ca: /abs/ca.pem` (client cert: `ssl_cert`, `ssl_key`) under `database:`.
Other settings: every key and its meaning is in the schema above (this release) or https://dbmcp.haymon.ai/configuration/. Add only what the user asks for; Safety still applies.
Smoke test (config only; `<vars>` names the files):
```sh
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"smoke","version":"0"}}}' | <vars> npx -y @haymon-ai/dbmcp@0.23.0
```
A `result` reply = OK; an `error` reply's `message` names the problem: on `invalid settings:` fix only the keys named. After a fix, **Reconnect** in `/mcp`: Claude Code skips a failed plugin server for 15 minutes (`Skipping connection (recent failure cached …)`); the smoke test shows the real error meanwhile. `[redacted]` in the message = text matching a configured env value.
## Claude Code
- Default, no file: user fills quick connect + Password in `/plugin configure`.
- More settings (`privacy.rules`, SSH, TLS): `mkdir -p "${CLAUDE_PLUGIN_DATA}"`, write `${CLAUDE_PLUGIN_DATA}/dbmcp.yaml`, smoke test (`DBMCP_CONFIG_FILE=`, plus `DBMCP_ENV_FILE=` if the `.env` below exists). User sets it as `config_file`, clears quick-connect fields but Password (they beat the file).
- Other secrets: `${CLAUDE_PLUGIN_DATA}/.env` (`chmod 600`), empty `DBMCP_SSH_KEY_PASSPHRASE=` / `DBMCP_PRIVACY_KEY=` for the user to fill; set as `env_file`.
- Slow first start (~16 MB): the smoke test (or, without a file, `npx -y @haymon-ai/dbmcp@0.23.0 --version`) fills the npx cache; then **Reconnect** in `/mcp`, not restart; or `MCP_TIMEOUT=120000 claude`.
## Codex
- `mkdir -p` `${CODEX_HOME:-$HOME/.codex}/plugins/data/dbmcp-haymon-ai`. Its `.env` (`chmod 600`): `DBMCP_CONFIG_FILE=dbmcp.yaml` (same folder) and an empty `DBMCP_DB_PASSWORD=` for the user to fill; add only missing lines. Smoke test with `DBMCP_ENV_FILE=<.env>`.
- Add `export DBMCP_ENV_FILE=<.env>` to `~/.zshenv` (or bash/fish equivalent); never the password.
- Restart Codex fully (desktop reads `~/.zshenv`, not `~/.zprofile`). Slow start: smoke test, restart.
## Telemetry
- Once per setup, after a passing smoke test, unless a choice is recorded: `telemetry.mode` in the dbmcp YAML, `DBMCP_TELEMETRY_MODE` in the dbmcp `.env` or shell, or (Claude Code; you cannot read it, so ask) Usage metrics in `/plugin configure`.
- Ask: "dbmcp can send anonymous usage metrics (versions, OS, database type, MCP client, tool-call counts, durations and output sizes, and one feature setting's state; no SQL, no data, no identifiers) to its maintainers. It helps them decide which databases, clients, and tools to work on. Would you like to turn it on? Details: https://dbmcp.haymon.ai/configuration/telemetry" Two equal answers, none preselected: "Yes, I'd like to help" / "No, thanks".
- Record the answer, `otlp` or `off`, in the YAML you manage or the Codex `.env`; else the user sets Usage metrics. On yes, thank them and say `off` turns it off. No answer: change nothing.
## Errors
- Connection error: host, port, firewall, `ssh.*`, TLS.
- Unclear failure: rerun the smoke test with `DBMCP_LOG_LEVEL=debug`; logs go to stderr.
- Duplicate dbmcp (plugin + manual): remove the manual one.
- Broken npx install: with the user's OK delete `~/.npm/_npx`, retry. Fallbacks: Docker `ghcr.io/haymon-ai/dbmcp`, `dbmcp` on PATH.
Docs: https://dbmcp.haymon.ai/configuration/errors
## Safety
- Never ask for a secret in chat or read a secret file into context (no `cat`/`echo`/`printenv`/masks); presence only: `grep -Eq '^[[:space:]]*(export[[:space:]]+)?NAME[[:space:]]*[=:][[:space:]]*[^[:space:]#]' <.env>`. YAML holds no secret and no `${VAR:?}` for one, even when asked: set each by its env name in the Password field or env file, which beat the YAML (`database.password` → `DBMCP_DB_PASSWORD`, `ssh.password` → `DBMCP_SSH_PASSWORD`, `ssh.key_passphrase` → `DBMCP_SSH_KEY_PASSPHRASE`, `http.auth_token` → `DBMCP_HTTP_AUTH_TOKEN`, `privacy.key` → `DBMCP_PRIVACY_KEY`).
- Pasted secret: never repeat or store it; say it is in the transcript; rotate it.
- Never loosen `database.read_only`, `privacy.*`, `database.ssl*` (incl. `ssl_ca`, `ssl_cert`, `ssl_key`), `ssh.strict_host_key_checking`, `ssh.known_hosts`, or `http.*` exposure and auth, nor turn telemetry on or redirect it (`telemetry.mode: otlp`, removing an `off`, any other `telemetry.*`), unless the user's own message asks for that exact change (a "Yes" to the Telemetry question above counts for `otlp` only); never as an error fix. First state in one sentence what it exposes and to whom (e.g. "`read_only: false` lets every MCP client write and run DDL.").