一、什么是 docmost-mcp
docmost-mcp 是一个基于 Model Context Protocol (MCP) 的服务器,用于连接 AI 助手与 Docmost 文档系统。通过该工具,AI 可以直接对 Docmost 中的文档进行搜索、创建、修改、删除和移动等操作。
二、安装方式
推荐通过 npx 直接运行,无需提前下载安装:
npx -y docmost-mcp@latest
- npx 会自动从 npm 仓库下载最新版本并执行
- 执行完成后临时文件自动清理,不占本地空间
- 首次运行需要联网下载,后续有缓存,启动很快
三、环境准备
1. Node.js 版本要求
需要 Node.js 16+,推荐 v20 以上版本。
查看当前 node 版本:
node --version
2. 各平台 Node.js 安装方式
Ubuntu / Linux
方式一:apt 安装(系统仓库版本,可能较旧)
sudo apt update
sudo apt install nodejs npm
注意:Ubuntu 默认仓库的 node 版本可能较低(如 v12),建议用方式二。
方式二:nvm 安装(推荐,可管理多版本,无需 root 权限)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.bashrc
nvm install 20
nvm use 20
Windows
- 访问 Node.js 官网:https://nodejs.org/
- 下载 LTS 版本的
.msi安装包 - 双击运行安装程序,按向导完成安装
- 安装完成后,打开命令提示符验证:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
node --version
npm --version
macOS
方式一:官网下载安装包
- 访问 Node.js 官网:https://nodejs.org/
- 下载 LTS 版本的
.pkg安装包 - 双击运行安装程序
方式二:Homebrew 安装
brew install node
3. 查看 npx 路径
配置 MCP 时需要知道 npx 的完整路径。
查看方式:
which npx
# Linux/mac 示例输出:/home/username/.nvm/versions/node/v20.x.x/bin/npx
# 或 /usr/bin/npx
Windows 上 npx 通常随 Node.js 一起安装,路径类似:
C:\Program Files\nodejs\npx.cmd
四、配置方法(VSCode 扩展版 Claude Code)
在 ~/.claude.json 中添加 mcpServers 配置:
{
"mcpServers": {
"docmost": {
"command": "npx",
"args": ["-y", "docmost-mcp@latest"],
"env": {
"DOCMOST_API_URL": "http://your-docmost-host:port/api",
"DOCMOST_EMAIL": "your-email@example.com",
"DOCMOST_PASSWORD": "your-password"
}
}
}
}
如果使用 nvm 的 npx,将 "command": "npx" 替换为 npx 的绝对路径:
"command": "/home/username/.nvm/versions/node/v20.x.x/bin/npx"
环境变量说明
| 变量名 | 说明 | 示例 |
|---|---|---|
DOCMOST_API_URL |
Docmost 的完整 API 地址 | http://192.168.1.100:3000/api |
DOCMOST_EMAIL |
登录邮箱 | user@example.com |
DOCMOST_PASSWORD |
登录密码 | yourpassword |
五、验证配置
保存 ~/.claude.json 后,重启 VSCode 或刷新 Claude Code 扩展,在工具列表中应能看到 docmost 相关的 MCP 工具(如 list_spaces、search、create_page 等)。
六、相关资源
- npm 包页面:https://www.npmjs.com/package/docmost-mcp
- Node.js 官网:https://nodejs.org/
- nvm 项目:https://github.com/nvm-sh/nvm
- 当前版本:1.0.1