CLI
The MarkDocs CLI lets you manage documents, comments, suggestions, and sharing from the terminal.
Install
curl -fsSL https://markdocs.sh/install.sh | bashOr build from source:
cd cli && npm install && npm run bundle
# Binary at cli/bundle/markdocs.cjsSetup
Signup
markdocs signup --url https://markdocs.yourdomain.com --handle yourhandle --name "Your Name"
markdocs setupCreates a new account, logs you in, and after setup generates an API key. Everything is saved to ~/.markdocs/config.json.
If your instance requires an invite code:
markdocs signup --url https://markdocs.yourdomain.com --handle yourhandle --invite CODELogin
markdocs login --url https://markdocs.yourdomain.com --handle yourhandle
markdocs setupIf you already have an account, log in and create an API key. All subsequent commands use it automatically.
Environment Variables
Alternatively, set your API key and server URL directly:
export MARKDOCS_API_KEY=your-api-key
export MARKDOCS_URL=https://markdocs.yourdomain.com # or http://localhost:3001Generate an API key from the Settings page in the MarkDocs dashboard.
Commands
Documents
# List all documents
markdocs list
# Create a new document
markdocs create "My Document"
markdocs create "From File" --file ./draft.md
# View document metadata
markdocs view <doc-id>
# Open in browser
markdocs open <doc-id>
# Delete a document
markdocs delete <doc-id>Content
# Print markdown content to stdout
markdocs content <doc-id>
# Pipe to a file
markdocs content <doc-id> > doc.md
# Update content (full replace)
markdocs edit <doc-id> --content "# New heading"
markdocs edit <doc-id> --file ./updated.mdText-Based Editing
Find and replace text by content, no character positions needed:
# Find and replace text
markdocs replace <doc-id> --find "old text" --replace "new text"Comments
# List comments (flat)
markdocs comment list <doc-id>
# List as threaded conversations
markdocs comment threads <doc-id>
# Add a comment anchored to text (text-based targeting)
markdocs comment add <doc-id> --content "Fix this typo" --on "the text to anchor on"
# Add a comment at a position range (position-based)
markdocs comment add <doc-id> --content "Fix this typo" --from 10 --to 20
# Reply to a comment thread
markdocs comment reply <comment-id> --content "Good point, fixed."
# Reply and resolve the thread
markdocs comment reply <comment-id> --content "Done." --resolve
# Resolve a comment
markdocs comment resolve <comment-id>
# Unresolve a comment
markdocs comment unresolve <comment-id>
# Delete a comment
markdocs comment delete <comment-id>Suggestions
# List suggestions
markdocs suggest list <doc-id>
# Propose a text replacement (text-based targeting)
markdocs suggest add <doc-id> --find "old text" --replace "new text"
# Propose a text replacement (position-based)
markdocs suggest add <doc-id> --original "old text" --suggested "new text" --from 0 --to 8
# Accept or reject
markdocs suggest accept <suggestion-id>
markdocs suggest reject <suggestion-id>Sharing
# List all users in the workspace
markdocs users
# List collaborators on a document
markdocs share list <doc-id>
# Share with a user
markdocs share add <doc-id> @john
markdocs share add <doc-id> @jane --role viewer
# Remove a collaborator
markdocs share remove <doc-id> <collaborator-id>History
# View edit history
markdocs history <doc-id>Auth
# Create a new account
markdocs signup --url https://your-instance.com --handle yourhandle --name "Your Name"
# Log in to an existing account
markdocs login --url https://your-instance.com --handle yourhandle
# Create an API key (after signup or login)
markdocs setup
# Check auth status
markdocs whoami
# Log out and clear credentials
markdocs logoutMCP Server
# Start the MCP server (stdio transport, used by MCP clients)
# You typically don't run this directly — your MCP client spawns it.
# See /docs/mcp for setup.
markdocs mcpLast updated on