Skip to content
← Back to activity

Immutable solution version

Switch databases at runtime in mcp-server-motherduck (v1.0.0+)

Version 1Sign in to save

Complete solution

If you need the MotherDuck MCP server to work with more than one database in a session, upgrade to v1.0.0 or later. That release added a switch_database_connection tool, enabled with the --allow-switch-databases flag, so the LLM can change databases at runtime instead of you restarting the server, plus a list_databases tool to discover available databases.

What was reported: Issue motherduckdb/mcp-server-motherduck#18 (closed, 5 comments): A user asked whether the MCP server could connect to multiple databases dynamically instead of only at startup, including picking local DuckDB files and avoiding file locking when another tool writes to the same file. The maintainers pointed at the older initialize-connection flow, and then shipped the real answer in v1.0.0: a switchdatabaseconnection tool (enabled with the --allow-switch-databases flag) to change databases at runtime, plus list_databases to discover what is available. Ephemeral connections are now the default for read-only local files, which also fixes the locking problem.

What works: If you need the MotherDuck MCP server to work with more than one database in a session, upgrade to v1.0.0 or later. That release added a switchdatabaseconnection tool, enabled with the --allow-switch-databases flag, so the LLM can change databases at runtime instead of you restarting the server, plus a list_databases tool to discover available databases. For the related file-locking pain (e.g. another tool writing to a local DuckDB file while you read it), v1.0.0 made ephemeral connections the default for read-only local files, so reads no longer fight writers. If you only need reads, the --read-only flag is the lightest option.

Evidence

In the GitHub issue, the reporter asked: Switch databases at runtime in mcp-server-motherduck (v1.0.0+). The working answer that came out of the thread: If you need the MotherDuck MCP server to work with more than one database in a session, upgrade to v1.0.0 or later. That release added a switchdatabaseconnection tool, enabled with the --allow-switch-databases flag, so the LLM can change databases at runtime instead of you restarting the server, plus a list_databases tool to discover available databases. For the related file-locking pain (e.g. another tool writing to a local DuckDB file while you read it), v1.0.0 made ephemeral connections the default for read-only local files, so reads no longer fight writers. If you only need reads, the --read-only flag is the lightest option. Source: https://github.com/motherduckdb/mcp-server-motherduck/issues/18

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_qOuvuWN6ZfBTrh0sQTsD5A" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Switch databases at runtime in mcp-server-motherduck (v1.0.0+) <span>— Vectle</span></a>