Skip to main content
Glama

docmost-mcp-oss

CI PyPI License: MIT Python 3.10+ M8ven Score

An MCP server built with FastMCP that exposes the REST API of Docmost as tools for AI assistants (Claude Desktop, Claude Code, Cursor, VS Code…).

Managed with uv.

πŸ“„ Full API research: docs/DOCMOST-API.md. Verified against a real Docmost instance (not just the documentation).

Why a custom MCP?

Docmost ships with an official MCP, but it requires a Business/Enterprise license and is enabled from Settings β†’ AI settings β†’ MCP. This project uses the internal API (the same one the web UI consumes), which is also available in the self-hosted OSS edition.

About the name: the -oss suffix distinguishes this package from the unrelated docmost-mcp already on PyPI. They are different projects by different authors, and they would collide if installed side by side (both used to ship the same import package). This one targets self-hosted Docmost and can edit page bodies; install it as docmost-mcp-oss.

Related MCP server: Docmost MCP Server

Exposed tools (21)

Category

Tools

Pages

get_workspace_overview, search_pages, get_page, create_page, update_page, update_page_content, delete_page, restore_page, move_page, list_recent_pages, list_child_pages, get_page_breadcrumbs, get_page_history

Spaces

list_spaces, get_space, create_space

Comments

get_comments, create_comment, update_comment

User

get_current_user, list_workspace_members

Every tool declares the four MCP annotation hints (readOnlyHint, destructiveHint, idempotentHint, openWorldHint), so a client knows before calling whether it is about to read, write or delete.

Four things stand out:

  • get_workspace_overview answers "what is in my Docmost?" in a single call: every space and every page, walking the whole tree, plus who last touched each page and a recently_updated ranking so an agent knows what to read first. It also returns a summary: counts per space, tree shape, date ranges, recency buckets, pages never edited, top editors and orphaned pages. The activity argument trades cost for detail ("recent", "full", "none"), and the optional check_empty measures page bodies to find the empty ones.

  • get_page returns metadata and content in Markdown (it combines /pages/info with /pages/export, because the former does not return the body).

  • move_page takes a destination, not a position: nest it with parent_page_id, or sit it next to a sibling with after/before. Docmost's position strings are generated for you.

  • update_page_content writes the body of an existing page, with a mode of "replace", "append" or "prepend". The REST API can't do this: it writes directly to the Yjs document over the collaboration WebSocket. Requires the yjs extra and takes ~13 s (Docmost persists with a 10 s debounce).

list_child_pages lists one level only (the direct children of a space or a page). Enumerating a space means walking its tree, which is what get_workspace_overview does for you.

Editing the body of an existing page

Docmost's REST API ignores the content field in /pages/create and /pages/update (they respond 200 but save nothing): the body lives in the Yjs collaboration server.

That's why there are two distinct paths:

Operation

How

Read content

get_page

Create page with content

create_page (uses /pages/import)

Replace the body of an existing page

update_page_content (Yjs WebSocket)

Rename

update_page

Delete / restore / move

βœ…

update_page_content opens the wss://<host>/collab WebSocket, syncs the document, replaces the content and waits for it to persist. Markdown is converted using Docmost's own converter, so it supports the full schema (tables, lists, code, quotes, images…).

uv sync --extra yjs     # enables update_page_content

Technical details of the protocol: docs/YJS-EDITING.md.

Installation

As a tool, from PyPI (no clone needed)

uvx docmost-mcp-oss            # stdio, for MCP clients
uvx docmost-mcp-oss --check    # verify the connection to your instance

Add --with pycrdt --with websockets (or install docmost-mcp-oss[yjs]) to enable update_page_content, the tool that edits existing page bodies.

From source (for development)

uv creates the virtual environment and installs the dependencies (pinned in uv.lock):

uv sync

No need to activate the environment: use uv run ….

Configuration

cp .env.example .env   # then edit the values
DOCMOST_URL=https://docmost.example.com

# Option A β€” API Key
DOCMOST_API_KEY=dm_xxx

# Option B β€” login (works on OSS)
DOCMOST_EMAIL=you@example.com
DOCMOST_PASSWORD=your-password

Verify the connection:

uv run docmost-mcp-oss --check
# -> OK: authenticated as you@example.com (https://docmost.example.com)

Usage

uv run docmost-mcp-oss

HTTP (for remote access)

uv run docmost-mcp-oss --http --port 8000
# MCP endpoint: http://127.0.0.1:8000/mcp

