Headless mode
Run Mind CLI non-interactively in CI/CD pipelines, automation scripts, and environments without a browser
Headless mode lets you run Mind CLI as part of your CI/CD pipeline to automate code reviews, generate tests, or troubleshoot build failures — no interactive terminal required. Authenticate with an API key, pass a prompt, and Mind executes it end-to-end.
Authentication
Headless mode requires an API key set as the MIND_API_KEY environment variable. If you haven't created one yet, follow the steps in Authentication.
Running headless commands
Pass --no-interactive along with your prompt:
Since there's no user to approve tool calls, use --trust-all-tools or --trust-tools to grant permissions upfront:
CI/CD examples
GitHub Actions
name: Mind Code Review
on: [pull_request]
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Mind CLI
run: curl -fsSL https://app.mindcode.sh/install.sh | bash
- name: Review PR changes
env:
MIND_API_KEY: ${{ secrets.MIND_API_KEY }}
run: mind chat --no-interactive --trust-tools=read,grep "Review PR for security issues"Structured output
Pass --output-format stream-json to receive run events as JSON Lines on stdout. Each line is a self-contained JSON object, making the output easier to process in scripts, logging pipelines, and CI jobs than formatted text.
Flags reference
| Flag | Description |
|---|---|
| --no-interactive | Run without an interactive session. Requires a prompt as an argument |
| --output-format stream-json | Emit run events as JSON Lines on stdout for programmatic use |
| --trust-all-tools | Auto-approve all tool calls without prompting |
| --trust-tools=<categories> | Auto-approve specific tool categories (e.g., read, grep, write) |
| --require-mcp-startup | Fail immediately if any MCP server fails to connect |
Best practices
- Store
MIND_API_KEYas a secret in your CI/CD platform — never commit it to source control. - Use
--trust-toolswith specific categories instead of--trust-all-toolsto follow least privilege. - Add
--require-mcp-startupwhen your pipeline depends on MCP servers to fail fast instead of hanging.