Overview

miu-db is headless database access for the CLI, MCP hosts, and editor workflows. The miudb binary keeps saved connections, secret resolution, tunnels, adapters, query execution, schema inspection, ERD generation, and machine-readable output in one local Go core.
The user-facing product is miu-db. The command stays miudb.
Start here
Section titled “Start here” Install Homebrew, go install, Windows zip, and local checkout verification.
Daily driver Add connections, test them, import shared config, and run bounded queries.
Agent CLI Discovery commands, JSON output, and agent-safe database workflows.
MCP server Local stdio tools and resources for Codex, Claude Code, Cursor, and VS Code.
ERD diagrams Interactive offline entity-relationship diagrams plus DBML from MySQL/Postgres.
Authentication Snowflake OAuth, BigQuery ADC, token storage, and secret-handling guarantees.
CLI contract Stable JSON envelopes, bounded query output, pagination, and redacted errors.
System architecture Config, secrets, adapters, tunnels, workers, MCP, and result paging.
What’s inside
Section titled “What’s inside”Connect and query
Section titled “Connect and query”- Native store — Daily driver
- Config lives under
~/.config/miu/db. - Sensitive values are classified before persistence.
- New credentials use the
miudbOS Keychain/keyring service by default.
- Config lives under
- Adapters — Install · Cloud adapters
- SQLite, PostgreSQL, MySQL, Snowflake, BigQuery, and SSH tunnels.
- Per-call session context via
--session key=valuewhere supported.
- Query execution — Agent CLI
query runfor one bounded statement.query scriptfor multi-statement Snowflake/MySQL scripts.- Pagination through cursors instead of unbounded stdout dumps.
Agent-ready contract
Section titled “Agent-ready contract”- JSON envelopes — CLI contract
- stdout is data; stderr is diagnostics.
- Stable
miudb.cli/v1responses for success and typed errors. - Redacted connection metadata and bounded result output.
- MCP server — MCP server
miudb mcp serve --transport stdioexposes local tools and resources.- Connection allowlists, read-only query defaults, and output byte caps.
- Schema inspection — Agent CLI
- Agents can discover command shape with
miudb commandsandmiudb describe. schema_treegives bounded schema context before writing SQL.
- Agents can discover command shape with
Diagrams and editor workflows
Section titled “Diagrams and editor workflows”- ERD diagrams — ERD diagrams
- Introspect MySQL/Postgres into offline HTML, JSON, and DBML artifacts.
- Optional agent-authored metadata adds groups and descriptions without touching live data.
- Neovim client — System architecture
ui/miu-db.nvimshells out to the same Go core.- SQL stays in normal
.sqlbuffers.
Operations
Section titled “Operations”- Activity log — Daily driver
- Query, exec, and schema operations write JSONL metadata.
- Result rows are never stored.
- Deployment — Deployment
- Single Go binary, Homebrew/GitHub Releases, and a static docs site.
- Local checkout smoke commands use the same binary path as release builds.
A 30-second tour
Section titled “A 30-second tour”miudb connections add --name local-app --db-type sqlite --path ./app.db -o jsonmiudb connections list --basic -o jsonmiudb connections test local-app -o jsonmiudb query run -c local-app --sql 'select 1 as one' -o jsonmiudb schema tree -c local-app -o jsonmiudb erd generate -c local-app --out-dir ./.miu-db/erd -o jsonmiudb mcp serve --transport stdioEvery command that agents should call emits compact JSON by default. New here? Start with Install, then connect the local MCP server from MCP server.