---
title: "Generate a CLI from your API docs with docstar-cli | DocStar"
description: "docstar-cli turns any DocStar docs site into terminal commands, one per published endpoint, and runs them as a local MCP server. No SDK to generate or maintain."
url: https://docstar.io/cli
---

# A CLI for your API, generated from your docs.

_CLI_

docstar-cli turns any DocStar docs site into a command-line tool: each published endpoint becomes a real command, required parameters and all, and the same commands run as a local MCP server. No SDK to generate, nothing to keep in sync.

Copy install command:

```bash
npm install -g docstar-cli
```

[CLI docs](https://docstar.io/help/cli)

What the agent does:

- you: docstar-cli init docs.msg91.com
- agent: Pick modules: ◉ WhatsApp  ◯ Email  ◯ OTP
- agent: Installed msg91 · whatsapp
- you: docstar-cli msg91 whatsapp check-whatsapp-prepaid-balance
- agent: ? Enter value for authkey
- agent: 200 OK

## From docs site to terminal in three steps.

_How it works_

1. **Run init against any DocStar docs site.** It reads the site once and fetches each module's endpoint contract: method, URL, headers, body and parameters.
2. **Pick the modules you need.** An interactive checklist shows every published module. Each endpoint becomes a real, inspectable command on disk.
3. **Run commands.** Pass flags, or leave them out and get prompted. Method, URL, headers and body come from the published endpoint; you supply the values.

## Only what's actually documented.

_Built for real use_

### Prompts for what's missing

Skip a required flag and the CLI asks for it, so a command works before you've read the docs.

### Local-first

Contracts are saved to ~/.docstar after install. No round-trip to the docs site per call.

### Predictable commands

Commands follow API → module → endpoint, and list lets you browse what's installed.

```text
docstar-cli list
```

### Published endpoints only

Never drafts, internal notes or raw credentials.

### Credentials per API

Save keys once per API; they're sent as the headers or params the docs describe.

```text
docstar-cli config set msg91 authkey <value>
```

### Always current

Re-run init any time to pick up newly published endpoints.

## Your installed APIs, as a local MCP server.

_For agents_

Run docstar-cli mcp to expose every installed endpoint as an MCP tool over stdio, named <api>__<module>__<endpoint>. Agents call your APIs with your saved credentials.

```bash
docstar-cli mcp
```

## CLI questions.

_FAQ_

### Which APIs can I install?

Any API documented on DocStar. Point init at its docs site, a custom domain or sub-path, or the collection's slug.

### How do I keep the commands up to date?

Re-run init. The CLI reads the published docs, so new and changed endpoints arrive with the next install.

### How are API keys handled?

Save a key once per API with config set, or sign in. You can also write a key into your project's env file. Keys are sent only as the headers or parameters the docs describe.

### Can my company ship it under our own name?

Yes. With white-label, your users run your CLI name with your branding, generated from the same docs.

### Does the CLI send my credentials anywhere?

No. Credentials stay in ~/.docstar on your machine and are only sent to the API you call.

## More from one source.

_Related_

### Hosted MCP server

Every API you document gets an MCP server that agents use to search your docs and call your API.

[How the MCP server works](https://docstar.io/mcp)

### API docs

A public API reference with a try-it playground, guides, llms.txt and markdown for every page.

[See the API docs platform](https://docstar.io/api-docs)

### White-label

Your domain on the docs and the MCP server, your name on the CLI, your look everywhere.

[Brand every channel](https://docstar.io/white-label)

## Give your users a CLI, without writing one.

One prompt. Your docs, MCP server and CLI, live.

Copy prompt: paste this into your agent:

```text
Use DocStar to let my users use my app from their AI assistants.
Follow https://docstar.io/mcp/quickstart.md, document my app's user-facing APIs from my latest code, and set up MCP.
```

[Start free](https://app.docstar.io/login?intent=signup)
