md2汇流mcp
Markdown到Confluence转换器 --MCP服务器,将Markdown文件上传到Atlassian Confluence,其中包含自动转换的Mermaid图、代码块和图像。
](https://www.npmjs.com/package/md2confluence-mcp) 
演示
上传中 showcase.md 与图像和美人鱼图融合
特性
- ✅ 美人鱼图 → PNG(通过kroki.io自动转换)
- ✅ 代码块 → Confluence代码宏
- ✅ 图像 → 附件(自动上传)
- ✅ 表格、链接、格式 → 保存的
安装
克劳德代码
添加到您的克劳德代码设置(~/.claude/settings.json):
{
"mcpServers": {
"confluence": {
"command": "npx",
"args": ["-y", "md2confluence-mcp"],
"env": {
"CONFLUENCE_URL": "https://your-domain.atlassian.net/wiki",
"CONFLUENCE_EMAIL": "your@email.com",
"CONFLUENCE_TOKEN": "YOUR_API_TOKEN"
}
}
}
}项目特定
添加到您的项目 .mcp.json:
{
"mcpServers": {
"confluence": {
"command": "npx",
"args": ["-y", "md2confluence-mcp"],
"env": {
"CONFLUENCE_URL": "https://your-domain.atlassian.net/wiki",
"CONFLUENCE_EMAIL": "your@email.com",
"CONFLUENCE_TOKEN": "YOUR_API_TOKEN"
}
}
}
}获取API令牌
- 首选https://id.atlassian.com/manage/api-tokens
- 点击“创建API令牌”
- 将令牌复制到
CONFLUENCE_TOKEN
用法
配置后,Claude Code可以自动使用这些工具。
提示示例
上传到您的个人空间
"Upload README.md to my personal Confluence space""Upload this document to my Confluence space"上传到特定空间(带URL)
"Upload docs/SETUP.md to Confluence here: https://company.atlassian.net/wiki/spaces/TEAM/overview""Create a new page in https://company.atlassian.net/wiki/spaces/~712020170fdaa4716743419285f156aa587665/overview with this content"更新现有页面
"Update this Confluence page with the latest content: https://company.atlassian.net/wiki/spaces/TEAM/pages/123456/My+Page""Sync docs/API.md to https://company.atlassian.net/wiki/spaces/EN/pages/789012/API+Reference"创建子页面(子页面)
"Create a new page under https://company.atlassian.net/wiki/spaces/TEAM/pages/123456/Parent+Page""Add a sub-page to this page: https://company.atlassian.net/wiki/spaces/EN/pages/789012/Guide"列表和搜索
"Show me available Confluence spaces""Find Confluence pages about authentication in the EN space"空格键格式
| 类型 | 格式 | 示例 |
|---|---|---|
| 全局空格 | 短键 | TEAM, EN, PROD |
| 个人空间 | ~ +ID | ~712020170fdaa4716743419285f156aa587665 |
提示: 您可以从Confluence URL中提取空格键:
https://company.atlassian.net/wiki/spaces/TEAM/overview
^^^^ space key
https://company.atlassian.net/wiki/spaces/~712020.../overview
^^^^^^^^^^ personal space key工具
| 工具 | 说明 |
|---|---|
upload_page | 从Markdown创建新的Confluence页面 |
update_page | 更新现有页面 |
create_child_page | 在现有页面下创建新页面 |
sync_file | 将本地文件同步到现有页面 |
list_spaces | 列出可用空间 |
search_pages | 搜索页面 |
运作原理
flowchart LR
A["Markdown"] --> B["Parse"]
B --> C["Mermaid → kroki.io → PNG"]
C --> D["Convert to Confluence HTML"]
D --> E["Upload via REST API"]
E --> F["Attach images"]- 解析 -提取内容物,去除正面物质
- 渲染 -通过将Mermaid图转换为PNG kroki.io
- 转换 -将Markdown转换为Confluence存储格式
- 上传 -通过Confluence REST API创建/更新页面
- 附加 -上传图片作为页面附件
环境变量
| 变量 | 必填 | 描述 |
|---|---|---|
CONFLUENCE_URL | ✅ | 例如。, https://your-domain.atlassian.net/wiki |
CONFLUENCE_EMAIL | ✅ | 您的Atlassian帐户电子邮件 |
CONFLUENCE_TOKEN | ✅ | API令牌 |
发展
# Clone
git clone https://github.com/Gyeom/md2confluence-mcp.git
cd md2confluence-mcp
# Install dependencies
npm install
# Build
npm run build
# Test locally
CONFLUENCE_URL=... CONFLUENCE_EMAIL=... CONFLUENCE_TOKEN=... npm start许可证
麻省理工学院
学分
- kroki.io -图表渲染API
- 模型上下文协议 -MCP-SDK
- Confluence REST API
