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

# MCP Server

> Connect AI assistants like Claude, ChatGPT, Gemini, Cursor, and OpenClaw to Data Legion using the Model Context Protocol (MCP). Access person and company data through AI tool calls.

The Data Legion MCP server lets AI assistants access your person and company data through tool calls. It works with any MCP-compatible client including Claude Code, Claude Desktop, ChatGPT, Gemini, Cursor, OpenClaw, Cline, Continue, Windsurf, and Goose.

## Server URL

```
https://api.datalegion.ai/mcp
```

## Discovery

We publish discovery metadata so MCP-compatible agents can detect the server, its tools, and its auth method automatically:

* **Server card**: [https://www.datalegion.ai/.well-known/mcp/server-card.json](https://www.datalegion.ai/.well-known/mcp/server-card.json) (per [SEP-1649](https://github.com/modelcontextprotocol/modelcontextprotocol/issues/1649))
* **Manifest pointer**: [https://www.datalegion.ai/.well-known/mcp.json](https://www.datalegion.ai/.well-known/mcp.json)

## Authentication

The MCP server uses the same `API-Key` authentication as the REST API. Pass your API key in the `headers` section of your MCP client configuration. The key is forwarded to the API on every tool call, so credits and rate limits apply exactly as they do for direct API calls.

## Setup

### Claude Code

Add to your project's `.mcp.json`:

```json theme={null}
{
  "mcpServers": {
    "datalegion": {
      "type": "http",
      "url": "https://api.datalegion.ai/mcp",
      "headers": {
        "API-Key": "YOUR_API_KEY"
      }
    }
  }
}
```

Or via CLI:

```bash theme={null}
claude mcp add --transport http datalegion https://api.datalegion.ai/mcp \
  --header "API-Key: YOUR_API_KEY"
```

### Claude Desktop

Add to your Claude Desktop configuration (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):

```json theme={null}
{
  "mcpServers": {
    "datalegion": {
      "type": "http",
      "url": "https://api.datalegion.ai/mcp",
      "headers": {
        "API-Key": "YOUR_API_KEY"
      }
    }
  }
}
```

### Cursor

Open **Cursor Settings → MCP**, add a new server with name `datalegion`, transport `HTTP`, URL `https://api.datalegion.ai/mcp`, and add an `API-Key` header with your key. Or paste this into your project's `.cursor/mcp.json`:

```json theme={null}
{
  "mcpServers": {
    "datalegion": {
      "type": "http",
      "url": "https://api.datalegion.ai/mcp",
      "headers": {
        "API-Key": "YOUR_API_KEY"
      }
    }
  }
}
```

### ChatGPT

In a Custom GPT or workspace with MCP enabled, add a connector pointing at `https://api.datalegion.ai/mcp`. Set authentication to **Custom header** with header name `API-Key` and your key as the value. ChatGPT will discover the nine Data Legion tools and call them automatically.

### Gemini (Gemini CLI / Code Assist)

In your `~/.gemini/settings.json` (or workspace settings):

```json theme={null}
{
  "mcpServers": {
    "datalegion": {
      "httpUrl": "https://api.datalegion.ai/mcp",
      "headers": {
        "API-Key": "YOUR_API_KEY"
      }
    }
  }
}
```

### OpenClaw

OpenClaw discovers MCP servers via the standard MCP config block. Add this to your OpenClaw `mcp.json`:

```json theme={null}
{
  "mcpServers": {
    "datalegion": {
      "type": "http",
      "url": "https://api.datalegion.ai/mcp",
      "headers": {
        "API-Key": "YOUR_API_KEY"
      }
    }
  }
}
```

OpenClaw's tool dispatcher will then expose all nine Data Legion tools to the agent loop.

### Other MCP-compatible clients

Cline, Continue, Windsurf, Goose, and any other client that speaks Model Context Protocol over Streamable HTTP work the same way: point them at `https://api.datalegion.ai/mcp` and pass your key in the `API-Key` header. The server-card at [`/.well-known/mcp/server-card.json`](https://www.datalegion.ai/.well-known/mcp/server-card.json) advertises capabilities and tools so compatible clients can connect with no further configuration.

## Available Tools

The MCP server exposes 9 tools that map directly to the Data Legion REST API endpoints. Credits are consumed the same way as direct API calls. The natural-language `/person/discover` and `/company/discover` REST endpoints are not exposed via MCP today; call them from the [REST API](/docs/api-reference/person-discovery) or SDKs.

### Person

| Tool            | Description                                                            | API Equivalent                                          |
| --------------- | ---------------------------------------------------------------------- | ------------------------------------------------------- |
| `person_enrich` | Look up a person by email, phone, name, LinkedIn, or other identifiers | [POST /person/enrich](/docs/api-reference/person-enrichment) |
| `person_search` | Query people using SQL WHERE syntax                                    | [POST /person/search](/docs/api-reference/person-search)     |

### Company

| Tool             | Description                                            | API Equivalent                                            |
| ---------------- | ------------------------------------------------------ | --------------------------------------------------------- |
| `company_enrich` | Look up a company by domain, name, ticker, or LinkedIn | [POST /company/enrich](/docs/api-reference/company-enrichment) |
| `company_search` | Query companies using SQL WHERE syntax                 | [POST /company/search](/docs/api-reference/company-search)     |

### Utilities

| Tool                 | Description                                                          | API Equivalent                                                |
| -------------------- | -------------------------------------------------------------------- | ------------------------------------------------------------- |
| `utility_clean`      | Normalize emails, phones, names, domains, and other fields           | [POST /utility/clean](/docs/api-reference/utility-clean)           |
| `utility_hash_email` | Hash an email address (SHA-256, SHA-1, MD5) for privacy-safe lookups | [POST /utility/hash/email](/docs/api-reference/utility-hash-email) |
| `utility_validate`   | Validate data format and get cleaning suggestions                    | [POST /utility/validate](/docs/api-reference/utility-validate)     |

### Reporting

| Tool             | Description                                                                              | API Equivalent                                                |
| ---------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
| `report_person`  | Flag a data-quality issue with a person record (wrong, outdated, or misattributed value) | [POST /utility/report/person](/docs/api-reference/utility-report)  |
| `report_company` | Flag a data-quality issue with a company record                                          | [POST /utility/report/company](/docs/api-reference/utility-report) |

Reporting has no credit cost and is available to any valid API key.

## Example Conversations

Once connected, you can ask your AI assistant things like:

* "Look up the person with email [jane.doe@acme.com](mailto:jane.doe@acme.com)"
* "Find software engineers in San Francisco who worked at Google"
* "Enrich the company google.com"
* "Search for AI startups with more than 50 employees"
* "Clean and validate this contact: email [john.doe+work@gmail.com](mailto:john.doe+work@gmail.com), phone (555) 123-4567"
* "Hash the email [john@example.com](mailto:john@example.com) for a privacy-safe lookup"

The AI assistant will automatically select the right tool based on your request.

## Credits

MCP tool calls consume credits at the same rate as the corresponding REST API endpoints.

## Rate Limits

The same [rate limits](/docs/api-reference/overview#rate-limiting) apply to MCP tool calls as to direct API calls.
