Markdown Formatter

io.github.XJTLUmedia由 GitHub 帳號 XJTLUmedia 發布v1.0.5更新於 Oct 24, 2026

AI Answer Copier — Convert Markdown to PDF, DOCX, HTML, LaTeX, CSV, JSON, XML, XLSX, RTF, PNG

概覽

AI 產生的概覽

在 AI 對話中把 Markdown 轉成多種文件與平台格式,並分析、檢查與修復 Markdown。

可以做什麼
提供 34 個工具,可將 Markdown 轉換為 PDF、DOCX、HTML、LaTeX、CSV、JSON、XML、XLSX、RTF、PNG、TXT 等格式,以及 Slack、Discord、JIRA、Confluence、AsciiDoc、RST、MediaWiki、BBCode、Textile、Org Mode 等平台標記。也支援一次呼叫批次轉換多份文件成多種格式、把 HTML 轉回 Markdown、檢查並修復損壞的 Markdown,以及統計文件字數、產生目錄、擷取程式碼區塊與連結。內建 6 個提示詞範本串接這些工具。
適用情境
適合需要把助理產生的 Markdown 交付成正式文件或貼到特定平台的場合,例如把講義匯出成 PDF 或 DOCX、把表格轉成 CSV 或 XLSX、為 Slack、JIRA 或 wiki 重新排版。也適合清理模型輸出中格式錯誤的 Markdown。
執行需求
以本機 Node.js 程序執行,通常透過 npx 啟動 npm 套件 @xjtlumedia/markdown-mcp-server,也可全域安裝。PDF 與 PNG 轉換需要本機 Chromium;若自動偵測失敗,可用環境變數 PUPPETEER_EXECUTABLE_PATH 指向本機 Chrome。未宣告帳號、API 金鑰或標頭。
安裝前請注意
工具可寫入助理指定的路徑,包括批次輸出目錄,安裝前應確認匯出檔案存放位置。PDF 與 PNG 算繪會啟動無頭瀏覽器,佔用本機 CPU 與記憶體。每次呼叫輸入上限為 1 MB,文件中另提到一個託管 HTTP 端點。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Markdown Formatter,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

AI Answer Copier — MCP-Powered Multi-Format Exporter

Turn "AI Noise" into "Classroom Ready" in 5 Seconds.

[npm version] [License: MIT] [MCP Registry] [Glama] [GitHub]

A Model Context Protocol (MCP) server that gives your AI assistant the power to convert Markdown into 22 professional document formats, batch-convert multiple documents across 22 formats in one call, analyze documents, repair broken Markdown, and convert across platforms — all without leaving your AI chat.

[image]

npm: https://www.npmjs.com/package/@xjtlumedia/markdown-mcp-server


Why This Exists

You asked an AI to write 20 questions. It delivered. But now you're stuck:

Pain PointManual WorkflowWith AI Answer Copier
Extracting Q&A10–15 min copying each line2 seconds (auto-detect)
Formatting Math20 min fixing broken symbolsInstant (KaTeX support)
LMS Upload15 min manual CSV entry1-click export
Total Prep Time~45–60 minutes< 1 minute

Generating content takes seconds. Formatting it for the real world takes an hour. This MCP server eliminates that gap entirely.


Live Demo

Online web version (no install needed): ai-answer-copier.vercel.app

[live_demo1] [live_demo2]

Test MCP tool in inspector:

[MCP server]

Use actual MCP instance:

[MCP1] [MCP2]

All 34 MCP Tools

Document Conversion Tools (15)

#ToolOutputDescription
1harmonize_markdown.mdStandardize and normalize Markdown syntax (ATX headers, - list markers, fenced code blocks) without changing meaning
2convert_to_txt.txtStrip all formatting to produce plain text
3convert_to_html.htmlFull styled HTML document with GFM tables, KaTeX math, and embedded stylesheet
4generate_htmlHTML stringGenerate self-contained HTML with all styles inlined (read-only, no file I/O)
5convert_to_pdf.pdfPrint-ready PDF via headless Chromium with full KaTeX math and syntax highlighting
6convert_to_docx.docxMicrosoft Word document with styled headings, lists, and code formatting
7convert_to_latex.texLaTeX source code with \section, list environments, and native math pass-through
8convert_to_rtf.rtfRich Text Format for legacy word processors and email clients
9convert_to_csv.csvExtract GFM pipe-tables to comma-separated values
10convert_to_json.jsonStructured JSON representation with sections, headings, lists, code blocks, and tables
11convert_to_xml.xmlWell-formed XML with <?xml?> declaration and structured elements
12convert_to_xlsx.xlsxExcel spreadsheet — each Markdown table becomes a sheet
13convert_to_image.pngFull-page PNG screenshot via headless Chromium
14convert_to_md.mdExport Markdown to file, optionally harmonizing formatting first (harmonize=true)
15convert_to_email_html.htmlEmail-optimized HTML with all styles inlined, compatible with Outlook, Gmail, Apple Mail

