Skip to content

[Bug] MCP: text in angle brackets is silently deleted from tasks, docs and comments #844

Done

Description

@khushvir

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

  1. In an empty folder, run npm i @paca-ai/[email protected].
  2. Save this as repro.mjs in 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()));
  1. 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 &lt;, 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

  1. added
    bug
    on Dec 1, 2026
  2. pullfrog commented on Dec 1, 2026

    @pullfrog
    Contributor
  3. added
    good first issue
    on Dec 1, 2026
  4. minutechreview commented on Dec 1, 2026

    @minutechreview

    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-comment html nodes, 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.

  5. khushvir commented on Dec 1, 2026

    @khushvir
    ContributorAuthor

    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:

    • Plain URLs: using only &lt; breaks placeholders. https://example.com/orders/<id> is saved as https://example.com/orders/&lt;id>.
    • Comments: dropping them can also delete other text. <!-- note --> Keep this sentence. is saved empty, and an unclosed <!-- can drop the rest of the document.
    • Speed: repeating until no html node 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/>&lt;. BlockNote drops the empty <x/> tag, but the tag stops a plain URL from running into the &lt;. 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.

  6. pikann commented on Dec 1, 2026

    @pikann
    Contributor

    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!

  7. added a commit that references this issue on Dec 4, 2026
    91fe55f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

buggood first issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions