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

> ## Agent Instructions
> Mono is an AI platform for small and medium-sized firms in Switzerland, Germany, Austria and Italy. Answer in the reader's language. Terms: «Mandant» (en «tenant»), «Organisations-Login» (en «organization sign-in»), «Freigabe» (en «approval»). Reading needs no approval; every write waits for one. Never suggest pasting a key or token into a chat.

# Run Mono from the source code

> Start a Node, the Console and the desktop app locally, and check your change with the same tests as the CI.

You start a Node (The tenant’s server. It holds the data, checks permissions and carries out every approval.) with the demo world of Muster AG, connect the Console to it and run the checks every change must pass.

> [accordion] What you need
>
> * **Node.js 22**, at least 22.18: the Node and the packages run directly as TypeScript (type stripping), without a build. The file `.nvmrc` names the version.
> * **pnpm 9.12**, through Corepack, which comes with Node.js.
> * **Git** and a clone of the repository.
> * **For the desktop app:** Rust (stable) and the Tauri 2 prerequisites for your system.
> * **For the model worker** (optional): Python 3.12 and uv.
> * **For the examples on these pages:** `curl` and `jq`.

```bash macOS and Linux theme={"system"}
nvm install          # reads .nvmrc
corepack enable      # provides pnpm in the version from package.json
node --version       # v22.18 or newer
```

```powershell Windows theme={"system"}
nvm install 22       # nvm-windows
nvm use 22
corepack enable
node --version       # v22.18 or newer
```

## Start

**1. Install the dependencies**

```bash theme={"system"}
pnpm install
```

**2. Start the development Node**

```bash theme={"system"}
pnpm dev:gateway
```

The Node listens on `http://localhost:8787`, with sign-in through development tokens and the servers “Muster AG” (`/muster-gateway/mcp`) and “Mono Admin” (`/admin-mono/mcp`). It restarts when the code changes.

At its first start, the development Node writes the file `services/gateway/.mono/dev-tokens.json`. It holds one token per demo person (Anna Keller and Marco Rossi as admins, Lea Meier as a member) and per audience (`console`, `admin-mono`, `muster-gateway`). The Node never prints the tokens in the log.

```bash macOS and Linux theme={"system"}
# Anna Keller (admin), audience "console"
TOKEN=$(jq -r 'to_entries[]
  | select(.value.audience == "console" and .value.user.id == "u-anna")
  | .key' services/gateway/.mono/dev-tokens.json)
```

```powershell Windows theme={"system"}
# Anna Keller (admin), audience "console"
$tokens = Get-Content services/gateway/.mono/dev-tokens.json | ConvertFrom-Json
$TOKEN = ($tokens.PSObject.Properties |
  Where-Object { $_.Value.audience -eq "console" -and $_.Value.user.id -eq "u-anna" } |
  Select-Object -First 1).Name
```

For the tenant server, replace `console` with `muster-gateway`; for “Mono Admin”, with `admin-mono`. The person ids are `u-anna`, `u-marco` and `u-lea`.

**3. Start the Console in the browser**

```bash theme={"system"}
pnpm dev
```

The Console opens at `http://localhost:5173`. Without a configuration it shows the demo, with no Node at all.

**4. Connect the Console to the local Node**

Create the file `apps/console/public/config.json`. It is not checked in.

```json apps/console/public/config.json theme={"system"}
{
  "mode": "nodes",
  "mandanten": [
    {
      "id": "muster-ag",
      "name": "Muster AG",
      "node": "http://localhost:8787",
      "auth": { "kind": "dev" }
    }
  ]
}
```

Reload the Console. Under “Development token”, paste a token with the audience `console` and choose “Sign in with token”.

**5. Start the same Console in the desktop app**

```bash theme={"system"}
pnpm dev:desktop
```

The desktop app is part of every stage. A change to the Console is done only when the desktop app builds as well and its smoke test passes.

> [!TIP]
>
> The Console shows Muster AG’s “Overview” with the local Node’s data. The Inbox, “Gateway” and the audit now read from the Node.

> [accordion] Which settings does the development Node take?
>
> | Variable | Default | Effect |
> | - | - | - |
> | `MONO_PORT` | `8787` | the Node’s port |
> | `MONO_PUBLIC_URL` | `http://localhost:8787` | the address by which the Node names itself (OAuth, MCP, discovery) |
> | `MONO_DATA_DIR` | `.mono` | folder for tokens, audit, keys and state |
> | `MONO_STATE` | `memory` | `file` keeps the state in `.mono/state.json` across restarts |
> | `MONO_CONSOLE_ORIGINS` | `http://localhost:5173` | origins that may reach the Console API by CORS |
> | `MONO_MODELS_LOCAL_URL` | none | an OpenAI-compatible model server, for example `http://10.20.0.9:8000/v1` |
>
> All variables with an explanation are in `deploy/node/.env.example`. The Node refuses development tokens as soon as `NODE_ENV=production` is set.

