Skip to main content

Upgrading to 2.0

2.0 is the hardening + agent-power release (plan 101). Every break below fails at boot with the variable or key named — a misconfigured 2.0 never serves traffic half-configured. Check each item before you roll.

Must change​

What1.x2.0Action
Metrics endpoint/metrics on the public listenerserved only on METRICS_BIND (default 127.0.0.1:9090)Set METRICS_BIND=0.0.0.0:9090, expose container/service port 9090, point the ServiceMonitor (or scraper) at it. Keep it off the public ingress.
Mock signing keyOIDC_MOCK_MODE=trueALLOW_INSECURE_SIGNING_KEY=true, accepted only with a loopback OIDC_ISSUERRename; production never sets it.
OIDC envissuer / client id could be absentOIDC_ISSUER and OIDC_CLIENT_ID requiredSet both.
Write grantsquery_write ran on the database's single rolequery_write requires write_role + write_password on the database (wildcards expanded); reads always run as role in a read-only transactionProvision a read-only role and a separate write role (config reference), move the write-capable role to write_role. The gateway never provisions roles.
Unknown YAML keysignoredboot failsRemove stray keys.
Zero / out-of-range valuesacceptedboot fails: row_limit: 0, statement_timeout_ms: 0, port: 0, STATE_DB_POOL_SIZE=0, MAX_CONCURRENT_*=0, PERMISSIONS_CACHE_TTL_SECONDS > 300, REFRESH_TTL_DAYS outside 1–366, SESSION_TTL_HOURS outside 1–168, pool min_connections > max_connectionsFix the value.
Inline secretsallowed everywhererejected when gateway.env: productionUse ${ENV:…} / ${FILE:…}.
Shutdownimmediatedrains in-flight requests for 80 s (the 75 s /mcp request timeout + 5 s), then detached audit work (≤20 s), then closes the two state-DB pools (≤10 s each)terminationGracePeriodSeconds ≥ 120 plus any preStop sleep. A shorter grace period SIGKILLs a pod mid-drain and loses the completion audit rows of slow calls.
Admin APIpositional internalsunchanged HTTP surface; PATCH now merges constraints per key (absent keeps, null clears)Clients that sent a full constraints object keep working; clients relying on "omitted key clears it" must send null.
GET /mcp (SSE)greeting stream405Clients POST (Streamable HTTP).

New, opt-in​

  • Hot reload: SIGHUP re-reads the YAML atomically (all or nothing); admin mount/group, store driver and — while the admin API is mounted — the server set still need a restart.
  • Agent tiers: write_role, service_accounts[].max_concurrent_requests, require_upstream, headers x-dbmcp-run-id / x-dbmcp-on-behalf-of (headless agents).
  • Tools: table_stats, db_activity, cancel_query; run_query dry_run; explain analyze (reads only); rows_affected everywhere.
  • Target TLS: tls: verify_full + tls_ca_file (Postgres required encrypts but does not verify).
  • Per-database pools: pool: on server or database.

State DB schema​

Migrations apply at boot.

MigrationChangeWho it affects
0010–0014Additive: audit_call_intents, history index, refresh-token session link, mongo db_type, upstream/rows_affected/sql_truncated columnsNobody — new objects only
0015Drops audit_calls_user_sub_idx and audit_calls_db_type_idxAd-hoc reporting queries that filtered audit_calls by user_sub alone or by db_type lose their dedicated index. (user_sub, occurred_at) and the history index still serve per-user lookups.
0016Drops sessions.agent_clientBreaking for reports that select sessions.agent_client — the query fails. The column was always NULL; read the per-call client banner from audit_calls.agent_client instead.
0017 (2.1.0)Adds oauth_refresh_tokens.chain_id and the oauth_refresh_rotated tombstone tableNone. Refresh-token reuse outside a 10 s grace now revokes the whole chain. chain_id keeps a default, so 2.0.3 still inserts after a rollback.
0018 (2.1.0)Adds sql, sql_truncated and reason to audit_call_intentsNone. An abandoned row the reaper writes now says what ran.
0019 (2.2.0)Adds nullable oauth_clients.client_nameNone. The consent page shows the self-registered name, marked unverified. 2.1.0 still inserts and reads.
0020 (2.2.1)Partial indexes on soft-deleted permissions_* rowsNone — supports the pruner, which now hard-deletes soft-deleted users/databases/grants and permissions_audit rows older than AUDIT_RETENTION_DAYS
0021 (2.3.0)Widens the permissions_databases.db_type CHECK to accept redis (MySQL permissions store: 0006)None — additive. Rolling back to 2.2.1 is safe while no redis database is registered

New outcomes: abandoned, audit_unavailable, dry_run, cancelled. Reporting queries that enumerated outcomes should add them.

MySQL permissions store​

Only for permissions_store.driver: mysql. Its migrations 0004 (identity and routing columns move to utf8mb4_0900_as_cs, so SSO subjects and server names compare case-sensitively) and 0005 (the db_type CHECK constraint is rebuilt to admit mongo) need MySQL 8.0. MariaDB has no utf8mb4_0900_as_cs collation, so 0004 fails there and the gateway refuses to boot. CI and the dev stack run mysql:8.

Rollback​

From 2.0.3, rolling back one release works in place. The gateway boots on a state DB (or MySQL permissions store) that a newer release has migrated. It skips the migration versions it does not know and logs schema was migrated by a newer gateway release at boot. Migrations follow expand/contract: a drop lands only in a release after the one that stopped using the object. So release N-1 always runs on schema N. Going back further is not guaranteed, because the older code may need something a later migration dropped. If you need to go back further, roll forward instead, or restore the state DB from a backup.

A migration that already ran and whose file was later edited still refuses boot, on every version. The gateway never re-runs or skips a changed migration.

Up to and including 2.0.2 (and every 1.x), rollback across a migration is not possible in place. Those images refuse to boot on a schema that carries a migration they don't know: migration N was previously applied but is missing in the resolved migrations. Deleting rows from _sqlx_migrations to force the older image to boot is not a fix. The next upgrade would re-run migrations that are not idempotent, and it fails on objects that already exist. To get back to one of those images, restore the state DB from a backup taken before the upgrade. For 2.0 → 1.6 that means migrations 0010 onward. Otherwise, roll forward.

In every case, revert any config the newer release introduced (write_role, pool:, gateway:). 2.0 refuses unknown YAML keys at boot, and 1.x silently ignores them.