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

# Connect HasMCP MCP servers to Cursor

> How to connect HasMCP servers to the Cursor code editor.

# Using MCP in Cursor

Cursor provides native support for the Model Context Protocol (MCP), allowing its AI features like Composer and Chat to directly use tools and context from your HasMCP servers.

## 1. Setup via Settings UI

<Steps>
  <Step title="Open Settings">
    Open **Cursor Settings** (Keyboard shortcut: `Cmd + ,` on macOS or `Ctrl + ,` on Windows) and navigate to **Cursor Settings > MCP**.
  </Step>

  <Step title="Add New Server">
    Click the **+ Add New MCP Server** button and configure the following fields:

    * **Name**: A recognizable name (e.g., `hasmcp-prod`).
    * **Type**: Select `sse` (Server-Sent Events) for remote HasMCP connections.
    * **URL**: Your HasMCP server endpoint (e.g., `https://app.hasmcp.com/mcp/<SERVER_ID>`).
  </Step>
</Steps>

## 2. Setup via `mcp.json` (Advanced)

For version-controlled or global configuration, you can edit the `mcp.json` file directly.

### Configuration Paths

* **Global (macOS/Linux)**: `~/.cursor/mcp.json`
* **Global (Windows)**: `%USERPROFILE%\.cursor\mcp.json`
* **Project-Specific**: `.cursor/mcp.json` in your project root

### Example Configuration

Add your server details to the `mcpServers` object. Use headers to provide your HasMCP access token:

```json theme={null}
{
  "mcpServers": {
    "hasmcp-server": {
      "url": "https://app.hasmcp.com/mcp/<SERVER_ID>",
      "headers": {
        "x-hasmcp-key": "Bearer <YOUR_ACCESS_TOKEN>"
      }
    }
  }
}
```

## Verifying the Connection

* **Status Indicator**: A green dot next to the server name indicates a successful connection.
* **Tool Discovery**: Expand the server entry to see the list of tools that Cursor has discovered from your HasMCP configuration.
* **Using in Chat**: You can now ask Cursor to use specific tools by name (e.g., "Use my db-agent tool to query the users table").

## Troubleshooting

<AccordionGroup>
  <Accordion title="Token Expiry">
    If the connection dot turns red, your token may have expired. Generate a new
    one in the HasMCP dashboard and update your config.
  </Accordion>

  <Accordion title="Restarting">
    After manually editing `mcp.json`, you must restart Cursor for the changes
    to take effect.
  </Accordion>
</AccordionGroup>
