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

# MCP authentication and keys

> How AiLunaPro MCP keys work: who can create them, what they can see, how to send them and what the error codes mean.

Every request to the AiLunaPro MCP server carries an **organisation MCP key** as a bearer token:

```http theme={null}
POST /mcp HTTP/1.1
Host: api.ailunapro.com
Authorization: Bearer alp_mcp_<43 characters>
Content-Type: application/json
```

## How keys work

| | |
| - | - |
| **Format** | `alp_mcp_` followed by 43 letters, digits, `-` or `_` |
| **Who can create keys** | Organisation **owners**, in **Settings → Organization → AI client access (MCP)** |
| **Who the key acts as** | The owner who created it, in that organisation |
| **What it can read** | That owner's own audits in that organisation, and product help |
| **What it cannot read** | Other members' audits, other organisations, billing, secrets |
| **Active keys per organisation** | 5 |
| **Shown** | Once, when created |
| **Stored by AiLunaPro** | A SHA-256 fingerprint only, never the key itself |
| **Expiry** | None. A key works until it is revoked |

The **AI client access (MCP)** card appears only when MCP is enabled for your organisation. To request access, contact [AiLunaPro support](https://developers.ailunapro.com/developers/support.md).

## Sending the key

All supported clients send the key in the `Authorization` header. The word `Bearer`, one space, then the key:

```text theme={null}
Authorization: Bearer alp_mcp_…
```

Keep the key in an environment variable or a password prompt rather than in a file:

| Client | Where the key lives |
| - | - |
| [VS Code](https://developers.ailunapro.com/developers/clients/vscode.md) | Password prompt, stored in VS Code secret storage |
| [Codex](https://developers.ailunapro.com/developers/clients/codex.md) | `AILUNAPRO_MCP_KEY` environment variable |
| [Cursor](https://developers.ailunapro.com/developers/clients/cursor.md) | `AILUNAPRO_MCP_KEY` environment variable |
| [Claude Code](https://developers.ailunapro.com/developers/clients/claude-code.md) | Claude Code configuration, or `${AILUNAPRO_MCP_KEY}` in `.mcp.json` |
| [Claude Desktop](https://developers.ailunapro.com/developers/clients/claude-desktop.md) | `claude_desktop_config.json` (plain text) |

## OAuth

AiLunaPro does not offer OAuth sign-in for MCP yet. Clients that connect **only** through OAuth cannot connect directly today:

* claude.ai custom connectors
* ChatGPT connectors
* Claude Desktop's **Settings → Connectors** screen (use the [`mcp-remote` bridge](https://developers.ailunapro.com/developers/clients/claude-desktop) instead)

The server never asks a client to start an OAuth sign-in: a `401` response has no `WWW-Authenticate` challenge.

## Authentication errors

| Response | Body | Meaning | What to do |
| - | - | - | - |
| `401` | `{"error":"Invalid or revoked MCP key","code":"UNAUTHORIZED"}` | Header missing, key mistyped, or key revoked | Check `Bearer ` and the variable; create a new key |
| `404` | `{"error":"Not found","code":"NOT_FOUND"}` | MCP is not enabled for your organisation | Contact support to request access |

All errors: [Errors](https://developers.ailunapro.com/developers/reference/errors.md).

## Good practice

> [!TIP]
>
> One key per person and per device. You can then revoke one without breaking the others.

> [!TIP]
>
> Name nothing after the key and paste it nowhere except your client's secret storage or environment.

> [!TIP]
>
> Revoke a key immediately if it appears in a log, a chat, a screenshot or a repository.

> [!TIP]
>
> Revoke keys of people who leave the organisation or change role.

Step-by-step: [Manage keys](https://developers.ailunapro.com/developers/security/manage-keys.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.