This MCP server provides an AI Answer Copier that converts Markdown into multiple output formats. The server description lists supported exports including PDF, DOCX, HTML, LaTeX, CSV, JSON, XML, XLSX, RTF, and PNG.
AI Answer Copier — MCP-Powered Multi-Format Exporter
Turn "AI Noise" into "Classroom Ready" in 5 Seconds.
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.
"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.
This release hardens both the local (npx) and remote Vercel MCP transports with 8 logic fixes:
#
Fix
Area
1
Browser not closed on error — try/finally around browser.close() so Chromium never leaks on PDF/PNG failures
Both transports
2
generate_html missing KaTeX CSS — restored viewport meta, KaTeX stylesheet (SRI hash), and full inline styles so math renders correctly
Vercel /api/mcp
3
convert_to_html incomplete styles — added SRI integrity hash, table borders, and blockquote styling to match local output
Vercel /api/mcp
4
Session map memory leak — instances Map now evicts stale sessions after 30 minutes (SESSION_TTL_MS); McpInstance tracks lastUsed
Vercel /api/mcp
5
keepAlive 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 upgrades
Vercel /api/mcp
7
No input size validation — added 1 GB hard limit (MAX_INPUT_BYTES) to all tool calls to prevent runaway CPU/memory on oversized payloads
Both transports
8
DELETE method creates new session — handler now returns 200 immediately on DELETE, preventing phantom session creation
Vercel /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 repository
git clone https://github.com/XJTLUmedia/AI_answer_copier.git
# Web app
npm install
npm run dev
# MCP servercd mcp-server
npm install
npm run dev # hot reload
npm run build # production build
npm run inspector # test with MCP Inspector
Tech Stack
Component
Technology
MCP SDK
@modelcontextprotocol/sdk
Markdown Parser
unified + remark + rehype
Math Rendering
remark-math + rehype-katex
Word Export
docx
Excel Export
xlsx
PDF/PNG Export
puppeteer
Schema Validation
zod
Runtime
Node.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.