Platform Converter Tools (10)

#ToolTarget PlatformDescription
16convert_to_slackSlackmrkdwn format — bold as *, links as <url|text>, headers as bold text
17convert_to_discordDiscordStyled bold/underline headers, preserved code blocks
18convert_to_jiraJIRAWiki markup — h1./h2., {code} blocks, [text|url] links
19convert_to_confluenceConfluenceWiki markup with {info}, {note} panels and {code:language=x} syntax
20convert_to_asciidocAsciiDoc= headers, ---- code blocks, url[text] links, image:: directives
21convert_to_rstreStructuredTextUnderlined headers, .. code-block:: directives, RST reference syntax
22convert_to_mediawikiMediaWiki== headers, '''bold''', <syntaxhighlight> tags, {\ wikitable
23convert_to_bbcodeBBCode[b], [i], [code], [url], [img] tags for phpBB/vBulletin forums
24convert_to_textileTextileMarkup for Redmine, Basecamp, and CMS platforms
25convert_to_orgmodeEmacs Org Mode* headers, #+BEGIN_SRC/#+END_SRC code, [[url][text]] links

Import Tools (1)

#ToolDescription
26html_to_markdownConvert HTML content (full document or fragment) back to Markdown

Repair & Lint Tools (2)

#ToolDescription
27repair_markdownFix broken Markdown from LLM output or copy-paste — unclosed code fences, broken tables, stray emphasis markers, missing heading spaces, broken links
28lint_markdownLint and report issues as JSON array with line number, severity, rule name, message, and fixable flag

Document Analysis Tools (5)

#ToolDescription
29extract_code_blocksExtract all code blocks with language, content, and start/end line numbers
30extract_linksExtract all links and images with text, URL, line number, and type (inline, reference, image, autolink)
31generate_tocGenerate Markdown Table of Contents from headings with configurable max_depth (1–6)
32analyze_documentComprehensive statistics — line/word/character/paragraph/sentence counts, heading/code/table/link/image counts, estimated reading time
33extract_structureBird's-eye document architecture — statistics, heading outline, code block summary, link summary

Batch Conversion (1)

#ToolInputDescription
34batch_convertitems[] × formats[]Batch-convert multiple Markdown documents to 22 formats in one call. Error-isolated per item+format. Optional output_dir for file output. Formats: txt, csv, json, xml, xlsx, latex, rtf, docx, pdf, html, md, email, slack, discord, jira, confluence, asciidoc, rst, mediawiki, bbcode, textile, orgmode

6 Built-in Prompts

Pre-configured prompt templates that orchestrate multiple tools:

PromptDescription
convert-documentConvert Markdown to any supported format (PDF, DOCX, HTML, LaTeX, CSV, JSON, XML, XLSX, RTF, PNG, TXT, MD)
extract-tablesExtract all tables from Markdown and export as CSV or XLSX
format-for-sharingHarmonize formatting, then convert to both PDF and HTML for distribution
analyze-and-repairLint → Repair → Re-lint to confirm all issues resolved
convert-for-platformConvert Markdown to any platform format (Slack, Discord, JIRA, Confluence, AsciiDoc, RST, MediaWiki, BBCode, Textile, Org Mode)
document-overviewFull overview — statistics, TOC, code blocks, and links in one report

2 Resources

Resource URIDescription
markdown-formatter://supported-formatsComplete JSON list of all 23+ output formats with tool names and types
markdown-formatter://conversion-guideGuide for choosing the right output format based on your use case

Quick Start

Install via npx (Recommended)

No installation needed — just configure your MCP client:

json
{  "mcpServers": {    "ai-answer-copier": {      "command": "npx",      "args": ["-y", "@xjtlumedia/markdown-mcp-server"]    }  }}

Install Globally

bash
npm install -g @xjtlumedia/markdown-mcp-server

Then configure:

json
{  "mcpServers": {    "ai-answer-copier": {      "command": "markdown-mcp-server"    }  }}

Configuration by AI Client

🔌 Claude Desktop

[image]

Edit %APPDATA%\Claude\claude_desktop_config.json (Windows) or ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):

