CLI Installation
Install and configure the mx command-line interface.
The mx CLI is a full-featured command-line interface for managing memories, facts, conversations, and more.
Requirements
- Node.js 18 or later
- npm, yarn, or pnpm
Install
npm install -g @memnexus-ai/cli
Verify the installation:
mx --version
Configure
Authenticate
mx auth login
This prompts for your API key with masked input — the key stays out of your shell history.
For CI/CD or automation, you can pass the key directly via environment variable:
export MX_API_KEY="cmk_live_xxx.yyy"
Connect your AI tools
After authenticating, connect MemNexus to your AI coding tools:
cd ~/your-project
mx setup
This configures MCP for your installed tools (Claude Code, Cursor, Copilot, etc.) and installs the CommitContext hook.
The MCP server entry that mx setup writes runs mx mcp serve, which sends error reports by default. Reports include your MCP session ID, CLI version and platform, and can be linked to your account. Set MX_ERROR_REPORTING_ENABLED=false to turn them off. See Error reports.
Verify authentication
mx auth status
You should see:
┌──────────────────┬────────────────────────────┐
│ Property │ Value │
├──────────────────┼────────────────────────────┤
│ Authentication │ ✓ Configured (via config) │
│ API URL │ https://api.memnexus.ai │
│ Output Format │ table │
└──────────────────┴────────────────────────────┘
Configure the API URL
By default, the CLI points to https://api.memnexus.ai. To change it:
mx config set apiUrl https://your-custom-url.example.com
Set a default output format
mx config set format json
Options: table (default), json, yaml.
Environment variables
You can also configure the CLI via environment variables:
| Variable | Description | Default |
|---|---|---|
MX_API_KEY | API authentication key | — |
MX_API_URL | API base URL | https://api.memnexus.ai |
MX_OUTPUT_FORMAT | Default output format | table |
MX_DEFAULT_PAGE_SIZE | Default pagination size | 20 |
export MX_API_KEY="cmk_live_xxx.yyy"
export MX_OUTPUT_FORMAT="json"
Environment variables override config file values.
Update
npm update -g @memnexus-ai/cli
Uninstall
npm uninstall -g @memnexus-ai/cli
Getting help
Every command has built-in help:
mx --help
mx memories --help
mx memories create --help
Next steps
- Authentication — API key management
- Managing Memories — Create, update, and organize memories
- Search — Find memories by meaning or keywords