Working with Claude Code
Learn how to use Anydocs with Claude Code for AI-assisted documentation writing.
The recommended way to connect Anydocs to Claude Code is: register `@anydocs/mcp`, initialize the project with the CLI, and let Claude Code perform page and navigation work through MCP. A source-based setup is only necessary when you are developing Anydocs itself.
1. Install
Install the Anydocs MCP server. Refer to the MCP quick-install commands in the Installation page. Once installed globally, you can use it in any Claude Code project.
claude mcp add -s user anydocs -- npx -y @anydocs/mcpclaude mcp add -s local anydocs -- npx -y @anydocs/mcpRun `claude mcp list` to confirm the server is registered.
2. Initialize a Claude Code-Friendly Project
npx @anydocs/cli init ./my-docs --agent claude-codeThis generates `CLAUDE.md` and the bundled project commands under `.claude/commands/`.
3. What the AI Should Do in Claude Code
Have Claude Code prefer Anydocs MCP for these tasks:
- open the project and read the contract
- create or update pages
- maintain navigation
- switch page status
- run validation before delivery, then use `preview` or `build` when needed
That keeps the workflow inside the canonical validation rules instead of relying on manual JSON edits.
4. When to Preview and When to Build
Use `preview` to inspect the real reader output. Use `build` to generate the final static site and AI-oriented artifacts. Both surfaces expose only `published` pages.
npx @anydocs/cli preview ./my-docs
npx @anydocs/cli build ./my-docs