Skip to content

Overview

miu-db

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.

  • Native storeDaily driver
    • Config lives under ~/.config/miu/db.
    • Sensitive values are classified before persistence.
    • New credentials use the miudb OS Keychain/keyring service by default.
  • AdaptersInstall · Cloud adapters
    • SQLite, PostgreSQL, MySQL, Snowflake, BigQuery, and SSH tunnels.
    • Per-call session context via --session key=value where supported.
  • Query executionAgent CLI
    • query run for one bounded statement.
    • query script for multi-statement Snowflake/MySQL scripts.
    • Pagination through cursors instead of unbounded stdout dumps.
  • JSON envelopesCLI contract
    • stdout is data; stderr is diagnostics.
    • Stable miudb.cli/v1 responses for success and typed errors.
    • Redacted connection metadata and bounded result output.
  • MCP serverMCP server
    • miudb mcp serve --transport stdio exposes local tools and resources.
    • Connection allowlists, read-only query defaults, and output byte caps.
  • Schema inspectionAgent CLI
    • Agents can discover command shape with miudb commands and miudb describe.
    • schema_tree gives bounded schema context before writing SQL.
  • ERD diagramsERD diagrams
    • Introspect MySQL/Postgres into offline HTML, JSON, and DBML artifacts.
    • Optional agent-authored metadata adds groups and descriptions without touching live data.
  • Neovim clientSystem architecture
    • ui/miu-db.nvim shells out to the same Go core.
    • SQL stays in normal .sql buffers.
  • Activity logDaily driver
    • Query, exec, and schema operations write JSONL metadata.
    • Result rows are never stored.
  • DeploymentDeployment
    • Single Go binary, Homebrew/GitHub Releases, and a static docs site.
    • Local checkout smoke commands use the same binary path as release builds.
Terminal window
miudb connections add --name local-app --db-type sqlite --path ./app.db -o json
miudb connections list --basic -o json
miudb connections test local-app -o json
miudb query run -c local-app --sql 'select 1 as one' -o json
miudb schema tree -c local-app -o json
miudb erd generate -c local-app --out-dir ./.miu-db/erd -o json
miudb mcp serve --transport stdio

Every command that agents should call emits compact JSON by default. New here? Start with Install, then connect the local MCP server from MCP server.