Confluence MCP Server
Provides tools to search, read, create, update, and delete Confluence pages, manage spaces, and convert between Confluence Storage Format and Markdown.
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 pages about 'onboarding' in space DEV"
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 Server
一个用于 Confluence Server/Data Center 的 Model Context Protocol (MCP) Server,提供完整的知识库读写能力。
功能特性
搜索页面: 使用 CQL 查询语言搜索 Confluence 页面
读取页面: 获取页面详情,自动转换为 Markdown 格式
创建页面: 支持 Markdown 和原生格式创建新页面
更新页面: 更新现有页面的标题和内容
删除页面: 删除指定页面
空间管理: 列出空间、获取空间内容、获取子页面结构
格式转换: 支持 Confluence Storage Format 与 Markdown 互转
Related MCP server: Confluence MCP Server
安装
pip install -e .配置
创建 .env 文件或设置环境变量:
CONFLUENCE_BASE_URL=https://your-confluence-domain.com/confluence
CONFLUENCE_USERNAME=your-email@example.com
CONFLUENCE_API_TOKEN=your-api-token-or-password
CONFLUENCE_API_VERSION=latest
CONFLUENCE_TIMEOUT=30使用
启动 MCP Server
confluence-mcp-server --url https://your-confluence/confluence --username user@example.com --api-token your-token或使用环境变量:
source .env
confluence-mcp-server命令行参数
confluence-mcp-server --help
Options:
--url TEXT Confluence base URL
--username TEXT Confluence username/email
--api-token TEXT Confluence API token or password
--api-version TEXT API version (default: latest)
--timeout INTEGER Request timeout in seconds
-v, --version Show the version and exit.
--help Show this message and exit.支持的工具
内容操作
search_pages: 使用 CQL 搜索页面get_page: 根据页面ID获取页面详情create_page: 创建新页面update_page: 更新现有页面delete_page: 删除页面get_page_by_title: 根据标题搜索页面
空间操作
list_spaces: 列出所有空间get_space: 获取空间详情get_space_content: 获取空间中的内容列表get_child_pages: 获取父页面的子页面
CQL 查询示例
text ~ "用户登录" AND space = "TECH"
title ~ "API" AND type = "page"
space = "PRD" AND label = "2024"多 Agent 使用教程
在 TRAE 中使用
方式一:通过项目技能导入(推荐)
打开 TRAE IDE
在项目面板中添加
confluence-skill项目目录TRAE 会自动识别
SKILL.md和mcp.json配置在对话中直接使用自然语言触发技能
方式二:手动配置 MCP Server
在终端启动 MCP Server:
cd /path/to/confluence-skill
source .venv/bin/activate
confluence-mcp-server在 TRAE 的设置中添加 MCP Server:
名称:
confluence-mcp-serverURL:
http://localhost:8000
在 Cursor 中使用
确保项目目录中有
.cursor/mcp.json配置文件Cursor 会自动读取配置并启动 MCP Server
在对话中使用
@confluence-mcp-server触发技能
.cursor/mcp.json 配置示例:
{
"name": "confluence-mcp-server",
"command": "python",
"args": ["-m", "src.main"],
"env": {
"CONFLUENCE_BASE_URL": "${CONFLUENCE_BASE_URL}",
"CONFLUENCE_USERNAME": "${CONFLUENCE_USERNAME}",
"CONFLUENCE_API_TOKEN": "${CONFLUENCE_API_TOKEN}"
},
"description": "Confluence MCP Server for reading and writing Confluence pages"
}在 Claude Code 中使用
方式一:通过 CLAUDE.md 配置
在项目根目录创建或编辑
CLAUDE.md文件添加以下配置:
---
skills:
- name: confluence-skill
type: mcp
server:
command: python
args: ["-m", "src.main"]
env:
CONFLUENCE_BASE_URL: "${CONFLUENCE_BASE_URL}"
CONFLUENCE_USERNAME: "${CONFLUENCE_USERNAME}"
CONFLUENCE_API_TOKEN: "${CONFLUENCE_API_TOKEN}"
---
# Confluence 知识库技能
使用 Confluence 技能可以搜索、读取、创建和更新 Confluence 文档。在对话中直接使用自然语言触发:
"帮我搜索 Java 编码规范文档"
"获取页面 63777422 的内容"
方式二:手动启动 MCP Server
启动 MCP Server:
cd /path/to/confluence-skill
source .venv/bin/activate
confluence-mcp-server在 Claude Code 设置中添加 MCP Server:
打开 Claude Code 设置
找到 MCP Servers 配置
添加新服务器:
http://localhost:8000
在 Codex 中使用
在项目目录中创建
.codex/mcp.json配置文件:
{
"servers": [
{
"name": "confluence-mcp-server",
"type": "http",
"url": "http://localhost:8000",
"description": "Confluence MCP Server"
}
]
}启动 MCP Server:
cd /path/to/confluence-skill
source .venv/bin/activate
confluence-mcp-server在 Codex 对话中使用
@confluence-mcp-server触发技能
在 OpenCode 中使用
在项目目录中创建
.opencode/mcp.json配置文件:
{
"name": "confluence-mcp-server",
"command": "python",
"args": ["-m", "src.main"],
"env": {
"CONFLUENCE_BASE_URL": "${CONFLUENCE_BASE_URL}",
"CONFLUENCE_USERNAME": "${CONFLUENCE_USERNAME}",
"CONFLUENCE_API_TOKEN": "${CONFLUENCE_API_TOKEN}"
},
"description": "Confluence MCP Server for reading and writing Confluence pages"
}OpenCode 会自动识别配置并启动 MCP Server
在对话中使用
@confluence-mcp-server触发技能
使用 MCP Python SDK
from mcp.stdio_client import StdioClient
async def main():
async with StdioClient(command="python", args=["-m", "src.main"]) as client:
# 搜索页面
results = await client.call_tool("search_pages", {"cql": "text ~ 'Java'", "limit": 5})
print(results)
# 获取页面内容
page = await client.call_tool("get_page", {"page_id": "63777422"})
print(page.get("title"))
print(page.get("body", {}).get("markdown"))
# 创建页面
new_page = await client.call_tool(
"create_page",
{
"title": "新文档标题",
"space_key": "TECH",
"content": "# 新文档\n\n内容描述",
"content_format": "markdown"
}
)
print(new_page)
if __name__ == "__main__":
import asyncio
asyncio.run(main())使用 HTTP API
MCP Server 默认在 http://localhost:8000 提供 HTTP 接口。
列出所有工具
curl http://localhost:8000/mcp/list_tools调用工具(POST)
curl -X POST http://localhost:8000/mcp/call_tool \
-H "Content-Type: application/json" \
-d '{
"name": "search_pages",
"arguments": {
"cql": "text ~ \"Java\"",
"limit": 5
}
}'在自定义 Agent 中集成
import requests
class ConfluenceSkillClient:
def __init__(self, base_url="http://localhost:8000"):
self.base_url = base_url
def search_pages(self, cql, limit=20):
return self._call_tool("search_pages", {"cql": cql, "limit": limit})
def get_page(self, page_id):
return self._call_tool("get_page", {"page_id": page_id})
def create_page(self, title, space_key, content, content_format="markdown"):
return self._call_tool(
"create_page",
{"title": title, "space_key": space_key, "content": content, "content_format": content_format}
)
def _call_tool(self, tool_name, arguments):
response = requests.post(
f"{self.base_url}/mcp/call_tool",
json={"name": tool_name, "arguments": arguments}
)
return response.json()
client = ConfluenceSkillClient()
results = client.search_pages("text ~ '技术文档'")
print(results)环境变量配置方式
方式一:使用 .env 文件
cp .env.example .env
# 编辑 .env 文件配置
source .env
confluence-mcp-server方式二:命令行参数
confluence-mcp-server \
--url https://docs.jk.com \
--username zhengzih \
--api-token your-password方式三:系统环境变量
export CONFLUENCE_BASE_URL=https://docs.jk.com
export CONFLUENCE_USERNAME=zhengzih
export CONFLUENCE_API_TOKEN=your-password
confluence-mcp-server技术栈
Python 3.10+
MCP SDK (
mcp[cli])Requests
BeautifulSoup4
Markdown
Click
许可证
MIT License
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/zhengziha/confluence-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server