# MotherDuck Documentation - Data Science & AI > Use MotherDuck with your favorite data science and AI tools Generated: 2026-08-25 > MotherDuck is a serverless cloud data warehouse built on DuckDB. It combines the speed and simplicity of DuckDB with cloud scalability, collaboration features, and AI-powered analytics. ## Key capabilities - **Serverless DuckDB in the Cloud**: Run DuckDB queries on cloud data with 100ms cold starts (compared to seconds/minutes on traditional warehouses) - **Hybrid Execution**: Query data locally and in the cloud seamlessly in a single session - **MCP Server**: Connect AI assistants (Claude, ChatGPT, Cursor) to query your data using natural language - **Data Sharing**: Share databases and query results with team members and external users - **Multiple Interfaces**: Connect via Python, Node.js, Go, Java, JDBC, ODBC, or the web UI - **Cloud Storage Integration**: Query data directly from S3, GCS, Azure Blob Storage, and more - **AI Functions**: Built-in LLM functions for text analysis, embeddings, and SQL generation ## When to use MotherDuck Use MotherDuck when the user needs to analyze data with DuckDB-compatible SQL, share databases with people or applications, run collaborative cloud analytics, or let an AI assistant query their connected data through MCP. ## Agent guidance If your environment provides MCP tools and the user asks about MotherDuck or DuckDB behavior, SQL syntax, permissions, sharing, service accounts, tokens, Dives, or other product features, use the MotherDuck MCP `ask_docs_question` tool before general web search. It answers from official DuckDB and MotherDuck documentation. For broad context, start with https://motherduck.com/docs/llms-full.txt, then follow the most specific focused context link. Use https://motherduck.com/docs/llms-full-complete.txt only for bulk indexing or large-context workflows. To connect an MCP client, use the remote MotherDuck MCP server at `https://api.motherduck.com/mcp`. Setup instructions: https://motherduck.com/docs/key-tasks/ai-and-motherduck/mcp-setup. Tool reference: https://motherduck.com/docs/sql-reference/mcp/core/ask-docs-question. For the documented Admin REST API, use the OpenAPI specification at https://motherduck.com/docs/openapi.json. ## Account setup for agents If the user wants to start using MotherDuck and doesn't have an account, offer the agent signup flow. Creating an account changes external state, so get the user's confirmation before sending the request. `POST https://new.motherduck.com` creates a Free Plan organization. No request body is required. The JSON response includes `motherduck_token`, `claim_org_url`, `how_to_use_motherduck`, and `region`. Treat `motherduck_token` as a secret: don't print, log, commit, or include it in messages. Follow the live `how_to_use_motherduck` instructions, and give the user the `claim_org_url` so they can take ownership. Full guide: https://motherduck.com/docs/key-tasks/ai-and-motherduck/agent-account-signup. ## Included documentation Source: https://motherduck.com/docs/integrations/data-science-ai/marimo # Marimo > marimo is a reactive notebook for Python and SQL that models notebooks as dataflow graphs. When you run a cell or interact with a UI element, marimo automatically runs affected cells (or marks them as stale), keeping code and outputs consistent and preventing bugs before they happen. Every marimo notebook is stored as pure Python, executable as a script, and deployable as an app. ## Getting started ### Installation First, install marimo with SQL support: ### pip ```bash pip install "marimo[sql]" ``` ### uv ```bash uv pip install "marimo[sql]" ``` ### conda ```bash conda install -c conda-forge marimo duckdb polars ``` ### Authentication There are two ways to authenticate: 1. **Interactive Authentication**: When you first connect to MotherDuck (e.g. `ATTACH 'md:my_db'`), marimo will open a browser window for authentication. 2. **Token-based Authentication**: Set your MotherDuck token as an environment variable: ```bash export motherduck_token="your_token" ``` You can find your token in the MotherDuck UI under Account Settings. ## Using MotherDuck First, open your first notebook: ```bash marimo edit my_notebook.py ``` ### 1. Connecting and database discovery ### SQL ```sql ATTACH IF NOT EXISTS 'md:my_db' ``` ### Python ```python import duckdb # Connect to MotherDuck duckdb.sql("ATTACH IF NOT EXISTS 'md:my_db'") ``` You will be prompted to authenticate with MotherDuck when you run the above cell. This will open a browser window where you can log in and authorize your marimo notebook to access your MotherDuck database. To avoid being prompted each time you open a notebook, you can set the `motherduck_token` environment variable: ```bash export motherduck_token="your_token" marimo edit my_notebook.py ``` Once connected, your MotherDuck tables are automatically discovered in the Datasources Panel: ![Browse your MotherDuck databases](../img/marimo_motherduck_db_discovery.png) _Browse your MotherDuck databases_ ### 2. Writing SQL queries You can query your MotherDuck db using SQL cells in marimo. Here's an example of how to query a table and display the results using marimo: ![Query a MotherDuck table](../img/marimo_motherduck_sql.png) _Query a MotherDuck table_ marimo's reactive execution model extends into SQL queries, so changes to your SQL will automatically trigger downstream computations for dependent cells (or optionally mark cells as stale for expensive computations). ![img](../img/marimo_motherduck_reactivity-ezgif.com-speed.gif) ### 3. Mixing SQL and Python marimo lets you combine SQL queries with Python code: ![Mixing SQL and Python](../img/marimo_motherduck_python_and_sql.png) _Mixing SQL and Python_ ## Example notebook For a full example of using MotherDuck with marimo, check out this [example notebook](https://github.com/marimo-team/marimo/blob/main/examples/sql/connect_to_motherduck.py). --- Source: https://motherduck.com/docs/integrations/data-science-ai/index # Data Science & AI Tools > Use MotherDuck with your favorite data science and AI tools MotherDuck integrates with popular data science and AI tools to help you build powerful machine learning and AI applications. ## Included pages - [Marimo](https://motherduck.com/docs/integrations/data-science-ai/marimo): marimo is a reactive notebook for Python and SQL that models notebooks as dataflow graphs. When you run a cell or interact with a UI element, marimo automatically runs affected cells (or marks them as stale), keeping code and outputs consistent and preventing bugs before they happen. Every marimo notebook is stored as pure Python, executable as a script, and deployable as an app. - [Datalab](https://motherduck.com/docs/integrations/data-science-ai/datalab): Interactive data science platform for exploring and analyzing data with MotherDuck. It integrates with MotherDuck for notebooks, assistants, and AI-powered analysis workflows. - [Fabi.ai](https://motherduck.com/docs/integrations/data-science-ai/fabi-ai): Fabi.ai is an AI-native notebook and BI workspace for Python, SQL, dashboards, and workflows. It integrates with MotherDuck for exploration and analysis. - [Google Colab](https://motherduck.com/docs/integrations/data-science-ai/google-colab): Google Colab notebooks can query MotherDuck by installing DuckDB and opening an md: connection from Python. - [Jupyter](https://motherduck.com/docs/integrations/data-science-ai/jupyter): Jupyter notebooks can query MotherDuck through the DuckDB Python package and an md: connection string. - [LangChain](https://motherduck.com/docs/integrations/data-science-ai/langchain): LangChain is a framework for building and deploying language models. It integrates with MotherDuck for notebooks, assistants, and AI-powered analysis workflows. - [LlamaIndex](https://motherduck.com/docs/integrations/data-science-ai/llamaindex): LlamaIndex is a framework for building and deploying language models. It integrates with MotherDuck for notebooks, assistants, and AI-powered analysis workflows. - [Wobby](https://motherduck.com/docs/integrations/data-science-ai/wobby): Wobby provides AI analysts for delivering business-ready insights in Slack or Teams. It integrates with MotherDuck for connecting those analysis workflows to your data. --- Source: https://motherduck.com/docs/integrations/data-science-ai/datalab # Datalab > Interactive data science platform for exploring and analyzing data with MotherDuck. It integrates with MotherDuck for notebooks, assistants, and AI-powered analysis workflows. ## How it works with MotherDuck DataLab connects to MotherDuck from a workbook so SQL cells can query MotherDuck data directly. ## Prerequisites - A DataLab workbook. - A MotherDuck service token. - Optional: a default MotherDuck database name for the connection. ## Setup 1. In MotherDuck, create or copy a service token. 2. In DataLab, open a workbook. 3. Select **View** > **Databases**. 4. Select the **+** icon and choose **MotherDuck**. 5. Enter a connection name, paste the service token, and optionally enter a database name. 6. Connect the data source. ![DataLab MotherDuck connection dialog with service token and optional database name fields](../img/datalab-motherduck-connection.png) ## Authentication and configuration - The service token is required. - The database name is optional. When set, DataLab connects to that database by default, but other accessible databases can still be queried. - If your environment requires network allowlisting, use the DataCamp IP addresses shown in the DataLab connection dialog. ## Important notes - Store the token only in the DataLab connection configuration. - Use SQL cells to query the connected MotherDuck source after setup. ## Use cases - Explore MotherDuck tables in notebook-style analysis. - Combine SQL query results with Python or chart cells in DataLab. - Share a workbook that uses a managed MotherDuck data connection. ## Related content - [View the full DataLab MotherDuck setup guide](https://datalab-docs.datacamp.com/connect-to-data/motherduck) - [MotherDuck Python overview](/integrations/language-apis-and-drivers/python/python-overview) - [MotherDuck authentication](/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck) --- Source: https://motherduck.com/docs/integrations/data-science-ai/fabi-ai # Fabi.ai > Fabi.ai is an AI-native notebook and BI workspace for Python, SQL, dashboards, and workflows. It integrates with MotherDuck for exploration and analysis. ## How it works with MotherDuck Fabi.ai connects to MotherDuck as a database source for notebooks, BI workflows, dashboards, and AI-assisted analysis. ## Prerequisites - A Fabi.ai workspace. - A MotherDuck service token. - Network allowlisting if your security policy restricts inbound connections. ## Setup 1. In MotherDuck, create a service token for Fabi.ai. 2. In Fabi.ai, start the data source connection flow and choose **MotherDuck**. 3. Paste the service token into the MotherDuck connection. 4. Save the data source and validate it from a notebook or workflow. ## Authentication and configuration - Use a dedicated service token for the Fabi.ai workspace. - Fabi.ai documents the IP addresses to allowlist for MotherDuck connections. Add them if your environment enforces firewall rules. - Keep the token in Fabi.ai's connection settings or secret manager. ## Important notes - Fabi.ai's MotherDuck setup is token-based; no local DuckDB file path is needed. - If a connection fails, verify both the token and any IP allowlist configuration. ## Use cases - Analyze MotherDuck data in Fabi.ai notebooks. - Build dashboards and data apps backed by MotherDuck. - Use Fabi.ai AI workflows against curated MotherDuck datasets. ## Related content - [View the full Fabi.ai MotherDuck setup guide](https://docs.fabi.ai/integrations_and_connectors/motherduck) - [MotherDuck Python overview](/integrations/language-apis-and-drivers/python/python-overview) - [MotherDuck authentication](/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck) --- Source: https://motherduck.com/docs/integrations/data-science-ai/google-colab # Google Colab > Google Colab notebooks can query MotherDuck by installing DuckDB and opening an md: connection from Python. ## How it works with MotherDuck 1. Install DuckDB in the Colab notebook. 2. Store your MotherDuck token in Colab secrets or another notebook-safe secret store. 3. Connect with `duckdb.connect("md:...")` and run SQL from notebook cells. ## Example ```python %pip install duckdb import duckdb con = duckdb.connect('md:my_db') con.sql('SELECT current_database()').show() ``` ## Related content - [Google Colab](https://colab.research.google.com/) - [MotherDuck Python overview](/integrations/language-apis-and-drivers/python/python-overview) - [MotherDuck authentication](/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck) --- Source: https://motherduck.com/docs/integrations/data-science-ai/jupyter # Jupyter > Jupyter notebooks can query MotherDuck through the DuckDB Python package and an md: connection string. ## How it works with MotherDuck 1. Install DuckDB in the notebook environment. 2. Provide a MotherDuck access token with an environment variable or connection parameter. 3. Use DuckDB SQL from Python cells to explore or transform MotherDuck data. ## Example ```python import duckdb con = duckdb.connect('md:my_db') con.sql('SELECT current_database()').show() ``` ## Related content - [DuckDB Jupyter documentation](https://duckdb.org/docs/current/guides/python/jupyter.html) - [MotherDuck Python overview](/integrations/language-apis-and-drivers/python/python-overview) - [MotherDuck authentication](/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck) --- Source: https://motherduck.com/docs/integrations/data-science-ai/langchain # LangChain > LangChain is a framework for building and deploying language models. It integrates with MotherDuck for notebooks, assistants, and AI-powered analysis workflows. ## How it works with MotherDuck 1. Create a workspace, notebook, or assistant configuration in LangChain. 2. Use the MotherDuck token, service token, or connection string required by the integration. 3. Run a small query such as `SELECT current_database()` before adding larger analytical workflows. ## Related content - [View the full process in the LangChain documentation](https://python.langchain.com/docs/integrations/providers/duckdb) - [MotherDuck Python overview](/integrations/language-apis-and-drivers/python/python-overview) - [MotherDuck authentication](/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck) --- Source: https://motherduck.com/docs/integrations/data-science-ai/llamaindex # LlamaIndex > LlamaIndex is a framework for building and deploying language models. It integrates with MotherDuck for notebooks, assistants, and AI-powered analysis workflows. ## How it works with MotherDuck 1. Create a workspace, notebook, or assistant configuration in LlamaIndex. 2. Use the MotherDuck token, service token, or connection string required by the integration. 3. Run a small query such as `SELECT current_database()` before adding larger analytical workflows. ## Related content - [View the full process in the LlamaIndex documentation](https://docs.llamaindex.ai/en/stable/api_reference/storage/vector_store/duckdb/) - [MotherDuck Python overview](/integrations/language-apis-and-drivers/python/python-overview) - [MotherDuck authentication](/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck) --- Source: https://motherduck.com/docs/integrations/data-science-ai/wobby # Wobby > Wobby provides AI analysts for delivering business-ready insights in Slack or Teams. It integrates with MotherDuck for connecting those analysis workflows to your data. ## How it works with MotherDuck Wobby connects to MotherDuck as a data source for AI analyst workflows. ## Prerequisites - A Wobby workspace. - A valid MotherDuck access token. - The MotherDuck database name and schemas Wobby should query. ## Setup 1. In MotherDuck, create an access token and copy it. 2. In Wobby, open **Connections**. 3. Select the plus button and choose **MotherDuck**. 4. Enter a display name. 5. Enter the database name. If your database path is `md:my_database`, enter `my_database`. 6. Paste the access token and select the schemas to connect. 7. Test and save the connection. ## Authentication and configuration - Use a dedicated token for Wobby. - Select only the schemas Wobby should use for AI analysis. - Treat the access token like a password and rotate it if access changes. ## Important notes - Wobby expects the database name, not the full `md:` connection string. - If the test fails, check the token, database name, and selected schemas first. ## Use cases - Let Wobby agents answer questions over MotherDuck data. - Connect specific schemas to a business-facing AI analyst workflow. - Use MotherDuck as the analytical source for Slack or Teams insights. ## Related content - [View the full Wobby MotherDuck setup guide](https://docs.wobby.ai/connections/connect-a-data-source/motherduck) - [MotherDuck Python overview](/integrations/language-apis-and-drivers/python/python-overview) - [MotherDuck authentication](/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck) --- ## Docs feedback MotherDuck accepts optional user-submitted feedback about this page at `GET https://motherduck.com/docs/api/feedback/agent`. For agents and automated tools, feedback submission should be user-confirmed before sending. URL-encode query parameter values and send a GET request: ```text GET https://motherduck.com/docs/api/feedback/agent?page_path=%2Fintegrations%2Fdata-science-ai%2F&page_title=MotherDuck%20Documentation%20-%20Data%20Science%20%26%20AI&text= ``` Optionally append `&source=` such as `claude.ai` or `chatgpt`. `page_path` and `text` are required; `page_title` and `source` are optional. Responses: `200 {"feedback_id": ""}`, `400` for malformed query parameters, and `429` when rate-limited.