Connecting to MCP clients

Every client below launches the same stdio command. The examples install from PyPI with uvx; to run from a clone instead, replace uvx docmost-mcp-oss with uv --directory /path/to/docmost-mcp-oss run docmost-mcp-oss.

To enable update_page_content (editing existing page bodies), use the yjs extra β€” replace docmost-mcp-oss with --from "docmost-mcp-oss[yjs]" docmost-mcp-oss, or see the note at the end of this section.

Claude Code

claude mcp add docmost \
  -e DOCMOST_URL=https://docmost.example.com \
  -e DOCMOST_EMAIL=you@example.com \
  -e DOCMOST_PASSWORD=your-password \
  -- uvx docmost-mcp-oss

Equivalent JSON, in .mcp.json at the root of your project (or under mcpServers in ~/.claude.json for a user-wide server):

{
  "mcpServers": {
    "docmost": {
      "type": "stdio",
      "command": "uvx",
      "args": ["docmost-mcp-oss"],
      "env": {
        "DOCMOST_URL": "https://docmost.example.com",
        "DOCMOST_EMAIL": "you@example.com",
        "DOCMOST_PASSWORD": "your-password"
      }
    }
  }
}

Codex

⚠️ Codex configures MCP servers in TOML, not JSON. Add this to ~/.codex/config.toml:

[mcp_servers.docmost]
command = "uvx"
args = ["docmost-mcp-oss"]

[mcp_servers.docmost.env]
DOCMOST_URL = "https://docmost.example.com"
DOCMOST_EMAIL = "you@example.com"
DOCMOST_PASSWORD = "your-password"

Or let the CLI write it for you:

codex mcp add docmost \
  --env DOCMOST_URL=https://docmost.example.com \
  --env DOCMOST_EMAIL=you@example.com \
  --env DOCMOST_PASSWORD=your-password \
  -- uvx docmost-mcp-oss

phoson-cli

phoson reads JSON from the file named by mcp_config_file in ~/.phoson/config.toml (defaults to ~/.phoson/mcps.json). Entries need an explicit "enabled": true:

{
  "mcpServers": {
    "docmost": {
      "command": "uvx",
      "args": ["docmost-mcp-oss"],
      "env": {
        "DOCMOST_URL": "https://docmost.example.com",
        "DOCMOST_EMAIL": "you@example.com",
        "DOCMOST_PASSWORD": "your-password"
      },
      "enabled": true
    }
  }
}

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "docmost": {
      "command": "uvx",
      "args": ["docmost-mcp-oss"],
      "env": {
        "DOCMOST_URL": "https://docmost.example.com",
        "DOCMOST_EMAIL": "you@example.com",
        "DOCMOST_PASSWORD": "your-password"
      }
    }
  }
}

Cursor (.cursor/mcp.json)

Same shape as Claude Desktop, inside the mcpServers key.

Enabling body editing

update_page_content needs the yjs extra, which is optional to keep the base install small. Point the client at the extra instead of the bare package:

Client

Launcher to use

uvx

uvx --from "docmost-mcp-oss[yjs]" docmost-mcp-oss

Any command/args JSON

"command": "uvx", "args": ["--from", "docmost-mcp-oss[yjs]", "docmost-mcp-oss"]

For example, in Claude Code:

claude mcp add docmost \
  -e DOCMOST_URL=https://docmost.example.com \
  -e DOCMOST_EMAIL=you@example.com \
  -e DOCMOST_PASSWORD=your-password \
  -- uvx --from "docmost-mcp-oss[yjs]" docmost-mcp-oss

Tests

Command

What it validates

Needs instance

uv run python tests/test_client.py

Client against a mocked Docmost (12 cases)

No

uv run python tests/test_tools.py

MCP tool registry

No

uv run python tests/smoke_live.py

Read-only against a real instance

Yes

uv run python tests/smoke_mcp_live.py

Tools through the MCP layer

Yes

uv run --extra yjs python tests/smoke_yjs_live.py

Body editing via Yjs (7 checks)

Yes

uv run ruff check .

Lint

No

The live tests read credentials from .docmost-creds.json (ignored by git):

{
  "url": "https://docmost.example.com",
  "email": "you@example.com",
  "password": "your-password"
}

--write adds a create β†’ update β†’ get β†’ delete cycle over a test page (use --write keep to keep it).

Implementation notes

