Skip to main content
Glama

Doco

📖 中文版

人类与 AI 智能体共同写作的文档空间。 一个开源的富文本协作编辑器,让你的数据重新回到自己手中——也以同样的谨慎对待 AI 智能体:块级稳定寻址、乐观并发控制,以及一个包含 29 个工具的 MCP 服务器,让智能体能够像细心的人类编辑一样安全地读写你的知识库。

  • 在线托管: doco.page —— beta 期间免费

  • 接入你的智能体: claude mcp add doco -- npx -y --package doco-agent-cli doco mcp

  • CLI: npm i -g doco-agent-cli && doco login

  • npm: doco-agent-cli · API 文档: doco.page/api-docs

为什么智能体在这里是安全的

能力

含义

块级稳定寻址

任意段落都有一个 block_<ULID> 标识,与位置无关,拖动和折叠后依然稳定

乐观并发控制

读取返回 sha256 版本号;写入要求 If-Match;遇到 409 时智能体重新读取、合并、重试 —— 盲目覆盖不可能

Markdown 往返

使用 ?annotate=anchors 导出;写回文档后 .d 保留

人类–智能体协同编辑

Agent 写入通过同一个 Yjs 文档流转,修改实时在浏览器中体现

事务与幂等性

批量操作原子式提交;Idempotency-Key 让重试无副作用

Related MCP server: session-coord-mcp

功能

