Wiki页面管理服务

一个基于MCP协议的Confluence Wiki页面管理服务,支持创建、更新、删除和搜索Wiki页面,并能根据用户查询自动选择正确的Confluence知识库。

  • by albertshao
  • Python
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 albertshao/wiki_mcp_server

使用说明

📚 Wiki MCP服务器

用于管理Confluence wiki页面的MCP(模型上下文协议)服务器实现。

支持:

  • 创建新的wiki页面
  • 更新现有wiki页面
  • 删除wiki页面
  • 按关键字搜索wiki页面
  • 自动选择正确的汇流知识库(alm, wpb等等)

内置于 快速 API,以下 MCP服务器最佳实践,并准备进行生产部署。


🚀 技术栈

  • Python 3.10+
  • 快速 API
  • MCP-SDK
  • 请求(用于Confluence API交互)
  • ContextVars(用于会话管理)

📦 项目结构

wiki_mcp_server/
├── src/wiki_mcp_server/
│   ├── server.py          # MCP server entry point
│   ├── service.py         # Business logic (Confluence API interactions)
│   ├── tools.py           # MCP tool definitions
│   ├── prompts.py         # MCP prompt definitions
│   ├── resources.py       # MCP resource definitions
│   ├── utils.py           # Helper functions (wiki_type inference etc.)
│   ├── utils/session_context.py  # Session context manager
│   └── middleware.py      # Authentication and session initialization middleware
├── Dockerfile             # Container configuration
├── requirements.txt       # Python dependencies
├── README.md              # Project documentation
├── smithery.yaml          # Smithery integration config (optional)
└── pyproject.toml         # Python project metadata

⚙️ 安装

  1. 克隆存储库:
git clone https://your-repo-url/wiki_mcp_server.git
cd wiki_mcp_server
  1. 安装依赖项:
pip install -r requirements.txt
  1. (可选)如果需要,配置环境变量。

🛠 本地运行

运行服务器:

cd src
uvicorn wiki_mcp_server.server:app --host 0.0.0.0 --port 9999 --reload

启动后,您可以访问:


🧪 示例请求

所需标题:

键 示例值
用户名 john.doe@domain.com
alm_confluence_base_url https://your-confluence-site/wiki/rest/api
alm_confluence_api_token 您的api令牌
wpb-conference_base_url (可选,如果可用)
wpb-conference_api_token (可选,如果可用)

⚠️ 若标头丢失或无效,服务器将返回HTTP 400错误。


示例:创建页面

发布 /create_page

{
  "space_key": "TEST",
  "title": "Test Page Created by MCP Server",
  "content": "<p>Hello, World!</p>",
  "user_query": "Please create a page in GSNA knowledge base."
}

行为:

  • 服务器将推断 wiki_type=alm 来自user_query。
  • 在Confluence中创建页面并返回页面元数据。

🧠 自动推理逻辑

  • 如果查询提到 gsna, global, alm-confluence → 阿尔姆
  • 如果查询提到 wpb, wealth → 板内玄武岩
  • 否则默认为 阿尔姆

(您也可以手动指定 wiki_type 输入)


🐳 Docker(可选)

构建并运行容器化服务器:

docker build -t wiki-mcp-server .
docker run -d -p 9999:9999 --name wiki-mcp-server wiki-mcp-server

📜 许可证

MIT许可证。


📞 联系

有关问题或协作请求,请联系:

  • 开发商: 肖恩
  • 电子邮件:gsqasxb@gmail.com
  • 由内部MCP工作组维护的项目

---#wiki_mcp_server