# Install Nib in this agent

Install Nib for the current user and the active agent host. Nib adds one remote MCP tool named `generate_ui` and one focused skill that tells the agent when to call it.

## Scope and safety

- The user who gave you this URL authorizes a user-scoped installation for the active agent host.
- Configure only the agent that is running this installation. Do not change other installed agents unless the user asks.
- Preserve existing settings and instructions. Never replace a complete configuration or instruction file.
- Make every change idempotent. Update an existing managed Nib block instead of adding a duplicate.
- Resolve symlinks before editing an instruction file and edit the shared target once.
- Do not use `sudo`, start a paid subscription, consume the free image, or put credentials in a skill or instruction file.
- Use the installed agent CLI's current `--help` output when its syntax differs from the examples below.

## Canonical resources

- MCP URL: `https://nibtool.com/mcp`
- MCP server name: `nib`
- MCP tool: `generate_ui`
- Skill source: `https://nibtool.com/install/nib-ui-image/SKILL.md`
- OpenAPI: `https://nibtool.com/openapi.json`

## 1. Detect the active host

Use the current process and available CLI to select one row. Do not configure every row.

| Active host | Global MCP scope | Global instruction file | User skill directory |
| --- | --- | --- | --- |
| Codex | Codex user configuration | `~/.codex/AGENTS.md` | `~/.agents/skills/nib-ui-image/` |
| Claude Code | `--scope user` | `~/.claude/CLAUDE.md` | `~/.claude/skills/nib-ui-image/` |
| Gemini CLI | `--scope user` | `~/.gemini/GEMINI.md` | `~/.gemini/skills/nib-ui-image/` |
| Another MCP agent | Its documented user scope | Its documented global instruction file | Its documented user skill directory |

If the host supports the shared Agent Skills directory, `~/.agents/skills/nib-ui-image/` is also valid. Prefer the host's existing convention when one is already present.

## 2. Add the remote MCP server globally

Inspect the existing `nib` entry first. Keep it when it already points to the canonical MCP URL. Otherwise add or update it with the active host's native command.

    codex mcp add nib --url https://nibtool.com/mcp
    claude mcp add --transport http --scope user nib https://nibtool.com/mcp
    gemini mcp add --transport http --scope user nib https://nibtool.com/mcp

Run only the command for the active host. Do not add an authentication header during discovery. Nib permits MCP initialization and `tools/list` before sign-in; `tools/call` remains authenticated.

## 3. Install the Nib skill globally

Fetch the canonical skill source. Create the selected user skill directory, then write the response body to `SKILL.md`. Replace only a previous copy of this same skill.

Verify that the installed file:

- starts with YAML frontmatter whose name is `nib-ui-image`;
- names the `generate_ui` MCP tool;
- does not contain credentials; and
- is available in the host's skill list after a reload or restart.

## 4. Add the managed global instruction

Add or update this exact block in the active host's global instruction file. Keep all unrelated content unchanged.

    <!-- nib-ui-image:start -->
    ## Nib UI images
    When a task needs an image of a user interface and the current model cannot create it, load the `nib-ui-image` skill and call the Nib `generate_ui` MCP tool. Nib also captures, annotates, and collects human review; use `generate_ui` for the generation step.
    <!-- nib-ui-image:end -->

The MCP configuration makes the tool available. This instruction only teaches the root agent when to use it.

## 5. Verify without generating an image

1. Use the host's MCP list or get command to confirm a global server named `nib` points to `https://nibtool.com/mcp`.
2. Connect to the server and confirm `tools/list` exposes exactly `generate_ui`.
3. Confirm the `nib-ui-image` skill appears in the host's user skill list.
4. Confirm the managed instruction block appears exactly once in the resolved global instruction file.
5. Report the host, MCP configuration path or scope, skill path, instruction path, and verification result.

Do not call `generate_ui` during installation because that would consume the user's eligible free image.

## First image and authentication

Authentication is deferred until the first image so installation and discovery do not require payment. If the first `generate_ui` call returns `401`, follow https://nibtool.com/docs#authentication to create a Nib account and copy its revocable access token. For remote MCP, add the token as an `Authorization: Bearer` credential with the active host's supported secret or environment mechanism. Never write the token into the skill or instruction file.
