CLI Reference

The MarkDocs CLI lets you manage documents, comments, and suggestions directly from your terminal.

Installation

curl -fsSL https://markdocs.sh/install.sh | bash

Requires Node.js 18 or later. The installer downloads pre-built binaries to /usr/local/bin.

Setup

  1. Create an account if you haven't already.
  2. Go to Settings and create an API key.
  3. Add to your shell profile (~/.zshrc, ~/.bashrc, etc.):
export MARKDOCS_API_KEY=mdk_your_key_here
export MARKDOCS_URL=https://markdocs.sh

Commands

Documents

# List all documents
markdocs list

# Create a new document
markdocs create "My Document"

# Create from a file
markdocs create "README" --file ./README.md

# View document details
markdocs view <document-id>

# Open in browser
markdocs open <document-id>

# Delete a document
markdocs delete <document-id>

Comments

# List comments on a document
markdocs comment list <document-id>

# Add a comment
markdocs comment add <document-id> \
  --content "This needs clarification" \
  --from 42 --to 67

# Resolve a comment
markdocs comment resolve <comment-id>

# Delete a comment
markdocs comment delete <comment-id>

Suggestions

# List suggestions
markdocs suggest list <document-id>

# Add a suggestion
markdocs suggest add <document-id> \
  --original "old text" \
  --suggested "new text" \
  --from 10 --to 18

# Accept a suggestion
markdocs suggest accept <suggestion-id>

# Reject a suggestion
markdocs suggest reject <suggestion-id>

History

# View edit history
markdocs history <document-id>

MCP Server

# Start the MCP server (stdio transport)
markdocs mcp

Examples

Create and comment workflow

# Create a doc
markdocs create "Sprint Planning"

# Output: Document created: 8f4a2b...

# Add a comment
markdocs comment add 8f4a2b... \
  --content "Should we break this into smaller tasks?" \
  --from 0 --to 50

# List comments
markdocs comment list 8f4a2b...

Suggestion review workflow

# List pending suggestions
markdocs suggest list <doc-id>

# Accept the good ones
markdocs suggest accept <suggestion-id>

# Reject the rest
markdocs suggest reject <suggestion-id>