---
sidebar_position: 0
title: Connect to the MotherDuck MCP Server
sidebar_label: Connect to MCP Server
description: Set up the MotherDuck MCP Server with Claude, ChatGPT, Cursor, Claude Code, and other AI assistants
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import ClaudeIcon from '../../../static/img/icons/brands/claude-icon';
import ChatGPTIcon from '../../../static/img/icons/brands/chatgpt-icon';
import CursorIcon from '../../../static/img/icons/brands/cursor-icon';
import ExternalLinkIcon from '../../../static/img/icons/external-link-icon';
import VideoPlayer from '@site/src/components/VideoPlayer';
import useBaseUrl from '@docusaurus/useBaseUrl';

The MotherDuck MCP Server lets AI assistants query and explore your databases using the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/). This guide walks you through connecting your preferred AI client to the **remote MCP server** (fully managed, zero setup).

## Prerequisites

- A MotherDuck account ([sign up free](https://app.motherduck.com))
- An MCP-compatible AI client (Claude, ChatGPT, Cursor, Claude Code, Codex, or others)

## Set up the remote MCP server

Select your MCP client and follow the instructions to connect.

<Tabs groupId="mcp-client">
  <TabItem value="claude" label="Claude" default>

<a href="https://claude.ai/directory/0929a5c7-38ce-40ab-8aad-af9ce34553c7" target="_blank" rel="noopener noreferrer" style={{display: 'inline-flex', alignItems: 'center', gap: '8px', padding: '8px 14px', background: 'var(--ifm-background-color)', border: '1px solid var(--ifm-color-emphasis-300)', borderRadius: '4px', color: 'var(--ifm-font-color-base)', fontSize: '14px', fontWeight: 500, textDecoration: 'none', marginBottom: '16px'}}>
  <ClaudeIcon />
  <span>Add MotherDuck to Claude</span>
  <ExternalLinkIcon />
</a>

Or manually:

1. Go to **Settings** → **Connectors**
2. Click **Browse Connectors** to find the MotherDuck connector

![MotherDuck Connector in the Claude connector Directory](./img/claude-connectors-motherduck.png)

A browser window should open for authentication. After authentication you can double check the connection by asking "List all my databases on MotherDuck."

  </TabItem>
  <TabItem value="chatgpt" label="ChatGPT">

<a href="https://chatgpt.com/apps/motherduck/asdk_app_696a54f1c91c81919002b9153ce0e336" target="_blank" rel="noopener noreferrer" style={{display: 'inline-flex', alignItems: 'center', gap: '8px', padding: '8px 14px', background: 'var(--ifm-background-color)', border: '1px solid var(--ifm-color-emphasis-300)', borderRadius: '4px', color: 'var(--ifm-font-color-base)', fontSize: '14px', fontWeight: 500, textDecoration: 'none', marginBottom: '16px'}}>
  <ChatGPTIcon />
  <span>Add MotherDuck to ChatGPT</span>
  <ExternalLinkIcon />
</a>

<VideoPlayer
  playbackId="GU41jMZ01O01uWGaukLbqj1Ee14tnHq800AV6OGWpvQbcE"
  title="Setting up MotherDuck in ChatGPT"
  autoPlay="true"
  muted="true"
  loop="true"
/>

1. Open the ChatGPT desktop or web app
2. Go to **Settings** → **Apps** and click **Browse Apps**

<img src={useBaseUrl('/img/key-tasks/ai-and-motherduck/chatgpt-browse-apps.png')} alt="Browse Apps in ChatGPT settings" style={{maxWidth: '500px', width: '100%', display: 'block', margin: '0 auto'}} />

3. Search for **MotherDuck** and select it

<img src={useBaseUrl('/img/key-tasks/ai-and-motherduck/chatgpt-search-motherduck.png')} alt="Searching for MotherDuck in the ChatGPT App Store" style={{maxWidth: '500px', width: '100%', display: 'block', margin: '0 auto'}} />

4. Click **Continue to MotherDuck** and authenticate with your MotherDuck account

<img src={useBaseUrl('/img/key-tasks/ai-and-motherduck/chatgpt-connect-motherduck.png')} alt="Connect MotherDuck dialog in ChatGPT" style={{maxWidth: '500px', width: '100%', display: 'block', margin: '0 auto'}} />

After authentication, ChatGPT can access your MotherDuck data. Try asking "List all my databases on MotherDuck" to verify the connection.

  </TabItem>
  <TabItem value="cursor" label="Cursor">
<a href="cursor://anysphere.cursor-deeplink/mcp/install?name=motherduck&config=eyJ1cmwiOiJodHRwczovL2FwaS5tb3RoZXJkdWNrLmNvbS9tY3AifQ%3D%3D" target="_blank" rel="noopener noreferrer" style={{display: 'inline-flex', alignItems: 'center', gap: '8px', padding: '8px 14px', background: 'var(--ifm-background-color)', border: '1px solid var(--ifm-color-emphasis-300)', borderRadius: '4px', color: 'var(--ifm-font-color-base)', fontSize: '14px', fontWeight: 500, textDecoration: 'none', marginBottom: '16px'}}>
  <CursorIcon />
  <span>Add MotherDuck to Cursor</span>
  <ExternalLinkIcon />
</a>

1. Open **Cursor Settings** (`Cmd/Ctrl + ,`)
2. Navigate to **Tools & MCP**
3. Click **+ New MCP Server**
4. Add the following to the configuration file:

```json
{
  "MotherDuck": {
    "url": "https://api.motherduck.com/mcp",
    "type": "http"
  }
}
```

5. Save and click **Connect** to authenticate with your MotherDuck account

> [Cursor MCP Documentation](https://docs.cursor.com/context/model-context-protocol)

  </TabItem>
  <TabItem value="claude-code" label="Claude Code">

1. Run the following command in your terminal:

```bash
claude mcp add MotherDuck --transport http https://api.motherduck.com/mcp
```

:::tip
By default, this command adds the MCP server to the current project.
You can also pass the `--scope user` flag, and the MCP server will be
available for all sessions from your current user
([`--scope` documentation](https://code.claude.com/docs/en/mcp#mcp-installation-scopes)).
:::

2. Run `claude` to start Claude Code
3. Type `/mcp`, select **MotherDuck** from the list, and press **Enter**
4. Select **Authenticate** and confirm the authorization dialog

> [Claude Code MCP Documentation](https://code.claude.com/docs/en/mcp)

  </TabItem>
  <TabItem value="others" label="Others">

If you're using **Windsurf**, **Zed**, or another MCP-compatible client, use the following JSON configuration:

```json
{
  "mcpServers": {
    "MotherDuck": {
      "url": "https://api.motherduck.com/mcp",
      "type": "http"
    }
  }
}
```

  </TabItem>
</Tabs>

:::tip Authentication
The remote MCP server uses OAuth, so you'll authenticate with your MotherDuck account during setup. Some clients also support [token-based authentication](/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck#creating-an-access-token) through a Bearer header.
:::

## Configuring tool permissions

Most MCP clients let you control how the AI uses each tool. The exact UI varies by client, but the general permission levels are:

| Permission | Behavior |
|------------|----------|
| **Always allow** | The AI uses the tool automatically without asking. Faster iteration when errors occur, but no human confirmation before each action. |
| **Needs approval** | The AI asks for your confirmation before each tool use. Gives you visibility into every action. |
| **Blocked** | The AI cannot use this tool. |

:::tip
The MCP Server provides both read-only (`query`) and read-write (`query_rw`) tools. For exploratory analysis, setting read-only tools to "Always allow" enables faster back-and-forth when the AI needs to retry or refine queries. You can keep `query_rw` on "Needs approval" or block it if you only need read access. See [Restricting to read-only access](/key-tasks/ai-and-motherduck/securing-read-only-access/) for more options.
:::

## Remote vs local MCP server

MotherDuck offers two MCP server options:

| Server | Best for | Setup | Access |
|--------|----------|--------|--------|
| **Remote** (hosted by MotherDuck) | Most users who query and modify data on MotherDuck cloud | Zero setup; connect through URL and OAuth | Read-write |
| **Local** ([mcp-server-motherduck](https://github.com/motherduckdb/mcp-server-motherduck)) | Self-hosted use; local DuckDB files; or when you need full customization | Install and run the server yourself | Fully customizable |

The **remote server** is recommended for most use cases. Use the **local server** when you need to work with local DuckDB files, want custom tool configurations, or require full control over the server environment.

<a href="https://github.com/motherduckdb/mcp-server-motherduck" target="_blank" rel="noopener noreferrer" className="github-repo-link">
  **Local MCP Server GitHub Repository** – Self-host the open-source MCP server for DuckDB and MotherDuck
</a>

## Where to go from here

- **[AI Data Analysis Getting Started](/getting-started/mcp-getting-started/)**: 5-minute walkthrough of querying data and creating Dives
- **[MCP Workflows Guide](/key-tasks/ai-and-motherduck/mcp-workflows/)**: Best practices for getting accurate results from AI-powered analysis
- **[MCP Server Reference](/sql-reference/mcp/)**: Server capabilities, available tools, and regional availability
- **[Restricting to Read-Only Access](/key-tasks/ai-and-motherduck/securing-read-only-access/)**: Restrict your AI assistant to read-only queries
