Provides tools for interacting with Confluence, enabling users to list spaces, search and retrieve page content, and create new pages within a knowledge base.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Confluence MCP Serversearch for the latest project roadmap and summarize the key milestones"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Confluence MCP Demo
这个目录提供了一个最小可运行的 Confluence MCP Python demo,目标是先把整体链路打通,再逐步扩展成生产可用版本。
1. 我们需要哪些功能
如果要做一个真正可用的 Confluence MCP,建议按下面 3 个层次来设计。
A. 最小可用能力
这些功能足够支持“让大模型读取 Confluence 知识库并做基础写入”:
health用于确认 MCP 服务是否正常、当前连接的是mock还是real模式。list_spaces列出空间,帮助模型知道知识分区。list_pages按空间列出页面,支持基础浏览。get_page读取页面正文,至少返回body.storage。search_pages基于 CQL 搜索页面,是最核心的检索能力。create_page允许模型把整理结果或报告写回 Confluence。
B. 生产常用能力
如果后续要真正接入业务,通常还需要:
update_page更新页面内容,并处理版本号冲突。delete_page或archive_page清理无效内容时会用到。get_page_children支持文档树遍历。get_comments/add_comment便于做协作场景。get_attachments/upload_attachment很多资料以附件方式存在。get_labels/set_labels有助于主题归档与检索。
C. 工程化能力
要稳定服务给 MCP 客户端,还应补齐:
认证配置管理 使用 API Token,避免把密钥写死在代码中。
权限边界 例如默认只读,写操作单独开关。
错误处理与重试 包括限流、401、403、404、429、5xx。
内容格式转换 Confluence 常见的是
storage格式,很多模型更适合 Markdown。观测性 增加请求日志、trace id、调用耗时。
结果裁剪 避免把超长正文一次性返回给模型。
2. 当前 demo 实现了什么
本 demo 已经实现以下 MCP 工具:
healthlist_spaceslist_pagesget_pagesearch_pagescreate_page
并且支持两种运行模式:
mock不依赖真实 Confluence,适合先演示流程。real通过 Confluence REST API 访问真实实例。
3. 文件说明
confluence_mcp_demo.pyMCP 服务主程序,包含 mock 客户端、真实 Confluence 客户端和工具注册逻辑。requirements.txtPython 依赖。env.example环境变量示例。
4. 安装与运行
安装依赖
cd /home/simon/simondisk1/NCAA2026/MCP_confluence
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt运行本地 demo
mock 模式下不需要真实 Confluence 账号:
python3 confluence_mcp_demo.py --mode mock --demo启动 MCP Server
python3 confluence_mcp_demo.py --mode mock切到真实 Confluence
先准备环境变量:
cp env.example .env然后把其中的值改成真实配置,再运行:
python3 confluence_mcp_demo.py --mode real --demo
python3 confluence_mcp_demo.py --mode real5. 示例代码
下面是直接调用业务层的演示思路,便于你理解 MCP 背后做了什么:
from confluence_mcp_demo import build_service
service = build_service(mode="mock")
print(service.list_spaces(limit=5))
print(service.list_pages(space_key="ENG", limit=5))
print(service.search_pages(cql='text ~ "API"', limit=5))
print(service.get_page(page_id="1002"))
print(
service.create_page(
space_key="ENG",
title="MCP Demo Page",
content="<p>Created from demo</p>",
)
)6. AI Agent Client 示例
如果你希望写一个真正的 AI client 去调用 MCP server,本目录已经新增:
ai_agent_client_demo.py
这个脚本的设计目标是:
通过
stdio连接本地confluence_mcp_demo.py自动读取 MCP tools
把 tools 转成 OpenAI Chat Completions 兼容的
tools格式用 HTTP
POST调用一个 AI 服务 URL让模型决定是否调用
search_pages、get_page等工具把工具结果再回传给模型生成最终回答
运行方式
先准备环境变量:
cp env.example .env填写以下几个关键值:
AI_CHAT_URL=https://api.openai.com/v1/chat/completions
AI_BEARER_TOKEN=your-token
AI_MODEL=gpt-4o-mini
MCP_MODE=mock
AGENT_USER_QUERY=请帮我搜索和API相关的Confluence页面,并总结页面标题。然后运行:
python3 ai_agent_client_demo.py说明
这个 agent 会自己拉起
confluence_mcp_demo.py --mode mock它使用
Authorization: Bearer <token>做鉴权它直接向
AI_CHAT_URL发送 HTTPPOST只要你的 AI 服务兼容 OpenAI Chat Completions 请求格式即可替换
7. 后续建议
如果你准备把它变成真正可接 Cursor 或 Claude Desktop 的 MCP Server,下一步最值得补的是:
update_pageget_page_childrenMarkdown 和 Confluence Storage 格式互转
写操作权限开关
更精细的搜索与摘要裁剪
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.