Skip to main content
Glama
lucaszarzur

CherryTree MCP Server

by lucaszarzur

CherryTree MCP Server

MCP 服务器,将 CherryTree .ctd(XML)文件的读写以 Claude Code 原生工具的形式暴露出来。

支持富文本、代码框、表格、图片、锚点和书签。所有写入操作都会自动进行逐字节审计,将备份与磁盘上生成的文件进行比对。

可用工具

读取

  • list_nodes — 列出树中的节点(含深度和面包屑导航)

  • read_node — 读取节点内容(文本、格式、组件)

  • search_nodes — 在所有节点中进行全文搜索

  • list_bookmarks — 列出标记为收藏的节点

写入

  • create_node — 创建节点(纯文本或通过 content_xml 传入富 XML)

  • create_node_with_codebox — 创建带代码框的节点(或通过 content_xml 传入富 XML)

  • update_node_content — 替换或追加(纯文本或通过 content_xml 传入富 XML)

  • append_codebox_to_node — 向现有节点添加代码框或富 XML

  • update_node_properties — 修改名称、标签、图标、颜色、只读属性

  • delete_node — 删除节点及其子节点

  • move_node — 将节点移动到另一个父节点下

书签

  • add_bookmark — 将节点添加到收藏

  • remove_bookmark — 从收藏中移除节点

Related MCP server: notion-full-mcp

富文本(content_xml

写入工具接受 content_xml 以实现完整的 CherryTree 格式:

<rich_text scale="h1" foreground="#00000000ffff" weight="heavy">Título</rich_text>
<rich_text>
Texto normal com </rich_text>
<rich_text weight="heavy">negrito</rich_text>
<rich_text> e </rich_text>
<rich_text style="italic">itálico</rich_text>
<rich_text foreground="#e66100" weight="heavy"> e laranja bold</rich_text>
<rich_text link="node 42">link interno</rich_text>

<rich_text> 支持的属性

属性

示例

weight

heavy

粗体

foreground

#RRRRGGGGBBBB(48 位 GTK)

#00000000ffff(蓝色)

background

#RRRRGGGGBBBB

高亮

style

italic

斜体

underline

single

下划线

strikethrough

true

删除线

scale

h1-h6smallsupsub

标题

family

monospace

等宽字体

justification

leftcenterrightfill

对齐

link

webs URLnode UIDfile BASE64fold BASE64

链接

indent

1-3

缩进

组件(按 char_offset 定位)

组件在 char_offset 位置内联渲染(按各 <rich_text> 拼接文本中的字符数计数)。每个组件在缓冲区中恰好占用 1 个字符。

<codebox char_offset="42" justification="left" frame_width="700"
         frame_height="200" width_in_pixels="1"
         syntax_highlighting="python3" highlight_brackets="1"
         show_line_numbers="0">print("hello")</codebox>

<table char_offset="100" col_min="40" col_max="400"
       col_widths="200,200" is_light="0">
  <row><cell>valor1</cell><cell>valor2</cell></row>
  <row><cell>header1</cell><cell>header2</cell></row>
</table>

<encoded_png char_offset="50" anchor="nome_ancora"/>

架构

  • 读取使用 lxml 进行 XML 解析/查询(安全,无写回)

  • 写入使用原始字符串操作,以避免 \r 规范化破坏未编辑节点中的 char_offsetlxml/ET 序列化时的 bug)

  • 备份每次写入前自动创建 .ctd.bak

  • 审计每次写入后逐字节进行:从磁盘读取备份和新文件,比较前缀/后缀,识别被修改的节点,统计节点总数,验证 XML

审计格式

每次写入操作都会返回如下报告:

[AUDIT] readback 45,120,109 bytes: OK
  delta: +252 bytes (45,119,857 -> 45,120,109)
  change region: bak[45,119,844:45,119,844] -> disk[45,119,844:45,120,096]
  prefix (45,119,844 bytes): OK
  suffix (13 bytes): OK
  nodes: 5304 (backup) -> 5305 (disco) [+1]
  node adicionado: 6481 "Nome do Node" (alvo)
  integridade: OK
  XML parse: OK

如果目标区域之外的任何字节在备份与磁盘之间不一致,报告将显示 CORRUPTED!INTEGRITY FAILURE

安装

1. 创建 virtualenv 并安装依赖

cd ~/cherrytree-mcp
python3 -m venv .venv
.venv/bin/pip install -e .

2. 在 Claude Code 中配置 MCP

claude mcp add cherrytree -s user \
  -e CHERRYTREE_FILE="/caminho/para/seu/arquivo.ctd" \
  -- /caminho/para/cherrytree-mcp/.venv/bin/python \
     /caminho/para/cherrytree-mcp/server.py

3. 重启 Claude Code

工具会自动以 mcp__cherrytree__<tool_name> 的形式出现。

环境变量

变量

描述

CHERRYTREE_FILE

CherryTree .ctd 文件的绝对路径

要求

  • Python >= 3.11

  • CherryTree v1.x(.ctd XML 格式,非 .ctb SQLite)

  • 依赖:mcp[cli]>=1.0.0lxml>=5.0.0

限制

  • 仅支持 .ctd(XML)格式。不支持 .ctb(SQLite)文件。

  • 通过 MCP 编辑后,需要重新加载 CherryTree(关闭/打开或切换节点)才能在 UI 中反映更改。

  • update_node_content 中使用 append=False 的写入操作会替换节点的全部内容(文本、代码框、图片、表格)。

F
license - not found
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
    C
    maintenance
    Full-featured Notion MCP server enabling deep page reading, block editing, snapshot/restore, file uploads, table manipulation, page restore, and destructive page copying.
    33
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    MCP server that provides read and write access to an Obsidian vault by interacting directly with markdown files on disk. Supports searching, listing, reading, creating, editing, and appending notes without requiring any Obsidian plugins.
    3,860
    ISC

View all related MCP servers

Related MCP Connectors

  • MCP-native open-source Notion alternative: read & write pages, databases and kanban boards.

  • Markdown-based note-taking with a hosted MCP server. Your notes serve you and your AI.

  • MCP Server for Slima - AI Writing IDE for Novel Authors with AI Beta Reader.

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/lucaszarzur/cherrytree-mcp'

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