> ## 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.

# Connect Claude Code to AiLunaPro (MCP)

> Connect Claude Code to the AiLunaPro MCP server with one claude mcp add command, check the connection and ask your first audit question.

Claude Code connects to AiLunaPro over HTTP with your MCP key in the `Authorization` header.

## Prerequisites

* MCP access for your organisation and the **owner** role (see [Before you start](https://developers.ailunapro.com/developers/index.md#before-you-start)).
* An MCP key from **Settings → Organization → AI client access (MCP) → Create key**.
* Claude Code installed and signed in. Check:

  ```bash theme={null}
  claude --version
  ```

## Set up

**1. Put your key in an environment variable**

> [tab] Windows (PowerShell)
>
> ```powershell theme={null}
> $env:AILUNAPRO_MCP_KEY = Read-Host -Prompt 'Paste your AiLunaPro MCP key'
> ```

> [tab] macOS / Linux
>
> ```bash theme={null}
> read -s -p "Paste your AiLunaPro MCP key: " AILUNAPRO_MCP_KEY && export AILUNAPRO_MCP_KEY && echo
> ```

**2. Add the server**

Choose the scope that fits you:

* **local** (default): this project only, for you.
* **user**: every project on this machine, for you.

> [tab] Windows (PowerShell)
>
> ```powershell theme={null}
> claude mcp add --transport http --scope user ailunapro https://api.ailunapro.com/mcp --header "Authorization: Bearer $env:AILUNAPRO_MCP_KEY"
> ```

> [tab] macOS / Linux
>
> ```bash theme={null}
> claude mcp add --transport http --scope user ailunapro https://api.ailunapro.com/mcp --header "Authorization: Bearer $AILUNAPRO_MCP_KEY"
> ```

Expected output:

```text theme={null}
Added HTTP MCP server ailunapro with URL: https://api.ailunapro.com/mcp to user config
```

> [!NOTE]
>
> Your shell expands the variable before Claude Code saves it, so the key is stored in Claude Code's own configuration on this machine. Do not use this command to configure a shared project; use the project file below instead.

**3. Check the connection**

```bash theme={null}
claude mcp list
```

Expected:

```text theme={null}
ailunapro: https://api.ailunapro.com/mcp (HTTP) - ✓ Connected
```

Inside a Claude Code session, run `/mcp` to see the three AiLunaPro tools.

![Claude Code /mcp view listing the ailunapro server and its three tools](https://mintlify.s3.us-west-1.amazonaws.com/ailunapro-mcp/images/mcp/claude-code-mcp-light.png)

**4. Ask a question**

Start with a test that needs no audit:

```text theme={null}
Use the AiLunaPro docs search to tell me how to share a report with stakeholders.
```

The client runs `docs_search_product` and quotes AiLunaPro's product help about reports. If you see that answer, the connection works.

Then ask about your own audit:

```text theme={null}
Use AiLunaPro to summarise my latest audit result for my leadership team.
```

Approve the `summary_draft_from_result` tool call when Claude Code asks.

> [!NOTE]
>
> "No matching audit was found for your account" means your organisation has no completed Audit Express yet. Complete one in AiLunaPro, then ask again.

## Share the setup with a project team

To commit the server to a repository without committing a key, add a `.mcp.json` file at the project root. Each teammate sets their own `AILUNAPRO_MCP_KEY` variable.

```json .mcp.json theme={null}
{
  "mcpServers": {
    "ailunapro": {
      "type": "http",
      "url": "https://api.ailunapro.com/mcp",
      "headers": {
        "Authorization": "Bearer ${AILUNAPRO_MCP_KEY}"
      }
    }
  }
}
```

> [!WARNING]
>
> Keep `"type": "http"`. Claude Code treats an entry with a `url` but no `type` as a configuration error and skips it.

## Remove or replace the key

```bash theme={null}
claude mcp remove ailunapro
```

Then repeat **Set up** with a new key. Revoke the old key in AiLunaPro: [Manage keys](https://developers.ailunapro.com/developers/security/manage-keys.md).

## Troubleshooting

> [accordion] claude mcp list shows Failed to connect
>
> Run the request yourself to see the status code:
>
> ```bash theme={null}
> curl -s -o /dev/null -w "%{http_code}\n" -X POST https://api.ailunapro.com/mcp -H "Authorization: Bearer $AILUNAPRO_MCP_KEY" -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1,"method":"ping"}'
> ```
>
> * `200`: the key works; restart Claude Code.
> * `401`: the key is missing, mistyped or revoked. Create a new key.
> * `404`: MCP is not enabled for your organisation. Contact support.

> [accordion] The variable was empty when I ran claude mcp add
>
> The header was saved as `Bearer ` with no key. Run `claude mcp remove ailunapro`, set the variable again in the same terminal window, then add the server again.

> [accordion] Claude Code connects but says no matching audit was found
>
> Your account has no completed Audit Express, or the `draftId` you gave belongs to someone else. Complete an Audit Express in AiLunaPro first.

More cases: [Troubleshooting](https://developers.ailunapro.com/developers/troubleshooting.md).


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