Datasources
One shared gateway for a project's databases and data stores — a free-form query tool per source, or a sidecar server where toolbox has none.
1 skill · 1 tool
Agents reach a project’s data sources through one declared catalogue: a database becomes a free-form query tool on a shared gateway, and a source toolbox cannot host (OpenSearch, S3) becomes its own small MCP server.
What it does
Runs the MCP Toolbox gateway as a shared service (port range 18500–18599) and registers the sources a project declares once in the config and opts into per project. Engines: MySQL/MariaDB, Postgres, SQLite, MongoDB and Redis. The devbot:datasources skill documents how to query them.
Sources with no toolbox engine are sidecars: a small MCP server in its own container, on its own port, declared with the same type + env shape — opensearch (the OpenSearch project’s server) and s3 (dev-bot’s own read-only server). See Configuration.
The module renders the gateway’s compose file, its tool definition, and every sidecar service from the declared sources, so adding a source is a config change, not a code change.
Only databases the gateway can actually initialize are registered. Toolbox treats an unreachable source as fatal at startup and on reload, so one down database would otherwise take the whole shared gateway down with it. Sidecars are not probed: each is its own container, so it cannot take anything else down with it — one that fails to start fails only its own manifest.
Contents
| Type | Name | Purpose |
|---|---|---|
| Skill | datasources |
Use when querying or exploring a project’s data sources — MySQL, MariaDB, Postgres, MongoDB, Redis, OpenSearch or S3 — through the datasources module. |
| Tool | reload-datasources |
Re-evaluate the catalogue and verify the gateway serves it |
Configuration
Each source is declared once in .devbot.global.jsonc under datasources, with its engine type and an env map of literals or ${VAR} references:
"datasources": {
"hotels-dev": {
"type": "mysql",
"env": { "MYSQL_HOST": "localhost", "MYSQL_USER": "root", "MYSQL_PASSWORD": "${HOTELS_DEV_DB_PASSWORD}" }
},
"prod-search": {
"type": "opensearch",
"mcp_timeout_ms": 300000,
"env": {
"OPENSEARCH_URL": "https://search.example.com",
"AWS_REGION": "eu-central-1",
"AWS_ACCESS_KEY_ID": "${OS_KEY_ID}",
"AWS_SECRET_ACCESS_KEY": "${OS_SECRET}"
}
}
}
An optional mcp_timeout_ms on a source raises the MCP client’s request timeout for that source — connect, tool listing and tool calls — in milliseconds, default 60000. It is opencode-only: Claude Code takes its equivalent from MCP_TIMEOUT. Like the rest of the wiring, a change takes effect on devbot reinit.
A project then selects which declared sources it wants in .devbot.project.jsonc; a source that is selected but not declared warns, and one no longer selected is unregistered from the harness.
What the project opt-in does and does not gate. The selection governs two things: which heavyweight sidecars (opensearch, s3) are rendered — and therefore run whenever the stack is up — and which ds-<name> servers are registered with the harness. It does not filter the toolbox catalogue: an enabled project with "datasources": [] still runs the gateway and the toolbox still initialises every reachable non-sidecar source — dev and production databases alike — because those share one process with no per-project partitioning. A project that must reach nothing should disable the module rather than empty the list; an empty list means “register no datasource server for me”, not “reach no database”.
Sidecar credentials are environment variables too — nothing mounts ~/.aws into a sidecar, so an AWS-facing one takes the standard credential variables rather than a profile. The AWS module documents the read-only IAM policy and the steps that produce the key pair.
Lifecycle
The gateway is started by this module’s up-shared.sh on every full boot — including a bare devbot started outside any project, which is how herdr’s launcher boot covers every registered project. The compose file is rendered per full boot, so rotating a credential in .env reaches the container on the next start. A herdr pane’s start skips that phase, so the module’s up.sh runs in project mode: it restarts a gateway that died from the rendered compose (never re-rendering) and starts any rendered sidecar that is not running.
A sidecar is rendered from the configured project set, not from module enablement alone: it appears in the gateway’s compose file only when a project listed in .devbot.global.jsonc::projects — or the project being wired — opts into it. Every rendered sidecar then runs for as long as the stack does; which sessions happen to be open does not affect it. The toolbox gateway is unaffected: it keeps its own availability filter, because one unreachable database would otherwise take it down (see What it does).
The cost is deliberate: a sidecar some project opts into occupies memory whether or not that project has a session open. In exchange a sidecar no longer appears and disappears as sessions come and go, a project that boots later finds its sources already serving, and every fresh render — a boot’s or a reload’s — stops a sidecar it no longer lists, so the running set matches the rendered compose. A sidecar’s port is allocated from the same catalogue the compose is rendered from, so a manifest URL and its service listener cannot drift; the render itself stays session-independent (.devbot.global.jsonc::projects plus the project being wired), because ports are allocated at reinit, before a session exists.
Sidecars run on the uv image and resolve their server’s dependencies at container start, so a shared cache under storage/datasources/uv-cache (mounted at /var/cache/uv) keeps a restart warm.
The gateway container is re-created on devbot up, deliberately. Its compose uses up -d --no-deps without --no-recreate, because the whole point of this container is the credentials it is handed: rotating a value in .env has to reach the process on the next start, and compose only recreates when the rendered definition differs. Every other gateway passes --no-recreate and stays put. Two consequences worth knowing: a devbot up can print Creating → Created → Starting for this one while the others log Running, and because every module shares the devbot compose project, each per-module docker compose call sees the other modules’ containers as orphans — a warning, not a fault. Never pass --remove-orphans to silence it; that removes the other gateways.
Recovering a source that was down
The catalogue is evaluated once, at startup. A database behind a VPN that is down when devbot up runs is left out of the gateway for that session — but its harness manifest is not, because manifests follow the project’s selection, never the render’s verdict. Enabling it then points the client at a toolset nothing serves, which is why only a restart used to help.
devbot datasources reload is the step in between. Run from the project once the network is back, it re-renders the catalogue against the network as it is now, hands the result to a running gateway (toolbox reloads its config on its own poll), starts a gateway a boot never started, starts every rendered sidecar that is not running, and confirms every published source answers a tools/list request on its own endpoint — plus that every source this project selects is published at all. A success therefore means enabling the datasource will work; a selected source the gateway still cannot serve is reported by name and fails the command. Like the rest of the lifecycle it is explicit: nothing re-evaluates in the background.
A change to the rendered compose — a port, an environment entry, the network stanza — takes effect when the gateway container is recreated. A reload does that too: it renders, then reconciles the gateway from the new compose file. The exception is a config the running gateway cannot hot-load — the render rolls that config back and aborts the reload before the reconciliation, leaving the updated compose file on disk for the next devbot up to pick up.
A source is judged by a throwaway toolbox container that has to answer within a fixed readiness budget — 15 seconds, sized so that a slow remote handshake still counts as up. DATASOURCES_CANARY_TIMEOUT (in seconds) raises it for a source that legitimately takes longer; a value below the 15-second default is refused, so the knob can only raise the budget and never pre-empt the driver’s named error. Eight canaries run at a time, so the budget bounds each wave rather than each source — a catalogue larger than that spans a wave per batch — and a source that misses it is dropped and named, never silently ignored.
An agent can run that same recovery itself: the reload-datasources MCP tool wraps the command, reports every source and ends with one of three lines: reload: complete, reload: not complete (the render applied, a source is still unserved) or reload: not applied (nothing ran and the running config is untouched). It flattens the whole report onto stdout and exits 0 even when a source is still unserved, so the per-source detail reaches the agent instead of being replaced by the error line.
The boot path names the command whenever it drops a declared source, so the recovery is one line away at the moment it is needed.
See also
- Polyrepo sessions — how this module scopes itself to the owning project
- MCP configuration — the manifest schema and the shared gateways
- Configuration — the global config keys