{
  "markdown": "# AI Answer Copier — MCP-Powered Multi-Format Exporter\n\n### *Turn \"AI Noise\" into \"Classroom Ready\" in 5 Seconds.*\n\n[![npm version](https://img.shields.io/npm/v/@xjtlumedia/markdown-mcp-server.svg)](https://www.npmjs.com/package/@xjtlumedia/markdown-mcp-server)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![MCP Registry](https://img.shields.io/badge/MCP-Registry-purple)](https://registry.modelcontextprotocol.io)\n[![Glama](https://glama.ai/mcp/servers/XJTLUmedia/MCP_Markdown_Formatter/badge)](https://glama.ai/mcp/servers/XJTLUmedia/MCP_Markdown_Formatter)\n[![GitHub](https://img.shields.io/github/stars/XJTLUmedia/AI_answer_copier?style=social)](https://github.com/XJTLUmedia/AI_answer_copier)\n\n**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.\n\n<img width=\"1018\" height=\"480\" alt=\"image\" src=\"https://github.com/user-attachments/assets/da33b251-f9fe-4bd5-941f-cb92f42350b9\" />\n\nnpm: https://www.npmjs.com/package/@xjtlumedia/markdown-mcp-server\n\n---\n\n## Why This Exists\n\nYou asked an AI to write 20 questions. It delivered. **But now you're stuck:**\n\n| Pain Point | Manual Workflow | With AI Answer Copier |\n|---|---|---|\n| **Extracting Q&A** | 10–15 min copying each line | **2 seconds** (auto-detect) |\n| **Formatting Math** | 20 min fixing broken symbols | **Instant** (KaTeX support) |\n| **LMS Upload** | 15 min manual CSV entry | **1-click** export |\n| **Total Prep Time** | **~45–60 minutes** | **< 1 minute** |\n\n**Generating content takes seconds. Formatting it for the real world takes an hour. This MCP server eliminates that gap entirely.**\n\n---\n\n## Live Demo\n\nOnline web version (no install needed): [ai-answer-copier.vercel.app](https://ai-answer-copier.vercel.app)\n\n<img width=\"1327\" height=\"732\" alt=\"live_demo1\" src=\"https://github.com/user-attachments/assets/ed6b9b14-2778-45c7-a27d-c3cc8afd9cd9\" />\n<img width=\"1170\" height=\"831\" alt=\"live_demo2\" src=\"https://github.com/user-attachments/assets/98c81708-e1e7-45e4-b27c-44450f51c017\" />\n\nTest MCP tool in inspector:\n\n<img width=\"1436\" height=\"491\" alt=\"MCP server\" src=\"https://github.com/user-attachments/assets/882ba600-6a33-41f7-9fdb-ff56e6fa346d\" />\n\nUse actual MCP instance:\n\n<img width=\"925\" height=\"567\" alt=\"MCP1\" src=\"https://github.com/user-attachments/assets/0edb36da-c048-4062-84a7-5521ad7b0f7f\" />\n<img width=\"950\" height=\"608\" alt=\"MCP2\" src=\"https://github.com/user-attachments/assets/0dd0c695-1c5a-41ab-9acd-f071b683e3a2\" />\n\n---\n\n## All 34 MCP Tools\n\n### Document Conversion Tools (15)\n\n| # | Tool | Output | Description |\n|---|---|---|---|\n| 1 | `harmonize_markdown` | `.md` | Standardize and normalize Markdown syntax (ATX headers, `-` list markers, fenced code blocks) without changing meaning |\n| 2 | `convert_to_txt` | `.txt` | Strip all formatting to produce plain text |\n| 3 | `convert_to_html` | `.html` | Full styled HTML document with GFM tables, KaTeX math, and embedded stylesheet |\n| 4 | `generate_html` | HTML string | Generate self-contained HTML with all styles inlined (read-only, no file I/O) |\n| 5 | `convert_to_pdf` | `.pdf` | Print-ready PDF via headless Chromium with full KaTeX math and syntax highlighting |\n| 6 | `convert_to_docx` | `.docx` | Microsoft Word document with styled headings, lists, and code formatting |\n| 7 | `convert_to_latex` | `.tex` | LaTeX source code with `\\section`, list environments, and native math pass-through |\n| 8 | `convert_to_rtf` | `.rtf` | Rich Text Format for legacy word processors and email clients |\n| 9 | `convert_to_csv` | `.csv` | Extract GFM pipe-tables to comma-separated values |\n| 10 | `convert_to_json` | `.json` | Structured JSON representation with sections, headings, lists, code blocks, and tables |\n| 11 | `convert_to_xml` | `.xml` | Well-formed XML with `<?xml?>` declaration and structured elements |\n| 12 | `convert_to_xlsx` | `.xlsx` | Excel spreadsheet — each Markdown table becomes a sheet |\n| 13 | `convert_to_image` | `.png` | Full-page PNG screenshot via headless Chromium |\n| 14 | `convert_to_md` | `.md` | Export Markdown to file, optionally harmonizing formatting first (`harmonize=true`) |\n| 15 | `convert_to_email_html` | `.html` | Email-optimized HTML with all styles inlined, compatible with Outlook, Gmail, Apple Mail |\n\n### Platform Converter Tools (10)\n\n| # | Tool | Target Platform | Description |\n|---|---|---|---|\n| 16 | `convert_to_slack` | Slack | mrkdwn format — bold as `*`, links as `<url\\|text>`, headers as bold text |\n| 17 | `convert_to_discord` | Discord | Styled bold/underline headers, preserved code blocks |\n| 18 | `convert_to_jira` | JIRA | Wiki markup — `h1.`/`h2.`, `{code}` blocks, `[text\\|url]` links |\n| 19 | `convert_to_confluence` | Confluence | Wiki markup with `{info}`, `{note}` panels and `{code:language=x}` syntax |\n| 20 | `convert_to_asciidoc` | AsciiDoc | `=` headers, `----` code blocks, `url[text]` links, `image::` directives |\n| 21 | `convert_to_rst` | reStructuredText | Underlined headers, `.. code-block::` directives, RST reference syntax |\n| 22 | `convert_to_mediawiki` | MediaWiki | `==` headers, `'''bold'''`, `<syntaxhighlight>` tags, `{\\ wikitable` |\n| 23 | `convert_to_bbcode` | BBCode | `[b]`, `[i]`, `[code]`, `[url]`, `[img]` tags for phpBB/vBulletin forums |\n| 24 | `convert_to_textile` | Textile | Markup for Redmine, Basecamp, and CMS platforms |\n| 25 | `convert_to_orgmode` | Emacs Org Mode | `*` headers, `#+BEGIN_SRC`/`#+END_SRC` code, `[[url][text]]` links |\n\n### Import Tools (1)\n\n| # | Tool | Description |\n|---|---|---|\n| 26 | `html_to_markdown` | Convert HTML content (full document or fragment) back to Markdown |\n\n### Repair & Lint Tools (2)\n\n| # | Tool | Description |\n|---|---|---|\n| 27 | `repair_markdown` | Fix broken Markdown from LLM output or copy-paste — unclosed code fences, broken tables, stray emphasis markers, missing heading spaces, broken links |\n| 28 | `lint_markdown` | Lint and report issues as JSON array with line number, severity, rule name, message, and fixable flag |\n\n### Document Analysis Tools (5)\n\n| # | Tool | Description |\n|---|---|---|\n| 29 | `extract_code_blocks` | Extract all code blocks with language, content, and start/end line numbers |\n| 30 | `extract_links` | Extract all links and images with text, URL, line number, and type (inline, reference, image, autolink) |\n| 31 | `generate_toc` | Generate Markdown Table of Contents from headings with configurable `max_depth` (1–6) |\n| 32 | `analyze_document` | Comprehensive statistics — line/word/character/paragraph/sentence counts, heading/code/table/link/image counts, estimated reading time |\n| 33 | `extract_structure` | Bird's-eye document architecture — statistics, heading outline, code block summary, link summary |\n\n### Batch Conversion (1)\n\n| # | Tool | Input | Description |\n|---|---|---|---|\n| 34 | `batch_convert` | `items[]` × `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 |\n\n---\n\n## 6 Built-in Prompts\n\nPre-configured prompt templates that orchestrate multiple tools:\n\n| Prompt | Description |\n|---|---|\n| `convert-document` | Convert Markdown to any supported format (PDF, DOCX, HTML, LaTeX, CSV, JSON, XML, XLSX, RTF, PNG, TXT, MD) |\n| `extract-tables` | Extract all tables from Markdown and export as CSV or XLSX |\n| `format-for-sharing` | Harmonize formatting, then convert to both PDF and HTML for distribution |\n| `analyze-and-repair` | Lint → Repair → Re-lint to confirm all issues resolved |\n| `convert-for-platform` | Convert Markdown to any platform format (Slack, Discord, JIRA, Confluence, AsciiDoc, RST, MediaWiki, BBCode, Textile, Org Mode) |\n| `document-overview` | Full overview — statistics, TOC, code blocks, and links in one report |\n\n---\n\n## 2 Resources\n\n| Resource URI | Description |\n|---|---|\n| `markdown-formatter://supported-formats` | Complete JSON list of all 23+ output formats with tool names and types |\n| `markdown-formatter://conversion-guide` | Guide for choosing the right output format based on your use case |\n\n---\n\n## Quick Start\n\n### Install via npx (Recommended)\n\nNo installation needed — just configure your MCP client:\n\n```json\n{\n  \"mcpServers\": {\n    \"ai-answer-copier\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@xjtlumedia/markdown-mcp-server\"]\n    }\n  }\n}\n```\n\n### Install Globally\n\n```bash\nnpm install -g @xjtlumedia/markdown-mcp-server\n```\n\nThen configure:\n\n```json\n{\n  \"mcpServers\": {\n    \"ai-answer-copier\": {\n      \"command\": \"markdown-mcp-server\"\n    }\n  }\n}\n```\n\n---\n\n## Configuration by AI Client\n\n### 🔌 Claude Desktop\n\n<img width=\"805\" height=\"621\" alt=\"image\" src=\"https://github.com/user-attachments/assets/b012a055-b595-446a-9c12-934239f3d63b\" />\n\nEdit `%APPDATA%\\Claude\\claude_desktop_config.json` (Windows) or `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS):\n\n```json\n{\n  \"mcpServers\": {\n    \"ai-answer-copier\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@xjtlumedia/markdown-mcp-server\"]\n    }\n  }\n}\n```\n\nRestart Claude Desktop. You'll see a 🔌 icon — all 34 tools are now available.\n\n### VS Code (GitHub Copilot)\n\nAdd to `.vscode/mcp.json` or VS Code settings:\n\n```json\n{\n  \"servers\": {\n    \"ai-answer-copier\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@xjtlumedia/markdown-mcp-server\"]\n    }\n  }\n}\n```\n\n### Cursor / Windsurf / Any MCP Client\n\nUse the same `npx` command pattern above in your client's MCP configuration.\n\n### DIY version (local build)\n\n```json\n{\n  \"mcpServers\": {\n    \"markdown-formatter\": {\n      \"command\": \"node\",\n      \"args\": [\n        \"YOUR_PATH_TO_PROJECT/mcp-server/dist/mcp-server/src/index.js\"\n      ]\n    }\n  }\n}\n```\n\n*Replace `YOUR_PATH_TO_PROJECT` with the absolute path to this folder.*\n\n### HTTP Mode (Vercel)\n\nA hosted HTTP endpoint is available for browser-based and remote integrations:\n\n```\nhttps://ai-answer-copier.vercel.app/api/mcp\n```\n\nTest with MCP Inspector:\n\n```bash\nnpx @modelcontextprotocol/inspector https://ai-answer-copier.vercel.app/api/mcp\n```\n\n---\n\n## Usage Examples\n\nOnce connected, just talk to your AI naturally:\n\n> **\"Batch-convert 5 markdown documents into DOCX, PDF, and HTML simultaneously and save them to my Downloads folder.\"**\n> → AI uses `batch_convert` with items[] and formats[]\n\n> **\"Generate 10 physics questions about Newton's Laws and export them as a Kahoot CSV.\"**\n> → AI uses `convert_to_csv`\n\n> **\"Convert this markdown into a Word document and save it to my Desktop.\"**\n> → AI calls `convert_to_docx` with `output_path`\n\n> **\"Take these lecture notes and produce a print-ready PDF.\"**\n> → AI calls `convert_to_pdf` with Puppeteer rendering, KaTeX math, and syntax highlighting\n\n> **\"Turn this into a Moodle-compatible XML quiz bank.\"**\n> → AI calls `convert_to_xml`\n\n> **\"Format this for Slack and send it to the team channel.\"**\n> → AI calls `convert_to_slack`\n\n> **\"Check this Markdown for issues and fix them.\"**\n> → AI calls `lint_markdown` then `repair_markdown`\n\n> **\"Give me an overview of this document — word count, structure, all links.\"**\n> → AI chains `analyze_document` + `generate_toc` + `extract_links`\n\n---\n\n## Features\n\n### 22 Output Formats\n\nExport 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.\n\n### Batch Conversion\n\nConvert multiple Markdown documents to multiple formats in one `batch_convert` call. Errors are isolated per item+format so one failure never blocks the rest.\n\n### Math & Code as First-Class Citizens\n\nFull support for KaTeX math expressions and syntax-highlighted code blocks. Your `$\\sqrt{x^2 + y^2}$` and Python snippets survive every conversion perfectly.\n\n### Smart Binary Handling\n\nBinary 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.\n\n### Document Analysis & Repair\n\nLint Markdown, auto-repair broken formatting, extract code blocks and links, generate Table of Contents, and get comprehensive document statistics — all without leaving the chat.\n\n### GFM (GitHub Flavored Markdown)\n\nTables, task lists, strikethrough, autolinks — all parsed correctly via `remark-gfm`.\n\n### Puppeteer-Powered PDF & PNG\n\nPDF and image exports use headless Chromium for pixel-perfect rendering with full CSS styling, KaTeX math, syntax highlighting, and print-optimized layouts.\n\n### Self-Contained\n\nZero runtime dependencies on external APIs. Everything runs locally. Your data never leaves your computer.\n\n---\n\n## Architecture\n\n```\n┌─────────────────────────┐\n│  AI Client               │\n│  (Claude, Copilot,      │\n│   Cursor, Windsurf)     │\n└──────────┬──────────────┘\n           │ MCP Protocol (stdio / HTTP)\n           ▼\n┌─────────────────────────┐\n│  AI Answer Copier        │\n│  MCP Server (34 tools)   │\n│                          │\n│  ┌── Conversion ────────┐│\n│  │ remark/rehype, docx, ││\n│  │ puppeteer, xlsx,     ││\n│  │ CSV/JSON/XML/RTF/    ││\n│  │ LaTeX/TXT parsers    ││\n│  └──────────────────────┘│\n│  ┌── Platform ──────────┐│\n│  │ Slack, Discord, JIRA,││\n│  │ Confluence, AsciiDoc,││\n│  │ RST, MediaWiki,      ││\n│  │ BBCode, Textile, Org ││\n│  └──────────────────────┘│\n│  ┌── Batch ─────────────┐│\n│  │ items[] × formats[]  ││\n│  │ 22 formats, isolated ││\n│  └──────────────────────┘│\n│  ┌── Analysis ──────────┐│\n│  │ Code blocks, links,  ││\n│  │ TOC, stats, structure││\n│  └──────────────────────┘│\n│  ┌── Repair ────────────┐│\n│  │ Lint, auto-repair    ││\n│  └──────────────────────┘│\n│  ┌── Import ────────────┐│\n│  │ HTML → Markdown      ││\n│  └──────────────────────┘│\n└─────────────────────────┘\n```\n\n---\n\n## What's New in v2.1.0\n\nThis release hardens both the local (`npx`) and remote Vercel MCP transports with 8 logic fixes:\n\n| # | Fix | Area |\n|---|---|---|\n| 1 | **Browser not closed on error** — `try/finally` around `browser.close()` so Chromium never leaks on PDF/PNG failures | Both transports |\n| 2 | **`generate_html` missing KaTeX CSS** — restored viewport meta, KaTeX stylesheet (SRI hash), and full inline styles so math renders correctly | Vercel `/api/mcp` |\n| 3 | **`convert_to_html` incomplete styles** — added SRI integrity hash, table borders, and blockquote styling to match local output | Vercel `/api/mcp` |\n| 4 | **Session map memory leak** — `instances` Map now evicts stale sessions after 30 minutes (`SESSION_TTL_MS`); `McpInstance` tracks `lastUsed` | Vercel `/api/mcp` |\n| 5 | **`keepAlive` interval not cleared** on normal SSE stream end — added inner `try/finally` that always calls `clearInterval(keepAlive)` | Vercel `/api/mcp` |\n| 6 | **`_initialized` SDK-internal access** — replaced bare `@ts-ignore` with a `typeof` guard so the server fails gracefully after SDK upgrades | Vercel `/api/mcp` |\n| 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 |\n| 8 | **DELETE method creates new session** — handler now returns `200` immediately on DELETE, preventing phantom session creation | Vercel `/api/mcp` |\n\n---\n\n## Known Limitations\n\n- **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.\n- **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.\n- **1 MB input limit** — all tool calls reject inputs larger than 1 MB. Split large documents into sections before converting.\n- **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.\n\n---\n\n## Development\n\n```bash\n# Clone the repository\ngit clone https://github.com/XJTLUmedia/AI_answer_copier.git\n\n# Web app\nnpm install\nnpm run dev\n\n# MCP server\ncd mcp-server\nnpm install\nnpm run dev     # hot reload\nnpm run build   # production build\nnpm run inspector  # test with MCP Inspector\n```\n\n---\n\n## Tech Stack\n\n| Component | Technology |\n|---|---|\n| MCP SDK | `@modelcontextprotocol/sdk` |\n| Markdown Parser | `unified` + `remark` + `rehype` |\n| Math Rendering | `remark-math` + `rehype-katex` |\n| Word Export | `docx` |\n| Excel Export | `xlsx` |\n| PDF/PNG Export | `puppeteer` |\n| Schema Validation | `zod` |\n| Runtime | Node.js (ESM) |\n\n---\n\n## Contributing\n\nWe welcome contributions! Whether it's a new export format, a bug fix, or documentation improvement — please consider making a pull request.\n\n1. Fork the [repository](https://github.com/XJTLUmedia/AI_answer_copier)\n2. Create a feature branch\n3. Submit a pull request\n\n---\n\n## License\n\n[MIT](https://opensource.org/licenses/MIT) © [XJTLUmedia](https://github.com/XJTLUmedia)\n\n---\n\n<p align=\"center\">\n  <b>Built by educators, for educators.</b><br/>\n  <i>Reclaim 5 hours of your week. Let the AI handle the formatting.</i>\n</p>\n",
  "bytes": 17608,
  "sha": "d64474c021e704cacdddce06dae792801c7d9644015f7b7a9c5aed00726f06e2",
  "repo_slug": "xjtlumedia/ai_answer_copier",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_xjtlumedia_markdown_formatter_650570e0/readme"
}