@thothica/docs-cli
v1.1.0
Published
Command-line tool and MCP server for Thothica Docs: let any AI agent read, create, edit, and comment on native .docx documents.
Maintainers
Readme
@thothica/docs-cli (thd)
Command-line tool and MCP server for Thothica Docs.
Log in without pasting a key, then read, create, edit, and comment on native
.docx documents from the terminal or an AI agent.
Zero runtime dependencies. Node >= 18.
Install
npm install -g @thothica/docs-cli
# or from the repo: npm install -g ./cli
# or run without installing: npx @thothica/docs-cli <command>Log in
thd loginThis starts a device-authorization flow: it opens the browser, the user signs in and approves, and a key is minted and stored in the operating system keychain. No key is ever pasted or printed.
Where the key is stored:
- macOS: the login keychain (via
security) - Linux: the Secret Service / libsecret (via
secret-tool), if present - Windows: DPAPI, encrypted per user
- Fallback (no keychain): a machine-bound AES-256-GCM encrypted file at
~/.config/thothica-docs/, mode0600. Never plaintext.
For CI or headless use, set THOTHICA_DOCS_TOKEN instead of logging in.
Commands
thd login [--client-name NAME] [--no-open] Log in via the browser
thd logout Remove the stored credential
thd whoami Show the signed-in account
thd doc ls [-q QUERY] [--shared] [--json] List / search documents
thd doc new "Title" [--md FILE|-] Create (markdown body, or --template ID)
thd doc upload FILE.docx [--folder id|name] Upload an existing .docx (optional --title)
thd doc cat ID [--text] Print content (markdown by default)
thd doc get ID [-o FILE] Download the real .docx
thd doc set ID --md FILE|- [--force] Replace content from markdown
thd doc mv ID (--folder id|name | --root) Move a document into a folder
thd doc rm ID [--permanent] Trash (or delete) a document
thd folder ls List your folders
thd folder new "Name" [--parent id|name] Create a folder
thd comment ls ID List comments inside the document
thd comment add ID "text" [--anchor "..."] Add a comment (optional --reply-to ID)
thd templates List document templates
thd mcp-config [--client NAME] Print connector config for MCP clients
thd open [ID] Open the app (or a document) in the browser
thd mcp Run the MCP server (for AI agents) over stdioGlobal flags: --origin URL (target another deployment), --json (machine
output). Environment: THOTHICA_DOCS_TOKEN, THOTHICA_DOCS_ORIGIN.
MCP server
thd mcp speaks the Model Context Protocol over stdio, exposing documents as
tools for AI agents. See AGENTS.md for per-client configuration
(Claude Code, Cursor, Codex, opencode). The server reads the credential stored by
thd login, or THOTHICA_DOCS_TOKEN.
Examples
# create a document from a markdown file
thd doc new "Q3 plan" --md plan.md
# pipe markdown in
echo "# Notes\n\n- one\n- two" | thd doc new "Notes" --md -
# read it back as markdown
thd doc cat DOC_ID
# comment on a phrase
thd comment add DOC_ID "Please expand this." --anchor "next quarter"
# download the .docx
thd doc get DOC_ID -o q3-plan.docxLicense
AGPL-3.0.
