MindMax Write

v0.3.0
io.github.woodpeng/mindmax-write Checked 9 hours ago Published 1 month ago

Open AI-written docs and diagrams in MindMax Write: edit, export Word/PDF, or request review.

An MCP server that adds "Open in MindMax Write" to any AI harness. After the agent writes a document, it calls a tool and shows the user a link. Clicking the link opens the document in mindmax.me/write, where the user can edit it and export Word (with native equations), PDF, or a review link. Spec: spec/63-write-handoff.md. The tool descriptions carry the trigger conditions, because not every host passes the server's instructions to the model. They ask for the link as an extra step *after* the model writes, wherever it writes (chat, artifact, canvas, doc).

Summary extracted from the README.

@mindmax/write-mcp

An MCP server that adds "Open in MindMax Write" to any AI harness. After the agent writes a document, it calls a tool and shows the user a link. Clicking the link opens the document in mindmax.me/write, where the user can edit it and export Word (with native equations), PDF, or a review link. Spec: spec/63-write-handoff.md.

Nothing is uploaded. The Markdown is compressed into the link's #fragment, and browsers never send the fragment to a server. When the user clicks, the document is decoded in their browser and saved to its IndexedDB. The tool makes no network calls.

Tools

Tool Mode What it does
open_in_mindmax_write { markdown, title? } stdio + HTTP Returns a Markdown link plus structuredContent.url; diagrams in the document that will not render are reported back to the model
request_review_with_mindmax { markdown, title? } stdio + HTTP Same, but the link (?then=review) opens the "Request review" panel right away
get_mindmax_diagram_guide { type?, language?, density? } stdio + HTTP Syntax guide for the diagram / infographic types MindMax renders, and how to cite the source text (%% mm:src); type: "cards" returns the card-draft format
open_diagram_in_mindmax { code, type?, source_text?, title? } stdio + HTTP Checks a Mermaid diagram or infographic block against source_text (verbatim quotes, numbers), returns what does not match, and a link (?then=diagram) that opens it in check mode — download PNG / SVG, copy as image, export Word. The diagram is rendered server-side first with the same renderer (pele); syntax errors come back to the model with the guide
open_cards_in_mindmax { draft, source_text, title? } stdio + HTTP Checks a card draft (long text → image carousel) against source_text and links to it with ?then=cards, which opens the image export panel
open_file_in_mindmax_write { path, title?, review? } stdio only Reads a .md / .markdown / .mdx / .txt file from the workspace (≤ 2 MB)

The tool descriptions carry the trigger conditions, because not every host passes the server's instructions to the model. They ask for the link as an extra step after the model writes, wherever it writes (chat, artifact, canvas, doc). They never ask the model to skip the host's own document features: hosts may ignore or down-rank that kind of wording, and connector directories may reject it.

Prompts

Hosts that support MCP prompts (claude.ai lists them under + → the connector) show these as menu items. Picking one is the user's own explicit choice, so it works more reliably than any tool description:

Prompt Arguments What it does
write_with_mindmax topic, requirements? Write a document, then hand it to MindMax Write
open_in_mindmax_write changes? Send the document from this conversation (including one in an artifact / canvas)
diagram_with_mindmax content, type? Turn text into a diagram or infographic and open it in MindMax Write
cards_with_mindmax content, density? Turn text into an image carousel, ready to export
request_review_with_mindmax reviewer? Same, opening the "Request review" panel

Document card (MCP Apps + ChatGPT)

Both link tools render as a document card (title, opening lines, an "Open in MindMax Write" / "Request review" button) instead of a long link. src/widget.ts registers one HTML file twice:

  • MCP Apps (claude.ai and other standard hosts): _meta.ui.resourceUri → ui://mindmax-write/card.html (text/html;profile=mcp-app). The card speaks the MCP Apps postMessage protocol (ui/initialize, ui/notifications/tool-result, ui/open-link, ui/notifications/size-changed).
  • ChatGPT Apps SDK: openai/outputTemplate → ui://widget/mindmax-write-card.html (text/html+skybridge), using window.openai.

The diagram and cards tools use the same card: the opening lines become the check summary, and the diagram (or the first visual of a card draft), rendered server-side to SVG, shows as a preview image. The preview travels in the result's _meta["mindmax/card"] (ChatGPT: toolResponseMetadata), not in structuredContent, so hosts don't feed the SVG to the model.

The card makes no network requests (its CSP allowlists are empty). Hosts without UI support ignore the metadata and show the link text.

Make it the default: a line for the user's own instructions