> [accordion] How do I connect an MCP client locally?
>
> Any MCP client that speaks Streamable HTTP with its own `Authorization: Bearer …` header, for example Claude Code, VS Code or Cursor, connects to `http://localhost:8787/admin-mono/mcp` with a token of the audience `admin-mono`. Claude, ChatGPT and Copilot on the web need a public HTTPS address; see [MCP servers](https://mono.mintlify.site/en/developers/mcp-servers.md).

> [accordion] Build the Node as one bundle
>
> ```bash theme={"system"}
> pnpm --filter @mono/gateway bundle
> ```
>
> esbuild writes the Node into one file (`dist/node.mjs`), without `node_modules` at runtime. The step fails if something pulls in the AWS SDK: the core has no dependency on AWS. Running it at the tenant is described in [Self-hosting](https://mono.mintlify.site/en/admins/self-hosting.md).

## Check and test

A change is done only when these checks are green. Tests are part of the change.

```bash Unit tests and rules theme={"system"}
pnpm check
# ADRs, boundary to the private paths, texts in five languages,
# lint, types and unit tests of all packages
```

```bash Node alone theme={"system"}
pnpm --filter @mono/gateway test
# MCP contract tests: a real MCP client against the real HTTP handler
```

```bash UI tests theme={"system"}
pnpm e2e
# Playwright: light and dark, 1440 × 900 and 390 px, interaction rules
SCREENSHOTS_DIR=$PWD/shots pnpm e2e   # also writes screenshots
```

```bash Desktop app theme={"system"}
pnpm e2e:desktop
# Rust tests, debug build and smoke test in every window size of the system
```

```bash UI audit theme={"system"}
pnpm audit:ui
# every route on every device of the device matrix, light and dark,
# with screenshots and contact sheets
AUDIT_DEVICES=iphone-se-3,ipad-mini,mac AUDIT_ROUTES=inbox pnpm audit:ui
```

> [accordion] What does the UI audit check?
>
> For every route on every device of the matrix (iPhone, iPad, Mac, Windows and Linux PC, Android, browser zoom 200 % and 400 %), it checks that the page never scrolls sideways, no text is clipped, touch targets measure 44 pt, focus is visible and axe finds no WCAG 2.2 AA violation. The contact sheets are then in `apps/console/audit-results/audit/`. Look at them before you report a UI change as done.

> [accordion] What does the desktop app need for its tests?
>
> * Once: `cargo install tauri-driver --locked`.
> * **Linux:** also `webkit2gtk-driver`; the test runs headless with `xvfb-run`.
> * **Windows:** also `msedgedriver` in the version of the installed Edge.
> * **macOS:** there is no WebDriver for WKWebView. `bash scripts/desktop-mac.sh` builds and opens the app for a manual check.

> [accordion] Test the Console against real test Nodes
>
> `node apps/console/test-nodes/serve.ts` starts the test Nodes of the e2e tests from port 8797. With a `config.json` pointing to `http://127.0.0.1:8797` and `"auth": { "kind": "dev" }`, `pnpm dev` then works against them. The test Nodes accept helper routes under `/__test/…` only on `127.0.0.1`.

## Check a whole installation

A topology file describes an installation with all its hosts, tenants, models and Mono Connectors. The command prints names, never the values of secrets.

```bash plan theme={"system"}
pnpm mono plan deploy/topologies/examples/1-one-box.json
# explains what runs where, and checks the rules
```

```bash render theme={"system"}
pnpm mono render deploy/topologies/examples/1-one-box.json --out ./out
# writes the settings files and steps per host
```

```bash doctor theme={"system"}
pnpm mono doctor deploy/topologies/examples/1-one-box.json
# checks the running operation, read-only
```

> [!TIP]
>
> With `--lang de`, `pnpm mono` speaks German. Without it, it takes `MONO_LANGUAGE`, then the system’s language, then English.

> [accordion] If something doesn’t work
>
> | Message | What helps |
> | - | - |
> | `Unknown file extension ".ts"` when starting `pnpm dev:gateway` or `pnpm mono` | Node.js is older than 22.18 and does not run TypeScript directly. Update Node.js. |
> | “The Node does not know this token. Is the audience “console” set?” | You pasted a token of another audience. Take one with `"audience": "console"`. |
> | “Development tokens only for a Node on this computer” | For `"auth": { "kind": "dev" }`, the `config.json` names a host other than `localhost` or `127.0.0.1`. |
> | The Console shows the demo instead of the Node | The Console finds no `config.json`. Check the path and the name (`apps/console/public/config.json`) and reload. A broken file never makes the Console fall back to the demo; it names where the error is. |
> | `{"error":"unauthorized","message":"Anmeldung nötig"}` | The `Authorization: Bearer …` header is missing. |
> | The tokens no longer fit after a restart | The Node created `.mono/dev-tokens.json` anew because the folder was deleted. Read the token again. |

## Next

> [card] [Node API](https://mono.mintlify.site/en/developers/node-api.md)
>
> First requests to `/api/v1`.

> [card] [MCP servers](https://mono.mintlify.site/en/developers/mcp-servers.md)
>
> Call tools locally.

> [card] [Contributing](https://mono.mintlify.site/en/developers/contributing.md)
>
> From the branch to the pull request.

> [card] [Architecture](https://mono.mintlify.site/en/developers/architecture.md)
>
> How the parts fit together.


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