Things that are not obvious and that the client already handles:

  • All endpoints are POST and respond with {data, success, status}; the client unwraps data.

  • Content does not come from /pages/info: it is fetched via /pages/export (markdown|html), which responds with the raw file, no wrapper.

  • Only /pages/import persists content over REST; /pages/create and /pages/update ignore content. To edit the body of an already-created page you must write to the Yjs document (see above).

  • Authentication: both real variants are supported β€” the authToken cookie (httpOnly) and data.tokens.accessToken forwarded as Bearer.

  • /search requires query and spaceId; if you don't provide a space, it fans out across all accessible spaces and merges by rank.

  • /pages/sidebar-pages requires spaceId; if you only provide a page, its space is resolved first.

  • Lexical search (PostgreSQL FTS): stopwords ("a", "de", "the") return 0 results.

  • Heterogeneous response shapes: some builds return {items, meta} and others raw lists; the client normalizes both.

  • Permissions: the MCP acts as the authenticated user; it can never do more than the user can.

Structure

docmost-mcp-oss/
β”œβ”€β”€ docmost_mcp_oss/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ client.py       # async HTTP client for the Docmost REST API
β”‚   β”œβ”€β”€ collab.py       # Yjs WebSocket: read/write page bodies
β”‚   β”œβ”€β”€ position.py     # fractional indexing within Docmost's 5-12 chars
β”‚   └── server.py       # FastMCP server + tools
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ DOCMOST-API.md  # API research (OSS + real instance)
β”‚   └── YJS-EDITING.md  # collaboration WebSocket protocol
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ test_client.py      # mocked, no network
β”‚   β”œβ”€β”€ test_tools.py       # MCP tool registry, no network
β”‚   β”œβ”€β”€ smoke_live.py       # real instance, read-only
β”‚   β”œβ”€β”€ smoke_mcp_live.py   # MCP layer against a real instance
β”‚   └── smoke_yjs_live.py   # body editing via Yjs
β”œβ”€β”€ .github/workflows/
β”‚   β”œβ”€β”€ ci.yml                # lint, tests and packaging
β”‚   └── release.yml           # tag -> build -> PyPI -> GitHub Release
β”œβ”€β”€ CHANGELOG.md
β”œβ”€β”€ CONTRIBUTING.md
β”œβ”€β”€ LICENSE                   # MIT
β”œβ”€β”€ pyproject.toml            # metadata, dependencies and ruff config
β”œβ”€β”€ uv.lock                   # reproducible resolution (it is versioned)
└── .env.example

License

MIT Β© 2026 Abel Santillan Rodriguez

Available Tools

21 tools
create_commentCreate CommentB

Adds a comment to a page.

Inputs: content (required), page_id (required), parent_comment_id. Returns: object

create_pageCreate PageA

Creates a new page in a space, with or without content.

If you provide content, the page is uploaded through the import endpoint (/pages/import), which is the only REST way that persists the page body in Docmost. The title is taken from the first heading; if you also provide title, that one is used.

Inputs: space_id (required), title, format, content, +1 more. Returns: object

create_spaceCreate SpaceB

Creates a new space.

Inputs: name (required), slug, description. Returns: object

delete_pageDelete PageA

Moves a page to the trash (recoverable with restore_page).

Inputs: page_id (required). Returns: object

get_commentsGet CommentsA

Gets the comments of a page.

Inputs: page_id (required), limit. Returns: result

get_current_userGet Current UserA

Returns the authenticated user and workspace information.

Inputs: no named parameters. Returns: object

get_pageGet PageA

Fetches a page: metadata and content.

Returns the page's metadata plus the content field with the full text. Internally it combines /pages/info with /pages/export.

Inputs: page_id (required), format. Returns: object

get_page_breadcrumbsGet Page BreadcrumbsA

Returns the ancestor path (breadcrumbs) of a page.

Inputs: page_id (required). Returns: result

get_page_historyGet Page HistoryC

Lists the version history of a page.

Inputs: page_id (required). Returns: result

get_spaceGet SpaceC

Gets the details of a space.

Inputs: space_id (required). Returns: object

get_workspace_overviewGet Workspace OverviewA

Start here. Lists everything in the workspace: every space and every page.

Use this to answer questions like "what do I have in Docmost?", to take an inventory, or to find a page by title before reading it with get_page. Unlike list_child_pages, it walks the whole page tree, so nested pages are included.

Each page carries id, slug_id, title, parent_page_id and depth, which is enough to rebuild the tree or to list everything flat.

