Skip to content

About

How to drive mostro-cli from a program: the --output json interface, every field, error and example

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

88 Commits

Folders and files

Repository files navigation

mostro-cli JSON Interface Book

Online: https://mostro.network/mostro-cli-book/

A guide for people and programs that drive mostro-cli through its machine interface (--output json): generic wrappers, bots, GUIs, MCP servers and AI agents.

It works like the Mostro protocol book, but one level up: the protocol book explains the Nostr messages between a client and the Mostro daemon. This book explains the commands of the CLI and the JSON documents they print.

What is in it

Path Content
src/ The book pages (mdBook). Start at src/introduction.md.
examples/ 164 JSON outcomes, one file per case, listed in examples/index.json with the exact command line.
schemas/ The JSON Schemas (Draft 2020-12) generated by the CLI, one input and one output schema per command, plus a hand-written generic envelope schema.
wrappers/ Small tested wrappers: Python, TypeScript, Rust, shell.
generated/ Example sections of the command pages, written by scripts/gen_examples_page.py. Do not edit.
scripts/ Tools to refresh the schemas and the fixture examples and to validate every example.
AGENTS.md Rules for an AI (or a human) editing this book.

Read it

cargo install mdbook        # once
mdbook serve                # http://localhost:3000
mdbook build                # static site in ./book

The Markdown also reads fine on GitHub, except that the JSON examples are pulled in with {{#include}}; follow the link printed under each example to see the file.

Keep it true

The book is checked against the binary it documents:

# 1. regenerate schemas from the binary (needs jq)
MOSTRO_CLI=../mostro-cli/target/debug/mostro-cli scripts/refresh_schemas.sh
# 2. refresh the examples that come from the CLI's test fixtures
python3 scripts/import_fixtures.py --cli-repo ../mostro-cli
# 3. validate every example against the schemas (needs `pip install jsonschema`)
python3 scripts/validate_examples.py
# 4. regenerate the example catalogue page
python3 scripts/gen_examples_page.py

Documented version: mostro-cli 0.17.0, JSON contract schema_version "1", the first release with the JSON interface; schemas and captured examples checked against the v0.17.0 binary on 2026-11-07. Also documented: the advertised proof of work of mostro-cli#247, on main after 0.17.0 and not yet released; the schemas were refreshed from that branch on 2026-11-08. Also documented: the node settings file of mostro-cli#244 (mostro-cli#248, read by the JSON-capable commands, and mostro-cli#249, read by the human-only commands too, except the gRPC operator commands, mostro-cli#250, the config set command that writes it, mostro-cli#251, the config show command that reports it, which completes the issue, and mostro-cli#254, their review fixes), from the branches stacked on main, not yet released; schemas refreshed from feat/config-review-fixes on 2026-11-09.

Also documented: order chat of mostro-cli#245 in human mode (mostro-cli#255) and with JSON output (mostro-cli#256), on main, not yet released; the schemas were refreshed from main after that merge on 2026-11-09.

Also documented: order watch of mostro-cli#246 in human mode (mostro-cli#261) and with JSON output (mostro-cli#262), on main, not yet released; schemas/discovery.json and the order.watch input and output schema files (the output file from mostro-cli#263) refreshed from main after that merge on 2026-11-09.

Also documented: the typed payment_failed payload, the order id in the human "👉 Next:" lines and the open next_step and payload kind enums of version 1, part of mostro-cli#243 (mostro-cli#264), on main, not yet released; the schemas were refreshed from main after that merge on 2026-11-09.

Also documented: the next_step values fiat_sent and rate, and order watch ending after the rate that follows a completed trade, part of mostro-cli#243 (mostro-cli#265), on main, not yet released; the schemas were refreshed from main after that merge on 2026-11-09.

Also documented: the next_step value release on the seller's fiat-sent-ok, from the local order row, part of mostro-cli#243 (mostro-cli#266), on main, not yet released; the schemas were refreshed from main after that merge on 2026-11-09.

About

How to drive mostro-cli from a program: the --output json interface, every field, error and example

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages