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

# Phantom CLI

> A terminal tool to sign transactions, swap tokens, and interact with your Phantom wallet from the command line — on Solana, EVM chains, and Hyperliquid.

The Phantom CLI (`@phantom/cli`) lets you interact with your Phantom embedded wallet directly from the terminal. It supports:

* **Wallet management** — check balances, get addresses, and rebalance portfolios
* **Solana and EVM** — sign messages, send transactions, swap tokens across chains
* **Hyperliquid perpetuals** — open positions, manage orders, deposit and withdraw
* **MCP server mode** — run as an AI agent tool server exposing all wallet operations as MCP tools

<CardGroup cols={2}>
  <Card title="Installation" icon="download" href="/phantom-cli/installation">
    Install the CLI, authenticate, and run your first command.
  </Card>

  <Card title="Commands" icon="terminal" href="/phantom-cli/commands">
    Full reference for all CLI commands and flags.
  </Card>
</CardGroup>

## How it works

The CLI authenticates via **Phantom Connect** — a browser-based OAuth flow (Google, Apple, or Phantom extension). Sessions persist locally and refresh automatically, so you only sign in once.

```bash theme={null}
# Install globally
npm install -g @phantom/cli

# Authenticate
phantom login

# Check your balances
phantom wallet balances
```

## MCP server mode

Run the CLI as an [MCP stdio server](https://modelcontextprotocol.io) to expose all wallet operations as tools for AI agents (Claude, Cursor, and others):

```bash theme={null}
phantom --mcp
```

See the [Phantom MCP Server](/phantom-mcp-server/index) docs for the full tool reference and agent setup instructions.
