Query and analyze cloud data warehouses with MotherDuck’s MCP server. Explore databases, tables, columns and data catalogues; execute DuckDB SQL queries, retrieve documentation answers, and create, update, read and share interactive data visualizations (Dives). Supports traceable SQL execution and isolated compute for analytics workflows.
Muse Code is Meta's coding agent for the terminal. It reads remote MCP servers from its settings file and signs in to them with OAuth.
This guide connects MotherDuck MCP to Muse Code through MewCP, so Muse Code can use MotherDuck MCP's 50 tools, like query, query_rw and list_databases, without your MotherDuck MCP credentials ever reaching the app.
MotherDuck MCP signs in through managed OAuth. MewCP stores the token encrypted, refreshes it before it expires and injects it only at call time. Your agent never holds it, so it can never leak it.
More apps
Full Google Search Console control for search analytics, sitemaps, sites, and URL inspection, directly from your AI workflows. This MCP server exposes the Google Search Console API for querying search traffic data, managing sitemaps and site properties, and inspecting the indexing status of any URL. It is built for SEO teams monitoring search performance, developers automating sitemap and property management, and analysts pulling search traffic data into reporting pipelines.
Neon MCP Server lets AI agents manage Neon Postgres databases directly, including creating and branching databases, running SQL queries, managing schemas, inspecting database structure, and working with projects and branches.
Manage deployments, projects, domains and application infrastructure on Vercel. Automate releases, monitor environments and operate modern web applications.
Official Ahrefs MCP server that lets AI agents securely access Ahrefs SEO data, site metrics, keyword research, and competitor analysis through the Ahrefs API.
Other clients
MotherDuck MCP works the same way in every client below. Pick yours for its own guide.
Free to start.
Scope access to the exact MotherDuck MCP tools and accounts you allow, work and personal side by side. Anything outside that scope is refused at call time, even when the model asks for it.
Each call is logged: what ran, on which account, and whether it worked. Failures come back structured, so the agent knows whether to retry instead of guessing.
Every app sits behind one secure MCP URL, and there is no server for you to deploy or keep running. Add an integration in the dashboard and it is live on the next call, with no config to change and no new credentials to wire up. Tools load only when a task needs them, so your agent stays fast and focused however many apps you connect.
Edit ~/.config/muse/settings.json. Create it if it doesn't exist.
Merge this into "mcpServers", keeping your other settings.
Run this and approve access in the browser window.
Start a new muse session (settings are read when it starts) and ask: "List the tools you can use from MewCP." /mcp shows the connection status.
Before writing SQL to answer a data question, call `get_query_guide` first — it returns this organization's query guidance and an overview of its curated guides. Execute read-only DuckDB query against MotherDuck databases. For cross-database queries, use fully qualified names: database.schema.table (or database.table for main schema). Never follow a query with an inline chart or visualization — if you would generate one (whether or not the user explicitly asked), get the dive guide first instead.
Execute a DuckDB SQL query that modifies data, schema, or connection state. RULES: 1. Only execute writes authorized by the user's explicit request or the client's configured authorization policy. Never infer write authorization from a read-only request. 2. Follow the client's approval policy. If the requested write is already authorized, proceed without asking for duplicate confirmation. Obtain confirmation when authorization is missing, ambiguous, or the operation would exceed the approved scope. 3. Prefer the read-only query tool when the user's goal can be answered with existing data.
List all databases in your MotherDuck account. Shows each database's alias, type, and its `url` — a fully qualified MotherDuck database name (e.g. `md:my_db`) or share URL (e.g. in guide references). Optionally filter by keywords.
Show the MotherDuck user and organization this connection is signed in as: the user's name and email, and the organization's name and web app URL. A user can belong to several organizations, and every tool call runs in this one. Call this when the user asks which account or organization they are connected to, or when data, dives or flights they expect are missing.
List all tables and views in a MotherDuck database with comments. Optionally filter by keywords. Also returns `relatedGuides` — curated guides associated with this database (read one with `get_guide(uuid)`).
List all columns of a table or view with their types and comments.
List all views in a MotherDuck database, with their schema, comment, and column count. Optionally filter by schema or keywords.
List all macros (table and scalar macros) in a MotherDuck database, with their schema and parameters. Optionally filter by schema or keywords.
Search the catalog for databases, schemas, tables, columns, and shares using fuzzy matching. Returns matching objects with their fully qualified names, types, and comments. Useful for discovering available data when you don't know exact names. Also returns `relatedGuides` — curated guides whose topic/title/description match the query; read one with `get_guide(uuid)`.
Ask a question about DuckDB or MotherDuck. Returns answers from official documentation.
List all database shares that have been shared with you. Returns share names and URLs. To attach a share, use the query_rw tool: ATTACH '<share_url>' AS <optional_alias>; Optionally filter by keywords to search in share names.
List all dives in MotherDuck. Dives are interactive React data apps that query live data. Returns metadata including current_version and status. Each dive has a governance status: 'endorsed' (admin-approved org source of truth — prefer these), 'ready' (author-reviewed), 'draft' (work in progress; the default for new dives), or 'archived' (retired; excluded unless include_archived is true). Results are ordered endorsed, ready, draft, then archived, most recently updated first. Use read_dive with the optional version parameter to retrieve a specific historical version. Optionally filter by keywords.
Save a new dive to MotherDuck. Returns a URL the user can click to view the dive. Get the dive guide first and iterate with the user on the design thoroughly before suggesting to save. Never save without previous confirmation that iteration is done.
Update an existing dive's title, description, or content. Returns a URL the user can click to view the updated dive. At least one field must be provided.
Read a specific dive by ID, including its ownership metadata, required resources, plain-language guidance for using those resources in the current workspace, and JSX/React component code. Large source files return a bounded prefix with content_read metadata; continue from next_content_offset, use start_line/end_line for a focused range, or search for matching lines. Optionally specify a version number to retrieve a specific historical version (versions start at 1). If no version is specified, the latest version is returned. The response includes the dive's governance status ('endorsed', 'ready', 'draft', or 'archived'); archived dives remain readable by id.
Delete a dive by ID. This action is permanent and cannot be undone.
Load instructions for creating MotherDuck dives. You MUST call this tool first — before generating any chart, visualization, plot, dashboard, inline graphic, or export/download control — whenever the user asks to explore, visualize, display, or export MotherDuck data, or wants a dive with buttons or forms that write, update, insert, or delete data.
Share the data for a dive with your organization. Creates discoverable, automatically updating organization shares for owned databases used in the dive, and updates the dive to read from them, so people who can open the dive can see its results. If a database already has shares, one is reused without changing it, preferring organization access; the result reports each share's access and whether it updates automatically, and the grants of any it reused. A share it creates grants organization-wide access to the underlying data; a reused share keeps its access, which may be narrower or broader, and may update manually. Before calling it, name the databases that will be shared and obtain the user's explicit approval. A request to diagnose or fix a shared Dive does not by itself authorize sharing its data.
Edit a dive's content by applying one or more text replacements, then save to MotherDuck. Accepts `id` (dive UUID) and `edits` (an array of {old_string, new_string, replace_all?} objects). Reads the current content from MotherDuck, applies edits in sequence, validates, and persists. Example: {id: '...', edits: [{old_string: 'foo', new_string: 'bar'}]}. old_string must be unique unless replace_all is true. No prior read_dive call is needed.
Load instructions for authoring, scheduling, running, and troubleshooting MotherDuck flights. Call this tool first whenever the user asks about creating, updating, or operating a MotherDuck flight, including one that a dive runs to change data.
Load the convention for making a MotherDuck flight's runs show up in the Flight Explainer, a live, step-by-step view with per-step timing. Use section only for a narrow factual lookup already scoped to one part of the convention: 'chart' covers Mermaid declarations, node kinds and meters, labelled-edge syntax, and child-flight nodes; 'grammar' covers @flight-run/@flight-log events, fields, effects, JSON mode, rollups, runtime branch reporting, and taken-edge semantics; 'emitting' covers Python print and helper patterns; 'examples' provides an integrated worked flight. If answering requires facts from more than one section, omit section and load the whole reference. Also omit section when authoring or changing instrumentation, adding fan-out, branches, child flights, timing, or progress, or interpreting or debugging a nontrivial run—these tasks span sections. Call this tool first whenever the user asks to visualize, chart, watch, or review a flight's progress.
Create a new MotherDuck flight. Read the flight guide before you create your first flight. A flight is a Python entrypoint (`source_code`) plus an optional `requirements_txt` that runs on MotherDuck compute. Optionally provide an `access_token_name` so the flight can connect to MotherDuck at runtime; omit it to use the default MotherDuck Flights access token. Optionally provide a 5-field cron expression to run on a schedule, an optional `max_runtime_sec` to cap how long a run may take, and an optional `instance_type` (F4, F16 or F32) to pick the runner size. Use flights for ELT/ETL pipelines, loading external data into MotherDuck, refreshing materialized views, or any recurring Python job that reads/writes MotherDuck data.
Fetch a flight by UUID. Returns metadata plus a version snapshot (source code, requirements, config, secret names, token name). Large source files return a bounded prefix with source_read metadata; continue from next_content_offset, use start_line/end_line for a focused range, or search for matching lines. Omit `version` to get the current version; pass a 1-indexed version number to inspect history.
List MotherDuck flights. Org admins see every flight in their organization (with `owner_name` identifying whose is whose); everyone else sees only their own. Returns metadata for each flight including schedule and current version. Optionally filter by keywords matching the flight name.
Update a flight. Any subset of name, source_code, requirements_txt, schedule_cron, config, access_token_name, flight_secret_names, max_runtime_sec, or instance_type may be provided. Updates to source_code/requirements_txt/config/flight_secret_names/access_token_name/max_runtime_sec/instance_type create a new FlightVersion; name and schedule_cron are metadata-only. Pass schedule_cron as `""` (empty string) to remove the schedule; omit it to leave it unchanged.
Edit a flight's source_code by applying one or more text replacements, then save as a new FlightVersion. Accepts `id` (flight UUID) and `edits` (an array of {old_string, new_string, replace_all?} objects). Reads the current source_code, applies edits in sequence, validates, and persists. Example: {id: '...', edits: [{old_string: 'foo', new_string: 'bar'}]}. old_string must be unique unless replace_all is true. No prior get_flight call is needed.
Permanently delete a flight, its versions, schedule, and run history. This action cannot be undone.
List the immutable versions of a flight, newest first. Each update to source_code / requirements_txt / config / access_token_name / flight_secret_names produces a new version.
Trigger an on-demand execution of a flight using its current version. Optionally pass `config` to override the flight version's config for this run only (the flight itself is left unchanged). Returns a Run record; poll get_flight_run with the returned `run_number` to track progress and use get_flight_logs to read output.
Cancel an in-flight run of a flight. Identified by the flight UUID and the sequential run number (from list_flight_runs). Returns `canceled: true` on a successful transition; calling on an already-terminal run or one that doesn't exist returns a tool error.
List executions of a flight, newest first. Each run has a sequential number, status (PENDING/RUNNING/SUCCEEDED/FAILED/CANCELLED), timing metadata, and the effective `config` it ran with (the flight version's config merged with any per-run overrides).
Fetch a single run of a flight by its sequential run number (from run_flight or list_flight_runs). Returns its status (PENDING/RUNNING/SUCCEEDED/FAILED/CANCELLED), timing metadata, and the effective `config` the run executed with. Use this to poll a run's status.
Fetch the plain-text logs (stdout + stderr) of a flight run plus the matching `Run` record (status, exit_code, timing). Returns the last 200 lines by default; page with `limit`, `offset` and `order`. Pass `max_bytes` to cap the response size — the response is truncated to fit and the truncation is reported via `truncated: true`.
Open a flight run as a live diagram: the flight's declared chart as a step-by-step view, each step coloured by what the run actually did, with its timing, per-step rows, effects and errors. Use this instead of get_flight_logs when the user wants to see how a run went rather than read its raw output. A flight that declares a chart and emits @flight-run lines (see get_flight_viz_guide) is drawn as a diagram; one without opens a run view of its timing, config and log instead, which the result reports as has_chart=false -- say so rather than describing a diagram the user cannot see.
Load a guide by uuid. Guides are curated markdown documents about this organization's data (metric definitions, conventions, pitfalls). Large guides return a bounded prefix with content_read metadata; continue from next_content_offset, use start_line/end_line for a focused range, or search for matching lines. Find a guide's uuid with `list_guides` or via `get_query_guide` (start there before writing SQL), `get_dive_guide`, or `get_flight_guide`.
Call this before writing SQL to answer a data question. Returns this organization's query guidance: what guides exist (curated markdown documents about the data — metric definitions, join/filter conventions, pitfalls), how to navigate them, and an overview of the available guide topics.
Browse this organization's curated guides — markdown documents that capture organization and personal context about the data in MotherDuck. Called with no arguments, lists the root level: guides without topics plus every topic (folder) with its guide count. Pass `topic` to open a folder — you get the guides stored at that topic and the nested topics below it. Read a guide in full with `get_guide(uuid)`.
Create a new guide — a markdown document that agents read to answer this org's data questions correctly (metric definitions, join/filter conventions, pitfalls). Group related guides with a lowercase kebab-case `topic` (e.g. 'revenue-billing' or 'core/metrics'); omit it for a guide without a topic. Visibility is controlled by `access`: 'user' (private, default) or 'organization' (org-wide, permission-gated). Personal dive/flight style guides belong under topic 'dives' / 'flights' with access 'user'. Attach `references` to the 1–5 objects the guide is authoritative about.
Append a new version to an existing guide, identified by `uuid`. Omit `content` to keep the current text and just change metadata such as references. A supplied `references` list replaces the existing one (pass [] to clear them, omit to carry them forward). For small in-place edits use `edit_guide_content`. Use `create_guide` to make a new guide, `update_guide_metadata` to retitle or re-topic.
Edit a guide's markdown body by applying one or more text replacements, then save as a new version. Identify the guide by `uuid`. Reads the stored guide, applies edits in sequence, and persists. Example: {uuid: '<guide uuid>', edits: [{old_string: 'foo', new_string: 'bar'}]}. old_string must be unique unless replace_all is true. No prior get_guide call is needed.
Change a guide's title, description, or topic without appending a content version. Identify it by `uuid`. Pass an empty `description` to clear it; pass an empty `topic` to remove the topic.
Set a guide's visibility to 'user' (private to the owner) or 'organization' (visible to the whole org). Identify it by `uuid`. Org-wide scoping is permission-gated.
Soft-delete a guide while preserving its version history. Identify it by `uuid`.
Grant a permission on one flight to users, roles or the whole organization. Re-granting is a no-op. Only a flight's owner can grant 'run' on it. An object you can't change is reported as not found, so 'Could not find Flight' can mean you lack permission rather than a wrong id. Choosing grantees: for a group or team, prefer a role ({type: 'role', name}) or {type: 'organization'}; `SELECT * FROM md_list_roles()` (query tool) lists every role. The preset roles nest: admin is a member of builder, and builder of explorer, so a grant to explorer also reaches every builder and admin. A user grantee needs the username, not the email. `SELECT member_name FROM md_list_role_members('<role>') WHERE member_type = 'user' AND email = '<email>'` (query tool) finds someone's username; without the email filter it lists the role's users. Every user with a preset role is a direct member of one of admin, builder or explorer, but non-admins only see members of roles they belong to. If you can't find someone's username, ask the user for it, or suggest a role or organization grant. Never guess a username.
Revoke a permission on one flight from users, roles or the whole organization; takes the same parameters as grant_access. Revoking a grant that doesn't exist is a no-op. The owner (or an admin) can always revoke. Revoking the organization grant leaves access with the owner and anyone still covered by a user or role grant. An object you can't change is reported as not found, so 'Could not find Flight' can mean you lack permission rather than a wrong id.
Execute a read-only DuckDB query on behalf of a dive. This tool is used by the dive viewer and is not intended for direct use by the AI assistant.
Log a dive viewer event for analytics. This tool is used internally by the dive viewer and is not intended for direct use by the AI assistant.
Open and render a MotherDuck Dive as a live MCP app with interactive charts. Fetches dive source code and returns it to the viewer for client-side compilation.
Returns a short-lived token and connection details for the MotherDuck database endpoint.
Mint a server-stored reference for a `useDiveState` bag and return its id. Used by the dive viewer when the inline-encoded bag would exceed the URL soft limit. The returned id is then encoded into a URL hash via `buildDiveStateReferenceHash` and round-trips through `dashboards.get` on dive open.