docmost-community-mcp
# docmost-community-mcp
[](https://www.npmjs.com/package/docmost-community-mcp)
[](https://www.npmjs.com/package/docmost-community-mcp)
[](LICENSE)
[](package.json)
[](https://glama.ai/mcp/servers/dilruwanm/docmost-community-mcp)
Model Context Protocol (MCP) server for self-hosted [Docmost](https://docmost.com) **Community / Open Source Edition**. Lets Claude, Cursor or any MCP client search, read, write and organize your wiki.
Docmost's official MCP server and API keys are Enterprise-only. This server talks to the same internal HTTP API the Docmost web app uses, so it works on the free edition.
Source: [github.com/dilruwanm/docmost-community-mcp](https://github.com/dilruwanm/docmost-community-mcp)
## Quick start
You need Docmost **v0.71+** (verified on **v0.96.0**), Node.js **20+**, and a Docmost user for the AI to sign in as. A dedicated user is best: the AI can do anything that user can.
**Claude Code:**
```bash
claude mcp add docmost --env DOCMOST_URL=https://docs.example.com --env DOCMOST_EMAIL=you@example.com --env DOCMOST_PASSWORD=your-password -- npx -y docmost-community-mcp
```
**Cursor, Claude Desktop and other clients:** add this to the client's MCP config (for Cursor, `.cursor/mcp.json` or `~/.cursor/mcp.json`):
```json
{
"mcpServers": {
"docmost": {
"command": "npx",
"args": ["-y", "docmost-community-mcp"],
"env": {
"DOCMOST_URL": "https://docs.example.com",
"DOCMOST_EMAIL": "you@example.com",
"DOCMOST_PASSWORD": "your-password"
}
}
}
}
```
Restart the client, then ask something like "list my Docmost spaces". To let the AI read but never change anything, add `DOCMOST_READ_ONLY=true`. All settings are under [Environment](#environment).
## What you can ask it
- "Find our onboarding checklist and summarize it."
- "In the Release 2.4 page, set Alpha's State to Done in the Status table."
- "Add a Risks section under Plan with these three points."
- "Move every page under Drafts into the Archive space."
- "Show the open comments on the Q3 roadmap and reply to the question about dates."
- "Export the Engineering space as Markdown."
## Compatibility
| | |
|---|---|
| Docmost | Community / Open Source Edition, **v0.71+** for page writes; verified on **v0.96.0**. Older servers can read, and writes fail with a clear error. |
| Node.js | 20 or newer |
| MCP clients | Any client that runs stdio servers. Setups above for Claude Code, Claude Desktop and Cursor. |
| Transport | stdio |
This server uses Docmost's internal HTTP API (the one its web app uses), not a documented public API. A Docmost upgrade can change it; if a tool breaks after an upgrade, please [open an issue](https://github.com/dilruwanm/docmost-community-mcp/issues) with your Docmost version.
## Install from source
```bash
git clone https://github.com/dilruwanm/docmost-community-mcp.git
cd docmost-community-mcp
npm install
npm run build
```
Then point your client at the build instead of `npx`:
```json
{
"mcpServers": {
"docmost": {
"command": "node",
"args": ["/absolute/path/to/docmost-community-mcp/dist/index.js"],
"env": {
"DOCMOST_URL": "https://docs.example.com",
"DOCMOST_EMAIL": "you@example.com",
"DOCMOST_PASSWORD": "your-password"
}
}
}
}
```
## What you get
Official Enterprise MCP tool names, plus Community extras those docs omit.
**Pages:** `search_pages`, `get_page`, `create_page`, `update_page`, `edit_page`, `list_pages`, `list_child_pages`, `duplicate_page`, `copy_page_to_space`, `move_page`, `move_page_to_space`, `delete_page`, `restore_page`, `list_trash`, `get_page_history`, `get_history_version`, `get_breadcrumbs`, `get_backlinks`, `export_page`
**Spaces:** `list_spaces`, `get_space`, `create_space`, `update_space`, `delete_space`, `export_space`
**Comments:** `get_comments`, `create_comment`, `update_comment`, `delete_comment`
**Search / people:** `search_attachments`, `search_suggest`, `list_workspace_members`, `get_current_user`
**Files / labels / access:** `upload_attachment`, `get_attachment_info`, `list_page_labels`, `add_page_labels`, `remove_page_label`, `list_space_members`, `add_space_members`, `remove_space_member`, `update_space_member_role`
Page and comment bodies are **Markdown**. `update_page` goes through `POST /api/pages/update` with `format: "markdown"` so Docmost converts and applies the change in place. `edit_page` (below) edits the page's ProseMirror JSON instead, so untouched content is written back exactly as it was read. The server does not open a Yjs socket or invent its own TipTap schema.
## Editing part of a page
`update_page` replaces, appends or prepends a whole body. To change one part, use `edit_page`: it reads the page, applies your edits in memory and writes once. Tables, callouts, inline comments and every block you did not touch are sent back unchanged. If any edit fails, nothing is written.
```json
{
"page_id": "aB3dE5fG7h",
"expected_updated_at": "2026-11-21T12:00:00.000Z",
"edits": [
{ "mode": "replace_text", "old_text": "v1.0", "new_text": "v1.1" },
{ "mode": "replace_section", "heading": "## Status", "markdown": "Shipped." },
{ "mode": "insert_in_section", "heading": "Install", "markdown": "Requires Node 20." }
]
}
```
| Mode | What it does |
|---|---|
| `replace_text` | Replaces `old_text` with `new_text`. It must match exactly once, inside one paragraph, heading or list item, unless `replace_all` is set. Formatting around the match is kept. |
| `replace_section` | Keeps the heading and replaces everything under it, **subsections included**. Rename a heading with `replace_text`. |
| `insert_in_section` | Adds blocks to a section. `at: "end"` (default) is the end of the section's own body, before any subsection; `at: "start"` is right under the heading. |
| `insert_after_section` | Adds blocks after the section **and all its subsections**. |
| `delete_section` | Removes the heading, its body and its subsections. |
| `update_row` | Changes one table row. `values` sets cells by column header (`{"State": "Done"}`, case-insensitive); `cells` replaces every cell in order. |
| `insert_row` | Adds a row with `cells`, after the row matched by `after_row`, or at the end of the only table in scope. |
| `delete_row` | Removes the row matched by `row`. |
How table rows work:
- `row` and `after_row` match a row by the text of its **first cell** (exact, ignoring extra spaces). Header rows never match. No match, or more than one, is an error that lists the candidates. Pass `heading` to search one section only, for example when two tables share a row name.
- Cell values are one line of text with bold, italic, code and links. The number of `cells` must equal the table's columns. Tables with merged cells, and tables inside callouts or columns, are refused.
```json
{
"page_id": "aB3dE5fG7h",
"edits": [
{ "mode": "update_row", "row": "Alpha", "values": { "State": "Done" } },
{ "mode": "insert_row", "after_row": "Alpha", "cells": ["Gamma", "Gil", "Open"] },
{ "mode": "delete_row", "row": "Beta", "heading": "Status" }
]
}
```
How sections work:
- `heading` is the heading's text (case-insensitive), or `"## Text"` to pin the level. A missing heading, or a name that matches more than one section, is an error that lists the candidates.
- A section runs from its heading to the next heading of the same or higher level. Sections are flat: text sitting after a subsection's content belongs to that subsection. To add text to a parent section ahead of its subsections, use `insert_in_section`, not `insert_after_section`.
- Only top-level headings count; headings inside callouts or tables do not.
- New `markdown` supports headings, paragraphs, one-level bullet and numbered lists, fenced code, and bold, italic, code and links. Tables, blockquotes, callouts, images, nested or task lists and horizontal rules are refused with an error naming the construct. Use `replace_text` to change text inside existing rich content, and the row modes to change table rows.
- `expected_updated_at` (optional) refuses the write if the page changed since that `updatedAt`. There is still a small window between the check and the write.
## Reading less
`get_page` can return part of a page: `outline: true` lists the headings with offsets, `heading` returns one section as Markdown, and `max_chars` plus `offset` page through the body. Text longer than 40,000 characters is cut off with `truncated: true` and a `next_offset`; pass it back as `offset` to continue. `get_history_version` pages the same way. `format=json` bodies are not capped.
## Smaller responses
To save AI context, list and write results are slim by default (for example `list_pages` items keep `id, slugId, title, icon, parentPageId, hasChildren, updatedAt`, with the shared `space` shown once), fields that are `null` are omitted, and JSON is compact. Pass `verbose: true` to get the full metadata. The [CHANGELOG](CHANGELOG.md) lists exactly which fields each tool drops.
`DOCMOST_TOOLSETS` limits which tools are exposed, which shrinks the tool list your client sends to the model on every request.
## Environment
| Variable | Required | Purpose |
|---|---|---|
| `DOCMOST_URL` | yes | Instance URL, e.g. `https://docs.example.com` |
| `DOCMOST_EMAIL` + `DOCMOST_PASSWORD` | one auth method | Community login |
| `DOCMOST_AUTH_TOKEN` | one auth method | `authToken` cookie from the browser |
| `DOCMOST_SESSION_PATH` | no | Session cache file |
| `DOCMOST_READ_ONLY` | no | `true` / `1` / `yes` — search and read only; mutating tools are refused |
| `DOCMOST_TOOLSETS` | no | Comma list of tool groups to expose: `pages`, `spaces`, `comments`, `search`, `workspace`, `attachments`, `labels`, `members`. Unset means all tools. An unknown name stops startup. |
Email/password is preferred. The JWT is cached under `~/.docmost-community-mcp/session.json` and refreshed on 401. MFA accounts cannot complete login here — use `DOCMOST_AUTH_TOKEN` instead.
Use a dedicated Docmost user. Do not commit credentials.
## Security
- **The AI acts as the Docmost user you configure,** with all of that user's permissions. Use a dedicated user, and give it only the spaces and role it needs.
- `DOCMOST_READ_ONLY=true` refuses every tool that changes content. `DOCMOST_TOOLSETS` hides whole tool groups.
- The login session (a JWT) is cached in `~/.docmost-community-mcp/session.json`, or `DOCMOST_SESSION_PATH`. Treat that file like a password.
- Keep credentials in your client's MCP config or environment, never in a repository.
- To report a vulnerability, see [SECURITY.md](SECURITY.md). Please don't open a public issue for it.
## Troubleshooting
| Symptom | Fix |
|---|---|
| "This account requires MFA" | The login here can't complete MFA. Sign in to Docmost in a browser, copy the `authToken` cookie, and set `DOCMOST_AUTH_TOKEN` instead of email and password. |
| "Saved session is missing or expired" | With `DOCMOST_AUTH_TOKEN`, the token has expired: copy a fresh one. With email and password, the session is refreshed on its own; check the password is still right. |
| "This Docmost build is too old for in-place Markdown writes" | Upgrade Docmost to v0.71 or newer. Reading works on older versions. |
| `search_attachments` returns 403 | Attachment search is a Docmost Enterprise feature. |
| `Unrecognized key: "pageId"` | The AI guessed an argument name. The error names the wrong key; the right one is in the tool's schema (here `page_id`). Most clients retry on their own. |
| A table gains an empty header row after an edit | Fixed in 1.2.0. Update to the latest version; the next save repairs an affected table. |
| The client can't start `npx` on Windows | Use `"command": "cmd"` with `"args": ["/c", "npx", "-y", "docmost-community-mcp"]`. |
## Design notes
- **stdio only** in this release. Streamable HTTP can be added later.
- **No Enterprise license, no Docmost database access, no Docmost fork.**
- Space slugs are accepted anywhere a space id is required.
- Page slugIds (the id in page URLs) are accepted anywhere a page id is required, and are resolved to UUIDs before the request.
- `move_page` computes the required fractional `position` key (`first`, `last`, or after a sibling).
- `create_page` / `update_page` fail clearly on servers older than v0.71 instead of silently dropping the body. `get_current_user` reports `docmostVersion` from Docmost's `currentVersion` field.
- `delete_space` requires `confirm: true`. Mutating tools honor `DOCMOST_READ_ONLY`.
- `list_pages` defaults to recently updated pages. Pass `view=tree` for sidebar-root pages.
- `edit_page` needs Docmost to accept `format: "json"` on `/api/pages/update`; this was verified on v0.96.0. It writes the whole page body back in one request, so a person typing in the editor at the same moment can still be overwritten (see `expected_updated_at`).
- Docmost's Markdown export ignores a table's header row and writes a blank header line instead, so writing that Markdown back would demote the real header and add an empty row each time. `get_page` puts the first non-blank row back as the header and drops blank rows left by earlier round trips, so reading and writing a page keeps its tables, and the next save repairs a damaged one. GFM has no headerless tables, so a table stored without a header row gains one on write-back. `export_page` output is not affected.
- Every tool rejects unknown argument names, and the error names them (for example `pageId` instead of `page_id`).
- `search_attachments` is Enterprise-only; Community hosts get a clear 403 message.
- Export tools write a zip or a single `.md`/`.html` file to `output_path` or a temp file and return the path.
## Contributing
Bug reports and pull requests are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md); for questions, use [Discussions](https://github.com/dilruwanm/docmost-community-mcp/discussions). Release notes are in the [CHANGELOG](CHANGELOG.md).
## License
MIT. This package does not include Docmost AGPL or Enterprise source.
TDQS
Scored across 42 tools
Most tools target a distinct resource+action, and close pairs like update_page vs edit_page, move_page vs move_page_to_space, and duplicate_page vs copy_page_to_space are explicitly clarified in their descriptions. A few boundaries (get_page_history vs get_history_version, search_pages vs search_suggest vs list_pages) still require reading descriptions carefully, but no true duplicates exist.
Nearly all tools follow a verb_noun snake_case pattern (create_page, list_spaces, delete_comment, export_space). Minor deviations exist in pluralization, e.g. create_comment vs get_comments, add_page_labels vs remove_page_label, which slightly weakens predictability.
42 tools is well beyond a comfortable surface for an agent, even for a full wiki platform. Many low-frequency operations (move_page_to_space, copy_page_to_space, search_suggest, get_history_version) inflate the set and increase selection cost.
Pages have full CRUD plus history, trash/restore, labels, comments, attachments, links, breadcrumbs, and export; spaces have CRUD plus member management. Gaps remain around attachment deletion/updating and inline/selection comments (explicitly unsupported), but core workflows are covered.