MotherDuck MCP server for AI agents and assistants

Securely connect your AI agents and chatbots (Claude, ChatGPT, Cursor, etc) with MotherDuck MCP or direct API to explore schemas, query data, manage Dives and Guides, and run SQL writes through natural language.

MotherDuck MCP logoMotherDuck MCP
Dcr Oauth

MotherDuck MCP is MotherDuck's official hosted server for database access and management. It provides a secure bridge to MotherDuck data, schemas, and database operations.

45 Tools

Try MotherDuck MCP now

Type what you want done — sign in and watch it run live in the Tool Router playground.

TOOL ROUTER PLAYGROUND
MotherDuck MCP
Try asking
TOOLS

Supported Tools

Every MotherDuck MCP action and event your agent gets out of the box.

Ask docs question

Ask a question about DuckDB or MotherDuck.

Cancel flight run

Cancel an in-flight run of a flight.

Create flight

Create a new MotherDuck flight.

Create guide

Create a new guide — a markdown document that agents read to answer this org's data questions correctly (metric definitions, join/filter conventions, pitfalls).

Delete dive

Delete a dive by ID.

Delete flight

Permanently delete a flight, its versions, schedule, and run history.

Delete guide

Soft-delete a guide while preserving its version history.

Dive query

Execute a read-only DuckDB query on behalf of a dive.

Edit dive content

Edit a dive's content by applying one or more text replacements, then save to MotherDuck.

Edit flight source

Edit a flight's source_code by applying one or more text replacements, then save as a new FlightVersion.

Edit guide content

Edit a guide's markdown body by applying one or more text replacements, then save as a new version.

Get dive guide

Load instructions for creating MotherDuck dives.

Get flight

Fetch a flight by UUID.

Get flight guide

Load instructions for authoring, scheduling, running, and troubleshooting MotherDuck flights.

Get flight logs

Fetch the plain-text logs (stdout + stderr) of a flight run plus the matching `Run` record (status, exit_code, timing).

Get flight run

Fetch a single run of a flight by its sequential run number (from list_flight_runs).

Get guide

Load a guide by uuid.

Get query guide

Call this before writing SQL to answer a data question.

Get short lived token

Returns a short-lived token and connection details for the MotherDuck database endpoint.

List columns

List all columns of a table or view with their types and comments.

List databases

List all databases in your MotherDuck account.

List dives

List all dives in MotherDuck.

List flight runs

List executions of a flight, newest first.

List flights

List MotherDuck flights.

List flight versions

List the immutable versions of a flight, newest first.

List guides

Browse this organization's curated guides — markdown documents that capture organization and personal context about the data in MotherDuck.

List macros

List all macros (table and scalar macros) in a MotherDuck database, with their schema and parameters.

List shares

List all database shares that have been shared with you.

List tables

List all tables and views in a MotherDuck database with comments.

List views

List all views in a MotherDuck database, with their schema, comment, and column count.

Log dive viewer event

Log a dive viewer event for analytics.

Mint dive state reference

Mint a server-stored reference for a `useDiveState` bag and return its id.

Query

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.

Query rw

Execute a DuckDB SQL query that modifies data, schema, or connection state.

Read dive

Read a specific dive by ID, including its full JSX/React component code.

Run flight

Trigger an on-demand execution of a flight using its current version.

Save dive

Save a new dive to MotherDuck.

Search catalog

Search the catalog for databases, schemas, tables, columns, and shares using fuzzy matching.

Set guide access

Set a guide's visibility to 'user' (private to the owner) or 'organization' (visible to the whole org).

Share dive data

Share the data for a dive with your organization.

Update dive

Update an existing dive's title, description, or content.

Update flight

Update a flight.

Update guide

Append a new version to an existing guide, identified by `uuid`.

Update guide metadata

Change a guide's title, description, or topic without appending a content version.

View dive

Open and render a MotherDuck Dive as a live MCP app with interactive charts.

SETUP GUIDE

Connect MotherDuck MCP Tool with your Agent

1

Install Composio

typescript
npm install @composio/core ai @ai-sdk/mcp @ai-sdk/openai
Install the Composio SDK and your agent framework
2

Create a session with MCP enabled

typescript
import { Composio } from "@composio/core";

const composio = new Composio();
const { mcp } = await composio.create("your-user-id", {
  toolkits: ["motherduck_mcp"],
  mcp: true,
});
Create a session scoped to MotherDuck MCP and read its MCP URL and headers
3

Connect your agent to the MCP server

typescript
import { createMCPClient } from "@ai-sdk/mcp";
import { openai } from "@ai-sdk/openai";
import { generateText, stepCountIs } from "ai";

const client = await createMCPClient({
  transport: { type: "http", url: mcp.url, headers: mcp.headers },
});

const { text } = await generateText({
  model: openai("gpt-5.6-sol"),
  tools: await client.tools(),
  prompt: "List the tables in my MotherDuck database and summarize the schema of the flights table",
  stopWhen: stepCountIs(10),
});

