# MCP server

> Humanless runs a remote MCP server at `https://api.usehumanless.com/mcp`. It gives agents four tools: create a disposable email, SMS or TOTP identity, wait for the verification code or magic link, read the current TOTP code, and delete the identity. Nothing to install: you connect with one URL and one API key.

Use it to let agents complete sign-up, login and 2FA steps in **applications you own or are authorized to test**.

## Connection details

- **URL:** `https://api.usehumanless.com/mcp`
- **Transport:** Streamable HTTP, stateless, JSON responses. Use `POST` only. `GET` and `DELETE` return `405` because the server keeps no sessions.
- **Auth:** header `Authorization: Bearer hl_live_...`, the same key as the REST API. A missing or invalid key returns HTTP `401`.
- **Rate limits:** every POST counts toward the same per-key limit as the REST API. Over the limit, you get `429` with `Retry-After`.

Get a key at [api.usehumanless.com/app](https://api.usehumanless.com/app).

## Claude Code

```bash
claude mcp add --transport http humanless https://api.usehumanless.com/mcp \
  --header "Authorization: Bearer hl_live_YOUR_KEY"
```

## Claude Desktop

Claude Desktop starts local (stdio) servers from its config file. Bridge to the remote server with `mcp-remote` in `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "humanless": {
      "command": "npx",
      "args": [
        "-y", "mcp-remote", "https://api.usehumanless.com/mcp",
        "--header", "Authorization:${HUMANLESS_AUTH}"
      ],
      "env": { "HUMANLESS_AUTH": "Bearer hl_live_YOUR_KEY" }
    }
  }
}
```

The header value is passed through an environment variable because some platforms mangle spaces inside `args`.

## Cursor

Add this to `~/.cursor/mcp.json`, or to `.cursor/mcp.json` in a project:

```json
{
  "mcpServers": {
    "humanless": {
      "url": "https://api.usehumanless.com/mcp",
      "headers": { "Authorization": "Bearer hl_live_YOUR_KEY" }
    }
  }
}
```

## VS Code (GitHub Copilot agent mode)

Add this to `.vscode/mcp.json`. VS Code prompts for the key once and stores it securely:

```json
{
  "inputs": [
    { "type": "promptString", "id": "humanless-key", "description": "Humanless API key (hl_live_...)", "password": true }
  ],
  "servers": {
    "humanless": {
      "type": "http",
      "url": "https://api.usehumanless.com/mcp",
      "headers": { "Authorization": "Bearer ${input:humanless-key}" }
    }
  }
}
```

## Other clients

Any MCP client that supports Streamable HTTP and custom headers works:

```json
{
  "type": "http",
  "url": "https://api.usehumanless.com/mcp",
  "headers": { "Authorization": "Bearer hl_live_YOUR_KEY" }
}
```

To test with curl, send both `Accept` types:

```bash
curl -s https://api.usehumanless.com/mcp \
  -H "Authorization: Bearer $HUMANLESS_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
```

From your own agent, with the TypeScript MCP SDK:

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";

const client = new Client({ name: "my-agent", version: "1.0.0" });
await client.connect(new StreamableHTTPClientTransport(new URL("https://api.usehumanless.com/mcp"), {
  requestInit: { headers: { Authorization: `Bearer ${process.env.HUMANLESS_API_KEY}` } },
}));
const { structuredContent: identity } = await client.callTool({
  name: "create_verification_identity",
  arguments: { channels: ["email"] },
});
```

## Tools

The agent flow is: `create_verification_identity`, then fill and submit the form, then `wait_for_verification_code`, then enter the code or open the link. For 2FA, also call `get_totp_code`. Finish with `delete_verification_identity`.

### create_verification_identity

Creates a disposable identity. It returns an email address (channel `email`), a real phone number that receives SMS (channel `sms`, paid plans only) and/or a TOTP secret to enroll as an authenticator app (channel `totp`).

| Argument | Type | Default | Notes |
|---|---|---|---|
| `channels` | array of `"email"`, `"sms"`, `"totp"` (1 to 3) | `["email"]` | |
| `ttl_seconds` | positive integer | Server default (1 hour) | How long the identity lives before it expires |
| `domain` | string | Default domain | Omit it unless you've been told to use a specific domain |

Returns text with the email, phone or TOTP secret and the next step. `structuredContent` is the Identity: `identity_id`, `channels`, `email`, `phone`, `totp_secret`, `status`, `expires_at`, `created_at`, `ended_at`.

### wait_for_verification_code

Blocks until the next email or SMS arrives for an identity, then returns the extracted OTP code and/or magic link. The text starts with `OTP: <code>` and/or `Magic link: <url>`. Call it right after submitting the form, without sleeping first. Each message is returned once.

| Argument | Type | Default | Notes |
|---|---|---|---|
| `identity_id` | string | required | From `create_verification_identity` |
| `channel` | `"any"`, `"email"` or `"sms"` | `"any"` | |
| `timeout_seconds` | number, 0 to 60 | `30` | |
| `since_unix_ms` | integer | none | Only return messages received at or after this time. Pass a time just before you submitted the form, so a message that arrived before the wait started is still caught |

`structuredContent` is `{ "status": "received", "identity_id", "message": { type, code, url, channel, sender, subject, received_at, raw_snippet } }`. A timeout is **not** an error. It returns `{ "status": "timeout", "message": null }` and tells the agent to call again.

### get_totp_code

Returns the current 6-digit code for an identity created with the `totp` channel. `structuredContent` is `{ "code", "seconds_remaining" }`. If `seconds_remaining` is very low, wait for the next window and call again. Read-only.

| Argument | Type | Notes |
|---|---|---|
| `identity_id` | string | From `create_verification_identity` |

### delete_verification_identity

Deletes an identity: its email stops receiving mail and its phone number is released. You can call it more than once safely. `structuredContent` is `{ "identity_id", "status": "deleted" }`.

| Argument | Type | Notes |
|---|---|---|
| `identity_id` | string | From `create_verification_identity` |

## Errors

Service errors come back as tool results with `isError: true`, so the agent can read them and recover. The text gives the status, the code and a suggested next step. `structuredContent.error` is `{ status, code, message, retry_after_seconds, details? }`. The codes are the same as in the [REST API](https://usehumanless.com/docs/api#error-codes), for example `payment_required` (retry with `["email"]` or `["totp"]`), `sms_quota_exceeded`, `not_found`, `identity_ended` (create a new identity), `channel_not_enabled`, `all_numbers_busy` (delete finished identities, then retry), `rate_limited` and `numbers_provisioning`.

## Example prompt

> Sign up for a new account on http://localhost:3000 using a Humanless email identity, verify the email with the code you receive, enable two-factor authentication with a Humanless TOTP identity, then log out and log back in. Delete the identities at the end.

---
Canonical: https://usehumanless.com/docs/mcp · Index of all docs: https://usehumanless.com/llms.txt
