Quickstart
Prerequisites
| Tool | Why |
|---|---|
| Python 3.11+ | The agent is a FastAPI process. 3.11 is the floor. |
Claude Code (npm install -g @anthropic-ai/claude-code) | The chat UX. Optional if you only want REST. |
| MangroveAI API key | Free at mangrovedeveloper.ai. dev_... or prod_.... The setup script will prompt for it. |
| VSCode (recommended) | Universal editor + integrated terminal that behaves the same on macOS, Linux, Windows. |
| Git for Windows (Windows only) | So *.sh scripts work via Git Bash. Set VSCode’s default terminal to Git Bash. |
keyring library can reach your OS keychain directly when the agent runs natively.
Bare-metal (recommended)
One command. It seeds your config (prompts for the API key), creates a venv, pip-installs dependencies, starts uvicorn in the background, registers the MCP server with Claude Code, and verifies/health.
- Agent runs at
http://localhost:9080(pid inagent-data/bare.pid, logs inagent-data/bare.log). Bound to 9080 externally because:8080is commonly squatted by VSCode Helper. ./scripts/verify_quickstart.sh --barepasses — the tool catalog returns the expected set.- Claude Code’s MCP registration now knows about
mangrove-agent.
Useful flags
Docker (alternate)
./agent-data/ directory (bind-mounted into the container). The directory mount avoids the macOS / Windows single-file bind-mount staleness that previously ate DB rows after rebuild.
The container cannot reach your OS keychain, so the Fernet master key lives in ./agent-data/master.key (chmod 600, gitignored).
Your first paper strategy (no wallet, no funds)
Start Claude Code in the repo directory. The agent runs a short platform tour — status, list_tools, get_market_data, kb_search, search_reference_strategies — then offers to help you build a strategy.“Build me a momentum strategy for ETH on 1h. Use a reference.”The agent searches curated reference strategies, picks a candidate, builds it, backtests with a timeframe-appropriate lookback, and reports PASS / MARGINAL / FAIL against six thresholds.
“Promote it to paper.”Schedules the strategy on a cron at the strategy’s timeframe. Evaluations fire, paper fills get logged. No funds at risk.
Going live (optional — needs funds)
Wallet setup and live trading are in Chapters 06 and 07 of the tutorial. Summary:- Create or import a wallet.
create_walletreturns avault_token, not the plaintext. - Save the secret off-agent.
./scripts/reveal-secret.sh <vault_token>prints to your terminal once. Put it in your password manager. - Flip the backup gate.
./scripts/confirm-backup.sh <address>.execute_swapandupdate_strategy_status -> liverefuse on wallets without this flag. - Fund the wallet with 1-5 USDC on Base.
- Promote the strategy to live. Allocation block requires
confirm=trueandslippage_pct <= 0.0025.
mangrovemarkets SDK routes the order through 1inch, the agent decrypts the wallet’s secret in-process, signs the transaction, broadcasts it, and zeroes the secret. The SDK never sees the key.