console.log(text);
await client.close();
Pass the session's MCP URL and headers to your agent and run a MotherDuck MCP request
SETUP GUIDE

Connect MotherDuck MCP API Tool with your Agent

1

Install Composio

typescript
npm install @composio/core @composio/openai openai
Install the Composio SDK, the OpenAI provider, and the OpenAI SDK
2

Create a Composio session

typescript
import OpenAI from "openai";
import { Composio } from "@composio/core";
import { OpenAIResponsesProvider } from "@composio/openai";

const composio = new Composio({ provider: new OpenAIResponsesProvider() });
const client = new OpenAI();

const session = await composio.create("your-user-id", { toolkits: ["motherduck_mcp"] });
const tools = await session.tools();
Initialize Composio with the OpenAI Responses provider and create a session scoped to MotherDuck MCP
3

Run MotherDuck MCP tools with your agent

typescript
let response = await client.responses.create({
  model: "gpt-5.6-sol",
  tools,
  input: [{ role: "user", content: "List the tables in my MotherDuck database and summarize the schema of the flights table" }],
});

while (response.output.some((o) => o.type === "function_call")) {
  const outputs = await composio.provider.handleToolCalls(session, response.output);
  response = await client.responses.create({
    model: "gpt-5.6-sol",
    tools,
    previous_response_id: response.id,
    input: outputs,
  });
}

console.log(response.output_text);
Send a request, execute the MotherDuck MCP tool calls through the session, and print the final answer

Why Use Composio?

AI Native MotherDuck MCP Integration

  • Connects agents to MotherDuck's official hosted MCP server and direct API workflows
  • Structured, LLM-friendly schemas for reliable database tool execution
  • Supports schema discovery, SQL queries, writes, sharing, deletion, and scheduled Python jobs

Managed Auth

  • Supports DCR OAuth flows for secure MotherDuck MCP access
  • Central place to configure, scope, and revoke MotherDuck MCP credentials
  • Per-user and per-environment credentials instead of hard-coded secrets

Agent Optimized Design

  • Tools are tuned using real error and success rates to improve reliability over time
  • Agents can discover MotherDuck schemas before writing queries or changing data
  • Comprehensive execution logs show what ran, when, and on whose behalf

Enterprise Grade Security

  • Fine-grained RBAC so you control which agents and users can access MotherDuck MCP
  • Scoped, least-privilege access to MotherDuck databases, Dives, Flights, and Guides
  • Full audit trail of agent actions to support review and compliance

Rolling this out across your team?

Give your team centralized access control across every framework with Composio’s MCP Gateway.

EXPLORE MCP GATEWAY
FAQ

Frequently asked questions

Yes, MotherDuck MCP requires you to configure your own Dcr OAuth credentials. Once set up, Composio handles token storage, refresh, and lifecycle management for you.

Yes! Composio's Tool Router enables agents to use multiple toolkits. Learn more.

Yes. Composio is SOC 2 Type II compliant and is built to keep your MotherDuck connection and credentials secure. OAuth tokens and API keys are encrypted, and sensitive customer data is protected at rest and in transit.

Composio also undergoes independent security testing and continuously monitors its systems for security threats. You can review the latest reports and policies in the Composio Trust Center.

Composio maintains and updates all toolkit integrations automatically, so your agents always work with the latest API versions.

When you connect a MotherDuck account through Composio, every action runs under that account, so anything the agent creates, sends, or changes shows up in MotherDuck as done by you. Keep an approval step in your prompt for actions with side effects, such as sending or deleting, and have the agent draft first.

Whatever the credentials you connect allow inside MotherDuck. If MotherDuck lets you scope a key to specific permissions, create a scoped one so the agent can only do what you intend. You can revoke the key inside MotherDuck at any time.

Yes. Composio supports multiple connected accounts for the same app, and that works in Claude, ChatGPT, or any other assistant you connect through Composio. Give each MotherDuck connection a name such as work or personal, and the assistant uses the one you mention in the request. Each account keeps its own credentials and nothing is merged.

Composio's free Hobby plan includes 100,000 tool calls per month with no credit card, which covers most personal MotherDuck use. Paid plans add higher limits and team features. Your MotherDuck plan and its API limits still apply as usual.

Built-in connectors usually give one AI access to a limited set of apps. Many people use Composio because it lets their AI connect to more apps than it normally supports, or connect to multiple accounts for the same app (e.g. connect Claude to multiple MotherDuck accounts).

With Composio, you connect MotherDuck once and then use it across different AI assistants without setting it up separately in each one. Connect your apps to Composio once, then connect Composio to whichever AI you use, whether that's Claude, ChatGPT, Hermes, or your own custom assistant.

Start with MotherDuck MCP.It takes 30 seconds.

Managed auth, hosted MCP servers, and every MotherDuck MCP tool your agent needs.Free to start.

Start building