使用说明
汇流MCP服务器
一种模型上下文协议(MCP)服务器,提供与Confluence交互的工具。读取、创建、更新和删除页面、管理空间、搜索内容等。
特性
- 页面操作:获取、创建、更新、删除页面
- 页面层次结构:移动页面、列出子页面、获取带有子页面的页面
- 空间操作:列出空间、获取空间详细信息、浏览空间内容
- 搜索:完全支持CQL,按文本或标题搜索
- 标签:获取、添加、删除和批量管理页面标签
- 评论:阅读并添加页面评论
- 附件:列出页面附件
- 特别:从每日报告中提取已完成部分
安装
使用npx(推荐,无需安装)
无需安装!只需配置Claude Desktop或Claude Code,如下所示。
全球安装
npm install -g @vinhnguyen/confluence-mcp
来源
git clone https://github.com/glorynguyen/confluence-mcp.git
cd confluence-mcp
npm install
配置
先决条件
MCP服务器需要Atlassian凭据:
| 变量 | 描述 | 示例 |
|---|---|---|
ATLASSIAN_EMAIL |
您的Atlassian帐户电子邮件 | user@company.com |
ATLASSIAN_API_TOKEN |
Atlassian的API令牌 | ATATT3xFfGF0... |
ATLASSIAN_DOMAIN |
您的Confluence域名 | company.atlassian.net |
获取API令牌
- 首选https://id.atlassian.com/manage-profile/security/api-tokens
- 点击“创建API令牌”
- 给它一个标签并复制令牌
克劳德桌面版
将服务器添加到Claude Desktop配置文件中:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - 视窗:
%APPDATA%\Claude\claude_desktop_config.json
使用npx(推荐,无需安装):
{
"mcpServers": {
"confluence": {
"command": "npx",
"args": ["-y", "@vinhnguyen/confluence-mcp"],
"env": {
"ATLASSIAN_EMAIL": "your.email@company.com",
"ATLASSIAN_API_TOKEN": "your_api_token",
"ATLASSIAN_DOMAIN": "your-domain.atlassian.net"
}
}
}
}
或者通过npm全局安装:
{
"mcpServers": {
"confluence": {
"command": "confluence-mcp",
"env": {
"ATLASSIAN_EMAIL": "your.email@company.com",
"ATLASSIAN_API_TOKEN": "your_api_token",
"ATLASSIAN_DOMAIN": "your-domain.atlassian.net"
}
}
}
}
或来源:
{
"mcpServers": {
"confluence": {
"command": "node",
"args": ["/path/to/confluence-mcp/index.js"],
"env": {
"ATLASSIAN_EMAIL": "your.email@company.com",
"ATLASSIAN_API_TOKEN": "your_api_token",
"ATLASSIAN_DOMAIN": "your-domain.atlassian.net"
}
}
}
}
克劳德代码
添加到您的 ~/.claude.json (项目)或 ~/.claude/settings.json (全球):
使用npx(推荐):
{
"mcpServers": {
"confluence": {
"command": "npx",
"args": ["-y", "@vinhnguyen/confluence-mcp"],
"env": {
"ATLASSIAN_EMAIL": "your.email@company.com",
"ATLASSIAN_API_TOKEN": "your_api_token",
"ATLASSIAN_DOMAIN": "your-domain.atlassian.net"
}
}
}
}
或者,如果全局安装:
{
"mcpServers": {
"confluence": {
"command": "confluence-mcp",
"env": {
"ATLASSIAN_EMAIL": "your.email@company.com",
"ATLASSIAN_API_TOKEN": "your_api_token",
"ATLASSIAN_DOMAIN": "your-domain.atlassian.net"
}
}
}
}
更新配置后重新启动Claude Desktop或Claude Code。
环境变量
| 变量 | 描述 | 必填 |
|---|---|---|
ATLASSIAN_EMAIL |
您的Atlassian帐户电子邮件 | 是 |
ATLASSIAN_API_TOKEN |
Atlassian的API令牌 | 是 |
ATLASSIAN_DOMAIN |
您的Confluence域名(例如。, company.atlassian.net) |
是 |
可用工具
页面操作
| 工具 | 说明 |
|---|---|
confluence_get_page |
获取页面详细信息,包括内容、版本、元数据 |
confluence_get_page_content |
以文本或HTML格式获取页面内容 |
confluence_get_child_pages |
获取父级的所有子页(带分页) |
confluence_get_page_with_children |
获取一个页面及其所有直接子页面 |
confluence_list_child_pages |
列出直接子页面(文件夹内容视图) |
confluence_create_page |
在空间中创建新页面 |
confluence_update_page |
更新现有页面(需要版本号) |
confluence_update_page_auto |
使用自动版本处理更新页面 |
confluence_move_page |
将页面移动到新的父级(重构层次结构) |
confluence_delete_page |
删除页面(移动到垃圾箱) |
空间操作
| 工具 | 说明 |
|---|---|
confluence_list_spaces |
列出所有可访问的空间 |
confluence_get_space |
获取空间详细信息 |
confluence_get_space_content |
在空间中获取页面或博客文章 |
搜索操作
| 工具 | 说明 |
|---|---|
confluence_search |
使用CQL查询进行搜索 |
confluence_search_by_text |
按文本内容搜索页面 |
confluence_search_by_title |
按标题搜索页面 |
标签操作
| 工具 | 说明 |
|---|---|
confluence_get_page_labels |
在页面上获取标签 |
confluence_add_page_label |
向页面添加标签 |
confluence_remove_page_label |
从页面中删除标签 |
评论和附件
| 工具 | 说明 |
|---|---|
confluence_get_page_comments |
在页面上获取评论 |
confluence_add_page_comment |
向页面添加评论 |
confluence_get_page_attachments |
在页面上列出附件 |
专用工具
| 工具 | 说明 |
|---|---|
confluence_extract_done_sections |
从每日报告中提取已完成部分 |
示例用法
获取页面及其内容
Use confluence_get_page with pageId "12345678"
创建新页面
Use confluence_create_page with:
- spaceKey: "DEV"
- title: "Weekly Report - Week 5"
- content: "<h1>Weekly Summary</h1><p>This week we completed...</p>"
- parentId: "87654321" (optional)
搜索页面
Use confluence_search_by_title with title "Daily Report" and spaceKey "TEAM"
提取已完成部分以生成报告
Use confluence_extract_done_sections with pageId "12345678"
内容格式
创建或更新页面时,请使用Confluence存储格式(XHTML):
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<p>Paragraph text</p>
<ul>
<li>List item 1</li>
<li>List item 2</li>
</ul>
<ac:structured-macro ac:name="code">
<ac:plain-text-body><![CDATA[code here]]></ac:plain-text-body>
</ac:structured-macro>
CQL查询示例
Confluence查询语言(CQL)用于高级搜索:
# Pages in a specific space
type=page AND space=DEV
# Pages modified recently
type=page AND lastmodified > now("-7d")
# Pages with specific label
type=page AND label=weekly-report
# Pages by creator
type=page AND creator=currentUser()
# Combined query
type=page AND space=TEAM AND text ~ "report" AND lastmodified > now("-30d")
许可证
麻省理工学院