# MCP server

> Connect Claude, ChatGPT, Cursor, VS Code or Codex to your workspace. The AI app signs in as you and asks before it publishes.

The MCP server lets an AI app read and edit your Lefine content. The address is the same for every app:

```text
https://dash.lefine.ai/v1/mcp
```

Every app signs in on a Lefine page. There is no key to copy.

1. The app opens a **Lefine page**.
2. **Pick the workspace** and click **Approve**.
3. The app now acts as you, with the access you approved.

You can also set it up in the dashboard: **Settings → AI apps** has the same steps, with buttons.

## Claude

### Claude on desktop and the web

1. Open **Customize**, then **Connectors**. Click **Add**, then **Add custom connector**.
2. Fill in the two fields and click **Continue**:
   - **Name**: `Lefine`
   - **MCP server URL**: `https://dash.lefine.ai/v1/mcp`
3. Keep the sign-in settings Claude detected. Click **Continue** again, then click **Add**.
4. If Claude does not open it for you, click **Connect**. On the Lefine page, pick the workspace and click **Approve**.

On a Team or Enterprise plan, an owner first goes to **Organization settings**, **Connectors**, **Add**, **Custom**, **Web**. Each member then clicks **Connect** under **Customize**, **Connectors**.

### Claude Code

Run this in a terminal. It adds Lefine for every folder:

```bash
claude mcp add --transport http --scope user lefine https://dash.lefine.ai/v1/mcp
```

Open Claude Code, type `/mcp`, pick **lefine** and sign in.

## ChatGPT

### ChatGPT

ChatGPT on the web only. On Business, Enterprise and Edu, an admin or owner creates it.

1. Go to chatgpt.com/plugins. Click the plus, then **Add custom MCP server**.
2. Fill in the two fields. Under **Authentication**, choose **OAuth**.
   - **Name**: `Lefine`
   - **Server URL**: `https://dash.lefine.ai/v1/mcp`
3. Tick **I understand and want to continue**, then click **Create as a plugin**.
4. Click **Install**. In a chat, type `@` and pick **Lefine**. A Lefine page opens to sign in.

## Cursor

### Cursor

One click. Cursor asks you to confirm.

[Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=Lefine&config=eyJ1cmwiOiJodHRwczovL2Rhc2gubGVmaW5lLmFpL3YxL21jcCJ9)

Then open Cursor's MCP settings and click **Connect** to sign in to Lefine.

Nothing happened? Cursor may not be installed, or your browser blocked the link. Add the address above by hand in the MCP settings.

## VS Code

### VS Code

One click. VS Code asks you to confirm, then you sign in to Lefine.

[Install in VS Code](vscode:mcp/install?%7B%22name%22%3A%22Lefine%22%2C%22url%22%3A%22https%3A%2F%2Fdash.lefine.ai%2Fv1%2Fmcp%22%7D)

Link blocked? [Use the web version](https://vscode.dev/redirect/mcp/install?name=lefine&config=%7B%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fdash.lefine.ai%2Fv1%2Fmcp%22%7D).

## Codex

### Codex

Run these in a terminal. The first adds Lefine. The second signs you in.

```bash
codex mcp add lefine --url https://dash.lefine.ai/v1/mcp
codex mcp login lefine
```

## Other apps

### Any other app

This finds your AI apps and sets them up:

```bash
npx lefine setup
```

Or paste the address into the app's MCP settings:

```text
https://dash.lefine.ai/v1/mcp
```

To run the MCP server on your own computer instead:

```bash
npx @lefine/mcp@next
```

Restart your AI app to get new versions.

An app that cannot sign in at all needs a key. In **Settings → AI apps**, click **Make a key for an AI app**. The key acts as you, with the access you pick. Add it to the app as `--header "Authorization: Bearer <key>"`.

## Before you approve

Approving gives the AI the same access as your account, at the level you choose. Check the app's name on the Lefine page. Do not paste text you do not trust into the chat.

## Ask before it publishes

An AI app can only publish if an owner or admin allows it. Other members go up to changing texts.

A publish asks you first, in the app or with a Lefine link. In **Settings → AI apps**, under **Connected AI apps**, a switch per app sets whether it asks. These always ask, whatever the switch says: permanent deletes, emails, access changes, connected apps and renders.

Revoke an app there too. Its next call fails.

## Read-only

Turn on **Read-only** in **Settings → AI apps**. The address then ends in `?level=read`, and the Lefine page offers Read and nothing more:

```text
https://dash.lefine.ai/v1/mcp?level=read
```

## Tools

| Tool | What it does |
|---|---|
| `lefine_context` | who the key is, which modules are on, what it may do. Call it first. |
| `lefine_find` | search the actions you can run |
| `lefine_read` | run an action that only reads |
| `lefine_write` | run an action that writes drafts or settings; nothing goes live |
| `lefine_publish` | run an action that goes live or spends money, after a person approves |
| `lefine_lookup` | find a page, key, media file, app, project, type or global by name |
| `lefine_edit` | change fields of one page, global or key as a draft |
| `lefine_launch` | take the workspace into a new market in one run, for example "launch in Japanese" |
| `lefine_launch_status` | read a launch: its steps, its diff, and whether it waits for you |

Every action behind these tools is in the [MCP tool reference](https://lefine.ai/en/docs/reference/mcp-tools/).

## Two more tools for coding agents

The local server for developers (`npx lefine mcp`) passes every tool above through to Lefine. It adds two for coding agents that add texts to your code. It signs in with `npx lefine login`, or with a key in `LEFINE_TOKEN`.

| Tool | When the agent uses it |
|---|---|
| `lefine_find_similar_key` | Always first. Give `appId` (`app_…`, from `lefine.ts`) and the text, the key name, or both. Returns up to 10 keys, closest first |
| `lefine_add_key` | Only when nothing fits. Adds one key with its source text |

`lefine_find_similar_key` answers with the keys to reuse:

```json
[
 { "namespace": "pricing", "key": "cta", "sourceText": "Start free trial", "score": 0.92 }
]
```

or `No similar key. A new one is fine.`

`lefine_add_key` refuses, and says why, when:

- the key exists in any namespace: "The key already exists: … Edit its text in Lefine instead of adding it again.";
- a key with the same text exists: "This text already has a key: pricing.cta. Use it in code." (pass `reuse: false` only after checking the meaning differs);
- the namespace does not exist (pass `newNamespace: true` only when a new one is meant);
- the text is not valid ICU.

On success: `Added pricing.hint. It is not live until someone publishes in Lefine. Run npx lefine strings types so the editor knows it.` The key ships with the next publish, which a person approves.

Source: https://lefine.ai/en/docs/mcp/
