MarsAI
Sign in Get Started

Mars CLI

AI coding agent for the terminal - understands your codebase, edits files, runs commands, coordinates subagents. One MarsAI account, whole model catalog, device OAuth: no key handling.

npm install -g @mars_ai/marscli@latest npm ↗
Prefer a GUI? The MarsAI desktop app is the same agent with a UI — Windows, macOS, Linux.

Mars CLI (mars) is an AI coding agent for the terminal. It understands your codebase, edits files, runs commands, and coordinates subagents — powered by the MarsAI model network (marsai.click), with a free-model pool, automatic failover, and a background service architecture.


Install

npm i -g @mars_ai/marscli

Verify:

mars --version

First run: launch mars in any project directory. If no MarsAI account is connected yet, a browser-based device sign-in opens automatically — approve once and you're in. No config files needed.

cd my-project
mars

Update later with mars upgrade (or the /update slash command inside the TUI). Auto-update is on by default.


Features

MarsAI model network

Free pool + automatic fallback

Explore agent

Subagent tools

Sidebar

Right-hand live panel: account info, token usage (session total + last response, main model only), agent activity, subagent pool activity, and the fastest models by measured latency.

Background service

Safety & permissions

Auto-update


CLI commands

Syntax: mars [command] [flags]. Run mars --help or mars <command> --help for the live list.

Core

CommandDescription
mars (no command)Launch the interactive TUI in the current directory
mars [directory]Launch the TUI in a specific directory
mars -cContinue the most recent session
mars -s <sessionID>Continue (or create) a specific session
mars --prompt "..."Start with an initial prompt
mars runRun a prompt non-interactively (scripts/CI)
mars serveRun a headless server
mars pairPair the CLI with a web/desktop client

Sessions

CommandDescription
mars session listList sessions
mars session exportExport a session
mars session importImport a session
mars session deleteDelete a session

Auth

CommandDescription
mars auth loginSign in to an integration (browser/device flow)
mars auth logoutSign out
mars auth listShow authenticated integrations
mars auth switchSwitch active account/credential
mars auth exportExport credentials
mars auth importImport credentials

Models & config

CommandDescription
mars modelsList available models
mars agentsList agents
mars config listList configuration sources
mars config get / set / unsetRead and write configuration values
mars pathsShow config/data/log paths
mars reloadReload configuration

Service

CommandDescription
mars service startStart the background server
mars service stopStop the background server
mars service restartRestart the background server
mars service statusShow background server status
mars service get / set / unsetService settings (e.g. port)

Extensions

CommandDescription
mars mcp listList configured MCP servers and status
mars mcp addAdd an MCP server
mars mcp auth / logoutMCP server authentication
mars plugin listList installed plugins
mars plugin add / remove / updateManage plugins
mars plugin checkCheck plugin health

Maintenance

CommandDescription
mars upgrade [version] (alias: update)Upgrade to latest or a specific version
mars uninstallUninstall the CLI (keeps sessions/config)
mars statsUsage statistics
mars api <operation or METHOD path>Call the running server's API directly
mars acpStart an Agent Client Protocol server
mars debugDebug utilities

Global flags

FlagDescription
--continue, -cContinue the last session
--session, -s <id>Continue/create a session by ID
--prompt <text>Initial prompt
--print-logsPrint logs to stderr
--standaloneRun with a private server instead of the background service
--server <url>Connect to a specific server URL
--autoAuto-approve non-denied permissions

Slash commands (inside the TUI)

CommandDescription
/newNew session
/sessions (aliases: /resume, /continue)Switch session
/clearClear the current session
/open (aliases: /projects, /project)Open another project
/modelsModel picker (paid first, free pool last, favorites + speed ranking)
/agentsAgent picker
/mcpsMCP servers
/variants (aliases: /thinking, /effort)Model variant / reasoning effort
/connectManage connected integrations
/healthcheckProbe model latency and availability live
/settingsSettings
/statusSession/service status
/updateUpdate Mars CLI
/pairPair with web/desktop
/restartRestart the background service
/reloadReload configuration
/themesTheme picker
/debugDebug tools
/cd <dir>Change directory
/helpHelp
/exitQuit

How it works

mars (TUI) ──┐
mars (TUI) ──┼──> background service (port 49474) ──> MarsAI API (marsai.click/v1)
mars run ────┘            │
                          ├── sessions, credentials (SQLite, encrypted)
                          ├── model catalog (live refresh, free/paid tags)
                          └── healthcheck probes (server-side, credentials never leave the service)

Data & config locations

PathContents
~/.local/share/marsai/Data: sessions, logs, plans
~/.local/state/marsai/State: service registration
~/.cache/marsai/Cache: binaries (ripgrep), npm artifacts
mars config pathsPrint exact paths on your machine

Links