@xjtlumedia/markdown-mcp-server 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -27
- package/dist/index.js +30 -18
- package/package.json +14 -3
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
[](https://glama.ai/mcp/servers/XJTLUmedia/AI_answer_copier)
|
|
9
9
|
[](https://github.com/XJTLUmedia/AI_answer_copier)
|
|
10
10
|
|
|
11
|
-
**A Model Context Protocol (MCP) server that gives your AI assistant
|
|
11
|
+
**A Model Context Protocol (MCP) server that gives your AI assistant 33 powerful tools** — convert Markdown to 23+ document formats (PDF, DOCX, HTML, LaTeX, CSV, JSON, XML, XLSX, RTF, PNG, Email HTML…), 10 platform-native formats (Slack, Discord, JIRA, Confluence, AsciiDoc, RST, MediaWiki, BBCode, Textile, Org Mode), plus HTML import, markdown repair & lint, and document analysis. Stop copy-pasting. Let the AI do the exporting.
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
@@ -27,13 +27,17 @@ You asked an AI to generate 20 exam questions. It delivered — beautifully. But
|
|
|
27
27
|
|
|
28
28
|
---
|
|
29
29
|
|
|
30
|
-
##
|
|
30
|
+
## 33 MCP Tools at Your AI's Fingertips
|
|
31
|
+
|
|
32
|
+
### Document Conversion (15 tools)
|
|
31
33
|
|
|
32
34
|
| Tool | Output Format | Use Case |
|
|
33
35
|
|---|---|---|
|
|
34
36
|
| `harmonize_markdown` | Clean `.md` | Standardize messy AI output |
|
|
35
37
|
| `convert_to_txt` | Plain `.txt` | Strip all formatting |
|
|
36
38
|
| `convert_to_html` | `.html` | Web pages, email templates |
|
|
39
|
+
| `generate_html` | Full HTML doc | Self-contained pages with inline styles |
|
|
40
|
+
| `convert_to_email_html` | Email `.html` | Outlook/Gmail/Apple Mail compatible |
|
|
37
41
|
| `convert_to_pdf` | `.pdf` | Print-ready exams, handouts |
|
|
38
42
|
| `convert_to_docx` | `.docx` | Microsoft Word documents |
|
|
39
43
|
| `convert_to_latex` | `.tex` | Academic papers, journals |
|
|
@@ -44,7 +48,34 @@ You asked an AI to generate 20 exam questions. It delivered — beautifully. But
|
|
|
44
48
|
| `convert_to_xlsx` | `.xlsx` | Excel spreadsheets |
|
|
45
49
|
| `convert_to_image` | `.png` | Social media, presentations |
|
|
46
50
|
| `convert_to_md` | `.md` | Documentation, GitHub |
|
|
47
|
-
|
|
51
|
+
|
|
52
|
+
### Platform Converters (10 tools)
|
|
53
|
+
|
|
54
|
+
| Tool | Target | Use Case |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| `convert_to_slack` | Slack | mrkdwn format for Slack messages |
|
|
57
|
+
| `convert_to_discord` | Discord | Styled markdown for Discord |
|
|
58
|
+
| `convert_to_jira` | JIRA | Wiki markup for Atlassian JIRA |
|
|
59
|
+
| `convert_to_confluence` | Confluence | Wiki markup with panels & macros |
|
|
60
|
+
| `convert_to_asciidoc` | AsciiDoc | Technical documentation format |
|
|
61
|
+
| `convert_to_rst` | reStructuredText | Sphinx / Read the Docs |
|
|
62
|
+
| `convert_to_mediawiki` | MediaWiki | Wikipedia-style markup |
|
|
63
|
+
| `convert_to_bbcode` | BBCode | phpBB / vBulletin forums |
|
|
64
|
+
| `convert_to_textile` | Textile | Redmine, Basecamp |
|
|
65
|
+
| `convert_to_orgmode` | Emacs Org Mode | Org-style headers & source blocks |
|
|
66
|
+
|
|
67
|
+
### Import, Repair & Analysis (8 tools)
|
|
68
|
+
|
|
69
|
+
| Tool | Description |
|
|
70
|
+
|---|---|
|
|
71
|
+
| `html_to_markdown` | Convert HTML back to Markdown |
|
|
72
|
+
| `repair_markdown` | Auto-fix broken Markdown syntax |
|
|
73
|
+
| `lint_markdown` | Check Markdown for style & syntax issues |
|
|
74
|
+
| `extract_code_blocks` | Pull out all fenced code blocks |
|
|
75
|
+
| `extract_links` | Extract all URLs and link text |
|
|
76
|
+
| `generate_toc` | Generate a table of contents |
|
|
77
|
+
| `analyze_document` | Word count, reading time, structure stats |
|
|
78
|
+
| `extract_structure` | Extract document heading hierarchy |
|
|
48
79
|
|
|
49
80
|
Every tool accepts a `markdown` string input and an optional `output_path` to save directly to disk. Binary formats (PDF, DOCX, XLSX, PNG) intelligently guide the AI to save files rather than dumping raw base64.
|
|
50
81
|
|
|
@@ -104,7 +135,7 @@ Edit `%APPDATA%\Claude\claude_desktop_config.json` (Windows) or `~/Library/Appli
|
|
|
104
135
|
}
|
|
105
136
|
```
|
|
106
137
|
|
|
107
|
-
Restart Claude Desktop. You'll see a 🔌 icon — all
|
|
138
|
+
Restart Claude Desktop. You'll see a 🔌 icon — all 33 tools are now available to Claude.
|
|
108
139
|
|
|
109
140
|
### VS Code (GitHub Copilot)
|
|
110
141
|
|
|
@@ -204,13 +235,28 @@ Zero runtime dependencies on external APIs. Everything runs locally on your mach
|
|
|
204
235
|
- **XML** → Enterprise integrations, SOAP services
|
|
205
236
|
- **HTML** → Embed in web apps, email templates
|
|
206
237
|
- **LaTeX** → Academic publishing, research papers
|
|
238
|
+
- **AsciiDoc / RST** → Sphinx, Read the Docs, technical manuals
|
|
239
|
+
- **Org Mode** → Emacs workflows
|
|
207
240
|
|
|
208
241
|
### For Content Creators
|
|
209
242
|
- **PNG** → Social media posts, slide decks
|
|
210
|
-
- **HTML** → Blog posts, newsletters
|
|
243
|
+
- **HTML / Email HTML** → Blog posts, newsletters, email campaigns
|
|
211
244
|
- **Markdown** → Documentation, READMEs, wikis
|
|
212
245
|
- **RTF** → Universal rich text compatibility
|
|
213
246
|
|
|
247
|
+
### For Teams & Collaboration
|
|
248
|
+
- **Slack** → Paste-ready mrkdwn messages
|
|
249
|
+
- **Discord** → Styled markdown for servers and channels
|
|
250
|
+
- **JIRA / Confluence** → Atlassian wiki markup
|
|
251
|
+
- **MediaWiki** → Wikipedia-style documentation
|
|
252
|
+
- **BBCode / Textile** → Forum posts (phpBB, Redmine, Basecamp)
|
|
253
|
+
|
|
254
|
+
### Import & Quality
|
|
255
|
+
- **HTML → Markdown** → Round-trip HTML content back to Markdown
|
|
256
|
+
- **Repair** → Auto-fix broken Markdown syntax
|
|
257
|
+
- **Lint** → Validate style and syntax
|
|
258
|
+
- **Analysis** → Word count, reading time, structure extraction
|
|
259
|
+
|
|
214
260
|
---
|
|
215
261
|
|
|
216
262
|
## Architecture
|
|
@@ -221,29 +267,32 @@ Zero runtime dependencies on external APIs. Everything runs locally on your mach
|
|
|
221
267
|
│ (Claude, Copilot, │
|
|
222
268
|
│ Cursor, etc.) │
|
|
223
269
|
└────────┬────────────┘
|
|
224
|
-
│ MCP Protocol (stdio)
|
|
270
|
+
│ MCP Protocol (stdio / HTTP)
|
|
225
271
|
▼
|
|
226
|
-
|
|
227
|
-
│ AI Answer Copier
|
|
228
|
-
│
|
|
229
|
-
│
|
|
230
|
-
│ ┌─
|
|
231
|
-
│ │
|
|
232
|
-
│
|
|
233
|
-
│
|
|
234
|
-
│ │
|
|
235
|
-
│
|
|
236
|
-
│ ┌─
|
|
237
|
-
│ │
|
|
238
|
-
│
|
|
239
|
-
│
|
|
240
|
-
│ │
|
|
241
|
-
│
|
|
242
|
-
│ ┌─
|
|
243
|
-
│ │
|
|
244
|
-
│
|
|
245
|
-
│
|
|
246
|
-
|
|
272
|
+
┌──────────────────────────────────┐
|
|
273
|
+
│ AI Answer Copier MCP Server │
|
|
274
|
+
│ 33 tools │
|
|
275
|
+
│ │
|
|
276
|
+
│ ┌─ Document Conversion (15) ───┐│
|
|
277
|
+
│ │ remark/rehype · docx · xlsx ││
|
|
278
|
+
│ │ puppeteer · KaTeX · CSV/XML ││
|
|
279
|
+
│ │ JSON · RTF · LaTeX · TXT ││
|
|
280
|
+
│ │ Email HTML (inline styles) ││
|
|
281
|
+
│ └──────────────────────────────┘│
|
|
282
|
+
│ ┌─ Platform Converters (10) ───┐│
|
|
283
|
+
│ │ Slack · Discord · JIRA ││
|
|
284
|
+
│ │ Confluence · AsciiDoc · RST ││
|
|
285
|
+
│ │ MediaWiki · BBCode ││
|
|
286
|
+
│ │ Textile · Org Mode ││
|
|
287
|
+
│ └──────────────────────────────┘│
|
|
288
|
+
│ ┌─ Import & Repair (3) ────────┐│
|
|
289
|
+
│ │ HTML→MD · Repair · Lint ││
|
|
290
|
+
│ └──────────────────────────────┘│
|
|
291
|
+
│ ┌─ Analysis (5) ───────────────┐│
|
|
292
|
+
│ │ Code Blocks · Links · TOC ││
|
|
293
|
+
│ │ Document Stats · Structure ││
|
|
294
|
+
│ └──────────────────────────────┘│
|
|
295
|
+
└──────────────────────────────────┘
|
|
247
296
|
```
|
|
248
297
|
|
|
249
298
|
---
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
-
import { CallToolRequestSchema, ListToolsRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
4
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, ListResourcesRequestSchema, ListResourceTemplatesRequestSchema, ReadResourceRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
5
|
import { unified } from 'unified';
|
|
6
6
|
import remarkParse from 'remark-parse';
|
|
7
7
|
import remarkGfm from 'remark-gfm';
|
|
@@ -943,6 +943,9 @@ server.setRequestHandler(GetPromptRequestSchema, async (request) => {
|
|
|
943
943
|
throw new Error(`Unknown prompt: ${name}`);
|
|
944
944
|
});
|
|
945
945
|
// ── Resources ────────────────────────────────────────────────────────
|
|
946
|
+
server.setRequestHandler(ListResourceTemplatesRequestSchema, async () => {
|
|
947
|
+
return { resourceTemplates: [] };
|
|
948
|
+
});
|
|
946
949
|
server.setRequestHandler(ListResourcesRequestSchema, async () => {
|
|
947
950
|
return {
|
|
948
951
|
resources: [
|
|
@@ -1106,6 +1109,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1106
1109
|
if (!markdown && !noMarkdownTools.includes(name)) {
|
|
1107
1110
|
throw new Error("Markdown content is required");
|
|
1108
1111
|
}
|
|
1112
|
+
// Guard against oversized inputs to prevent runaway memory/CPU usage
|
|
1113
|
+
const MAX_INPUT_BYTES = 1024 * 1024 * 1024; // 1 GB
|
|
1114
|
+
const inputToCheck = markdown ?? args.html ?? '';
|
|
1115
|
+
if (Buffer.byteLength(inputToCheck, 'utf8') > MAX_INPUT_BYTES) {
|
|
1116
|
+
throw new Error('Input too large: content exceeds the 1 GB limit. Please split the document into smaller sections.');
|
|
1117
|
+
}
|
|
1109
1118
|
if (name === "harmonize_markdown") {
|
|
1110
1119
|
const file = await unified()
|
|
1111
1120
|
.use(remarkParse)
|
|
@@ -1196,25 +1205,28 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1196
1205
|
return handleOutput(htmlDoc, outputPath);
|
|
1197
1206
|
}
|
|
1198
1207
|
const browser = await puppeteer.launch({ headless: true, executablePath: await findChrome() });
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1208
|
+
try {
|
|
1209
|
+
const page = await browser.newPage();
|
|
1210
|
+
await page.setContent(htmlDoc);
|
|
1211
|
+
let resultBuffer;
|
|
1212
|
+
if (name === "convert_to_pdf") {
|
|
1213
|
+
resultBuffer = await page.pdf({ format: 'A4' });
|
|
1214
|
+
return handleOutput(resultBuffer, outputPath, {
|
|
1215
|
+
format: 'pdf',
|
|
1216
|
+
description: 'PDF document generated from Markdown via Puppeteer'
|
|
1217
|
+
});
|
|
1218
|
+
}
|
|
1219
|
+
else {
|
|
1220
|
+
const screenshot = await page.screenshot({ fullPage: true, encoding: 'binary' });
|
|
1221
|
+
resultBuffer = screenshot;
|
|
1222
|
+
return handleOutput(resultBuffer, outputPath, {
|
|
1223
|
+
format: 'png',
|
|
1224
|
+
description: 'PNG image screenshot of the rendered Markdown'
|
|
1225
|
+
});
|
|
1226
|
+
}
|
|
1209
1227
|
}
|
|
1210
|
-
|
|
1211
|
-
const screenshot = await page.screenshot({ fullPage: true, encoding: 'binary' });
|
|
1212
|
-
resultBuffer = screenshot;
|
|
1228
|
+
finally {
|
|
1213
1229
|
await browser.close();
|
|
1214
|
-
return handleOutput(resultBuffer, outputPath, {
|
|
1215
|
-
format: 'png',
|
|
1216
|
-
description: 'PNG image screenshot of the rendered Markdown'
|
|
1217
|
-
});
|
|
1218
1230
|
}
|
|
1219
1231
|
}
|
|
1220
1232
|
// New tools: convert_to_md and generate_html
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xjtlumedia/markdown-mcp-server",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "AI Answer Copier — MCP Server
|
|
3
|
+
"version": "2.1.1",
|
|
4
|
+
"description": "AI Answer Copier — MCP Server with 33 tools: convert Markdown to 23+ formats (PDF, DOCX, HTML, Slack, Discord, JIRA, Confluence, AsciiDoc, RST, MediaWiki, BBCode, Textile, Org Mode, Email HTML, and more), plus document analysis, repair/lint, and HTML import.",
|
|
5
5
|
"mcpName": "io.github.XJTLUmedia/markdown-formatter",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
@@ -37,7 +37,18 @@
|
|
|
37
37
|
"lms",
|
|
38
38
|
"claude",
|
|
39
39
|
"copilot",
|
|
40
|
-
"ai-tools"
|
|
40
|
+
"ai-tools",
|
|
41
|
+
"slack",
|
|
42
|
+
"discord",
|
|
43
|
+
"jira",
|
|
44
|
+
"confluence",
|
|
45
|
+
"asciidoc",
|
|
46
|
+
"rst",
|
|
47
|
+
"mediawiki",
|
|
48
|
+
"bbcode",
|
|
49
|
+
"lint",
|
|
50
|
+
"repair",
|
|
51
|
+
"document-analysis"
|
|
41
52
|
],
|
|
42
53
|
"author": "XJTLUmedia",
|
|
43
54
|
"license": "MIT",
|