@hun-dun/markdown-to-html-mcp
项目简介
本项目基于 modelcontextprotocol/typescript-sdk 实现 Markdown 转 HTML 的 MCP 服务端,支持 npx/全局命令一键启动、远程 HTTP/Streamable HTTP 调用,并可被 Cursor 等 MCP 客户端直接调用。
特性
支持 ESM/CJS 双产物,适配多种 Node.js 环境
一键 npx/全局命令启动(stdio)
支持 HTTP/Streamable HTTP 服务
结构现代,类型安全,源码位于
src/,产物位于dist/(ESM)和dist-cjs/(CJS)bin/主入口均指向 CJS 产物,兼容性强
可被 Cursor、curl、代码等多种方式远程调用
快速开始
安装依赖
构建产物
本地启动(stdio)
启动 HTTP 服务
作为全局命令/被 Cursor 调用
远程 HTTP/Streamable HTTP 调用
ESM/CJS 产物说明
ESM 产物位于
dist/,入口dist/index.jsCJS 产物位于
dist-cjs/,入口dist-cjs/index.jsbin/主入口均指向 CJS 产物,兼容 npx/全局命令
MCP 工具注册与调用
registerMarkdownToHtmlTool(server)注册 markdownToHtml 工具,参数为 markdown,返回 HTML。CLI 支持 stdio 和 HTTP 两种模式。
在 Cursor 中调用
本工具可直接集成到 Cursor,支持本地(stdio)和远程(http)两种方式:
方式一:本地调用(stdio,推荐本地开发/临时调用)
在 .cursor/config.json 中添加如下配置:
Cursor 会自动用 npx 下载并调用你的包,适合本地/临时场景。
不需要你手动启动服务端。
结果会直接在 Cursor 工具面板中展示。
方式二:远程调用(http,推荐云端/团队共享)
启动 HTTP 服务:
npx @hun-dun/markdown-to-html-mcp --http # 或 PORT=8080 npx @hun-dun/markdown-to-html-mcp --http在
.cursor/config.json中添加如下配置:
适合你用
npx @hun-dun/markdown-to-html-mcp --http启动服务后,供多台机器/团队成员/云端调用。结果会直接在 Cursor 工具面板中展示。
常见问题
ts-node 运行 .ts 文件报 "Unknown file extension .ts"——需加
--loader ts-node/esmnode 运行 dist/index.js 报 "exports is not defined in ES module scope"——需用 CommonJS 产物并移除 package.json 的 "type": "module",或用 .cjs 后缀
StreamableHTTPServerTransport 构造参数报错,需根据 SDK 版本传递正确 options
适用场景
本地开发、测试
远程 HTTP/Streamable HTTP 服务
Cursor、MCP 客户端一键集成
代码/脚本/命令行调用
License
MIT
Related MCP Servers
- AsecurityAlicenseAqualityMCP server for seamless document format conversion using Pandoc, supporting Markdown, HTML, PDF, DOCX (.docx), csv and more.Last updated -1454MIT License
- AsecurityAlicenseAqualityAn MCP server for converting Markdown documents to PDF files.Last updated -11720MIT License
- AsecurityAlicenseAqualityA powerful MCP server for fetching and transforming web content into various formats (HTML, JSON, Markdown, Plain Text) with ease.Last updated -462336MIT License
- AsecurityFlicenseAqualityAn MCP server that extracts meaningful content from websites and converts HTML to high-quality Markdown, using Mozilla's Readability engine.Last updated -117,5327