DocStar CLI

DocStar CLI turns the API endpoints in any published DocStar docs site into commands you can run in your terminal. It can also serve those endpoints as MCP tools, so AI assistants like Claude can call your API.

The CLI reads the docs each time a command runs, so edits to the docs show up on the next command. There is no SDK to generate and nothing to keep in sync.

#

Install

You need Node.js 18 or later.

npm install -g docstar-cli

Check it worked:

docstar-cli --version
#

How commands are organised

Every API command has three levels:

docstar-cli <collection> <module> <endpoint> [--parameters]
Level What it is Example
Collection A DocStar docs site, named by its collection slug msg91
Module A top-level section of that docs site sms
Endpoint One published API in that module send-sms

The collection slug is chosen when the collection is created in DocStar and never changes. It is the slug, not the docs domain: use msg91, not docs.msg91.com. The same slug identifies the collection's MCP server.

#

1. Run any collection, no setup

Every published collection works straight away:

docstar-cli msg91 sms send-sms --template_id 123 --recipients '[...]'

The CLI reads that endpoint's contract from the docs, asks for anything missing (parameters, an API key, a sign-in) and calls the API. It prints the response status and body.

To explore a collection:

docstar-cli msg91                     # list its modules
docstar-cli msg91 sms                 # list the endpoints in a module
docstar-cli msg91 sms send-sms --help # show an endpoint's flags

Leave out a required parameter and the CLI asks for it. Optional query parameters work as flags too, for example --startDate 2026-10-01.

Commands need network access, because they read the docs when they run.

#

2. Register modules (optional)

docstar-cli init msg91

init lists the collection's published modules. Press space to select modules (or pick Select all modules at the bottom), then enter.

Registering gives you three things for the chosen modules:

  • a msg91 shortcut command, so you can run msg91 sms send-sms without typing docstar-cli (skip it with --no-alias),
  • shell tab completion,
  • their endpoints as MCP tools (see below).

Nothing is downloaded or generated. Run init with another slug to register more collections; existing ones are kept.

#

3. See what's available

docstar-cli list                 # registered collections
docstar-cli list msg91           # modules in "msg91"
docstar-cli list msg91 sms       # endpoints in the "sms" module

list works for any collection, registered or not. Each endpoint shows its name, description, HTTP method, required parameters and what it needs (an API key or sign-in).

#

Sign-in and API keys

Each endpoint runs on your sign-in, or on an API key where the docs owner marked one. The CLI checks what a call needs before calling:

docstar-cli auth status msg91    # what msg91 needs, and whether it's set up
#

Sign in

If the docs owner set up sign-in (OAuth) for their DocStar MCP server, sign in once:

docstar-cli login msg91      # opens the sign-in page in your browser
docstar-cli logout msg91     # forget the sign-in on this computer

Tokens are kept in ~/.docstar/credentials.json, readable only by you, and refreshed automatically. When an AI assistant runs the CLI one command at a time, login msg91 --no-wait prints the link and exits, and login msg91 --continue finishes after you sign in.

Docs owners: add https://api.docstar.io/p/cli-auth/callback as a redirect URI in the OAuth app you use for MCP sign-in.

#

API keys

Pass a key on the command (--authkey <key>), or save it once:

docstar-cli config set msg91 authkey YOUR_AUTH_KEY
docstar-cli config get msg91            # show saved credentials (last 4 characters)

The key name must match the header or parameter name in the docs. A flag on a command overrides the saved value. If a key is missing when you run a command in a terminal, the CLI asks for it and offers to save it. The CLI never reads your environment or .env files.

#

Exit codes

Code Meaning
0 Success
1 The API returned an error (4xx/5xx) or the call failed
4 An API key or sign-in is missing; the message says how to add it
#

Use with AI assistants (MCP)

docstar-cli mcp starts a local MCP server that exposes every registered endpoint as a tool. Register at least one module with init first, then add it to your AI client's MCP config, for example .mcp.json for Claude Code or claude_desktop_config.json for Claude Desktop:

{
  "mcpServers": {
    "docstar": {
      "command": "docstar-cli",
      "args": ["mcp"]
    }
  }
}

Each tool is named <collection>__<module>__<endpoint>, for example msg91__sms__send-sms. Ask "Send an SMS using MSG91" and the assistant calls the right tool, asking you for any value it needs.

To connect an AI assistant to a collection's hosted MCP server without installing anything, see Build an MCP Server for Your App.

#

Let an assistant create an API key for you

Some MCP tools create an API key for you, for example a provider's "create API key" tool. The key is never shown to your AI assistant and is not stored by DocStar. The assistant runs these steps for you:

docstar-cli key request                           # makes a one-time public key
docstar-cli key save --payload <encrypted key>    # stores the key under its collection
docstar-cli key emit msg91 authkey --env .env     # writes it to your project's .env

key emit keeps every other line in the file, makes it readable only by you and adds it to .gitignore. These commands print only the key's last 4 characters.

#

Tab completion

For bash, or zsh with bashcompinit:

echo 'eval "$(docstar-cli completion-script)"' >> ~/.bashrc   # or ~/.zshrc

After you type a registered collection, Tab completes module and endpoint names.

#

Remove modules

docstar-cli clean msg91                # choose modules to remove
docstar-cli clean msg91 --all          # remove the whole collection
#

Upgrading from 1.x

  • init now takes the collection slug: docstar-cli init msg91, not docstar-cli init docs.msg91.com. The --collectionId flag is gone.
  • You no longer need to run init again when the docs change. Every command reads the current docs.
  • init only registers modules. It removes the command files that 1.x generated.
#

Tips