MCP server
MCP Server
Section titled “MCP Server”miudb mcp serve --transport stdio exposes saved miu-db connections to MCP
clients over standard input/output. It is separate from the native
miudb serve --protocol jsonrpc|ndjson protocol used by Neovim and custom
clients.
Command
Section titled “Command”miudb mcp serve --transport stdioUseful flags:
--connection <name>: repeat to restrict visible and callable connections.--limit <n>: default row limit forquery_run.--max-limit <n>: upper bound accepted from tool arguments.--max-bytes <n>: maximum serialized tool or resource response size.--timeout <duration>: inherited global timeout, such as30s.--allow-mutate: permit mutation SQL throughquery_run; unsafe and off by default.
Safety Model
Section titled “Safety Model”MCP v1 is local stdio only. There is no remote HTTP transport or remote auth in this release.
- Connections are loaded from the normal native store under
~/.config/miu/dbunless CLI flags override it. - Connection output is redacted with the same helpers as the CLI.
- Passwords, SSH passwords, private key content, credential file content, and credential-bearing URLs are not serialized.
query_runis read-only by default. Mutation statements, uncertain multi-statements, mutating CTEs,EXPLAIN, andPRAGMAare rejected unless--allow-mutateis set.- Continuation cursors are signed for the running MCP server and scoped to the
source connection, so allowlists also apply to
query_fetch_page. - Large outputs fail with
query.output_too_large; lower--limit, increase--max-bytes, or fetch narrower data.
connections_list: list redacted MCP-visible connections and store metadata.connection_describe: return redacted metadata for one connection.connection_test: open one connection and report reachability.connections_smoke: run a small read-only smoke query across visible connections or a named subset.schema_tree: inspect schema objects for one connection.query_run: run bounded read-only SQL and return columns plus row arrays.query_fetch_page: fetch a continuation cursor returned byquery_run.
Resources
Section titled “Resources”miudb://connectionsmiudb://connections/{name}miudb://connections/{name}/schemamiudb://queries/{cursor}
Schema resources can be large. Prefer schema_tree when an agent needs bounded,
interactive control over what it reads.
Host Setup
Section titled “Host Setup”Codex reads MCP server entries from ~/.codex/config.toml under
mcp_servers.<id>.
[mcp_servers.miudb]command = "miudb"args = ["mcp", "serve", "--transport", "stdio"]startup_timeout_sec = 10tool_timeout_sec = 60To restrict the server to one connection:
[mcp_servers.miudb]command = "miudb"args = ["mcp", "serve", "--transport", "stdio", "--connection", "local-app"]Reference: OpenAI Codex configuration reference.
Claude Code
Section titled “Claude Code”Use the CLI:
claude mcp add --transport stdio miudb -- miudb mcp serve --transport stdioOr add project-scoped .mcp.json:
{ "mcpServers": { "miudb": { "type": "stdio", "command": "miudb", "args": ["mcp", "serve", "--transport", "stdio"], "env": {} } }}Reference: Claude Code MCP documentation.
Cursor
Section titled “Cursor”Use .cursor/mcp.json for project configuration or ~/.cursor/mcp.json for
global configuration.
{ "mcpServers": { "miudb": { "type": "stdio", "command": "miudb", "args": ["mcp", "serve", "--transport", "stdio"] } }}Reference: Cursor MCP documentation.
VS Code and Copilot
Section titled “VS Code and Copilot”Use .vscode/mcp.json for workspace configuration or your VS Code user profile
MCP configuration.
{ "servers": { "miudb": { "type": "stdio", "command": "miudb", "args": ["mcp", "serve", "--transport", "stdio"] } }}Reference: VS Code MCP configuration reference.
Troubleshooting
Section titled “Troubleshooting”- If the host cannot start the server, use a full path from
which miudb. - If no tools appear, restart the host and verify its MCP panel or command.
- If a connection is hidden, check repeated
--connectionflags. - If SQL is rejected as read-only, simplify to a single
selectstatement. - If output is too large, lower
--limitor query fewer columns.