docmost-mcp
Health Uyari
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 5 GitHub stars
Code Uyari
- fs module — File system access in package.json
- process.env — Environment variable access in src/config.ts
- network request — Outbound network request in src/docmost.ts
Permissions Gecti
- Permissions — No dangerous permissions requested
Bu listing icin henuz AI raporu yok.
MCP server for self-hosted Docmost: let Claude, Cursor and AI agents read, search, create and edit wiki pages in Markdown. No Enterprise API key.
Docmost MCP server
An MCP server for self-hosted Docmost. Read, search, create and edit wiki pages in Markdown from Claude Code, Claude Desktop, Cursor, VS Code or any other MCP client. Works with the free Community Edition: no Enterprise licence and no API key, just a normal Docmost login.
claude mcp add docmost --scope user \
-e DOCMOST_URL=https://docs.example.com \
-e [email protected] \
-e DOCMOST_PASSWORD='your-password' \
-- npx -y @punyamsingh/docmost-mcp
That is all Claude Code needs; config for Claude Desktop, Cursor and VS Code is under Setup.
Docmost's official MCP server and API keys are part of its paid Enterprise edition. This server needs neither. It logs in with a normal Docmost account and calls the same API the Docmost web app uses. Since Docmost v0.70 that API accepts and returns Markdown, and the server converts it to and from its editor format.
- Markdown in and out: pages come back as Markdown and are written from Markdown.
- Safe edits: an optional stale-write check stops a replace from overwriting someone else's newer change, and rewrites that would delete comments, mentions or diagrams are refused.
- Live collaboration: text edits are made in the live document, the way Docmost's own editor makes them, so they merge with whatever people with the page open are typing.
- Any page reference: a page id, slug id or the URL copied from the browser.
Tools
| Tool | What it does |
|---|---|
list_spaces |
Lists the spaces the account can see, with their ids |
list_pages |
Lists the root pages of a space, or the children of a page, with each page's updatedAt on Docmost 0.97 and newer |
search_pages |
Full-text search, optionally within one space, with each result's spaceId and updatedAt; offset pages through more results |
get_page |
Returns a page as Markdown, 500 lines at a time by default, with its id, space, parent, URL and updatedAt; or one heading's section; or, with outline, only its headings and their line numbers |
list_page_history |
Lists a page's saved revisions, newest first, with author, contributors and time |
get_page_revision |
Returns one saved revision as Markdown, 500 lines at a time by default |
restore_page_revision |
Puts a saved revision back as the page's body and title, diagrams, mentions and formatting included |
list_recent_pages |
Lists recently updated pages across the account's spaces, or within one space |
get_page_breadcrumbs |
Returns the path from the space root down to a page |
get_current_user |
Returns the account the server is logged in as, with its email, role, workspace and the workspace's member count |
list_workspace_members |
Lists the workspace's members with names, emails and roles, optionally filtered by name or email |
get_backlinks |
Lists the pages linking to a page, or the pages it links to, on Docmost 0.90 and newer |
list_page_labels |
Lists a page's labels, on Docmost 0.90 and newer |
update_page_labels |
Adds and removes a page's labels by name and returns the labels afterwards; removing a label the page doesn't have is refused |
find_pages_by_label |
Lists the pages carrying a label, optionally within one space, on Docmost 0.90 and newer |
create_page |
Creates a page from Markdown, at a space root or under a parent page |
update_page |
Replaces, appends to or prepends to a page body; can rename it or change its icon |
edit_page |
Replaces an exact piece of text in a page, in place when it is plain text, leaving the rest of the page as it is |
move_page |
Moves a page and its subpages under another page or to a space root, including into another space |
delete_page |
Moves a page and its subpages to the space's trash; never deletes permanently |
restore_page |
Restores a page and its subpages from the trash |
list_trash |
Lists the pages in a space's trash, newest first, with the ids restore_page takes |
duplicate_page |
Copies a page and its subpages, without comments, next to the original, into another space or under a chosen page |
list_comments |
Lists a page's open comment threads with their replies, or every thread with includeResolved |
add_comment |
Posts a page comment, or an inline comment attached to a quote copied from get_page |
reply_to_comment |
Replies in a comment's thread |
edit_comment |
Replaces the text of one of the account's own comments |
delete_comment |
Permanently deletes a comment and removes its highlight; a whole thread needs deleteReplies |
resolve_comment |
Resolves or reopens a thread; before Docmost 0.98 this needs an Enterprise licence |
upload_attachment |
Uploads a local image or file (up to 50 MB) to a page and returns a Markdown image or link to place with edit_page or update_page |
export_page |
Saves a page as a Markdown or HTML file, or as a .zip with its subpages or attachments, and returns the path and size |
export_space |
Saves a whole space as a .zip of Markdown or HTML files; needs space admin rights |
import_pages |
Creates pages from a .md or .html file, a .zip, or a folder, at the space root or under a parent page |
Every tool that takes a page accepts a page id, a slug id, or the page URL copied from the browser.
list_spaces and list_pages return at most 1000 items; a longer list ends with a note saying it was cut short.
Pass the updatedAt from get_page as expectedUpdatedAt to update_page, and a replace is refused if someone changed the page in the meantime. edit_page reads the current body itself, so it applies on top of other people's changes as long as the text still matches exactly once.
When oldText and newText are plain text and each match sits inside one paragraph, heading or code block, edit_page changes just that text in the page's live document, over Docmost's collaboration websocket, the same connection Docmost's editor uses. The change merges with what anyone with the page open is typing, and comments, mentions, colours and everything else on the page are kept. The new text takes the formatting of the text it replaces, as typing over a selection does in the editor. Docmost saves the change within 45 seconds, so the result's updatedAt is null; editedInPlace and liveMerge say which way the edit went. If the websocket can't be reached within 10 seconds, the edit is written to the saved page instead and liveMergeSkipped says why.
Otherwise, for example when the new text has Markdown formatting or the match crosses a line break or a mention, the edit rewrites the whole body from Markdown, as an update_page replace does. Content that Markdown cannot carry would be deleted, so the server refuses such a rewrite on any page that holds it: mentions, comments, highlights, coloured or underlined text, drawio and excalidraw diagrams, embeds, attachments, merged table cells, and any block type it does not recognise. Append and prepend only add blocks, so they still work on those pages.
A whole-body rewrite can't be merged, so it is refused while someone with the page open has typing that Docmost hasn't saved yet; retry a minute later. Append and prepend are merged by Docmost, so they always go through.
restore_page_revision undoes changes by putting a revision from list_page_history back, the way Docmost's own Restore button does. It sends the revision in Docmost's editor format rather than Markdown, so nothing is lost, and takes expectedUpdatedAt like a replace. Like a rewrite, it is refused while someone has unsaved typing open, and on a page in the trash. Comments added since the revision keep their thread but lose their highlight in the text; the result's commentHighlightsRemoved says how many.
Exports and imports
Paths are on the machine running the server, which over HTTP is not the client's machine. An export given an existing folder saves under Docmost's file name, and refuses to replace a file unless overwrite: true. import_pages uses Docmost's own importer, which turns relative links into page links and uploads the images they point to; a folder is zipped first, and each subfolder becomes a page holding its files' pages. A single file must be under 30 MB, and .docx and .pdf need Docmost Enterprise. The server waits up to 2 minutes for a .zip or folder import, or DOCMOST_IMPORT_WAIT_SECONDS, then returns the import's task id if it is still running. With parentPageId the new pages are moved under that page; if the move fails they stay at the space root and the result says moved: false and why.
Comments
Comment text is plain text: blank lines start new paragraphs, and @[Full Name] mentions the one member with that name, which notifies them. A name that matches no member, or several, refuses the call before anything is posted.
An inline comment's quote must appear exactly once inside one paragraph or heading, without crossing a mention or sitting in a code block or on text that already has a comment. The server finds it in the page's live document and sends its position with the comment, and Docmost adds the highlight, as it does in its own editor. The server then waits up to 5 seconds for the highlight; if it doesn't appear, the comment still exists and the result says anchored: false.
Docmost threads are one level deep, so a reply to a reply is posted in the same thread, and only a thread's top comment can be resolved. Docmost 0.98 and newer let any member resolve threads; older releases keep it for Enterprise licences, and without one the call is refused and nothing changes. Docmost 0.95 leaves an inline thread's highlight looking open after a resolve, so the server updates it through the live document; highlightUpdated says whether it could. Deletes are permanent and take a comment's replies with them, so deleting a thread's top comment needs deleteReplies: true. Docmost's API leaves a deleted comment's highlight on the page, so the server removes it through the live document; if it can't, for an account that can only comment, the result says highlightRemoved: false.
Requirements
- Node.js 22.18 or newer
- Docmost v0.70 or newer
- A Docmost account without MFA. Edits are attributed to this account in page history, so each person should use their own.
Setup
There is nothing to clone. Register the server with your MCP client and pass your Docmost login as environment variables. npx downloads and runs it.
Claude Code: all projects
claude mcp add docmost --scope user \
-e DOCMOST_URL=https://docs.example.com \
-e [email protected] \
-e DOCMOST_PASSWORD='your-password' \
-- npx -y @punyamsingh/docmost-mcp
Claude Desktop, Cursor and other clients
Add the following to the client's MCP config (claude_desktop_config.json, ~/.cursor/mcp.json, …):
{
"mcpServers": {
"docmost": {
"command": "npx",
"args": ["-y", "@punyamsingh/docmost-mcp"],
"env": {
"DOCMOST_URL": "https://docs.example.com",
"DOCMOST_EMAIL": "[email protected]",
"DOCMOST_PASSWORD": "your-password"
}
}
}
}
VS Code
Add the following to .vscode/mcp.json in a workspace, or to your user MCP config:
{
"servers": {
"docmost": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@punyamsingh/docmost-mcp"],
"env": {
"DOCMOST_URL": "https://docs.example.com",
"DOCMOST_EMAIL": "[email protected]",
"DOCMOST_PASSWORD": "your-password"
}
}
}
}
To run the latest code on GitHub instead of the npm release, replace @punyamsingh/docmost-mcp with github:punyamsingh/docmost-mcp. The first start is slower because it builds from source.
The client stores these values in its own config file in plain text, the same as a .env file would, so use a config file only you can read.
After the first login the session token is cached in ~/.cache/docmost-mcp/ (or $XDG_CACHE_HOME/docmost-mcp/), with file mode 600. Restarting the client therefore does not open a new Docmost session each time. A new login happens automatically when the token expires or is revoked.
From a clone
git clone https://github.com/punyamsingh/docmost-mcp.git
cd docmost-mcp
npm install # also builds into build/
cp .env.example .env # then fill in DOCMOST_URL, DOCMOST_EMAIL, DOCMOST_PASSWORD
claude mcp add docmost --scope user -- node "$PWD/build/index.js"
.env is git-ignored. Variables set in the client's config take precedence over it.
The server reaches Docmost's collaboration websocket at DOCMOST_URL + /collab. If your Docmost serves it elsewhere (its COLLAB_URL setting), set DOCMOST_COLLAB_URL to that address.
npm test builds the server and runs the test suite against a fake Docmost, so it needs no Docmost instance.
Over HTTP
The server speaks stdio by default. To serve Streamable HTTP instead, start it with --http or set DOCMOST_MCP_PORT:
DOCMOST_URL=https://docs.example.com [email protected] DOCMOST_PASSWORD='your-password' \
npx -y @punyamsingh/docmost-mcp --http --port 3000
Clients connect to http://127.0.0.1:3000/mcp, for example claude mcp add --transport http docmost http://127.0.0.1:3000/mcp.
| Flag | Environment variable | Default |
|---|---|---|
--port |
DOCMOST_MCP_PORT |
3000 |
--host |
DOCMOST_MCP_HOST |
127.0.0.1 |
DOCMOST_MCP_TOKEN |
none |
The server still logs in to Docmost with its own DOCMOST_* variables, so every client that reaches it acts as that one account. When DOCMOST_MCP_TOKEN is set, each request must send Authorization: Bearer <token>. The server refuses to bind to anything but a loopback address without a token, and serves plain HTTP, so put it behind a TLS proxy before exposing it to a network.
Limitations
- No tools for permissions.
- Mentions are looked up through Docmost's people search, 100 people at a time; when 100 or more people match a name, uniqueness can't be confirmed and the mention is refused.
delete_commentchecks a thread for replies just before deleting it. A reply posted in the moment between that check and the delete is deleted with the thread, because Docmost's delete can't be made conditional.- The HTTP transport is stateless: it keeps no MCP sessions, so it sends no server-initiated notifications and serves no
GETstream. search_pagesoffers a nextoffsetonly when a full page of results came back. Docmost drops pages the account can't open after counting, so a short page can still have more results after it.- Docmost returns revisions only as editor JSON, so
get_page_revisionconverts them to Markdown itself; content Markdown can't hold, such as diagrams or embeds, comes back as a link or is left out. - Accounts with MFA cannot log in, because the server has no way to complete the second factor.
- When the collaboration websocket can't be reached,
edit_pagefalls back to writing the saved page. Docmost saves what people type 10 to 45 seconds after they type it, so in that case text typed in that window by someone with the page open can be lost. - Docmost's import task doesn't record the pages it created, so
import_pagestakes the space's new root pages as the import's. A root page someone else creates in that space during the import is reported, and moved underparentPageId, with it. - Before a whole-body rewrite the server compares the live text with the saved text, not formatting, so bold or colour added in the last 45 seconds without typing can still be lost by a rewrite.
License
MIT
Yorumlar (0)
Yorum birakmak icin giris yap.
Yorum birakSonuc bulunamadi