---
title: "Cursor / Windsurf / VS Code"
description: "Add Horizon as an MCP server in Cursor, Windsurf, or VS Code for AI-assisted trading."
icon: "/images/integrations/cursor.svg"
---

Cursor, Windsurf, and VS Code all support MCP servers. Adding Horizon gives the AI assistant access to your trading engine directly from your editor.

## Cursor

<Steps>
  <Step title="Install">
    ```bash
    pip install horizon-sdk[mcp]
    # or
    uv pip install horizon-sdk[mcp]
    ```
  </Step>
  <Step title="Configure">
    Open **Cursor Settings** > **MCP Servers** and add:

    ```json
    {
      "horizon": {
        "command": "python",
        "args": ["-m", "horizon.mcp"],
        "env": {
          "HORIZON_API_KEY": "your-key",
          "HORIZON_EXCHANGE": "paper"
        }
      }
    }
    ```

    Or create/edit `.cursor/mcp.json` in your project root:

    ```json
    {
      "mcpServers": {
        "horizon": {
          "command": "python",
          "args": ["-m", "horizon.mcp"],
          "env": {
            "HORIZON_API_KEY": "your-key",
            "HORIZON_EXCHANGE": "paper"
          }
        }
      }
    }
    ```
  </Step>
  <Step title="Use">
    In Cursor's AI chat, ask about positions, markets, or orders. The assistant will use Horizon tools automatically.
  </Step>
</Steps>

## Windsurf

<Steps>
  <Step title="Install">
    ```bash
    pip install horizon-sdk[mcp]
    # or
    uv pip install horizon-sdk[mcp]
    ```
  </Step>
  <Step title="Configure">
    Create or edit `~/.codeium/windsurf/mcp_config.json`:

    ```json
    {
      "mcpServers": {
        "horizon": {
          "command": "python",
          "args": ["-m", "horizon.mcp"],
          "env": {
            "HORIZON_API_KEY": "your-key",
            "HORIZON_EXCHANGE": "paper"
          }
        }
      }
    }
    ```
  </Step>
  <Step title="Use">
    Windsurf's Cascade will discover the Horizon tools and use them when you ask about trading.
  </Step>
</Steps>

## VS Code (Copilot)

<Steps>
  <Step title="Install">
    ```bash
    pip install horizon-sdk[mcp]
    # or
    uv pip install horizon-sdk[mcp]
    ```
  </Step>
  <Step title="Configure">
    Create `.vscode/mcp.json` in your workspace:

    ```json
    {
      "servers": {
        "horizon": {
          "type": "stdio",
          "command": "python",
          "args": ["-m", "horizon.mcp"],
          "env": {
            "HORIZON_API_KEY": "your-key",
            "HORIZON_EXCHANGE": "paper"
          }
        }
      }
    }
    ```
  </Step>
  <Step title="Use">
    In the Copilot chat panel, switch to Agent mode. Copilot will discover the Horizon MCP tools.
  </Step>
</Steps>

## Live Trading

To switch from paper to a live exchange, update the `env` block:

<CodeGroup>
```json Polymarket
{
  "env": {
    "HORIZON_API_KEY": "your-key",
    "HORIZON_EXCHANGE": "polymarket",
    "POLYMARKET_API_KEY": "...",
    "POLYMARKET_API_SECRET": "...",
    "POLYMARKET_API_PASSPHRASE": "...",
    "POLYMARKET_PRIVATE_KEY": "0x..."
  }
}
```

```json Kalshi
{
  "env": {
    "HORIZON_API_KEY": "your-key",
    "HORIZON_EXCHANGE": "kalshi",
    "KALSHI_API_KEY": "...",
    "KALSHI_EMAIL": "...",
    "KALSHI_PASSWORD": "..."
  }
}
```
</CodeGroup>

<Warning>
Never commit API keys to version control. Use environment variables or a secrets manager.
</Warning>

## HTTP Transport

For clients that support HTTP-based MCP (streamable HTTP), use:

```json
{
  "horizon": {
    "command": "python",
    "args": ["-m", "horizon.mcp", "--http"]
  }
}
```

This starts the server on the default HTTP port instead of stdio.
