Contextual menu
The Copy page button in every page header is a split button with a dropdown. It is how readers hand a page to an AI assistant: copy it as Markdown, open it in ChatGPT or Claude, or install the site's MCP server. You choose which options appear, in which order, and you can add your own links.
Choose the options
Set contextual in docslit.json to a list. The first option is the main button, and the rest fill the dropdown:
| Option | What it does | Needs url |
|---|---|---|
copy |
Copies the page as Markdown | No |
view-markdown |
Opens the page's .md source in a new tab |
No |
chatgpt |
Opens ChatGPT with a prompt that points at the published page | Yes |
claude |
Opens Claude with a prompt that points at the published page | Yes |
perplexity |
Opens Perplexity with a prompt that points at the published page | Yes |
mcp |
Copies an npx command that installs the site's MCP server |
Yes |
claude-code |
Opens Claude Code with a prompt that points at the published page (claude://code/new?q=) |
Yes |
codex |
Opens Codex with a prompt that points at the published page (codex://threads/new?prompt=) |
Yes |
cursor-mcp |
Installs the site's MCP server in Cursor with a cursor://anysphere.cursor-deeplink/mcp/install link |
Yes |
vscode-mcp |
Installs the site's MCP server in VS Code with a vscode:mcp/install link |
Yes |
The assistant options link to the published page, so they need url in docslit.json. Without it they are left out. The spellings copy-page, view, view-as-markdown, markdown and add-mcp are accepted as aliases.
claude-code, codex, cursor-mcp and vscode-mcp are opt-in. The menu shows them as "Open in Claude Code", "Open in Codex", "Install MCP in Cursor" and "Install MCP in VS Code". The two install links add a server that runs npx -y docslit mcp <site URL>. The site URL includes basePath, and the server name is the slugified site name plus -docs. These links open the installed app instead of a new tab.
If you do not set contextual, readers get copy, chatgpt, claude and mcp.
Add a custom option
A custom option is an object with a title and an href. Add a description and an icon if you like:
The href can use these placeholders, which are URL-encoded for you:
| Placeholder | Value |
|---|---|
{url} |
The published URL of the page |
{markdown_url} |
The URL of the page's Markdown source |
{title} |
The page title |
{path} |
The page path, such as /guides/install |
The icon takes any icon. When you omit it, a link icon is used. Links that start with http open in a new tab.
Change it for one page
A page can replace the menu with its own contextual list in frontmatter:
Use contextual: false to remove the menu from a page, or hide_actions: true, which also hides the rest of the page actions.
Turn it off everywhere
The object form { "options": [...] } is accepted too.
Check the configuration
docslit validate reports an unknown option name or a custom option without a title or href as contextual-option-invalid, and tells you which entry to fix.
Next steps
- Let agents read your docs directly with the MCP server
- See how agents consume Markdown in Reading docs as an agent
- Adjust the rest of the page header in Page layout