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

# Connect an MCP client to a release

> Give an AI agent the blueprints of a deployed release as MCP tools, using the application's MCP address and an evaluation key.

Every deployed application answers the Model Context Protocol (MCP). Each callable blueprint is one tool. Use this when an AI agent or an MCP client, such as Claude Code, Claude Desktop or Cursor, should run your blueprints. The steps check the connection with the MCP Inspector first; the sections after them add the server to a client.

## Before you start

* The application is deployed and has an evaluation key ([Deploy a release and call it](https://docs.leapter.com/rc/user-guide/deploy-and-call.md), [Create and revoke an evaluation key](https://docs.leapter.com/rc/user-guide/evaluation-keys.md)).
* You can sign in to the Admin UI of the runtime cluster. Its address is the cluster address followed by `/runtime-management/ui/`, for example `https://cluster.example.com/runtime-management/ui/`.
* Node.js with `npx`, to check the connection with the MCP Inspector. The steps were run with MCP Inspector 2.12.0 and Claude Code 2.1.306.

## Check the connection

**1. Copy the MCP address**

Open the Admin UI, click **Sign in with Leapter** and sign in with the account you use for the Lab. The Admin UI may open on another environment: click the environment's name at the bottom of the sidebar and choose yours in the list that opens. Then click the application's name on the **Status** page. In the card **Connect to** with the application's name, click **Copy** next to **Standard endpoint**.

![The card Connect to pizza-pricing-calculator-180269. Under MCP, Standard endpoint is https://cluster.example.com/runtime/api/v1/playground/pizza-pricing-calculator-180269/mcp and its Copy button has a green ring. Below it is the Server-sent events endpoint ending in /mcp/sse.](https://mintcdn.com/leapter/3NthIZmfsFFgUhyn/rc/user-guide/images/admin-connect-mcp.png?fit=max\&auto=format\&n=3NthIZmfsFFgUhyn\&q=85\&s=a69ec5eea0c88014f7181fd0a484dc64)

The MCP addresses of the application.

**2. Store the address and the key**

Replace `<mcp-address>` with the address you copied, and `<your-evaluation-key>` with your key. Run the next steps in the same terminal, so that both variables are set:

```bash theme={null}
export MCP_ADDRESS='<mcp-address>'
export LEAPTER_EVALUATION_KEY='<your-evaluation-key>'
```

**3. List the tools**

Check the connection with the MCP Inspector, a command-line client for MCP servers. The key goes in the `X-API-Key` header. On the first run in a terminal, `npx` asks before it installs the Inspector: it prints `Need to install the following packages:`, the package name and `Ok to proceed? (y)`. Type `y` and press Enter.

```bash theme={null}
npx @modelcontextprotocol/inspector --cli "$MCP_ADDRESS" --transport http \
  --header "X-API-Key: $LEAPTER_EVALUATION_KEY" --method tools/list
```

You should see one tool per callable blueprint, with the blueprint's description and the schema of its inputs:

```json theme={null}
{
  "tools": [
    {
      "name": "pizza_pricing",
      "description": "Calculates the price of a pizza based on size, number of toppings, crust type,\nand the day of the week. The total is built up from a base price (determined\nby size), a per-topping charge, an upcharge for premium crusts, and a final\nday-of-week multiplier that rewards off-peak ordering and prices in peak nights.\nAll amounts are in USD.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "pizzaSize": {
            "type": "string",
            "description": "Size of the pizza (small, medium, or large)"
          },
          "toppings": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "Selected topping IDs (basic: tomato, onion, bell-pepper, mushroom, olive, sweet-corn; premium: bacon, prosciutto, mozzarella, shrimp)"
            }
          },
          "crustType": {
            "type": "string",
            "description": "Type of crust (thin, regular, or stuffed)"
          },
          "dayOfWeek": {
            "type": "string",
            "description": "Day the pizza is being ordered (monday through sunday, lowercase)"
          }
        },
        "required": [
          "pizzaSize",
          "toppings",
          "crustType",
          "dayOfWeek"
        ],
        "$schema": "http://json-schema.org/draft-07/schema#",
        "additionalProperties": false
      }
    }
  ]
}
```

**4. Call a tool**

```bash theme={null}
npx @modelcontextprotocol/inspector --cli "$MCP_ADDRESS" --transport http \
  --header "X-API-Key: $LEAPTER_EVALUATION_KEY" --method tools/call \
  --tool-name pizza_pricing --tool-arg pizzaSize=large \
  --tool-arg 'toppings=["mushroom","olive"]' --tool-arg crustType=thin \
  --tool-arg dayOfWeek=friday
```

The tool answers with the blueprint's outputs as text:

```json theme={null}
{
  "content": [
    {
      "type": "text",
      "text": "{\"basePrice\":16,\"crustUpcharge\":0,\"dayMultiplier\":1.1,\"subtotal\":19,\"toppingsCost\":3,\"totalPrice\":20.9,\"weeklyPrices\":[19,15.2,17.1,19,20.9,21.85,19]}"
    }
  ],
  "isError": false
}
```

Every MCP client needs the same two things as the MCP Inspector: the address, and the header `X-API-Key` with the key. The sections below show where they go in Claude Code, Claude Desktop, Cursor and other clients. When a client does not connect, run the step **List the tools** again with the address and the key from the client's settings: if the MCP Inspector lists the tools, the address and the key are right.

## Connect Claude Code

The commands use the two variables from the step **Store the address and the key**, so run them in the same terminal. Run them in the folder of the project that should use the server, here `~/pizza-shop`. Claude Code adds the server for this folder only (`Local config`):

```bash theme={null}
claude mcp add --transport http pizza-pricing "$MCP_ADDRESS" \
  --header "X-API-Key: $LEAPTER_EVALUATION_KEY"
```

```text theme={null}
Added HTTP MCP server pizza-pricing with URL: https://cluster.example.com/runtime/api/v1/playground/pizza-pricing-calculator-180269/mcp to local config
Headers: {
  "X-API-Key": "[REDACTED]"
}
File modified: ~/.claude.json [project: ~/pizza-shop]
```

Check that Claude Code reaches the server:

```bash theme={null}
claude mcp get pizza-pricing
```

```text theme={null}
pizza-pricing:
  Scope: Local config (private to you in this project)
  Status: ✔ Connected
  Type: http
  URL: https://cluster.example.com/runtime/api/v1/playground/pizza-pricing-calculator-180269/mcp
  Headers:
    X-API-Key: lk_dev_…

To remove this server, run: claude mcp remove pizza-pricing -s local
```

Claude Code prints the whole key here; it is shortened on this page. Do not share this output.

To remove the server from Claude Code again:

```bash theme={null}
claude mcp remove pizza-pricing -s local
```

```text theme={null}
Removed MCP server pizza-pricing from local config
File modified: ~/.claude.json [project: ~/pizza-shop]
```

## Connect Claude Desktop

Claude Desktop adds a server with an address as a custom connector. Its configuration file, `claude_desktop_config.json`, is for MCP servers that run on your own computer, so the runtime cluster does not go there. Claude's article [Get started with custom connectors using remote MCP](https://support.claude.com/en/articles/11175166-getting-started-with-custom-connectors-using-remote-mcp) describes custom connectors: they are available on the Free plan (one connector), Pro, Max, Team and Enterprise. The steps follow that article:

1. Go to **Customize** > **Connectors**, click **+ Add**, then **Add custom connector**. On a Team or Enterprise plan, an owner adds the connector in **Organization settings** > **Connectors** instead, and members then click **Connect** on it.
2. Enter a name, for example `pizza-pricing`, and the address of the **Standard endpoint** as the remote MCP server URL. Click **Continue**.
3. Claude shows the authentication settings it detected. Under **Authentication**, choose **No sign in**: calls to the runtime cluster need the key, not a sign-in.
4. Under **Request headers**, add the header `X-API-Key` with your evaluation key as its value. Click **Add**.
5. In a chat, click **+**, choose **Connectors** and switch the connector on. Claude can then use the tool `pizza_pricing` in that chat.

> [!WARNING]
>
> Claude connects to custom connectors from Anthropic's cloud, not from your computer. The runtime cluster's address must therefore be reachable from the internet. For a cluster in a private network, Claude's article says to allow [Anthropic's IP addresses](https://platform.claude.com/docs/en/api/ip-addresses) in your firewall. If you cannot do that, use Claude Code: it connects from your computer.

On a Team or Enterprise plan, everyone who uses the connector sends the same key. Give the connector its own key, so that you can revoke it without stopping other callers.

## Connect Cursor

Cursor reads MCP servers from a file called `mcp.json`: `~/.cursor/mcp.json` in your home folder for all your projects, or `.cursor/mcp.json` in one project's folder ([Cursor documentation: Model Context Protocol](https://cursor.com/docs/context/mcp)). Add the server with the MCP address as `url` and the key in `headers`. If the file already lists servers, add the entry `pizza-pricing` next to them inside `mcpServers`:

```json theme={null}
{
  "mcpServers": {
    "pizza-pricing": {
      "url": "https://cluster.example.com/runtime/api/v1/playground/pizza-pricing-calculator-180269/mcp",
      "headers": {
        "X-API-Key": "<your-evaluation-key>"
      }
    }
  }
}
```

The file then contains the key, so keep it out of Git. Cursor can also read the key from an environment variable: write `${env:LEAPTER_EVALUATION_KEY}` as the value, and set the variable in your shell profile or your system's environment, as Cursor's documentation says.

To switch the server on or off, open **Customize** in Cursor's sidebar. When Cursor does not show the tools, open the Output panel (Cmd+Shift+U on macOS) and choose **MCP Logs** in its list: it shows connection and authentication errors.

## Connect other MCP clients

Any MCP client that can send a header with its requests can connect. Give it:

* The **Standard endpoint** as the address. For a client that connects with server-sent events, use the **Server-sent events endpoint** from the same card instead. It ends in `/mcp/sse`.
* The header `X-API-Key` with your evaluation key.

To check the server-sent events endpoint with the MCP Inspector, run the command from the step **List the tools** with that address and `--transport sse`:

```bash theme={null}
npx @modelcontextprotocol/inspector --cli "$MCP_ADDRESS/sse" --transport sse \
  --header "X-API-Key: $LEAPTER_EVALUATION_KEY" --method tools/list
```

It prints the same list of tools as the step **List the tools**.

Look up where your client takes the address and the headers in its own documentation. A client that cannot send the header cannot connect: the cluster refuses its requests, and it tries to sign in with OAuth instead (see Troubleshooting).

## Result

Your MCP client lists the blueprint `pizza_pricing` as a tool and can run it. Each tool call is a run of the release, recorded like any other call ([Find a run and read usage](https://docs.leapter.com/rc/user-guide/runs-and-usage.md)).

## Troubleshooting

**After Sign in with Leapter, you are in the Lab and not in the Admin UI, or the Lab says "This sign-in cannot go on." and "authorization not found".** Open the Admin UI's address again and click **Sign in with Leapter** once more. The **Status** page opens.

**The MCP Inspector answers with an error about client registration or OAuth.** The `X-API-Key` header is missing, so the cluster refused the request, and the Inspector tried to sign in with OAuth instead. In a terminal, it prints:

```json theme={null}
{"error":{"code":"error","message":"Dynamic Client Registration rejected (HTTP 404): 404 page not found\n","status":404}}
```

In a script without a terminal, for example in CI, it prints:

```json theme={null}
{"error":{"code":"auth_required","message":"Interactive OAuth requires a TTY on stdin or stderr (or MCP_AUTO_OPEN_ENABLED=true). For CI/non-interactive runs use --stored-auth-only."}}
```

Add `--header "X-API-Key: $LEAPTER_EVALUATION_KEY"` and run the command again.

## What to do next

* [Create and revoke an evaluation key](https://docs.leapter.com/rc/user-guide/evaluation-keys.md): give each agent its own key.
* [Use your blueprints in an n8n AI agent](https://docs.leapter.com/rc/user-guide/n8n-mcp-agent.md): an n8n agent workflow uses the same MCP address.


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