json
{  "mcpServers": {    "ai-answer-copier": {      "command": "npx",      "args": ["-y", "@xjtlumedia/markdown-mcp-server"]    }  }}

Restart Claude Desktop. You'll see a 🔌 icon — all 34 tools are now available.

VS Code (GitHub Copilot)

Add to .vscode/mcp.json or VS Code settings:

json
{  "servers": {    "ai-answer-copier": {      "command": "npx",      "args": ["-y", "@xjtlumedia/markdown-mcp-server"]    }  }}

Cursor / Windsurf / Any MCP Client

Use the same npx command pattern above in your client's MCP configuration.

DIY version (local build)

json
{  "mcpServers": {    "markdown-formatter": {      "command": "node",      "args": [        "YOUR_PATH_TO_PROJECT/mcp-server/dist/mcp-server/src/index.js"      ]    }  }}

Replace YOUR_PATH_TO_PROJECT with the absolute path to this folder.

HTTP Mode (Vercel)

A hosted HTTP endpoint is available for browser-based and remote integrations:

https://ai-answer-copier.vercel.app/api/mcp

Test with MCP Inspector:

bash
npx @modelcontextprotocol/inspector https://ai-answer-copier.vercel.app/api/mcp

Usage Examples

Once connected, just talk to your AI naturally:

"Batch-convert 5 markdown documents into DOCX, PDF, and HTML simultaneously and save them to my Downloads folder." → AI uses batch_convert with items[] and formats[]

"Generate 10 physics questions about Newton's Laws and export them as a Kahoot CSV." → AI uses convert_to_csv

"Convert this markdown into a Word document and save it to my Desktop." → AI calls convert_to_docx with output_path

"Take these lecture notes and produce a print-ready PDF." → AI calls convert_to_pdf with Puppeteer rendering, KaTeX math, and syntax highlighting

"Turn this into a Moodle-compatible XML quiz bank." → AI calls convert_to_xml

"Format this for Slack and send it to the team channel." → AI calls convert_to_slack

"Check this Markdown for issues and fix them." → AI calls lint_markdown then repair_markdown

"Give me an overview of this document — word count, structure, all links." → AI chains analyze_document + generate_toc + extract_links


Features

22 Output Formats

Export to PDF, DOCX, HTML, LaTeX, CSV, JSON, XML, XLSX, RTF, PNG, TXT, Markdown — plus Slack, Discord, JIRA, Confluence, AsciiDoc, RST, MediaWiki, BBCode, Textile, Org Mode, and Email HTML.

Batch Conversion

Convert multiple Markdown documents to multiple formats in one batch_convert call. Errors are isolated per item+format so one failure never blocks the rest.

Math & Code as First-Class Citizens

Full support for KaTeX math expressions and syntax-highlighted code blocks. Your $\sqrt{x^2 + y^2}$ and Python snippets survive every conversion perfectly.

Smart Binary Handling

Binary formats (PDF, DOCX, XLSX, PNG) don't dump raw base64 into chat. The server returns actionable guidance so the AI knows to save to a file path.

Document Analysis & Repair

Lint Markdown, auto-repair broken formatting, extract code blocks and links, generate Table of Contents, and get comprehensive document statistics — all without leaving the chat.

GFM (GitHub Flavored Markdown)

Tables, task lists, strikethrough, autolinks — all parsed correctly via remark-gfm.

Puppeteer-Powered PDF & PNG

PDF and image exports use headless Chromium for pixel-perfect rendering with full CSS styling, KaTeX math, syntax highlighting, and print-optimized layouts.

Self-Contained

Zero runtime dependencies on external APIs. Everything runs locally. Your data never leaves your computer.


Architecture