With an activity level above "none" each page also carries updated_at and updated_by, and the result includes recently_updated: the most recently touched pages, newest first. Use it to decide what is worth reading first instead of walking the inventory blindly.

It also returns a summary with counts per space, tree shape (roots, containers, leaves, max depth), date ranges and recency buckets, pages never edited after creation, top editors and any orphaned pages. Every figure comes from data already gathered, so it costs nothing extra; summary.date_coverage states how much of the workspace the date-based numbers actually cover.

Inputs: activity, space_id, max_pages, check_empty. Returns: object

list_child_pagesList Child PagesA

Lists only the direct children of a space or a page.

This is one level, not the whole tree. To enumerate everything in the workspace, use get_workspace_overview instead.

Inputs: limit, page_id, space_id. Returns: object

list_recent_pagesList Recent PagesB

Lists recently updated pages.

Inputs: limit, space_id. Returns: result

list_spacesList SpacesB

Lists the spaces the user has access to.

Inputs: limit. Returns: result

list_workspace_membersList Workspace MembersB

Lists the members of the workspace.

Inputs: limit. Returns: result

move_pageMove PageA

Moves or reorders a page. Say where it should go; the position is computed.

Three ways to place a page, in order of preference:

  • Nest it: pass parent_page_id and the page becomes a child of that page (appended at the end of its children by default).

  • Reorder it: pass after or before with the id of a sibling to sit next to.

  • Neither: the page is appended at the end of its current parent.

You never have to invent a position. Docmost orders pages with fractional indexing β€” a base62 string it compares lexicographically, which must be 5-12 characters β€” and that is fiddly to get right by hand. This tool reads the neighbouring positions and generates a valid one in between.

Inputs: page_id (required), after, before, parent_page_id. Returns: object

restore_pageRestore PageA

Restores a page that is in the trash.

Inputs: page_id (required). Returns: object

search_pagesSearch PagesA

Searches pages by keyword (full-text search).

It is a lexical search (PostgreSQL FTS): use meaningful words. Empty-meaning terms ("a", "de", "the") are stopwords and return no results.

Inputs: query (required), limit, space_id. Returns: object

update_commentUpdate CommentB

Updates the content of a comment.

Inputs: content (required), comment_id (required). Returns: object

update_pageUpdate PageA

Renames a page.

To change the content, use update_page_content.

Inputs: page_id (required), title. Returns: object

update_page_contentUpdate Page ContentA

Writes into the body of an already-created page.

Docmost's REST API cannot do this β€” the body lives in the Yjs collaboration server β€” so this tool opens the collaboration WebSocket, edits the document and waits for it to be persisted (~13 s).

Unlike /pages/update, which accepts an operation field and ignores it, mode genuinely works here:

  • "replace" (default): the page ends up with exactly this Markdown.

  • "append": keeps what is there and adds this at the end.

  • "prepend": keeps what is there and adds this at the start.

The Markdown is converted with Docmost's own converter, so it supports its whole schema: headings, bold, italics, code, lists, tables, blockquotes, code blocks, etc.

Requires the yjs extra (uv sync --extra yjs).

Inputs: page_id (required), markdown (required), mode. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 21 tools

    Disambiguation5/5

    Each tool targets a distinct resource and action: pages (get/create/update/delete/restore/move/history/breadcrumbs), spaces (list/get/create), comments (get/create/update), and workspace overviews. The only potential overlap between update_page and update_page_content is clearly resolved by descriptions stating one renames and the other edits content. No tools appear to do the same thing.

    Naming Consistency5/5

    All 21 tools follow a consistent verb_noun pattern in snake_case: get_page, create_comment, list_spaces, update_page_content, delete_page, restore_page, move_page, etc. Verbs like get/list/create/update/delete/restore/move are used predictably, and even compound nouns like workspace_overview and child_pages maintain the pattern. No mixing of conventions.

    Tool Count4/5

    21 tools is slightly above the typical 3-15 ideal range, but the server covers a broad domain (spaces, pages, comments, workspace info) and each tool has a clear role. While a few could be merged (e.g., get_workspace_overview could subsume list_child_pages), the count is not excessive and fits the scope of a wiki/documentation server.

    Completeness4/5

    The tool surface covers the full lifecycle for pages (create, get, update content, rename, delete, restore, move, history), spaces (create, list, get), and comments (create, get, update), plus search, breadcrumbs, recent pages, and workspace overview. Missing operations like comment deletion or space updates are minor and can be worked around. Overall, it covers the core domain without dead ends.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers