> For the complete documentation index, see [llms.txt](https://nasu-capital.gitbook.io/nasu-capital-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nasu-capital.gitbook.io/nasu-capital-docs/authentication.md).

# Authentication

Create an MCP key and choose between OAuth 2.0 and a bearer header.

### Two ways to connect

Different AI clients authenticate to remote MCP servers in different ways. Nasu Capital supports both:

| Method            | Used by                                                                                  | How it works                                                                                                                                                |
| ----------------- | ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **OAuth 2.0**     | Claude web/desktop "custom connectors", and any client that performs OAuth discovery     | The client discovers the OAuth endpoints, registers itself, and opens a consent screen where you paste your MCP key. The client stores the resulting token. |
| **Bearer header** | Claude Code, Cursor, VS Code, scripts, and any client that lets you set a request header | You put `Authorization: Bearer <key>` directly in the client's config.                                                                                      |

{% hint style="success" icon="key" %}
Both methods use the **same MCP key**. Pick whichever your client supports — if the client has a connection URL but no header field, use OAuth.
{% endhint %}

### Creating an MCP key

{% stepper %}
{% step %}

#### Sign in

Log in to the Nasu Capital admin dashboard at [lf.nasucapital.com](https://lf.nasucapital.com).
{% endstep %}

{% step %}

#### Open the MCP settings

Go to **Settings → MCP** (Model Context Protocol).
{% endstep %}

{% step %}

#### Create a key

Click **New MCP Key**.
{% endstep %}

{% step %}

#### Describe it and set an expiry

Enter a description (e.g. `"Alice — Claude workspace"`) and an expiry (default 365 days, max 3650).
{% endstep %}

{% step %}

#### Copy the key

Copy the key **immediately** — it is shown only once.
{% endstep %}
{% endstepper %}

{% hint style="warning" icon="shield-halved" %}
Keys are prefixed `nasu_` and stored as a **SHA-256 hash**; the platform never stores the raw value after creation. An MCP key grants fund-wide *read* access, so treat it like a password.
{% endhint %}

### Method A — OAuth 2.0 (web connectors)

When you add the server as a custom connector in Claude's web/desktop app, the OAuth flow runs automatically:

{% stepper %}
{% step %}

#### Discovery

The client fetches the server's OAuth metadata from `/.well-known/oauth-authorization-server` and `/.well-known/oauth-protected-resource`.
{% endstep %}

{% step %}

#### Registration

The client registers itself via `POST /oauth/register` (RFC 7591 Dynamic Client Registration). No client ID or secret is needed up front — **leave those fields blank**; the client obtains its own ID automatically.
{% endstep %}

{% step %}

#### Authorization

The client opens the Nasu Capital **consent screen**. You paste an MCP key (from Settings → MCP) and approve.
{% endstep %}

{% step %}

#### Token exchange

The client exchanges a single-use, PKCE-protected authorization code for an access token at `POST /oauth/token`.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
**What the token is.** The issued OAuth access token *is* your MCP key. So the client ends up holding exactly the same credential it would with the bearer-header method. Because you must already possess a valid key to pass the consent screen, OAuth here proves possession only — it grants no new access. Revoke at any time from Settings → MCP.
{% endhint %}

The flow uses **Authorization Code + PKCE (`S256`)** and **scope `mcp`**. Full endpoint details are in the [OAuth 2.0 reference](https://nasu-capital.gitbook.io/nasu-capital-docs/oauth-reference.md).

### Method B — Bearer header (config-based clients)

If your client lets you set a request header, skip OAuth entirely and pass the key directly on every request to `https://api-lf.nasucapital.com/mcp`:

{% code title="Request header" %}

```
Authorization: Bearer nasu_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

{% endcode %}

### Key lifecycle

| State                                                                                               | Behaviour                                            |
| --------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
| Active + not expired                                                                                | Admitted; `last_used_at` and `request_count` updated |
| Expired                                                                                             | Rejected with `invalid_credentials`                  |
| Revoked                                                                                             | Rejected with `invalid_credentials`                  |
| Bound to an archived, deactivated or deleted investor                                               | Rejected with `invalid_credentials`                  |
| Created by an account that is no longer an active admin (demoted, deactivated, archived or deleted) | Rejected with `invalid_credentials`                  |
| No header                                                                                           | Rejected with `missing_authorization`                |

{% hint style="info" icon="ban" %}
Revoke a key at any time from **Settings → MCP → Revoke**. Revoking a key immediately invalidates every connector and token derived from it.
{% endhint %}
