Anydocs Documents
Quick Start

Working with Codex

Learn how to use Anydocs with Codex for AI-assisted documentation writing.

The recommended way to connect Anydocs to Codex is: register `@anydocs/mcp`, initialize the project with the CLI, and let Codex perform page, navigation, and status work through MCP. Unless you are developing Anydocs itself, you do not need a source-based setup.

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 Codex project.

codex mcp add anydocs -- npx -y @anydocs/mcp

Run `codex mcp list` to confirm the server is registered.

2. Initialize a Codex-Friendly Project

npx @anydocs/cli init ./my-docs --agent codex

This generates `AGENTS.md` in the project root as the minimal Codex guide.

3. What the AI Should Do in Codex

Have Codex prefer Anydocs MCP for these tasks:

  • open the project and read the contract
  • create pages and update content
  • maintain navigation
  • switch page status
  • run validation before delivery, then decide whether to use `preview` or `build`

That keeps the work inside canonical validation and templating rules instead of treating `pages/*.json` or `navigation/*.json` as the primary interface.

4. When to Preview and When to Build

Use `preview` to inspect the real reader output. Use `build` to produce the final static site, search indexes, and AI artifacts. Both surfaces expose only `published` pages.

npx @anydocs/cli preview ./my-docs
npx @anydocs/cli build ./my-docs