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

# MCP Server

> Connect AI tools to DFlow documentation and API references with our hosted MCP server.

export const InstallButton = ({children, href}) => {
  return <a href={href} className="text-sm font-medium text-white dark:!text-zinc-950 bg-zinc-900 hover:bg-zinc-700 dark:bg-zinc-100 hover:dark:bg-zinc-300 rounded-full px-3.5 py-1.5 not-prose">
        {children}
      </a>;
};

The DFlow MCP server gives AI tools direct access to our documentation, API specs, and code examples so they can generate accurate, up-to-date code for your integration.

```
https://pond.dflow.net/mcp
```

## What is MCP?

[Model Context Protocol](https://modelcontextprotocol.io/) (MCP) is an open standard that connects AI applications to external data sources. Instead of relying on general web search, your AI tool searches DFlow documentation directly during response generation, giving you current API methods, correct parameters, and working examples.

## Connecting to the DFlow MCP Server

Use the contextual menu at the top of any documentation page for one-click setup, or follow the manual instructions below.

<Tabs>
  <Tab title="Claude Code">
    Run the following command:

    ```bash theme={null}
    claude mcp add --transport http DFlow https://pond.dflow.net/mcp
    ```

    Or add to your project's `.mcp.json`:

    ```json theme={null}
    {
      "mcpServers": {
        "DFlow": {
          "type": "http",
          "url": "https://pond.dflow.net/mcp"
        }
      }
    }
    ```

    Verify with:

    ```bash theme={null}
    claude mcp list
    ```
  </Tab>

  <Tab title="Claude">
    1. Go to [Connectors](https://claude.ai/settings/connectors) in your Claude settings.
    2. Select **Add custom connector**.
    3. Set the name to `DFlow` and the URL to `https://pond.dflow.net/mcp`.
    4. When chatting, click the attachments button (plus icon) and select the DFlow connector.
  </Tab>

  <Tab title="Cursor">
    <InstallButton href="cursor://anysphere.cursor-deeplink/mcp/install?name=DFlow&config=eyJ1cmwiOiJodHRwczovL3BvbmQuZGZsb3cubmV0L21jcCJ9">Install in Cursor</InstallButton>

    To connect the DFlow MCP server to Cursor, click the **Install in Cursor** button above. Or to manually connect the MCP server, follow these steps:

    1. Open the command palette with `Cmd + Shift + P` (or `Ctrl + Shift + P` on Windows).
    2. Search for **Open MCP settings**.
    3. Add the following to your `mcp.json`:

    ```json theme={null}
    {
      "mcpServers": {
        "DFlow": {
          "url": "https://pond.dflow.net/mcp"
        }
      }
    }
    ```
  </Tab>

  <Tab title="VS Code">
    Create a `.vscode/mcp.json` file in your project and add:

    ```json theme={null}
    {
      "servers": {
        "DFlow": {
          "type": "http",
          "url": "https://pond.dflow.net/mcp"
        }
      }
    }
    ```
  </Tab>

  <Tab title="Windsurf">
    1. Open the command palette with `Cmd + Shift + P` (or `Ctrl + Shift + P` on Windows).
    2. Search for **Windsurf: Configure MCP Servers**.
    3. Add the following to your `mcp_config.json`:

    ```json theme={null}
    {
      "mcpServers": {
        "DFlow": {
          "serverUrl": "https://pond.dflow.net/mcp"
        }
      }
    }
    ```
  </Tab>
</Tabs>

## What You Get

Once connected, your AI tool can search DFlow documentation while generating responses. This includes:

* **Trading API**: Order, imperative, and declarative endpoints with parameters and examples.
* **Metadata API**: Prediction market discovery, orderbooks, candlesticks, websockets.
* **Proof API**: KYC verification endpoints.
* **Code Recipes**: End-to-end implementation patterns for common use cases.
* **Concepts**: How routing, slippage, priority fees, and platform fees work.
* **Debugging**: Draws from a large FAQ library that is continuously updated based on real integration questions from builders, so your AI tool can troubleshoot issues using the same answers our team gives in support channels.

<Note>
  The MCP server is automatically generated from this documentation and stays in sync as pages are updated.
</Note>

## Example Prompts

Try these with the DFlow MCP server connected:

**Arbitrage and Market Scanning**

* "Build a scanner that finds active prediction markets where the combined YES and NO ask prices sum to less than \$1."
* "Write a function that monitors orderbook depth across markets and flags any where the top-of-book spread is wider than 5 cents."

**Automated Trading Bots**

* "Write a bot that streams websocket price updates and automatically buys YES when the ask drops below a target price."
* "Build an auto-redemption bot that polls for markets transitioning to determined status and redeems winning outcome tokens immediately."
* "Write a script that monitors market lifecycle status and places a trade the moment a market goes active."

**Position Management**

* "Build a portfolio tracker that maps a wallet's outcome token balances to their current market prices and shows unrealized P\&L."
* "Write a function that automatically decreases a position when the bid price hits a take-profit target."
* "How do I track all my open prediction market positions and calculate total exposure?"

**Execution Optimization**

* "Write an imperative trade that restricts routing to a single DEX using the dexes parameter."
* "How do I use USDC as the input mint to skip the spot swap leg and get the lowest latency prediction market trade?"
* "How do I use priority fee presets like auto, medium, high, and veryHigh to speed up time-sensitive trades?"

**Trading Basics**

* "Write a TypeScript function that executes an imperative token swap on DFlow with custom slippage."
* "How do I add dynamic platform fees to prediction market trades?"
* "How do I trade BONK into a prediction market outcome token position?"

**Debugging**

* "My trade is returning `route_not_found`, how do I debug this?"
* "Why is my swap transaction failing onchain after getting a successful quote?"

## Tips

* **Be specific**: "How do I submit a declarative trade with platform fees?" works better than "help with trading."
* **Mention your stack**: "Using TypeScript and Next.js, show me how to..." gives better results.
* **Iterate**: Use generated code as a starting point and ask for modifications.
* **Prepare**: Read the docs first, so you know how to properly frame your commands.

## Other AI Resources

For tools that don't support MCP, see the [AI overview](/ai/introduction).
