database-readonly
MCP server database-readonly (${CLAUDE_PLUGIN_ROOT}/mcp/database-readonly). Tools: profile, logout,
query, list_tables, describe_table. Login is a terminal CLI: node ${CLAUDE_PLUGIN_ROOT}/mcp/database-readonly/cli.mjs.
Setup
Run once:
cd ${CLAUDE_PLUGIN_ROOT}/mcp/database-readonly && npm install
claude mcp add -s user database-readonly -- node ${CLAUDE_PLUGIN_ROOT}/mcp/database-readonly/server.mjs
Process
- Which profile. Call
profilewith no name: active profile and who is logged in. The server always starts onlocal. If the person named an environment ("dev에서", "stage 기준"), switch withprofile({name})before querying. - prod only on request. Switch to
prodonly when the person asked for prod in this conversation. The server then asks the person to confirm; never retry around a decline. - Not logged in. Never ask for a password in chat and never pass one to a tool. Tell the person
to run it themselves:
! node ${CLAUDE_PLUGIN_ROOT}/mcp/database-readonly/cli.mjs login <profile>(hidden password prompt saved to Keychain; typing anop://reference uses 1Password instead). If a password is pasted into chat anyway, do not repeat it; ask them to log in with the CLI. - Query.
list_tables/describe_tablefirst when the schema is unknown; then one statement perquery. AddLIMIT;truncated: truemeans the row cap cut the result — say so. - Rejected. A
rejected [rule]result is the read-only guard; do not rephrase the statement to get around it. Writes are not possible through this server. - Logout.
logout({name})when asked; it removes the saved password, keeps host/user/database.
Output Template
[profile: dev] <one line: what was asked>
<result table or summary, rows N, truncated yes/no, elapsed ms>
Every answer built on query results names the profile it came from.
What Claude Does / What You Do
| Claude | You |
|---|---|
| Picks/switches the profile you named, runs read-only queries, names the profile in every answer | Log in with the CLI (! … cli.mjs login <profile>); confirm a prod switch in the dialog |
| Stops at a rejection or a missing login and tells you the command | Decide when prod is needed |
Related Skills
develop:sql-pro— writing the SQL itself.develop:database-optimizer— when a query is slow (useEXPLAINthroughquery).