Using dbabrain from Claude and other AI agents
1. Install dbabrain on a machine that reaches your databases
pip install "dbabrain[all,mcp]"
dbabrain init # in an empty folder: the tool root
# fill data/db_instances.json and data/users.json; passwords go to the encrypted store:
dbabrain common secret-set - # {"ref": "...", "value": "..."} on stdin2. Give that machine a dbabrain key
dbabrain key-request
Free, an email sign-in like the link below: the MCP server runs only on a node with a valid key. What a key is, and how long it lasts.
3. Link that machine to your account
dbabrain mcp connect
It prints a link and a code. Open the link, sign in with your email (a one-time code is sent to it), check the code matches, and approve. The machine keeps one outbound connection to dbabrain.dev - no port is opened on it. Keep the command running (a service, or a terminal).
To run it as a service, link once by hand as above, then start dbabrain mcp connect --wait-for-link:
it never asks for a code, waits for a linked token and reads the secret store again every minute until it
has one. A secret you store on the machine while it runs is usable at the next request, with no restart.
4. Add the connector in Claude
Settings → Connectors → Add custom connector → https://mcp.dbabrain.dev/mcp, then sign in
with the same email. Claude now reaches your machine's dbabrain: one tool per dbabrain command
(list-targets, db-status, list-databases, run-sql, ...) and two
read-only tools on dbabrain's own store (the list).
On the same machine: Claude Code, Claude Desktop, any MCP client
With no connector at all: the app starts dbabrain mcp serve as a child process and talks to it over
stdin / stdout, so nothing from dbabrain goes on the network. Steps 1 and 2 above still apply (the key too); then
put the store's passphrase in your own environment, never in the app's config file
(Windows setx DBABRAIN_SECRET_KEY "<passphrase>"; Linux / macOS
export DBABRAIN_SECRET_KEY=... in the profile the app starts from), and add the server:
claude mcp add dbabrain --env DBABRAIN_HOME=D:/dbabrain -- dbabrain mcp serve
{"mcpServers": {"dbabrain": {"command": "dbabrain", "args": ["mcp", "serve"],
"env": {"DBABRAIN_HOME": "D:/dbabrain"}}}}DBABRAIN_HOME is the tool root (the folder of step 1's dbabrain init). Another MCP client
starts the same command the same way. Check it without any client: dbabrain mcp tools.
Serving MCP over HTTP yourself is dbabrain mcp serve --http, behind a bearer token
(docs/16_mcp_app.md).
Try it without your own machine
Sign in with any email and skip steps 1 to 3: an account with no linked machine reaches the public demo - two lab databases holding a made-up shop, nothing else:
DEMO-PG-5432- PostgreSQL 16, databaseshopdb:customers(500 rows) andorders.DEMO-ORA-1521- Oracle 23 Free, PDBFREEPDB1:DEMO_READER.products(300 rows).
The demo offers only read-only tools (14: check-credentials, check-objects, check-references, db-status, describe-object, due-check, list-databases, list-jobs, list-schemas, list-targets, run-sql, self-status, store_query, store_schema), 60 seconds per call, a 30-second
statement limit and 20 calls a minute per account. Linking your own machine (step 3) replaces it for that
account.
Example prompts
Each works on the demo as written; on your own machine name your own servers.
- "List the databases dbabrain can reach and check that each one is up." -
list-targets, thendb-statuson each. - "On DEMO-PG-5432, which five cities have the most paid orders, and what is their total?" -
list-schemas/describe-objectto find the tables, then onerun-sqlSELECT. - "Describe the products table on DEMO-ORA-1521 and show its ten most expensive products." -
describe-object, thenrun-sql. - "What has dbabrain recorded about these servers, and is any check due?" -
store_schema/store_queryon dbabrain's own store, anddue-check.
Tools
One tool per dbabrain command, and two on dbabrain's own store. Every tool carries
readOnlyHint or destructiveHint. run-sql is read-only: one SELECT,
checked before it runs and always rolled back; writing SQL is the separate run-sql-write.
Your machine offers what its data/mcp_tools.json leaves on - turn any tool off there
(disabled_tools); dbabrain mcp tools lists what it offers.
Read-only (32)
| Tool | In the demo |
|---|---|
check-credentials | yes |
check-identifiers | no |
check-objects | yes |
check-references | yes |
check-secret | no |
check-secret-literals | no |
db-status | yes |
describe-object | yes |
due-check | yes |
file-checksum | no |
guide | no |
host-facts | no |
inventory-summary | no |
list-backup-files | no |
list-databases | yes |
list-files | no |
list-jobs | yes |
list-schemas | yes |
list-targets | yes |
metric-batch | no |
probe-host | no |
read-file | no |
run-sql | yes |
self-status | yes |
smb-list | no |
sqlserver-precheck | no |
sqlserver-verify-build | no |
sqlserver-verify-instance | no |
store_query | yes |
store_schema | yes |
trace-session | no |
verify-restore | no |
Change something (72)
Marked destructiveHint. Each asks for its own confirmation on your machine
(confirm) and none is in the demo: add-sql, app-command-set, ask, authorize, backup-database, backup-stop, build-showcase, copy-files, copy-schema, create-db-docker, create-table-from-xlsx, credential-remove, delete-empty-folder, delete-empty-folders, delete-file, delete-verified-file, delete-verified-files, disable-job, encrypt-file, encrypt-secret, entry-remove, export-data, fetch-file, finish-staging, host-restart, host-service, import-data, init, instance-active, instance-add, instance-remove, key-renew, key-request, key-status, kill-spid, lift-example, metric-env, metric-severity, metric-toggle, move-db-docker, pack-backup, pack-files, prepare-staging, prune-backup-files, pull-file, push-file, relay-file, remote-credential-add, report-server-remove, restore-diff, restore-full, restore-key, restore-log, restore-metadata, rotate-password, run-cmd, run-sql-write, run-sqlcmd, seal-ssh-key, send-file, shrink-log, smb-credential, smb-delete, smb-get, sql-command-add, sql-target-add, sqlserver-apply-cu, sqlserver-export-instance, sqlserver-replay-instance, standardize-field-names, start-job, upgrade-config.
What it can and cannot do
- Each request goes only to the machine you linked; nobody else's account reaches it.
- Passwords never cross: a request names a server, and your machine fills its login from its encrypted store. Every answer has the store's secret values removed and is capped in size.
- No secret goes in through Claude either: a request that carries a password, a key or a token is refused.
Set a secret on your machine (
dbabrain common secret-set -, the request on stdin) and let Claude name it by its reference (password_ref); a command that only takes a secret is not offered. - Tools that change something are marked destructive and still ask for their own confirmation.
- Your machine records every call (tool, server, who asked) in its own runtime store.
- dbabrain.dev records that a request was made - when, by which account, which tool - never what it asked or what came back (Privacy).
Over MCP, "read only" is a hint to the client, not a security boundary. Tools are switched
off by name (disabled_tools), and run-sql's check reads the statement's text. Treat an
MCP client as having the node's own access: connect only clients and accounts you trust, keep the approval
prompts on, switch off the tools you do not need, and give the node logins that can only read.
Source and full reference: github.com/tanthanhkaka01/dba-brain (docs/16_mcp_app.md). Support: [email protected].