Interact with the Confluence API to manage spaces, pages, and content. Supports searching, creating, and updating pages.
这是一个基于 MCP (Model Context Protocol) 的 Confluence API 服务实现。该服务提供了与 Confluence 进行交互的能力,支持获取空间信息、页面内容、搜索等功能。
# 安装依赖
npm install
# 清理并构建项目
npm run build:clean
# 启动服务
npm start
服务支持两种认证方式,你可以选择其中一种:
在 .env
文件中配置:
CONFLUENCE_URL=https://your-confluence-url
CONFLUENCE_ACCESS_TOKEN=your-access-token
在 .env
文件中配置:
CONFLUENCE_URL=https://your-confluence-url
CONFLUENCE_USERNAME=your-username
CONFLUENCE_PASSWORD=your-password
# 服务器配置
PORT=3000
NODE_ENV=development
TIMEOUT=10000
REJECT_UNAUTHORIZED=true
%USERPROFILE%\.cursor\mcp.json
中添加:{
"mcpServers": {
"mcp-server-confluence-ts": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"@smithery/cli@latest",
"run",
"@enjoyzl/mcp-server-confluence-ts",
"--config",
"{\"confluenceUrl\":\"your-confluence-url\",\"confluenceUsername\":\"your-username\",\"confluencePassword\":\"your-password\"}"
]
}
}
}
%USERPROFILE%\.cursor\mcp.json
中添加:{
"mcpServers": {
"mcp-server-confluence-ts": {
"command": "cmd",
"args": [
"/k",
"cd",
"/d",
"D:\\workspace\\code\\mcp\\mcp-server-confluence-ts",
"&",
"node",
"dist/index.js"
]
}
}
}
Windows 配置说明:
/k
: 执行命令后保持命令窗口,便于查看日志/d
: 切换到指定驱动器- 使用
&
连接多个命令- 路径使用双反斜杠
\\
转义- 环境变量可以在项目的
.env
文件中配置
~/.cursor/mcp.json
中添加:{
"mcpServers": {
"mcp-server-confluence-ts": {
"command": "bash",
"args": [
"-c",
"npx -y @smithery/cli@latest run @enjoyzl/mcp-server-confluence-ts --config '{\"confluenceUrl\":\"your-confluence-url\",\"confluenceUsername\":\"your-username\",\"confluencePassword\":\"your-password\"}'"
]
}
}
}
~/.cursor/mcp.json
中添加:{
"mcpServers": {
"mcp-server-confluence-ts": {
"command": "node",
"args": ["/Users/your-username/workspace/code/mcp/mcp-server-confluence-ts/dist/index.js"],
"env": {
"CONFLUENCE_URL": "your-confluence-url",
"CONFLUENCE_USERNAME": "youraccount",
"CONFLUENCE_PASSWORD": "yourpwd",
}
}
}
}
Mac/Linux 配置说明:
-c
: 执行命令字符串- 使用
&&
连接多个命令- 路径使用正斜杠
/
- 环境变量可以在项目的
.env
文件中配置- Mac 用户主目录通常在
/Users/your-username/
- Linux 用户主目录通常在
/home/your-username/
# 监听文件变化并自动编译
npm run dev
# 监听文件变化并自动重启服务
npm run dev:start
# 仅构建项目
npm run build
# 清理构建目录
npm run clean
# 清理并重新构建
npm run build:clean
# 基本调试模式
npm run inspector
# 开发调试模式(带详细日志)
npm run inspector:dev
const space = await confluenceService.getSpace('SPACE_KEY');
const page = await confluenceService.getPage('PAGE_ID');
const page = await confluenceService.getPageByPrettyUrl('SPACE_KEY', 'PAGE_TITLE');
const newPage = await confluenceService.createPage({
spaceKey: 'SPACE_KEY',
title: 'Page Title',
content: 'Page Content',
parentId: 'PARENT_PAGE_ID', // 可选
representation: 'storage' // 可选,默认为 'storage'
});
const updatedPage = await confluenceService.updatePage({
id: 'PAGE_ID',
title: 'Updated Title', // 可选
content: 'Updated Content', // 可选
version: 2, // 页面版本号
representation: 'storage' // 可选,默认为 'storage'
});
const results = await confluenceService.searchContent('search query');
const content = await confluenceService.getPageContent('PAGE_ID');
.env
文件已添加到 .gitignore
中连接优化
请求优化
错误处理
服务使用结构化日志输出,包含以下信息:
{
"jsonrpc": "2.0",
"method": "log",
"params": {
"level": "info",
"message": "请求信息",
"timestamp": "2024-04-16T12:00:44.000Z"
}
}
错误响应格式:
interface ErrorResponse {
message: string;
statusCode?: number;
error?: any;
config?: {
url?: string;
method?: string;
params?: any;
};
}
欢迎提交 Issue 和 Pull Request。
Trello integration for working with boards, lists in boards and cards in lists.
Add smart Backup ability to coding agents like Windsurf, Cursor, Cluade Coder, etc
Create, read, edit, and convert Excel files without requiring Microsoft Office.
Connect with 10,000+ tools across HRIS, ATS, CRM, Accounting, Calendar, Meeting, Ticketing, and more categories.
A wrapper for OpenAI's built-in tools, enabling functionalities like web search and code execution. Requires an OpenAI API key.
Connect your AI Agents to 8,000 apps instantly.
Interact with Notion using its API. This server mirrors the Notion API SDK, allowing LLMs to manage pages, databases, and other Notion content.
Access and analyze Fathom Analytics data and reports
An MCP server for managing Yandex Browser tabs with extended functionality.
Create professional PDF invoices using natural language.