How krakenfx/kraken-cli works
Kraken CLI exposes Kraken market data, account, trading, and research workflows through one command interface, with JSON or table output and an MCP server that reuses CLI dispatch. A typical workflow is an agent or user invoking a command, the CLI resolving configuration and credentials, a domain command performing the operation, and output being rendered. The README documents paper trading, recording/replay, sessions, workspaces, and the research lab as additional capabilities. Several of those paths are supported by the tree and documentation, but their internal runtime links are not shown in the excerpts.
Main entry points: mod.rs Command dispatch · cli.rs CLI parser · futures.rs Spot and futures · client.rs HTTP clients
Components 22
Entry surfaces
- CLI parser
src/cli.rs - MCP server
src/mcp/server.rs - Command dispatch
src/commands/mod.rs - Tool registry
src/mcp/registry.rs
Runtime foundation
- Configuration
src/config.rs - Authentication
src/auth.rs - Error taxonomy
src/errors.rs
Exchange operations
- HTTP clients
src/client.rs - WebSocket clients
crates/kraken-ws/src/connection.rs - API types
crates/kraken-core/src/lib.rs - Market commands
src/commands/market.rs - Spot and futures
src/commands/futures.rs
Trading research
- Paper trading
src/commands/paper.rs - Paper account
crates/kraken-paper/src/account.rs - Market recording
src/commands/record.rs - Tape storage
crates/kraken-recording/src/frames/mod.rs - Replay playback
crates/kraken-replay/src/playback.rs - Autoresearch lab
crates/kraken-lab/src/app.rs
State and output
- Trading sessions
src/commands/session.rs - Workspaces
crates/kraken-workspace/src/app.rs - Output rendering
src/output/mod.rs
Other components
- User or agent
Connections 23
- User or agent → CLI parser: invokes
README.md - CLI parser → Command dispatch: dispatches
src/commands/mod.rs - MCP server → Command dispatch: re-enters dispatch
src/mcp/server.rs - MCP server → Tool registry: uses tools
src/mcp/server.rs - CLI parser → Configuration: resolves context
src/cli.rs - CLI parser → Output rendering: renders results
src/cli.rs - Command dispatch → Market commands: routes
src/commands/mod.rs - Command dispatch → Spot and futures: routes
src/commands/mod.rs - Command dispatch → Paper trading: routes
src/commands/mod.rs - Command dispatch → Market recording: routes
src/commands/mod.rs - Command dispatch → Trading sessions: routes
src/commands/mod.rs - Market commands → HTTP clients: requests data
- Spot and futures → HTTP clients: sends requests
- Spot and futures → WebSocket clients: uses WebSockets
- WebSocket clients → API types: uses protocol types
- Market recording → Tape storage: records streams
- Replay playback → Tape storage: reads tapes
- Paper trading → Paper account: runs paper trades
- Autoresearch lab → Tape storage: researches recordings
- Trading sessions → Workspaces: scopes sessions
- Command dispatch → Output rendering: produces command output
src/output/mod.rs - Configuration → Authentication: resolves credentials
- HTTP clients → Error taxonomy: normalizes failures
src/client.rs