TheDocumentation Index
Fetch the complete documentation index at: https://docs.markapidown.net/llms.txt
Use this file to discover all available pages before exploring further.
mad binary is MarkApiDown’s command-line interface — a single executable that covers the full API development lifecycle, from scaffolding a new workspace to executing requests in CI. Every command described here is authoritative: flag names, default values, and behavior are drawn directly from the source code. Use the accordions below to jump to the command you need.
Global flags
Place these flags before the subcommand name. They apply to everymad command.
| Flag | Short | Default | Description |
|---|---|---|---|
--config <path> | — | auto-discover | Path to api-docs/mad.md. Overrides the automatic workspace discovery. |
--no-color | — | false | Disable ANSI color output. Also respected when the NO_COLOR environment variable is set. |
--verbose | -v | false | Enable verbose diagnostic output for all subcommands. |
Subcommands
mad init
mad init
Scaffold a new Examples
api-docs/ workspace in the current directory. After creating the directory structure, mad init automatically runs mad import project to discover existing API routes, then prints a reminder to run mad serve.Project name written into
mad.md. When omitted and --yes is not set, you are prompted interactively. MarkApiDown attempts to detect the name from package.json, Cargo.toml, pyproject.toml, go.mod, composer.json, or pom.xml before falling back to my-api.Base URL written into
_shared/env.md for the dev environment. When omitted without --yes, you are prompted. Defaults to http://localhost:8080 when --yes is set and no value is provided.Accept all defaults without interactive prompts. Useful in CI or automated setup scripts.
mad init never overwrites existing files. If a file already exists it exits with an error naming the conflicting path. It also appends .env.local to .gitignore automatically if that entry is not already present.mad exec <file>
mad exec <file>
Execute a single endpoint spec file. ExamplesExit codes:
mad exec resolves all variables, builds the HTTP request, sends it, and compares the actual response against the ## Expected response block in your spec. Results are printed in the chosen output format.Path to an endpoint markdown file (e.g.,
api-docs/apis/users/get-user.md).Environment name. Must match a heading in
_shared/env.md. Variables for the chosen environment are loaded automatically.Output format. One of
console, json, junit, or markdown. See Output Formats for details.Inject a variable as
key=value. Repeatable. CLI variables take the highest precedence and override environment files, .env.local, and MAD_* OS variables.Print the fully resolved request without sending it. No network connection is made. Useful for debugging variable substitution.
Override the request timeout in milliseconds. Takes precedence over endpoint-level and project-level timeout settings.
0 response matches, 1 assertion fails, 2 invalid spec, 3 engine error, 4 network error, 5 secret detected.mad flow <pipeline>
mad flow <pipeline>
Execute a pipeline file. Steps run sequentially by default. Override the pipeline’s own ExamplesExit codes:
parallel setting with --parallel or --no-parallel.Path to a pipeline markdown file (e.g.,
api-docs/flows/user-onboarding.md).Environment name used for all steps in the pipeline.
Output format:
console, json, junit, or markdown.Inject a variable as
key=value. Repeatable. Applies to every step.Force parallel execution, overriding the
parallel field in the pipeline file.Force sequential execution, overriding the
parallel field in the pipeline file.Timeout override in milliseconds applied to every step.
0 all steps pass, 1 any step fails, 2 pipeline spec invalid, 3 engine error, 4 network error.mad request <METHOD> <URL>
mad request <METHOD> <URL>
Send a one-off HTTP request without a spec file. Think of it as a Examples
curl replacement that understands MarkApiDown variables. By default it prints a compact status + body. Add --verbose for the full request/response diff. Use --save to persist the result as a spec file.HTTP method:
GET, POST, PUT, PATCH, DELETE, HEAD, or OPTIONS.Target URL. May contain
{{variable}} references resolved from the active environment.Add a request header as
Name: Value. Repeatable.Request body as a raw string, or
@file to read the body from a file path.Environment for variable resolution.
Inject a variable as
key=value. Repeatable.Print the resolved request without sending it.
Timeout override in milliseconds.
Save the request and response as a spec file. Provide a path to save there, or omit the path to auto-save into the current collection at
api-docs/apis/scratch/.Show the full request/response diff instead of the compact status + body view.
Output format:
console, json, junit, or markdown.mad validate <path>
mad validate <path>
Validate one endpoint file, one pipeline file, or every markdown file under a directory. Each file is classified by its location and name:ExamplesExit codes:
- Files named
env.md→ validated as environment config. - Files under
flows/orpipelines/→ validated as pipeline files. mad.mdandREADME.md→ frontmatter check only.- All other
.mdfiles → validated as endpoint specs.
File or directory to validate. Pass
api-docs/ to validate the entire workspace.0 all valid, 2 any spec is invalid, 5 secret detected.mad serve
mad serve
Start the local web preview server. The preview reads the same markdown files as the CLI — no build step is required. The server watches for file changes and refreshes connected browsers automatically.ExamplesExit codes:
Root directory of the MarkApiDown project. Defaults to the current directory.
TCP port to listen on.
Host address to bind to. Set to
0.0.0.0 to expose the preview on your local network (a warning is printed when you do this).Environment used when executing endpoints from the web preview UI.
Start in mock mode. The Send button in the preview returns the recorded
## Expected response block instead of making a real HTTP request.0 on clean shutdown (Ctrl-C), 3 on startup error.mad mock
mad mock
Start a standalone mock HTTP server. The server reads Examples
## Expected response blocks from your endpoint files and serves those bodies at the corresponding HTTP methods and paths. Use it for frontend development when the live backend is unavailable, or for latency simulation.Root directory containing the spec files. Defaults to
api-docs.TCP port to listen on.
Artificial response delay in milliseconds. Omit for zero-latency responses. Useful for testing loading states and timeout handling.
mad import
mad import
Convert specs from another API tool into MarkApiDown endpoint markdown files. All subcommands write files under
Exit codes (all import subcommands):
api-docs/ and run mad index automatically. Complex logic — pre-request scripts, dynamic variables, JavaScript assertions — is imported as agent-task blocks for manual review.After any import, run mad validate api-docs/ and move any embedded secrets to .env.local.mad import postman
Import a Postman Collection v2.1 JSON export.mad import insomnia
Import an Insomnia v4 JSON export.mad import openapi
Import an OpenAPI 3.x spec in YAML or JSON format.mad import curl
Import a rawcurl command as a MarkApiDown endpoint file. Reads from a file if provided, otherwise reads from stdin — ideal for pasting directly from browser DevTools.mad import project
Scan project source code for route definitions and import them. Uses a priority chain:--url— fetch an OpenAPI spec from an explicit URL.- Static OpenAPI/Swagger file found in the project (
openapi.yaml,swagger.json, etc.). - Running dev server probed on localhost (
--portor common framework defaults). - Regex-based source-code scan as a fallback (method + path only).
Root directory to scan. Defaults to the current directory.
Port of a running development server to probe for an OpenAPI spec. If omitted, common framework defaults (8000, 8080, 3000, …) are tried automatically.
Explicit OpenAPI/Swagger spec URL. When set, all other discovery strategies are skipped.
0 on success, 2 if the input is not a valid spec, 3 on filesystem error.mad install
mad install
Install skills, slash commands, or the MCP server for AI agent integration. Skills and slash commands are embedded in the binary — no network access is required.
mad install skills
Install AI agent skill files into detected agent config directories.Install only one specific skill by name (e.g.,
mad-sync, mad-debug). Omit to install all available skills.Target a specific agent by name (e.g.,
claude-code, cursor, copilot). Omit to install for all detected agents.mad install slashcmd
Install slash commands for Claude Code and Codex CLI.Install only one command by name (e.g.,
mad-scan, mad-debug). Omit to install all.Agent name:
claude-code or codex-cli. Omit to install for all detected agents.mad install mcp
Register the MarkApiDown MCP server with Claude Code. Runsclaude mcp add mad -- mad mcp internally.mad install list
List all detected agents and their current installation status.mad doctor
mad doctor
Diagnose your project setup. Examples
mad doctor checks whether api-docs/ exists, whether .env.local is in .gitignore, whether all specs are valid, which AI agent directories are present, and whether skills match the current binary version. Use --fix to apply safe automatic repairs.Automatically apply safe fixes: adds
.env.local to .gitignore if missing and reinstalls any stale skill files.Run
mad doctor as your first debugging step whenever mad exec, mad validate, or an AI agent skill behaves unexpectedly.mad index
mad index
Regenerate ExampleExit codes:
api-docs/README.md from the current set of markdown files under api-docs/. The generated file contains a linked list of all specs. Do not edit it by hand — it is overwritten on every run.mad index runs automatically after mad init and after every mad import subcommand. Run it manually only when you have added or renamed spec files directly.0 on success, 3 on filesystem error.mad mcp
mad mcp
Start a Model Context Protocol (MCP) server using the stdio transport. This exposes MarkApiDown tools to any MCP-compatible AI agent, including Claude Code.No flags. Register the server with Claude Code using:Or use
mad install mcp to run that registration command automatically.mad version
mad version
Print the installed version of MarkApiDown and exit.ExampleExit codes:
0 always.mad completion <shell>
mad completion <shell>
Print a shell completion script to stdout. Pipe the output to the appropriate location for your shell.
One of:
bash, zsh, fish, elvish, or powershell.- Bash
- Zsh
- Fish
- Elvish
- PowerShell
Output formats
All execution commands (mad exec, mad flow, mad request --verbose) accept --output=<format>.
| Format | Flag value | Best for |
|---|---|---|
| Console | console | Human-readable terminal output with color-coded diffs (default) |
| JSON | json | Scripting, programmatic result parsing, custom dashboards |
| JUnit XML | junit | CI systems: GitHub Actions, Jenkins, CircleCI test reporters |
| Markdown | markdown | Saving reports to files or posting summaries to pull request comments |