# Connect an AI assistant

> Register Liminalia's MCP server with Claude Desktop, Claude Code or Codex, check that it's connected, and send your first request

Liminalia comes with an MCP server (`lim mcp`) for AI assistants. MCP (Model Context Protocol) is a way to connect outside tools to an AI assistant. Once it's registered, you can just ask for a visual novel, and the assistant will create the project, write the scenario, run the syntax check and confirm the result with screenshots.

You can connect Claude Desktop, Claude Code and Codex. If you use the desktop version of Studio, you can register from the menu. If you use the `lim` command line, you write the settings by hand.

## Connect from the desktop version of Studio

The desktop version of Studio can register the server from its menu. You don't need Node.js or npm.

1. From the Help menu, choose Connect an AI Assistant….
2. Choose the assistant to connect: Claude Desktop, Claude Code or Codex.
3. Choose the folder where the AI may create and edit projects, and press Use This Folder. At first, `Liminalia` in your Documents folder is selected.
4. When Connected appears, quit the assistant you chose and start it again.

Depending on the assistant you choose, it's registered as follows.

| Assistant | How it's registered |
|---|---|
| Claude Desktop | Adds `liminalia` to `mcpServers` in `claude_desktop_config.json`. Settings for other servers are kept, and the previous contents are saved next to it with `.bak` added to the name |
| Claude Code | Runs `claude mcp add-json --scope user liminalia …`. The `claude` command must be installed |
| Codex | Rewrites the `[mcp_servers.liminalia]` section of `~/.codex/config.toml` (or `config.toml` in the folder set by the `CODEX_HOME` environment variable, if there is one). Other sections are kept |

The registered MCP server runs on the engine inside the desktop version of Studio.

## Connect by writing the settings by hand

If you have the `lim` command line installed, add `lim mcp` to the assistant's settings. How to install `lim` is described in [Start with the command line](/en/docs/start/) (distribution is in preparation). Pass `--root` the folder where the AI may create, read and write projects. If you leave it out, it's `~/Liminalia`.

### Claude Code

Run this command in a terminal.

```bash
claude mcp add --scope user liminalia -- lim mcp --root ~/Liminalia
```

With `--scope user`, you can use it whichever folder you start Claude Code in. Without it, you can use it only in the project in the current folder.

### Claude Desktop

Add it to `mcpServers` in the settings file `claude_desktop_config.json`. You can open the file with Edit Config under Developer in Claude Desktop's settings.

| OS | Where the settings file is |
|---|---|
| Mac | `~/Library/Application Support/Claude/claude_desktop_config.json` |
| Windows | `%APPDATA%\Claude\claude_desktop_config.json` |

```json
{
  "mcpServers": {
    "liminalia": {
      "command": "lim",
      "args": ["mcp", "--root", "~/Liminalia"]
    }
  }
}
```

If other MCP servers are already listed, add just the `liminalia` entry inside `mcpServers`. After saving, quit Claude Desktop and start it again.

### Codex

Run this command in a terminal.

```bash
codex mcp add liminalia -- lim mcp --root ~/Liminalia
```

You can also write it directly in `~/.codex/config.toml`. The Codex CLI, the IDE extension and the ChatGPT desktop app share this setting.

```toml
[mcp_servers.liminalia]
command = "lim"
args = ["mcp", "--root", "~/Liminalia"]
tool_timeout_sec = 600
```

By default, Codex waits only 60 seconds for a tool to finish. Exporting (`build`) can take a few minutes, so set a longer wait with `tool_timeout_sec`. If you registered with `codex mcp add`, you can add this line afterward too.

### If lim isn't found

Some assistants start servers with a different `PATH` from your terminal, so they can't find `lim` and fail to connect. In that case, write the absolute path of `lim` in `command`. Run `which lim` in a terminal to see the absolute path.

## Check that it's connected

| Assistant | How to check |
|---|---|
| Claude Code | Run `claude mcp list` in a terminal. If `liminalia` shows `✔ Connected`, it's connected. While Claude Code is running, you can also check with `/mcp` |
| Claude Desktop | Open Manage connectors under Connectors from the button at the bottom left of the input box (Add files, connectors, and more). If `liminalia` is in the list, it's connected |
| Codex | `liminalia` appears in the list from `codex mcp list`. While Codex is running, `/mcp` shows the MCP servers you can use |

If Claude Desktop doesn't connect, look at the logs. They're in `~/Library/Logs/Claude/` on Mac and `%APPDATA%\Claude\logs\` on Windows, and `mcp-server-liminalia.log` holds the output of Liminalia's MCP server.

## Examples of a first request

Once it's connected, ask in your own words. The assistant follows the guidance it receives when it connects, and reads the writing guide with `scenario_guide` before writing a scenario for the first time. The names in parentheses are the tools the assistant uses for each request.

- “Use Liminalia to create a project with the sample story, titled ‘Waiting for Stars’. When it's ready, show me a screenshot of the title screen.” (`create_project`, `screenshot`)
- “At the start of the story, add a short scene where the main character hears about the meteor shower on the morning radio. After writing it, run the syntax check and take a screenshot of the scene.” (`scenario_guide`, `write_scenario`, `check`, `screenshot`)
- “Explain how the scenes in this project connect. Tell me if any lines are never reached.” (`story_map`, `coverage`)
- “Show the number of characters of dialogue for each speaker, and show possible spelling variants too.” (`text_stats`)
- “Change the theme to Washi and check the look on the title screen.” (`set_theme`, `screenshot`)
- “I want to fix things myself, so open it in Studio.” (`open_studio`)

You can also ask while the project is open in Studio. Lines edited in Studio after the assistant read the scenario aren't overwritten. Screenshots are taken in the open Studio too.

A record of actually calling these tools is in [An example of building with AI](/en/howto/ai-flow/). For the list of tools, see [Using Liminalia from AI assistants (MCP)](/en/docs/mcp/).

## Where the AI can read and write

The AI can read and write only inside the folders passed with `--root`. When you connect from the desktop version of Studio, it's only inside the folder you chose there. To pass several folders, repeat `--root`, or list them in the `LIMINALIA_MCP_ROOTS` environment variable.

Reading and writing scenarios is limited to `.lim` files in the project's scenario folder (`scenario/` by default). The contents before each rewrite are kept in `.liminalia/history/`, and you can restore them from Change history in Studio.
