> ## Documentation Index
> Fetch the complete documentation index at: https://docs.datafold.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP Server

> Connect AI assistants to Datafold using the Model Context Protocol

## Overview

Datafold provides a public HTTP MCP (Model Context Protocol) server that enables AI assistants to interact with your Datafold data sources, run queries, and manage data diffs.

**Endpoint:** `https://app.datafold.com/mcp/` (EU: `https://eu.datafold.com/mcp/`; Classic Dedicated Cloud: `https://<your domain>/mcp/`)

## Prerequisites

Before setting up the MCP server, you need a Datafold API key.

**1. Navigate to Settings**

Open the Datafold app and go to **Settings > Account**

**2. Create API Key**

Click **Create API Key** and store it securely

> [!NOTE]
>
> If you lose your API key, you'll need to generate a new one. See the [Introduction guide](https://docs.datafold.com/classic/api-reference/introduction.md) for more details.

## Authentication

The MCP server uses Bearer token authentication with your Datafold API key:

```
Authorization: Bearer YOUR_API_KEY
```

The `Key YOUR_API_KEY` format used by the REST API is also accepted.

Include this header in your MCP client configuration.

***

## Setup by Client

> **Claude Desktop**
>
> Claude Desktop supports MCP servers through its developer configuration file.
>
> **Steps:**
>
> 1. Open Claude Desktop
> 2. Go to **Settings > Developer > Edit Config**
> 3. Add the following to your list of MCP servers in `claude_desktop_config.json`:
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "datafold": {
>       "command": "mcp-remote",
>       "args": [
>         "https://app.datafold.com/mcp/",
>         "--header",
>         "Authorization: Bearer YOUR_API_KEY"
>       ]
>     }
>   }
> }
> ```
>
> 4. Save the file and restart Claude Desktop
>
> > [!NOTE]
> >
> > You need to have `mcp-remote` installed. Install it with `npm install -g mcp-remote` if you haven't already.

> **Claude Code**
>
> Claude Code supports MCP through a simple CLI command.
>
> **Quick Setup:**
>
> Run the following command in your terminal:
>
> ```bash theme={null}
> claude mcp add --transport http --scope user \
>   datafold https://app.datafold.com/mcp/ \
>   --header "Authorization: Bearer YOUR_API_KEY"
> ```
>
> **Options:**
>
> * `--scope user` - Makes the server available across all projects
> * `--header` - Adds authentication header
>
> **Verify Installation:**
>
> ```bash theme={null}
> claude mcp list
> ```
>
> The Datafold MCP server will now be available in all your Claude Code sessions.
>
> > [!NOTE]
> >
> > See the [Claude Code MCP documentation](https://code.claude.com/docs/en/mcp) for more configuration options.

> **Cursor**
>
> Cursor supports MCP servers through project-specific or global configuration.
>
> **Project-Specific Setup:**
>
> Create `.cursor/mcp.json` in your project directory:
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "datafold": {
>       "type": "http",
>       "url": "https://app.datafold.com/mcp/",
>       "headers": {
>         "Authorization": "Bearer YOUR_API_KEY"
>       }
>     }
>   }
> }
> ```
>
> Restart Cursor to load the configuration.

