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

# MCP Flow

> How agents connect to Encrata via Model Context Protocol. Skip HTTP, use tool calls.

# MCP Flow

Agents that speak MCP (Model Context Protocol) can skip HTTP entirely. Add the Encrata server to your MCP config and every lookup becomes a native tool call. The agent doesn't need to construct HTTP requests, parse JSON responses, or manage authentication headers. MCP handles it all.

## When to use it

* Your agent platform supports MCP (Claude Code, Cursor, Windsurf, custom MCP clients)
* You want **native tool integration** - lookups appear as callable functions
* You prefer **structured I/O** over raw HTTP request/response management

## How it works

```mermaid theme={"dark"}
sequenceDiagram
    participant Agent
    participant MCP Client
    participant Encrata MCP Server

    Agent->>MCP Client: Call tool: lookup_email
    MCP Client->>Encrata MCP Server: MCP request (with Bearer token)
    Encrata MCP Server-->>MCP Client: Tool result (enrichment data)
    MCP Client-->>Agent: Structured response
```

1. Agent calls a named tool (e.g., `lookup_email`)
2. MCP client sends the request to Encrata's MCP server with the configured auth header
3. Encrata processes the lookup and returns structured data
4. Agent receives the result as a native tool response

## Configuration

Add Encrata to your MCP config file:

```json theme={"dark"}
{
  "mcpServers": {
    "encrata": {
      "url": "https://encrata.com/mcp",
      "headers": {
        "Authorization": "Bearer enc_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}
```

<Info>
  You still need an API key for MCP authentication. Create one via the [API Key Flow](/auth-md/flows/api-key) or from the [dashboard](https://encrata.com/api-keys).
</Info>

## Available tools

Once connected, the following tools are available to your agent:

| Tool              | Description                       | Parameters                                   |
| ----------------- | --------------------------------- | -------------------------------------------- |
| `lookup_email`    | Email enrichment                  | `email` (string)                             |
| `lookup_phone`    | Phone number lookup               | `phone` (string)                             |
| `lookup_ip`       | IP intelligence                   | `ip` (string)                                |
| `lookup_domain`   | Domain search                     | `domain` (string)                            |
| `lookup_company`  | Company search                    | `company` (string)                           |
| `google_search`   | Google search                     | `query` (string)                             |
| `google_dork`     | OSINT dork pack + free enrichment | `query` (string)                             |
| `darkweb_search`  | Dark web search                   | `query` (string)                             |
| `onion_search`    | Find onion sites by keyword       | `query` (string), `limit` (number, optional) |
| `onion_render`    | Fetch an onion page over Tor      | `url` (string)                               |
| `username_search` | Username search                   | `username` (string)                          |
| `check_credits`   | Check remaining credits           | none                                         |

## Platform-specific setup

<Tabs>
  <Tab title="Claude Code">
    Add to `~/.claude/mcp.json`:

    ```json theme={"dark"}
    {
      "mcpServers": {
        "encrata": {
          "url": "https://encrata.com/mcp",
          "headers": {
            "Authorization": "Bearer enc_live_xxx..."
          }
        }
      }
    }
    ```
  </Tab>

  <Tab title="Cursor">
    Add to `.cursor/mcp.json` in your project:

    ```json theme={"dark"}
    {
      "mcpServers": {
        "encrata": {
          "url": "https://encrata.com/mcp",
          "headers": {
            "Authorization": "Bearer enc_live_xxx..."
          }
        }
      }
    }
    ```
  </Tab>

  <Tab title="Windsurf">
    Add to `~/.codeium/windsurf/mcp_config.json`:

    ```json theme={"dark"}
    {
      "mcpServers": {
        "encrata": {
          "url": "https://encrata.com/mcp",
          "headers": {
            "Authorization": "Bearer enc_live_xxx..."
          }
        }
      }
    }
    ```
  </Tab>
</Tabs>

## What you get

* **Native tool calls** - no HTTP boilerplate, no JSON parsing
* **Automatic discovery** - agent sees available tools without reading docs
* **Structured responses** - data comes back in the format your agent expects
* **Same credit system** - each tool call costs the same as the equivalent HTTP endpoint

## MCP vs HTTP

| Aspect           | MCP                           | HTTP                           |
| ---------------- | ----------------------------- | ------------------------------ |
| Setup            | Config file + API key         | API key only                   |
| Request format   | Tool call with named params   | HTTP POST with JSON body       |
| Response format  | Structured tool result        | JSON response body             |
| Auth             | Configured once in MCP config | Bearer header on every request |
| Platform support | MCP-capable agents only       | Any HTTP client                |
| Discovery        | Automatic (tool listing)      | Manual (read auth.md)          |

## Errors in MCP

MCP tool calls return errors as structured responses:

```json theme={"dark"}
{
  "error": "insufficient_credits",
  "message": "Not enough credits. Current balance: 0",
  "credits_remaining": 0
}
```

The agent handles these the same way as HTTP errors. Check credits, retry on rate limits, alert user on auth failures.
