Repository navigation
Description
Summary
Text written through the MCP server loses anything the Markdown parser reads as an HTML tag, such as <store> or the <string> in Promise<string>. No error is returned. In some cases the whole line is lost.
It affects the MCP tools that create or update tasks and documents, and task and document comments, because they all convert Markdown with markdownToBlocknote.
Area
AI Agent
Steps to reproduce
- In an empty folder, run
npm i @paca-ai/[email protected]. - Save this as
repro.mjsin the same folder:
import { markdownToBlocknote as save, blocknoteToMarkdown as read } from "./node_modules/@paca-ai/paca-mcp/build/utils/converters.js";
for (const input of [
"Close the <store> on <day> please.",
"Returns Promise<string> to the caller.",
"<details>x</details> end",
"Run `deploy <store>` now.",
]) console.log(JSON.stringify(input), "->", JSON.stringify(read(save(input)).trim()));- Run
node repro.mjs.
I first hit this when an AI agent wrote a task description through create_task.
Expected behavior
The text is saved as written.
Actual behavior
"Close the <store> on <day> please." -> "Close the on please."
"Returns Promise<string> to the caller." -> "Returns Promise to the caller."
"<details>x</details> end" -> ""
"Run `deploy <store>` now." -> "Run `deploy <store>` now."
Text inside backticks is kept (last line).
Environment
@paca-ai/paca-mcp 0.22.1, @blocknote/core 0.48.1, Node 24.19.0, macOS
Error details / logs
Additional context
Cause. markdownToBlocknote (apps/mcp/src/utils/converters.ts) uses BlockNote's Markdown parser. Its markdownToHTML runs remark-rehype without allowDangerousHtml, so every html node is dropped.
Possible fix. Before handing the Markdown to BlockNote, parse it with remark-parse (already a dependency), replace the < that starts each html node with <, and repeat until no html node is left.
I tried this in a local prototype of about 16 lines. It kept the text in 18 cases, also after reading it back and saving it again. The cases included code spans, fenced and indented code, autolinks, escaped brackets, lists, quotes, tables, headings and link text. I have not run the repository's tests or build with it.
One behaviour change to decide. HTML written on purpose is dropped today and would show as text with this fix, for example <br> or <u>under</u>. I suggest showing it as typed, but still dropping HTML comments (<!-- -->) as today. The prototype does not make that exception yet.
I would like to work on this. If the approach sounds right, could you assign it to me?
I used Claude, to reproduce this, build the prototype and draft this report. I ran the example and reviewed the report before posting.
Activity
pullfrog commentedon Dec 1, 2026
minutechreview commentedon Dec 1, 2026
Hi @khushvir, thanks for the detailed write-up. I saw you asked to take this one, so I wanted to check before doing anything: I have a small tested fix ready that follows the approach you described (escape the
<on non-commenthtmlnodes, keep dropping<!-- -->), with regression tests.Is it OK if I open a PR for it, or would you rather do it yourself? Totally fine either way. If you want it, I'll step back. @pikann, happy to go with whatever you prefer too.
khushvir commentedon Dec 1, 2026
Hi @minutechreview, thanks for checking first, and for offering to step back. I'd like to do this one myself, as it's my first contribution here. I'll open a PR today, and I'd welcome your review.
I rechecked the fix I suggested in the issue, and found some problems with it:
<breaks placeholders.https://example.com/orders/<id>is saved ashttps://example.com/orders/<id>.<!-- note --> Keep this sentence.is saved empty, and an unclosed<!--can drop the rest of the document.htmlnode is left is slow. An 800-line HTML block took 802 parses and 2.8 s.The bug can also affect text typed in the web editor. MCP returns
<store>unescaped, so it can be lost when an agent saves that text back.My new fix parses the Markdown once with HTML turned off, then replaces each unescaped
<in normal text (not code) with<x/><. BlockNote drops the empty<x/>tag, but the tag stops a plain URL from running into the<. Lint, build and the MCP tests pass locally, including new tests for this bug. I haven't tested it in a running Paca yet. A few unusual inputs still aren't handled, such as a backslash right before<in a URL.@pikann, HTML comments would now show as text instead of being dropped. Is that OK? If you'd prefer something different, I'm happy to change it in the PR.
pikann commentedon Dec 1, 2026
Hi @khushvir ,
Thank you so much for flagging this and wanting to help out!
Showing HTML comments as plain text is totally fine. Please go ahead and open a PR whenever you're ready!
fix(mcp): keep text in angle brackets when saving Markdown