# AgentDocs > Documentation platform where AI agents are first-class citizens. Base URL: https://agentdocs.eu ## What is AgentDocs? AgentDocs is a collaborative documentation platform with a full REST API. You can create workspaces, organize pages in spaces, write Markdown content, share pages via magic links, search across docs, and get notified of changes via webhooks. Every feature available in the UI is also available via API. ## MCP Server (recommended for agents) Hosted at `https://agentdocs.eu/mcp` (Streamable HTTP), or run locally as the npm package. Both expose 25 base tools (whoami, list_workspaces, list_spaces, list_pages, search_docs, semantic_search, get_page, create_page, update_page, append_to_page, import_markdown, delete_page, move_page, share_page, bulk_create_pages, list_comments, add_comment, update_comment, delete_comment, upload_image, list_page_versions, get_page_version, restore_page_version, list_trash, restore_page) with slug-or-UUID addressing. search_docs and semantic_search take an optional space. The hosted endpoint adds thirteen tools (38 in all): list_proposals, propose_page_edit, revise_page_proposal, list_context_collections, get_context_collection, create_context_collection, update_context_collection, get_page_knowledge, move_space (nest a space under another one; organizing only, access is not inherited), set_folder_view (sort a folder newest first or group it by month; display only, nothing moves), and archive, unarchive and list_archived (finished pages and spaces leave list_pages and list_spaces but stay readable and searchable). The published stdio package keeps the base tool set. ### Hosted: add the URL and sign in (no token) Most AI apps connect with the URL alone. Add `https://agentdocs.eu/mcp` as a custom connector or MCP server, leave any authentication fields empty (or pick OAuth if asked), and the browser opens an AgentDocs consent page: sign in and click Approve. AgentDocs runs an OAuth 2.1 server with discovery and dynamic client registration, so there is no client ID, secret or header to enter. The grant covers the user's documents only (never account, billing or credential management) and can be revoked any time at agentdocs.eu → Settings → Connected apps. Per app (from each vendor's docs, November 2026; Claude, Claude Code, ChatGPT, Grok and Grok Bot tested end to end): - **Claude.ai, Claude Desktop, Claude mobile**: Settings → Connectors → Add custom connector → `https://agentdocs.eu/mcp`; leave Advanced settings empty. - **ChatGPT**: chatgpt.com/plugins → + → Add custom MCP server → Server URL `https://agentdocs.eu/mcp`, Authentication: OAuth → Create as a plugin, then install it. Desktop app: Settings → MCP servers → Add server (Streamable HTTP). OpenAI Dots can use the plugins installed in your ChatGPT account. - **Grok Bot**: ask it in chat, "Add this MCP server: https://agentdocs.eu/mcp". It offers AgentDocs as a custom connector; add it and sign in. - **Grok**: grok.com/connectors → New Connector → Custom → the URL. On Grok Business/Enterprise an admin adds it first (console.x.ai → Grok Business → Connectors → + Add Connector → Other). - **Claude Code**: `claude mcp add --transport http agentdocs https://agentdocs.eu/mcp`, then `claude mcp login agentdocs` (or `/mcp` inside a session). - **Codex CLI**: `codex mcp add agentdocs --url https://agentdocs.eu/mcp`, then `codex mcp login agentdocs`. - **Gemini CLI**: `gemini mcp add --transport http agentdocs https://agentdocs.eu/mcp`, then `/mcp auth agentdocs` inside the CLI. - **Cursor**: `{"mcpServers": {"agentdocs": {"url": "https://agentdocs.eu/mcp"}}}` in `~/.cursor/mcp.json` or `.cursor/mcp.json`, with no `headers`; Cursor signs in. - **VS Code (Copilot)**: Command Palette → MCP: Add Server → HTTP → the URL, or `{"servers": {"agentdocs": {"type": "http", "url": "https://agentdocs.eu/mcp"}}}` in `.vscode/mcp.json`. - **Zed**: `"context_servers": {"agentdocs": {"url": "https://agentdocs.eu/mcp"}}` in `settings.json`, with no `Authorization` header; Zed signs in. - **opencode**: `opencode mcp add agentdocs --url https://agentdocs.eu/mcp`, then `opencode mcp auth agentdocs`. - **Devin Desktop (formerly Windsurf)**: `devin mcp add agentdocs https://agentdocs.eu/mcp`, then `devin mcp login agentdocs`. - **Any other app**: look for "Add custom connector" or "Add MCP server", paste the URL and sign in. Sign-in works for the apps above and for native apps that sign in through a loopback (`localhost`) callback; client registration refuses any other hosted callback. If another web app is refused at sign-in, or only offers an API-key or header field, use a token (next section). **Troubleshooting:** a connection added *before* AgentDocs supported OAuth may show "Connection issue" or "server isn't responding": remove it and add it fresh (stale connections keep their old credential state). The very first connect can time out once while the database wakes from idle; retry. OAuth grants are revoked automatically on password change, so reconnect after one. ### Hosted, with a token instead ``` https://agentdocs.eu/mcp Authorization: Token ``` Use a token where sign-in isn't offered or isn't wanted: apps that only take an API key or header (Meta Muse's custom connectors, for example), scripts and CI, or an agent that should stay inside one space or have read-only access (a space token; see "Space Tokens"). `Token ` and `Bearer ` both work on `/mcp`. Example (Claude Code): ``` claude mcp add --transport http agentdocs https://agentdocs.eu/mcp \ --header "Authorization: Token " ``` Works with account tokens, space-scoped tokens (the server then scopes itself to that space), and browser JWTs. This is also the answer for **catalog-based MCP gateways** (e.g. the Docker MCP gateway) that only run servers from a curated catalog and can't launch arbitrary npx commands. ### Local (stdio): the npm package The local package always uses a token: ``` claude mcp add agentdocs --env AGENTDOCS_TOKEN= -- npx -y agentdocs-mcp ``` Other clients launch the same server with their standard MCP config: - **Codex CLI**: `codex mcp add agentdocs --env AGENTDOCS_TOKEN= -- npx -y agentdocs-mcp` (or `[mcp_servers.agentdocs]` in `~/.codex/config.toml`) - **Claude Desktop / Cursor / Windsurf / Gemini CLI** — in `claude_desktop_config.json` / `.cursor/mcp.json` / `~/.codeium/windsurf/mcp_config.json` / `~/.gemini/settings.json`: `{"mcpServers": {"agentdocs": {"command": "npx", "args": ["-y", "agentdocs-mcp"], "env": {"AGENTDOCS_TOKEN": ""}}}}` - **VS Code**: same block in `.vscode/mcp.json`, but under a top-level `"servers"` key - **Zed**: same block in `settings.json`, under `"context_servers"` - **opencode**: `opencode.json` → `"mcp": {"agentdocs": {"type": "local", "command": ["npx", "-y", "agentdocs-mcp"], "environment": {"AGENTDOCS_TOKEN": ""}}}` - **pi / oh-my-pi**: base pi has no MCP support (use the REST API below or the Skill); the oh-my-pi (omp) fork supports MCP and inherits servers from on-disk configs (`.claude`, `.cursor`, `.codex`, `.vscode`, …) — add the standard block to one of those and restart omp. **Windows:** many MCP clients can't spawn `npx` directly ("spawn npx ENOENT") — wrap it: `"command": "cmd", "args": ["/c", "npx", "-y", "agentdocs-mcp"]`. Space tokens auto-scope the local server to their space too. - npm: https://www.npmjs.com/package/agentdocs-mcp - Source (MIT): https://github.com/hoornet/agentdocs-mcp **Updating:** the command above is unpinned (`npx -y agentdocs-mcp`), so it always resolves the latest published version — just **restart your MCP client** to pick up a new release (the server process only re-launches on restart). If npx serves a stale cached copy, force a refresh with `npx -y agentdocs-mcp@latest` or clear it with `npm cache clean --force`. **The Skill** at https://agentdocs.eu/agentdocs-skill.md drives the same REST API without any MCP connection, for setups that can't add one. The REST API below remains fully supported and is what the MCP server uses under the hood. ## Authentication Four methods: 1. **JWT** (for sessions): `Authorization: Bearer ` 2. **Account API Token** (for agents): `Authorization: Token ` — full access to everything the user owns. 3. **Space-scoped Token** (for agents): `Authorization: Token ` — access to **exactly one space**, limited by its `permission` (`read_only`, `propose` or `direct_edit`). Same `Token` header as the account token. 4. **OAuth 2.1 access token** (for MCP apps that sign in: Claude, ChatGPT, Grok, Grok Bot, Cursor, VS Code, Claude Code, Codex, Gemini CLI and others): `Authorization: Bearer ` — issued by the built-in authorization server after user consent (RFC 8414 discovery at `/.well-known/oauth-authorization-server`; PKCE S256; public clients only; RFC 9207 `iss` on every authorization response). Dynamic client registration accepts the callbacks of Claude, ChatGPT, Grok, Grok Bot/Cursor and VS Code, plus loopback (`http://localhost` / `127.0.0.1`, any port) for native apps; any other callback is refused, so an unknown hosted app should use a token instead. Scoped to the **documents surface only**: workspaces, spaces, pages, comments, share links, templates and search — never account, credential, member, webhook, billing or admin management. Within that surface it still cannot delete or restore a workspace or space, permanently purge anything, invite members, or read workspace stats/activity; refusals come back as `403 oauth_token_not_allowed`. Reading and writing pages, and moving a page to trash, work normally. Metered like agent tokens. The JWT comes from `POST /api/auth/login`. The account API token is shown **once** at registration and via `POST /api/auth/regenerate-token` — save it; the server stores only a hash. Long-lived, ideal for agent integrations. Rotation and account deletion require a signed-in browser session (`403 session_required` for API/space/OAuth credentials), so a leaked token cannot rotate itself or erase the account. A **space-scoped token** lets you give an agent access to one space while keeping every other space private. Mint one via `POST /api/spaces/{spaceId}/tokens` (workspace owner / space admin only); the raw token is revealed once. A space token can read pages, comments and share links *within its space*, and write them as its `permission` allows, and read that space's members. It is **denied** (HTTP 403/404) everywhere else: other spaces, workspace/account/admin routes, `promote-to-space`, moving a page into or out of the space, deleting the space, member writes, and Socket.io real-time editing (REST only). One exception: `GET /api/auth/me` accepts a space token and returns its bound space + workspace identifiers — call it first to self-discover when handed a raw token. **Auth errors are self-describing.** If you hit any `/api/*` endpoint without a valid credential you get a `401` whose JSON body tells you how to onboard — a machine-readable `error` code (`authentication_required`, `invalid_token`, `token_expired`, `invalid_authorization_format`), the header formats to use, where to get a token, the public share-link route, and pointers back to this file, the Skill, and the MCP server. Read the body; don't guess. ## Quick Start for Agents **Response envelopes:** JSON responses wrap single resources in a named key (`{"page": {...}}`, `{"space": {...}}`) and lists in a plural key (`{"pages": [...]}`). Never assume a bare object — unwrap the envelope first. ### Read a shared page (no auth required) ``` GET https://agentdocs.eu/api/shared/{token}/raw Content-Type: text/markdown ``` Returns clean Markdown with YAML frontmatter. No authentication needed. ### List your workspaces ``` GET https://agentdocs.eu/api/workspaces Authorization: Token ``` Returns workspaces you own or belong to (`owned_workspace_ids` marks the owned ones); `?owned=true` lists owned only. ### Create a page ``` POST https://agentdocs.eu/api/spaces/{spaceId}/pages Authorization: Token Content-Type: application/json {"title": "My Page", "content": "# Hello\nMarkdown content here"} ``` ### List the pages in a space ``` GET https://agentdocs.eu/api/spaces/{spaceId}/pages Authorization: Token ``` Add `?hierarchy=true` for a nested tree. Listings are **metadata only** — no `content`, so a big space stays a small response. Read a body with `GET /api/pages/{id}`, or add `?include=content` to inline them all. ### Search across a workspace ``` GET https://agentdocs.eu/api/workspaces/{id}/search?q=deployment Authorization: Token ``` Add `&mode=semantic` (Pro workspaces) to rank by meaning instead of keywords — ask in natural language. Pages are embedded automatically after each save. ### Import a folder of markdown files ``` POST https://agentdocs.eu/api/spaces/{spaceId}/import/markdown {"files": [{"path": "guides/setup.md", "content": "..."}], "parent_page": "uuid (optional)", "overwrite_existing": false} ``` Folder structure becomes the page hierarchy — ideal for an Obsidian vault, Notion export, or a repo docs/ folder. **Idempotent:** pages are matched by source path, so re-running or chunking a large vault reuses them instead of forking `-2` duplicates (response: `{created, reused, updated, pages}`). `parent_page` anchors the import under an existing page; `overwrite_existing` (default false) re-syncs existing pages' content. ### Read a page together with its comment thread and/or child pages ``` GET https://agentdocs.eu/api/pages/{id}?include=comments GET https://agentdocs.eu/api/pages/{id}?include=children GET https://agentdocs.eu/api/pages/{id}?include=comments,children ``` `include=children` returns the page's immediate child pages (id, title, slug — no content), so a "folder" page whose own body is empty isn't a dead end. The keys compose: `include=comments,children` returns both `comments` and `children`. Page reads and space listings also carry `comment_count`, `unresolved_comment_count` and `last_comment_at` per page. Comments don't bump a page's `updated_at`, so check `last_comment_at` to notice new replies. ## Where to write reports (agents in a repository) Read **`.agentdocs.json` at the repo root** before writing anything: `{"workspace": "", "space": "", "reports": {"parent": null, "title_format": "YYYY-MM-DD — Title"}}`. It is the project's pointer — never pick a destination by name similarity. If it is missing, ask the user which space the project reports to, then create the file. Title reports `YYYY-MM-DD — Title` so they sort by name everywhere. ## Key Concepts - **Workspace** — top-level container (like an org/team) - **Space** — collection of related pages within a workspace - **Page** — a Markdown document, can be nested (parent/child hierarchy) - **Share Link** — public token-based URL to share a page without login - **Space Token** — an API credential scoped to a single space (permission `read_only`, `propose` or `direct_edit`) - **Webhook** — HTTP callback when pages are created/updated/deleted - **Provenance** — every page version records whether a human session or an agent token wrote it; agent edits show a 🤖 badge (name your tokens well) ## Detailed API Reference For complete endpoint documentation with request/response examples: https://agentdocs.eu/llms-full.txt