Doccupine is an open-source CLI that turns a directory of MDX files into a full-featured Next.js documentation website. Write your docs in Markdown, and Doccupine watches for changes, generates pages, and starts a live dev server automatically.
- Live preview - watches your MDX files and regenerates pages on every save
- Auto-generated navigation - sidebar built from frontmatter (
category,order) - Sections - organize docs into tabbed sections via frontmatter or
sections.json - Theming - dark/light mode with customizable theme via
theme.json - AI chat assistant - built-in RAG-powered chat (OpenAI, Anthropic, or Google)
- MCP server - exposes
search_docs,get_doc, andlist_docstools for AI agents - Custom fonts - Google Fonts or local fonts via
fonts.json - Static assets -
public/directory is watched and synced to the generated app - Zero config to start -
npx doccupinescaffolds everything and starts the server
Make sure you have Node.js (v22+) installed.
npx doccupineDoccupine will prompt you for:
- A directory to store your MDX files (default:
docs) - An output directory for the generated Next.js app (default:
nextjs-app)
It then scaffolds the app, installs dependencies, and starts the dev server. Open http://localhost:3000 to view your docs.
doccupine watch [options] # Default. Watch MDX files and start dev server
doccupine build [options] # One-time build without starting the server
doccupine config -show # Show current configuration
doccupine config -reset # Re-prompt for configuration| Flag | Description |
|---|---|
--port <port> |
Port for the dev server (default: 3000). Auto-increments if taken. |
--verbose |
Show all Next.js output including compilation details |
--reset |
Re-prompt for watch/output directories |
Each MDX file supports these frontmatter fields:
---
title: "Page Title"
description: "Page description for SEO"
category: "Getting Started"
categoryOrder: 0 # Sort order for the category group
order: 1 # Sort order within the category
name: "My Docs" # Override site name in title suffix
icon: "https://..." # Page favicon URL
image: "https://..." # OpenGraph image URL
date: "2025-01-01" # Page date metadata
section: "API Reference" # Section this page belongs to
sectionOrder: 1 # Sort order for the section in the tab bar
---Navigation is auto-generated from category, categoryOrder, and order. Pages without a category appear ungrouped.
Use sectionLabel on your root index.mdx to rename the default "Docs" tab:
---
title: "Welcome"
sectionLabel: "Guides"
---Sections let you split your docs into separate tabbed groups (e.g. "Docs", "API Reference", "SDKs"). There are two ways to configure them:
Add a section field to your MDX files. The section slug is derived from the label automatically. Use sectionOrder to control tab order (lower numbers appear first):
---
title: "Authentication"
section: "API Reference"
sectionOrder: 1
---Pages without a section field stay at the root URL under the default "Docs" tab.
For full control, create a sections.json file in your project root:
[
{ "label": "Docs", "slug": "" },
{ "label": "API Reference", "slug": "api" },
{ "label": "SDKs", "slug": "sdks" }
]Each entry has:
label- display name shown in the section barslug- URL prefix for this section (use""for the root section)directory(optional) - subdirectory containing this section's MDX files, only needed when the directory name differs from the slug
[
{ "label": "Guides", "slug": "", "directory": "guides" },
{ "label": "API Reference", "slug": "api", "directory": "api-reference" }
]Place these JSON files in your project root (where you run doccupine). They are auto-copied to the generated app and watched for changes.
| File | Purpose |
|---|---|
doccupine.json |
CLI config (watchDir, outputDir, port). Auto-generated on first run. |
config.json |
Site metadata: name, description, icon, image URL |
theme.json |
Theme overrides for cherry-styled-components |
navigation.json |
Manual navigation structure (overrides auto-generated) |
links.json |
Static header/footer links |
fonts.json |
Font configuration (Google Fonts or local) |
sections.json |
Section definitions for tabbed doc groups (see Sections) |
analytics.json |
Analytics provider configuration (PostHog supported) |
Place static assets (images, favicons, robots.txt, etc.) in a public/ directory at your project root. Doccupine copies it to the generated Next.js app on startup and watches for changes, so added, modified, or deleted files are synced automatically.
The generated app includes an AI chat assistant. To enable it, create a .env file in the generated app directory:
LLM_PROVIDER=openai # openai | anthropic | google
# API Keys (set the one matching your provider)
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GOOGLE_API_KEY=...If LLM_PROVIDER is not set, the chat component is hidden automatically.
Note: Anthropic does not provide an embeddings API. When using
anthropicas your provider, you must also setOPENAI_API_KEYfor embeddings to work.
LLM_CHAT_MODEL=gpt-4.1-nano # Override the default chat model
LLM_EMBEDDING_MODEL=text-embedding-3-small # Override the default embedding model
LLM_TEMPERATURE=0 # Set temperature (0-1, default: 0)Default models per provider:
| Provider | Chat model | Embedding model |
|---|---|---|
| OpenAI | gpt-4.1-nano |
text-embedding-3-small |
| Anthropic | claude-sonnet-4-5-20250929 |
OpenAI fallback |
gemini-2.5-flash-lite |
gemini-embedding-001 |
The generated app exposes an MCP endpoint at /api/mcp with three tools:
search_docs- semantic search across all documentationget_doc- retrieve a specific document by pathlist_docs- list all available documents
This lets AI agents (Claude, ChatGPT, etc.) query your docs programmatically. Requires the AI chat setup above for embeddings.
This project is licensed under a modified MIT license with a SaaS restriction. See LICENSE for details.