┌─────────────────────────┐│  AI Client               ││  (Claude, Copilot,      ││   Cursor, Windsurf)     │└──────────┬──────────────┘           │ MCP Protocol (stdio / HTTP)           ▼┌─────────────────────────┐│  AI Answer Copier        ││  MCP Server (34 tools)   ││                          ││  ┌── Conversion ────────┐││  │ remark/rehype, docx, │││  │ puppeteer, xlsx,     │││  │ CSV/JSON/XML/RTF/    │││  │ LaTeX/TXT parsers    │││  └──────────────────────┘││  ┌── Platform ──────────┐││  │ Slack, Discord, JIRA,│││  │ Confluence, AsciiDoc,│││  │ RST, MediaWiki,      │││  │ BBCode, Textile, Org │││  └──────────────────────┘││  ┌── Batch ─────────────┐││  │ items[] × formats[]  │││  │ 22 formats, isolated │││  └──────────────────────┘││  ┌── Analysis ──────────┐││  │ Code blocks, links,  │││  │ TOC, stats, structure│││  └──────────────────────┘││  ┌── Repair ────────────┐││  │ Lint, auto-repair    │││  └──────────────────────┘││  ┌── Import ────────────┐││  │ HTML → Markdown      │││  └──────────────────────┘│└─────────────────────────┘

What's New in v2.1.0

This release hardens both the local (npx) and remote Vercel MCP transports with 8 logic fixes:

#FixArea
1Browser not closed on error — try/finally around browser.close() so Chromium never leaks on PDF/PNG failuresBoth transports
2generate_html missing KaTeX CSS — restored viewport meta, KaTeX stylesheet (SRI hash), and full inline styles so math renders correctlyVercel /api/mcp
3convert_to_html incomplete styles — added SRI integrity hash, table borders, and blockquote styling to match local outputVercel /api/mcp
4Session map memory leak — instances Map now evicts stale sessions after 30 minutes (SESSION_TTL_MS); McpInstance tracks lastUsedVercel /api/mcp
5keepAlive interval not cleared on normal SSE stream end — added inner try/finally that always calls clearInterval(keepAlive)Vercel /api/mcp
6_initialized SDK-internal access — replaced bare @ts-ignore with a typeof guard so the server fails gracefully after SDK upgradesVercel /api/mcp
7No input size validation — added 1 GB hard limit (MAX_INPUT_BYTES) to all tool calls to prevent runaway CPU/memory on oversized payloadsBoth transports
8DELETE method creates new session — handler now returns 200 immediately on DELETE, preventing phantom session creationVercel /api/mcp

Known Limitations

  • PDF / PNG require local Chromium — convert_to_pdf and convert_to_image launch a headless browser. This works fine with npx but is unavailable on Vercel's free tier (no bundled Chromium). Set the PUPPETEER_EXECUTABLE_PATH environment variable to point to your local Chrome if auto-detection fails.
  • Chromium version on Vercel — the remote endpoint uses @sparticuz/chromium-min with a pinned tar at v131.0.1. If Vercel bumps the Lambda runtime you may need to update the CHROMIUM_TAR_URL env var.
  • 1 MB input limit — all tool calls reject inputs larger than 1 MB. Split large documents into sections before converting.
  • Session TTL (remote only) — sessions on the Vercel endpoint expire after 30 minutes of inactivity. Long-running stateful workflows should issue periodic keep-alive calls.

Development

bash
# Clone the repositorygit clone https://github.com/XJTLUmedia/AI_answer_copier.git
# Web appnpm installnpm run dev
# MCP servercd mcp-servernpm installnpm run dev     # hot reloadnpm run build   # production buildnpm run inspector  # test with MCP Inspector

Tech Stack

ComponentTechnology
MCP SDK@modelcontextprotocol/sdk
Markdown Parserunified + remark + rehype
Math Renderingremark-math + rehype-katex
Word Exportdocx
Excel Exportxlsx
PDF/PNG Exportpuppeteer
Schema Validationzod
RuntimeNode.js (ESM)

Contributing

We welcome contributions! Whether it's a new export format, a bug fix, or documentation improvement — please consider making a pull request.

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request

License

MIT © XJTLUmedia


Built by educators, for educators.
Reclaim 5 hours of your week. Let the AI handle the formatting.

來源:README.md,提交 1a009ab

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.0.5最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分