> **VS Code with Cline**
>
> Cline is a VS Code extension that supports MCP servers.
>
> **Steps:**
>
> 1. Install the Cline extension
> 2. Click the **MCP Servers** icon in Cline's navigation
> 3. Select **Configure** tab → **Advanced MCP Settings**
> 4. Add to `cline_mcp_settings.json`:
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "datafold": {
>       "type": "http",
>       "url": "https://app.datafold.com/mcp/",
>       "headers": {
>         "Authorization": "Bearer YOUR_API_KEY"
>       },
>       "timeout": 60000
>     }
>   }
> }
> ```
>
> 5. Toggle the switch to enable the server
> 6. Close and reopen VS Code

> **Windsurf**
>
> Windsurf supports environment variable interpolation for secure credential storage.
>
> **Configuration File:** `~/.codeium/windsurf/mcp_config.json`
>
> **Basic Configuration:**
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "datafold": {
>       "type": "http",
>       "serverUrl": "https://app.datafold.com/mcp/",
>       "headers": {
>         "Authorization": "Bearer YOUR_API_KEY"
>       }
>     }
>   }
> }
> ```
>
> **Using Environment Variables (Recommended):**
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "datafold": {
>       "type": "http",
>       "serverUrl": "https://app.datafold.com/mcp/",
>       "headers": {
>         "Authorization": "Key ${env:DATAFOLD_API_KEY}"
>       }
>     }
>   }
> }
> ```
>
> Set `DATAFOLD_API_KEY` as an environment variable, then restart Windsurf.

> **Continue.dev**
>
> Continue.dev supports MCP in agent mode through YAML configuration.
>
> **Configuration Directory:** `.continue/mcpServers/`
>
> Create `datafold.yaml`:
>
> ```yaml theme={null}
> type: streamable-http
> url: https://app.datafold.com/mcp/
> headers:
>   Authorization: "Bearer YOUR_API_KEY"
> ```
>
> > [!NOTE]
> >
> > MCP can only be used in agent mode within Continue.dev.

> **Zed**
>
> Zed supports MCP through custom configuration in settings.
>
> **Steps:**
>
> 1. Open Zed
> 2. Go to **Preferences > Settings** (`⌘,` on macOS)
> 3. Add a `context_servers` section:
>
> ```json theme={null}
> {
>   "context_servers": {
>     "datafold": {
>       "settings": {
>         "url": "https://app.datafold.com/mcp/",
>         "headers": {
>           "Authorization": "Bearer YOUR_API_KEY"
>         }
>       }
>     }
>   }
> }
> ```
>
> 4. Check the Agent Panel - the indicator should be green when active

> **OpenCode**
>
> OpenCode supports both local and remote MCP servers with automatic OAuth handling.
>
> **Configuration Files:**
>
> * Global: `~/.config/opencode/opencode.json`
> * Project: `opencode.json` in project root (overrides global)
>
> **Remote MCP Configuration:**
>
> ```json theme={null}
> {
>   "$schema": "https://opencode.ai/config.json",
>   "mcp": {
>     "datafold": {
>       "type": "remote",
>       "url": "https://app.datafold.com/mcp/",
>       "headers": {
>         "Authorization": "Bearer MY_DATAFOLD_API_KEY"
>       },
>       "enabled": true
>     }
>   }
> }
> ```
>
> **CLI Setup:**
> You can also use the interactive CLI to add the server:
>
> ```bash theme={null}
> opencode mcp add
> ```
>
> Then follow the prompts to configure the Datafold remote MCP server.
>
> > [!NOTE]
> >
> > See the [OpenCode MCP documentation](https://opencode.ai/docs/mcp-servers/) for advanced configuration.

> **Gemini CLI**
>
> Gemini CLI supports MCP servers with built-in OAuth 2.0 authentication.
>
> **Configuration Files:**
>
> * Global: `~/.gemini/settings.json`
> * Project: `.gemini/settings.json` in project directory
>
> **Add via CLI (Recommended):**
>
> ```bash theme={null}
> gemini mcp add datafold --scope user \
>   --transport http \
>   --url https://app.datafold.com/mcp/ \
>   --header "Authorization: Bearer YOUR_API_KEY"
> ```
>
> **Manual Configuration:**
>
> Edit your settings file:
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "datafold": {
>       "transport": "http",
>       "url": "https://app.datafold.com/mcp/",
>       "headers": {
>         "Authorization": "Bearer YOUR_API_KEY"
>       }
>     }
>   }
> }
> ```
>
> > [!NOTE]
> >
> > See the [Gemini CLI MCP documentation](https://geminicli.com/docs/tools/mcp-server/) for OAuth and advanced features.

> **Kiro**
>
> Kiro supports both global and project-specific MCP configuration.
>
> **Global Configuration:**
>
> Edit `~/.kiro/settings/mcp.json`:
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "datafold": {
>       "url": "https://app.datafold.com/mcp/",
>       "headers": {
>         "Authorization": "Bearer YOUR_API_KEY"
>       }
>     }
>   }
> }
> ```
>
> **Project-Specific Configuration:**
>
> Edit `.kiro/settings/mcp.json` in your project directory with the same format.
>
> **Using Environment Variables (Recommended):**
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "datafold": {
>       "url": "https://app.datafold.com/mcp/",
>       "headers": {
>         "Authorization": "Key ${API_TOKEN}"
>       }
>     }
>   }
> }
> ```
>
> Changes apply automatically when you save the file.
>
> > [!NOTE]
> >
> > See the [Kiro MCP documentation](https://kiro.dev/docs/mcp/configuration/) for advanced options.

***

## Verification

After configuring your MCP client, verify the connection:

1. Check that the server status shows as "active" or "connected"
2. Test with a simple query:
   * "List my Datafold data sources"
   * "Run a query against \[data source name]"

If successful, your AI assistant can now interact with Datafold through MCP.

***

## Troubleshooting

> **Connection Errors**
>
> **Symptoms:** "Unable to connect to MCP server" or "No valid session ID"
>
> **Solutions:**
>
> * Verify your API key is valid
> * Confirm the URL is exactly `https://app.datafold.com/mcp/`
> * Check header format: `Authorization: Bearer YOUR_API_KEY`
> * Regenerate your API key if issues persist

> **Authentication Errors**
>
> **Symptoms:** "401 Unauthorized" or "403 Forbidden"
>
> **Solutions:**
>
> * Generate a new API key if needed
> * Verify the header is `Authorization: Bearer YOUR_API_KEY` (`Key YOUR_API_KEY` also works)
> * Check your API key hasn't been revoked

> **Server Not Loading**
>
> **Symptoms:** MCP server doesn't appear or shows as inactive
>
> **Solutions:**
>
> * Restart your MCP client completely
> * Validate JSON/YAML syntax
> * Check client logs for specific errors
> * Ensure configuration file is in the correct location

***

## Best Practices

> **Secure Your Keys**
>
> Never commit API keys to version control. Use environment variables or secure secret management.

> **Use Environment Variables**
>
> Reference API keys through environment variables rather than hardcoding them in configuration files.

> **Monitor Usage**
>
> Regularly check Datafold audit logs to monitor API usage and detect anomalies.

> **Rotate Keys**
>
> Periodically rotate your API keys as part of security best practices.

***

## Additional Resources

> **[API Introduction](https://docs.datafold.com/classic/api-reference/introduction.md)**
>
> Learn more about Datafold's REST API

> **[Model Context Protocol](https://modelcontextprotocol.io/)**
>
> Official MCP specification

> **[Data Sources API](https://docs.datafold.com/classic/api-reference/data-sources/list-data-sources.md)**
>
> Explore data source endpoints

> **[Data Diffs API](https://docs.datafold.com/classic/api-reference/data-diffs/list-data-diffs.md)**
>
> Learn about data diff operations

***

## Support

If you need assistance:

* Check the [Datafold documentation](https://docs.datafold.com)
* Review your MCP client's documentation
* Contact support via Slack, in-app chat, or [support@datafold.com](mailto:support@datafold.com)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.