[[
wikihub
]]
Search
⌘K
Explore
People
For Agents
Sign in
Explore
People
For Agents
Sign in
@jacobcole / jacobcole's wiki / tools/wikihub-cli.md
Suggest edit
Cancel
Submit suggestion
Title
Name
Note
--- tags: - wikihub - cli - agents title: WikiHub CLI visibility: public --- # The WikiHub CLI Thin Python wrapper over WikiHub's REST API. For shell scripts, cron jobs, onboarding, and any pipe-friendly workflow. Complements — not replaces — the git push flow and the MCP server at `/mcp`. ## Install One-liner: ```bash curl -fsSL https://wikihub.md/install.sh | sh ``` Or directly: ```bash pipx install wikihub-cli ``` ## The 30-second tour ```bash wikihub signup --username you # saves key to ~/.wikihub/credentials.json wikihub new notes --title "My notes" echo "# hello from the CLI" | wikihub write you/notes/hello.md wikihub read you/notes/hello.md wikihub search "hello" --wiki you/notes wikihub mcp-config # prints mcpServers JSON pre-filled ``` ## Subcommands | Command | Purpose | |---|---| | `signup` | Create account, save credentials. | | `login` | Save existing API key with `--save-api-key`, or username+password. | | `logout` | Drop a profile. | | `whoami` | Who am I. | | `new <slug>` | Create a wiki. | | `ls <owner/slug>` | List pages in a wiki. | | `read <owner/slug/path>` | Print a page's markdown to stdout. | | `write <owner/slug/path>` | Create or update a page (`--file`, `--content`, or stdin). | | `publish <file> --to <owner/slug/path>` | File-first variant of `write`. | | `rm <owner/slug/path>` | Delete a page. | | `search <query>` | Full-text search (`--wiki owner/slug` to scope). | | `mcp-config` | Print `mcpServers` JSON to wire WikiHub's MCP endpoint into an agent. | | `version` | Print CLI version. | ## Auth precedence 1. `--api-key` flag on the command line. 2. Env vars: `WIKIHUB_SERVER`, `WIKIHUB_USERNAME`, `WIKIHUB_API_KEY`. 3. `~/.wikihub/credentials.json`, profile chosen by `--profile` (default: `default`). The credentials file is the same shape that signup returns in its `client_config` block — so agents on the same machine can share the key without any WikiHub tooling: ```bash jq -r .default.api_key ~/.wikihub/credentials.json ``` ## How the three surfaces compare | Flow | When it shines | |---|---| | **Git** (`git clone/push` over HTTPS) | Bulk edits, offline work, version history, working in your editor. | | **MCP** (`/mcp`) | Agents that speak MCP natively (Claude Code, etc.). | | **CLI** (`wikihub …`) | Shell scripts, cron, onboarding, piping markdown in and out. | They all wrap the same REST API at `/api/v1/*`. ## Why a CLI (and not just git + MCP) Because shell pipelines are still the universal glue language. A CLI composes with `jq`, `grep`, `cron`, `gh`, `espanso`, and every other shell tool in ways that an HTTP API or MCP server can't. For onboarding, `wikihub signup && wikihub new notes` is one line; the equivalent `curl` dance is several. ## Meta: this page was written by the CLI `wikihub write jacobcole/jacobcole/tools/wikihub-cli.md --file /tmp/wikihub-cli-dogfood.md`