# CLI and agent plugin

The mp CLI is your access to MainPath from the terminal, and the agent plugin gives Cursor, Claude Code and Codex the same functions as MCP tools.

> Source: https://www.mainpath.ai/en/docs/cli-and-agent-plugin/

## Install the mp CLI and sign in

A script installs the current release into `~/.local/bin` (Windows: `%LOCALAPPDATA%\ap-cli`) and adds the folder to your PATH; the [MainPath Toolbox]({{< relref "/downloads" >}}) ships the CLI as well, and remote workspaces have it preinstalled.

```bash
# macOS and Linux
curl -fsSL https://www.application-platform.com/install.sh | sh
# Windows (PowerShell)
irm https://www.application-platform.com/install.ps1 | iex
```

The script accepts `--dir`, `--version`, and `--no-modify-path` (after `sh -s --`); the manual binaries are on the downloads page. Then, in a new terminal:

```bash
mp login             # opens the browser to sign in
mp whoami            # shows user and organization
mp doctor            # checks that Git, Docker, runtimes and friends are present
mp cli-update check  # checks for a newer CLI release
```

`mp cli-update update-now` installs a newer release, `mp logout` removes the stored session, and the commands for working inside a repository are covered in [Local development]({{< relref "local-development" >}}).

## Install the agent plugin

Skills, rules, and MCP ship inside the mp CLI, not as an npm package. After installing the CLI (or any time later):

```bash
mp agent install
mp login
```

`mp login`, `mp doctor`, and `mp cli-update update-now` run `agent install` as well. The CLI copies the plugin to `~/.cursor/plugins/local/application-platform` (and to Claude/Codex if those tools are present), places the skills under `~/.cursor/skills`, `~/.claude/skills`, and `~/.codex/skills`, and writes the **absolute path** to `mp` into the user MCP file so GUI editors can find the CLI. Reload the editor afterwards. Step by step: [Work with an AI agent]({{< relref "work-with-ai-agents" >}}).

The plugin ships the skills `setup-and-login`, `create-project`, `import-existing-project`, `run-local`, `git-and-pipelines`, and `report-blocker`, matching slash commands, a Cursor rule with MainPath conventions, and the MCP server `application-platform` (`mp mcp serve`). A manual entry in `~/.cursor/mcp.json` needs the same absolute `command` path that `mp agent install` writes — not a bare `mp` or `ap` without a path.

## The MCP tools

Destructive tools require `confirm=true`, and status messages show no internal infrastructure terms.

| Area | Tools |
|---|---|
| Identity and status | `platform_whoami`, `platform_watch`, `platform_status` |
| Organizations | `platform_organizations_*` with list, get, create, update, invite and member management |
| Projects | `platform_projects_*` with list, get, create, update, delete, demo_json, clone, import_local, status, import_android_keystore and load_tests |
| Servers | `platform_servers_*` with list, get, create, update, delete, monitoring and firewall |
| Network tunnels | `platform_tunnels_*` with list, get, create, update, delete, test and reconnect; `platform_tunnels_test` accepts optional destHost/destPort; assign with `configuration.tunnelId` on the server |
| Credentials | `platform_credentials_create` for web space, SMTP, App Store, Play Store, Hetzner and Hostinger, plus `platform_credentials_sentry_projects` |
| Pipelines and blockers | `platform_pipelines_list`, `platform_pipelines_get`, `platform_pipelines_wait`, `platform_pipelines_job_log`, `platform_agent_report` |
| Workspaces, computers, compliance | `platform_workspaces_*`, `platform_computers_*`, `platform_compliance_*` |

The call order for import and project creation is described in [Import an existing repository]({{< relref "agent-project-import" >}}) and [Create a new project]({{< relref "create-project" >}}).

## When the agent gets stuck

If a tool reports `not logged in` or `session expired`, run `mp login` and check with `mp whoami`. If `mp` is missing from the PATH, install the CLI and reload the editor. If the server `application-platform` is missing in the client, `mp agent install` usually has not been run or the window has not been reloaded.

Cloud agents without a local `mp` cannot use the stdio MCP; import and project creation need a locally running agent. If create, import or watch fails, that error message stands; the agent does not work around it with its own `git clone` or `git remote add`. After a push, the agent waits with `platform_pipelines_wait` for **that** commit. If it is blocked by the platform, it calls `platform_agent_report`.