A tool description cannot outrank the host's system prompt, but the user's own instructions can. Put this snippet in the connector setup guide so users can paste it into claude.ai (Settings → Profile → personal preferences, or a Project's instructions), ChatGPT (Customize ChatGPT), or a harness's rules file:

After you write or substantially revise a document for me (an article, report, memo, proposal, paper section, letter or notes), call the MindMax Write tool open_in_mindmax_write with the complete Markdown and end your reply with the link it returns. If I want someone else to look at it, use request_review_with_mindmax instead.

每次替我写完或大改一篇文档(文章、报告、备忘录、方案、论文章节、信件、笔记)后,调用 MindMax Write 的 open_in_mindmax_write,传入完整 Markdown,并在回复末尾附上它返回的链接。如果我要请别人看,改用 request_review_with_mindmax。

Gemini's consumer app cannot connect custom MCP servers (Gemini CLI can, over stdio).

Links are capped at 32,000 characters, which is roughly 60–100k characters of Markdown. A longer document returns a tool error that tells the model to use a fallback: save the document as .md and open it with "Open local file", or split it into parts.

Install

DeepSeek Harness (dsh) and other local agents (stdio)

Register it as a stdio MCP server:

{
  "mcpServers": {
    "mindmax-write": { "command": "npx", "args": ["-y", "@mindmax/write-mcp"] }
  }
}

dsh loads MCP servers through its MCP client plugin. The exact config file and key names come from the dsh docs and have not been verified here. The command and args are the same in every harness.

The same block works in Claude Desktop (claude_desktop_config.json), Cursor (.cursor/mcp.json), Codex CLI, Gemini CLI and others.

Claude Code

Install integrations/claude-code/ as a plugin. It bundles the MCP server and a mindmax-write skill. Or add just the server:

claude mcp add mindmax-write -- npx -y @mindmax/write-mcp

claude.ai / ChatGPT (remote MCP)

These apps call MCP servers from their own cloud, so they need a public HTTPS endpoint. Production runs at https://api.mindmax.me/mcp/write. Each MindMax app gets its own segment under /mcp (MindMax Think is /mcp/think, packages/mcp-think). Bare /mcp is the bundle endpoint with every app's tools (packages/mcp, spec 64 §5): one connector for users who want both.

  • claude.ai: Settings → Connectors → Add custom connector → https://api.mindmax.me/mcp/write/claude-ai. No OAuth settings are needed.
  • ChatGPT: Settings → Connectors → Developer mode → Create → https://api.mindmax.me/mcp/write/chatgpt, with authentication set to "No authentication".

In HTTP mode the file tool is disabled, because the server cannot see the user's files.

Remote endpoint: deploy

The endpoint is a separate pm2 process (mindmax-write-mcp, 127.0.0.1:8790) on the same EC2 host as mindmax-server. nginx on api.mindmax.me forwards /mcp/write and /mcp/write/<source> to it. Deploying packages/server does not deploy it.

  1. One time: copy packages/server/deploy/nginx/api.mindmax.me.conf, which includes the new location ~ ^/mcp/write… block, to /etc/nginx/conf.d/ on the server, then run sudo nginx -t && sudo systemctl reload nginx.
  2. Each release: run packages/mcp-write/deploy/deploy.sh, with the same DEPLOY_HOST / DEPLOY_SSH_KEY as the server deploy. The steps are shared by every MindMax MCP package and live in packages/mcp-kit/deploy/deploy.sh. It tests, builds and npm packs locally, installs the package on the host, restarts pm2 and checks /healthz. The package does not need to be on npm first.
  3. Check:
    curl -s -X POST https://api.mindmax.me/mcp/write -H 'content-type: application/json' \
      -H 'accept: application/json, text/event-stream' \
      -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
    

To run it anywhere else: PORT=8787 npx -y @mindmax/write-mcp --http (POST /mcp, /mcp/write or /mcp/write/<source>, GET /healthz) behind TLS.

Attribution

Every link carries ?utm_source=mcp_<host>. This follows the same utm_source convention the website uses for links into /write. <host> is the clientInfo.name the agent reports in the MCP handshake, so you get values like mcp_claude-code and mcp_deepseek-harness. Stateless HTTP has no handshake, so remote mode takes the label from the endpoint path: /mcp/write/chatgpt gives mcp_chatgpt, and plain /mcp/write gives mcp_remote. The query string reaches the site but only says where the click came from. The document itself stays in the fragment.

Environment

  • MINDMAX_WRITE_URL: points the links at a different /write (for example http://localhost:5173/write/ for local dev).
  • PORT: the default port for --http.

Publish

Package @mindmax/write-mcp (npm scope @mindmax). Registry entry io.github.woodpeng/mindmax-write (server.json).

First release (manual, once). npm Trusted Publishing can only be configured on a package that already exists.

cd packages/mcp-write
npm login                      # an npm account that can publish to @mindmax, with 2FA
npm publish --access public    # prepublishOnly builds and runs the tests

Then, on npmjs.com, go to @mindmax/write-mcp → Settings → Trusted publishing → GitHub Actions, and set user woodpeng, repo mindmax, workflow mcp-write.yml. You can also set "Require two-factor authentication and disallow tokens" from then on.

The first MCP Registry entry can be published locally as well: mcp-publisher login github then mcp-publisher publish. You can also leave it for the workflow.

Later releases. Bump version in package.json and both version fields in server.json, merge to master, then run Actions → MCP Write (npm) → Run workflow. The workflow typechecks, tests and builds, checks that the versions agree, and publishes over OIDC to npm and the MCP Registry. A version that is already on npm is skipped, so re-running is safe.

Develop

pnpm --filter @mindmax/write-mcp test
pnpm --filter @mindmax/write-mcp build    # dist/index.js, core's write-handoff and mcp-kit inlined

The stateless HTTP server, route matching, utm_source attribution and the card bridge (MCP Apps + ChatGPT) are shared with the other MindMax MCP servers in packages/mcp-kit/ (source only, inlined at build time). registerWriteTools is also used by the bundle server in packages/mcp.

The link codec lives in packages/core/src/write-handoff/ and is shared with /write, which reads #import= at startup (packages/web/src/shell/WebApp.tsx).