# Connect Codex to Niro

**One command connects Codex to Niro:**

```
niro mcp install --client codex

```

Then restart Codex, because it reads its settings only when it starts.

You must have run `niro start` first, so that you are signed in. See [Connect your coding agent to Niro](https://help.niroai.dev/cli/connect-your-ai-assistant/).

## What the install writes

- The connection, through Codex's own command (`codex mcp add niro ... -- niro mcp serve`), in `~/.codex/config.toml`. If you set `CODEX_HOME`, that folder is used instead of `~/.codex`.

- `default_tools_approval_mode = "writes"`, so Codex asks you only before a tool that writes. Niro's tools only read.

## How Codex learns to use Niro

- A section in `~/.codex/AGENTS.md`.

- The two skills, in `~/.agents/skills/niro-skill` and `~/.agents/skills/niro-local`.

## Check that it works

Ask it a question about your code, such as "which routes does this project serve?". An answer from Niro starts with "Answered from the local graph on this machine (niro-local)."

## Things to know

- If the Codex command is missing, the install says "Failed to register MCP server. Is the Codex CLI installed?".

- Codex reads `AGENTS.md` once, when a session starts. On a long task it may drift back to searching files.

## Remove it

```
niro mcp uninstall --client codex

```

If something goes wrong, see [FAQ: coding agents and MCP](https://help.niroai.dev/cli/faq-assistants-and-mcp/).