编辑体验

  • 富文本编辑:标题、列表、引用、任务列表、代码块(语法高亮)、表格、图片、链接、文字样式等

  • / 斜杠命令:输入 / 打开命令面板,支持模糊搜索——中文用户可用拼音首字母过滤

  • 浮动工具栏:选中文字时自动出现,所有设置操作都聚集在光标附近的阴影内

  • 块拖拽:鼠标悬停在任意左侧边缘的段落时可显示拖动手柄——像积木一样重新排列内容

  • 可折叠区块:暂时折叠不打算操作的内容,折叠状态跨会话保留

  • 自动标题编号:一键切换,H1–H4 标题自动维护层级编号(1. 1.1 1.1.1

  • 键盘快捷键⌥↑/↓ 移动块,⌘D 复制块,⌘⌥1/2/3/0 切换标题级别

文本转为图表

直接在文档中编写 Mermaid 或 PlantUML 源码,图表页面地渲染出来。双击可编辑、全屏查看、双指缩放——不再需要与 draw.io 进行导出—导入—替换。

  • Mermaid:流程图、时序图、类图、甘特图、状态图等

  • PlantUML:时序图、类图、用例图、组件图等

电子表格

文档中嵌入完整电子表格引擎:

  • 公式计算、单元格文字设置

  • 冻结行/列、排序与筛选

  • 单元格合并/拆分

  • CSV 导入、导出

它可以内联到文档作为内容块,也可以弹出为独立的全屏电子表格。

知识库

  • 知识库 → 文件夹(可嵌套)→ 文档——三级结构

  • 侧边栏拖拽重新排序、重命名、移动

  • 整个知识库 ZIP 导出,保留文件夹层级,并附带图片

  • 支持文档、文件夹或知识库的整体无损原生 .doco.zip 传输

实时协作

基于 Yjs CRDT 算法:

  • 无需保存按钮——改动自动同步

  • 离线优先:浏览器 IndexedDB 是主要存储,服务器保留快照。离线状态下可编辑,重新联网后自动合并

  • 设备无缝切换:合上笔记本,可以手机接着写

导入 / 导出

格式

导入

导出

Doco 原生格式

✅ 文档 / 文件夹 / 知识库

✅ 无损文档 / 文件夹 / 知识库

Markdown

✅ 粘贴 / 上传文件

✅ 单文档 & 知识库打包

Word (DOCX)

PDF

HTML

微信公众号

✅(主题预览)

图片(文档内图片)

✅(粘贴 / 拖拽)

✅(打包在 ZIP 中)

API · MCP · CLI

三个通道,同一接口规范:

  • REST API:OpenAPI 3.1 规范、Bearer Token 认证、ETag 版本控制、游标分页、幂等性键

  • MCP 服务器doco mcp(随 doco-agent-cli 附带)——29 个工具和 doco:// 资源

  • doco CLIlogin / whoami / docs / blocks / edit / mcp,全局 --json,写入时间自动结合 ETag/If-Match

将文档变成可编程的资产——通过脚本实现自己的备份,让智能体自己重新整理知识库,把你的撰写工作流中的文档同步到博客。内置 API 文档页面,开箱即用。

技术栈

技术

前端框架

React 18 + Vite + TypeScript

CSS

Tailwind CSS v4

编辑器

Tiptap v3 (ProseMirror)

协作底座

Yjs (CRDT) + Hocuspocus

图表

Mermaid + PlantUML

后端

Node.js + Express + Hocuspocus Server

数据库

better-sqlite3 (SQLite, WAL mode)

UI 组件库

Radix UI、Lucide React、Tippy.js

快速开始

环境要求

  • Node.js >= 18

  • pnpm

安装与运行

# Install frontend dependencies
pnpm install

# Install backend dependencies
cd backend && npm install && cd ..

# Start the frontend dev server (Vite, default :5173)
pnpm run dev

# In another terminal, start the backend (Express + WebSocket, default :8000)
cd backend
npm run dev

打开 http://localhost:5173 —— 它会自动连接后端 WebSocket 服务。

Docker 部署(推荐)

完整自托管方案包括 Caddy 前端、Node.js 协作后端、持久化 SQLite 存储、健康检查、同源 WebSocket 代理。已公开的镜像同时支持 linux/amd64linux/arm64

git clone https://github.com/songofhawk/doco.git
cd doco
cp .env.docker.example .env.docker

# Review .env.docker first, then start with prebuilt Docker Hub images
docker compose --env-file .env.docker up -d

# Verify the deployment
docker compose --env-file .env.docker ps
curl --fail http://localhost:8080/healthz

默认打开 http://localhost:8080。根据你的环境在 .env.docker 中设置 ALLOWED_ORIGINSCOOKIE_SECURE、Google OAuth 和 SMTP 这些值。这些值在容器启动时注入,不会怀进镜像中。应用数据存储在 doco-data 命名卷中。

Docker Hub:songofhawkg/doco-frontend · songofhawkg/doco-backend

如果你想从源码,构建完全相同的镜像:

docker compose --env-file .env.docker up -d --build

请阅读 Docker 部署指南 了解所有配置选项、HTTPS、日志、备份、恢复与升级。不要直接运行 docker compose down -v,否则会删除数据库和附件。

手动构建与部署

# Frontend build
pnpm run build          # output → dist/
pnpm run deploy         # deploy to Cloudflare Pages

# Backend (production)
cd backend
npm start

项目结构

doco/
├── src/
│   ├── main.tsx                      # App entry point
│   ├── App.tsx                       # Root component, routing, import/export
│   ├── components/
│   │   └── Sidebar.tsx               # KB sidebar (document tree)
│   └── editor/                       # Editor module
│       ├── index.ts                  # Entry, exports DocoEditor component
│       ├── DocoEditor.tsx            # Editor core (Yjs/Hocuspocus init, extension registration)
│       ├── types.ts                  # DocoEditor Props/Ref type definitions
│       └── components/
│           ├── BubbleMenu.tsx        # Selection floating toolbar
│           ├── BlockHandle.tsx       # Block drag handle
│           ├── SlashCommand.ts       # / command palette
│           ├── CommandList.tsx       # Command palette UI
│           ├── suggestions.ts        # Command menu data
│           ├── CollapseExtension.ts  # Block collapse extension
│           ├── DocSettings.tsx       # Document settings (heading numbering, background)
│           ├── MermaidBlock.ts       # Mermaid node definition
│           ├── MermaidComponent.tsx  # Mermaid renderer
│           ├── PlantUMLBlock.ts      # PlantUML node definition
│           ├── PlantUMLComponent.tsx # PlantUML renderer
│           ├── CalloutBlock.ts       # Callout block definition
│           ├── CalloutComponent.tsx  # Callout renderer
│           ├── SpreadsheetBlock.ts   # Spreadsheet node definition
│           ├── SpreadsheetComponent.tsx  # Spreadsheet renderer
│           ├── spreadsheetEngine.ts  # Spreadsheet calculation engine
│           ├── WeChatExportDialog.tsx # WeChat Official Account export
│           ├── KeyboardShortcuts.ts  # Keyboard shortcuts
│           ├── TableOfContents.tsx   # Table of contents
│           ├── CodeBlockComponent.tsx # Code block (highlight + copy)
│           └── ImageComponent.tsx    # Image renderer
├── backend/
│   ├── server.js                     # Entry: Express + Hocuspocus + export routes
│   ├── database.js                   # better-sqlite3 init & schema
│   ├── api.js                        # KB / folder / document REST API
│   ├── auth.js                       # Auth (OAuth + Email + API Token)
│   ├── markdown.js                   # YDoc → Markdown server-side export
│   ├── permissions.js                # Permission management
│   ├── quota.js                      # Quota management
│   ├── openapi.js                    # OpenAPI spec definition
│   └── tests/                        # Backend tests
└── docs/                             # Design docs & proposals

独立前端组件

编辑器核心也已发布为 doco-text-editor。它包含完整的 Doco 编辑体验和内置样式,但不依赖 Doco 身份认证、REST API、协作服务或 IndexedDB。宿主应用可以决定内容的存放位置:内存、浏览器存储、你自己的后端,或 ClickUp 等外部系统。

npm install doco-text-editor
import { useRef } from 'react'
import {
  DocoTextEditor,
  type DocoTextEditorRef,
} from 'doco-text-editor'
import 'doco-text-editor/style.css'

const editorRef = useRef<DocoTextEditorRef>(null)

<DocoTextEditor
  ref={editorRef}
  defaultValue="# Browser-only draft"
  format="markdown"
  onChange={({ steps }) => {
    // Only the ProseMirror steps changed by this transaction.
    queueIncrementalChanges(steps)
  }}
/>

// Read the complete document only when needed.
const json = editorRef.current?.getContent('tiptap-json')
const markdown = editorRef.current?.getContent('markdown')
const html = editorRef.current?.getContent('html')
const text = editorRef.current?.getContent('text')

包含:标题、行内格式化、引用、有序/无序/任务列表、代码块、图片、表格、提示框、Mermaid、可选的 PlantUML 渲染,以及嵌入电子表格。请参阅 src/editor/README.md 获取完整 API 与集成说明。

完整 Doco 编辑器组件用法

import { DocoEditor } from './editor'
import type { DocoEditorRef } from './editor/types'

const editorRef = useRef<DocoEditorRef>(null)

<DocoEditor
  ref={editorRef}
  docId="doc-001"
  userId="user-001"
  collaboration={{
    websocketUrl: 'ws://localhost:8000',
  }}
  onTitleChange={(docId, title) => console.log('Title changed:', title)}
  placeholder="Start writing…"
/>

{/* Call export methods via ref */}
<button onClick={() => editorRef.current?.exportMarkdown()}>Export MD</button>

协作架构

Browser IndexedDB (y-indexeddb)  ← local primary store
       ↕
Browser Y.Doc  ← @hocuspocus/provider (WebSocket)
       ↕  Yjs binary delta messages
Server @hocuspocus/server  →  SQLite ydoc_state (one merged snapshot per doc)
  • 浏览器 IndexedDB 是主要存储,服务器快照是辅助。如果服务器快照丢失,只需在浏览器中打开文档,就能重新填充数据。

  • 离线编辑是无缝的——断网时仍可操作,网络恢复后自动同步。

  • 协作光标:由框架支持,但默认不启用。

Markdown 导出

无论是单篇文档还是知识库打包,都支持 Markdown 导出,所有内容都在服务端由 YDoc 实时生成:

# Single document export
curl http://localhost:8000/api/docs/{id}/export.md

# KB ZIP bundle
curl http://localhost:8000/api/kb/{id}/export.zip

自定义节点(Mermaid、PlantUML、Callout 等)在 backend/markdown.js 中有对应的序列化规则。新增自定义节点时,需要同时更新服务端序列化器。

无损 Doco 传输

在文档、文件夹或知识库中选择 导出 Doco 文件。产生的 .doco.zip 文件包含原始 Yjs 状态、层级结构、文档设置、独立电子表格和附件。导入时页总是创建一个带全新资源与附件 ID 的副本,因此可以安全地在相互独立的 Doco 部署之间迁移,不会与已有数据冲突。

使用知识库标题侧的上传按钮可导入整个知识库。若要导入单个文档或文件夹备份,请在目标知识库或文件夹菜单中,选择 导入 Doco 文件

许可证

MIT License

A
license - permissive license
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    MCP server that gives AI coding agents on-demand access to private project docs via BM25 ranked search. One setup for Claude Code, Cursor, Codex, Gemini CLI, and more. Docs stay private, never in public repos.
    15
    15
    Apache 2.0
  • A
    license
    Not graded
    quality
    B
    maintenance
    Persistent docs and memory for AI agents. Writespace is a collaborative markdown editor with a built-in MCP server — your model reads, writes, organizes, and searches a shared workspace while humans edit the same docs live. Drop the ranked full-text search straight in as RAG retrieval.
    MIT
  • A
    license
    Not graded
    quality
    F
    maintenance
    MCP server for collaborative markdown editing, allowing agents to write documents and humans to comment, with comments fed back as agent input.
    300,650
    MIT

View all related MCP servers

Related MCP Connectors

  • MCP-native collaborative markdown editor with real-time AI document editing

  • Persistent docs and memory for AI agents — read, write, organize & search a shared workspace.

  • Cross-agent artifact workspace with provenance across Claude Code, Codex, Cursor, LangGraph.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/songofhawk/doco'

If you have feedback or need assistance with the MCP directory API, please join our Discord server