汇流数据中心MCP服务器
用于汇流数据中心/服务器的MCP(模型上下文协议)服务器。使像Claude这样的人工智能助手能够与Confluence页面进行交互。
特性
- 使用HTML或纯文本内容创建Confluence页面
- 为页面(用户和组)添加读取/编辑限制
- 获取和删除页面限制
- 在所有空格中使用CQL或纯文本搜索页面
- 阅读特定页面的完整内容
- 在具有筛选功能的空间中列出页面
- 获取父页面的子页面
- 将用户目录与外部目录(例如Active directory)同步
可用工具
confluence_create_page
在Confluence空间中创建新页面。
confluence_add_restrictions
为特定用户或组向页面添加阅读或编辑限制。
confluence_get_restrictions
获取页面的当前限制。
confluence_remove_restrictions
从页面中删除限制。
confluence_get_space_pages
使用可选的标题筛选列出空间中的所有页面。
confluence_get_child_pages
获取特定父页面的所有子页面。
confluence_search_pages
使用纯文本或CQL(汇流查询语言)在所有空间(或特定空间)中搜索页面。
支持纯文本查询以及完整的CQL表达式:
"deployment guide"--全文搜索title ~ "Meeting Notes"--在标题中搜索space = "TEAM" AND text ~ "roadmap"--带空间滤波器的CQLspace = "DOCS" AND lastmodified >= "2024-01-01"--日期筛选
confluence_get_page
阅读特定页面的完整内容和元数据。可以通过以下方式识别 page_id 或通过 page_title + space_key.Set include_content=false 仅检索元数据而不检索完整的HTML正文。
confluence_sync_user_directory
触发用户目录与外部目录的同步(需要管理员权限)。
用法示例
配置后,您可以在Claude中使用自然语言命令:
- “在团队空间中创建一个名为“会议笔记”的新页面”
- “为组“开发人员”的页面ID 12345添加编辑限制”
- “在TEAM空间中为组“开发人员”的IT-DEV页面添加查看和编辑限制”
- “搜索space TEAM中的所有页面,不受限制地仅列出页面”
- “在所有空间中搜索有关“部署指南”的页面”
- “在团队空间中查找标题中包含“会议”的所有页面”
- “阅读DOCS空间中标题为“架构概述”的页面内容”
- “列出DOCS空间中的所有页面”
- “同步Confluence用户目录”
需求
- Python 3.10+
- 克劳德
- 汇流数据中心或服务器实例
- API用户令牌或用户凭据
安装uv(推荐)
uv 是一个速度极快的Python包管理器,简化了MCP服务器的运行。随着 uv,您不需要手动创建虚拟环境或安装依赖关系,它会自动处理所有事情。
macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | shmacOS(自制)
brew install uv视窗
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"验证安装
uv --version注: 使用uv是可选的,但建议使用。如果你不想使用它,你可以使用标准python+pip install相反,方法。
安装
- 克隆存储库:
git clone https://github.com/marekudlacek/mcp-confluence-datacenter.git
cd mcp-confluence-datacenter- 安装依赖项(!仅当不使用uv时!):
pip install -r requirements.txt配置
设置以下环境变量:
| 变量 | 必填 | 描述 |
|---|---|---|
CONFLUENCE_URL | 是 | 您的Confluence URL(例如。, https://confluence.company.com) |
CONFLUENCE_LOGIN | 是 | 您的Confluence用户名 |
CONFLUENCE_API_TOKEN | 是 | 您的Confluence API令牌或密码 |
CONFLUENCE_LOGIN_PASSWORD | 用于同步 | 管理员密码(用户目录同步所需) |
CONFLUENCE_DIRECTORY_ID | 用于同步 | 用户目录同步的目录ID |
Claude代码的设置
添加到您的 ~/.claude.json 或项目的 .claude.json:
{
"mcpServers": {
"confluence": {
"command": "python",
"args": ["/path/to/mcp-confluence-datacenter.py"],
"env": {
"CONFLUENCE_URL": "https://confluence.your-company.com",
"CONFLUENCE_LOGIN": "your-username",
"CONFLUENCE_API_TOKEN": "your-api-token",
"CONFLUENCE_LOGIN_PASSWORD": "your-password",
"CONFLUENCE_DIRECTORY_ID": "your-directory-id"
}
}
}
}或与 uv (推荐):
{
"mcpServers": {
"confluence": {
"command": "uv",
"args": [
"run",
"--with", "httpx",
"--with", "pydantic",
"--with", "mcp",
"python",
"/path/to/mcp-confluence-datacenter.py"
],
"env": {
"CONFLUENCE_URL": "https://confluence.your-company.com",
"CONFLUENCE_LOGIN": "your-username",
"CONFLUENCE_API_TOKEN": "your-api-token",
"CONFLUENCE_LOGIN_PASSWORD": "your-password",
"CONFLUENCE_DIRECTORY_ID": "your-directory-id"
}
}
}
}Claude桌面设置
通过CLI快速安装
您可以使用直接添加此MCP服务器 claude mcp add 命令。
紫外线(推荐):
claude mcp add --transport stdio confluence \
--env CONFLUENCE_URL=https://confluence.your-company.com \
--env CONFLUENCE_LOGIN=your-username \
--env CONFLUENCE_API_TOKEN=your-api-token \
--env CONFLUENCE_LOGIN_PASSWORD=your-password \
--env CONFLUENCE_DIRECTORY_ID=your-directory-id \
-- uv run --with httpx --with pydantic --with mcp python /path/to/mcp-confluence-datacenter.py使用python:
claude mcp add --transport stdio confluence \
--env CONFLUENCE_URL=https://confluence.your-company.com \
--env CONFLUENCE_LOGIN=your-username \
--env CONFLUENCE_API_TOKEN=your-api-token \
--env CONFLUENCE_LOGIN_PASSWORD=your-password \
--env CONFLUENCE_DIRECTORY_ID=your-directory-id \
-- python /path/to/mcp-confluence-datacenter.py管理MCP服务器:
# List all configured servers
claude mcp list
# Get details for a specific server
claude mcp get confluence
# Remove a server
claude mcp remove confluence通过CONFIG文件安装
添加到您的Claude Desktop配置文件中:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json 窗户: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"confluence": {
"command": "python",
"args": ["/path/to/mcp-confluence-datacenter.py"],
"env": {
"CONFLUENCE_URL": "https://confluence.your-company.com",
"CONFLUENCE_LOGIN": "your-username",
"CONFLUENCE_API_TOKEN": "your-api-token",
"CONFLUENCE_LOGIN_PASSWORD": "your-password",
"CONFLUENCE_DIRECTORY_ID": "your-directory-id"
}
}
}
}或与 uv (推荐):
{
"mcpServers": {
"confluence": {
"command": "uv",
"args": [
"run",
"--with", "httpx",
"--with", "pydantic",
"--with", "mcp",
"python",
"/path/to/mcp-confluence-datacenter.py"
],
"env": {
"CONFLUENCE_URL": "https://confluence.your-company.com",
"CONFLUENCE_LOGIN": "your-username",
"CONFLUENCE_API_TOKEN": "your-api-token",
"CONFLUENCE_LOGIN_PASSWORD": "your-password",
"CONFLUENCE_DIRECTORY_ID": "your-directory-id"
}
}
}
}许可证
MIT许可证
