# Authentication

> How agents sign in to the Deeper Research MCP server with OAuth or an API key, and what each can do.

Source: https://deeperesearch.com/docs/mcp/authentication/

Every request to `/mcp` needs a bearer token in the `Authorization` header. It’s either an OAuth access token, which your client gets when you sign in, or a Deeper Research API key.

|                   | OAuth sign-in                                          | API key                                                                                |
| ----------------- | ------------------------------------------------------ | -------------------------------------------------------------------------------------- |
| Best for          | Interactive agents in your editor                      | CI, scripts, clients without sign-in support                                           |
| How you set it up | The client opens your browser; you sign in and approve | Create a key in [Settings → API keys](https://deeperesearch.com/app/settings/api-keys) |
| Token format      | Issued by the sign-in server                           | Starts with `dr_live_`                                                                 |
| Access            | Read and start research                                | Read and start research                                                                |
| Default limits    | $5 per research, $10 a month                           | $5 per research, $25 a month                                                           |

## How sign-in works

The server follows the MCP authorization spec, so clients that support it handle sign-in for you:

1. The client calls `/mcp` without a token. The server answers `401 Unauthorized` with a `WWW-Authenticate` header whose `resource_metadata` points to `https://deeperesearch.com/.well-known/oauth-protected-resource/mcp`.
2. That metadata ([RFC 9728](https://www.rfc-editor.org/rfc/rfc9728)) names the authorization server. The client opens it in your browser.
3. You sign in with your Deeper Research account, choose this agent’s spending limits, and approve.
4. The client receives an access token and sends it on every request.

If you haven’t finished setting up your account yet, the server answers `403` with `onboarding_required`. Open [deeperesearch.com](https://deeperesearch.com/) once to finish setup, then reconnect.

## API keys

Create a key in [Settings → API keys](https://deeperesearch.com/app/settings/api-keys) and send it as:

```txt
Authorization: Bearer dr_live_...
```

Access is checked per tool with two scopes:

| Scope            | Allows                                                                                                             |
| ---------------- | ------------------------------------------------------------------------------------------------------------------ |
| `research:read`  | `search_research`, `list_providers`, `estimate_research`, `wait_for_research`, `get_report`, and reading resources |
| `research:write` | `start_research`, `attach_file`, `cancel_research`, `merge_research`                                               |

Keys created in Settings and agents that sign in with OAuth get both scopes. A tool called without the scope it needs returns a `forbidden` error.

Caution

Treat an API key like a password. Keep it in an environment variable or your client’s secret storage, not in a config file you might commit. The server refuses attached files that contain a Deeper Research key, but it can’t protect a key you’ve published elsewhere.

## Connections and revoking access

Each OAuth sign-in and each API key becomes a **connection** in [Settings → Connections](https://deeperesearch.com/app/settings/connections). There you can see what each agent has spent, change its limits, or disconnect it. A disconnected agent gets `401` with a message asking you to sign in again.

Research an agent starts is marked in the app with the agent that started it.

## Rate limits

Requests to `/mcp` share your organization’s per-minute request limit with the Deeper Research API, so an agent can’t get around it by switching to MCP. Over the limit, the server answers `429` with a `Retry-After` header in seconds.
