返回市场
一键维基MCP服务器

一键维基MCP服务器

作者:brianxiadong2 星标更新:2025-05-29

项目介绍

ONES Wiki MCP Server

基于Spring AI MCP的服务,用于检索ONES Wiki内容并将其转换为适合AI处理的文本格式。

功能

  • 🔐 支持ONES平台认证
  • 🌐 自动将Wiki URL转换为API端点
  • 📄 提取并格式化Wiki页面内容
  • 🤖 输出适合AI处理的文本格式
  • ⚙️ 通过属性文件或命令行参数进行配置

预备条件

  • Java 17 或更高版本
  • Maven 3.6 或更高版本
  • 访问ONES平台实例

快速开始

1. 构建项目

mvn clean package

2. 配置认证

方案1:修改application.properties

编辑 src/main/resources/application.properties

ones.host=your-ones-host.com
ones.email=your-email@example.com
ones.password=your-password

方案2:使用命令行参数

java -jar target/ones-wiki-mcp-server-0.0.1-SNAPSHOT.jar \
  --ones.host=your-ones-host.com \
  --ones.email=your-email@example.com \
  --ones.password=your-password

方案3:使用环境变量

export ONES_HOST=your-ones-host.com
export ONES_EMAIL=your-email@example.com
export ONES_PASSWORD=your-password
./start-mcp-server.sh

3. 在MCP客户端中配置

添加到Claude Desktop配置文件:

{
  "mcpServers": {
    "ones-wiki": {
      "command": "java",
      "args": [
        "-jar",
        "/path/to/ones-wiki-mcp-server-0.0.1-SNAPSHOT.jar",
        "--ones.host=your-ones-host.com",
        "--ones.email=your-email@example.com",
        "--ones.password=your-password"
      ]
    }
  }
}

使用方法

获取Wiki内容

在使用工具时提供完整的Wiki页面URL:

请获取此Wiki页面的内容:https://your-ones-host.com/wiki/#/team/TEAM_UUID/space/SPACE_UUID/page/PAGE_UUID

URL格式

支持的Wiki URL格式:

https://{host}/wiki/#/team/{team_uuid}/space/{space_uuid}/page/{page_uuid}

自动转换为API端点:

https://{host}/wiki/api/wiki/team/{team_uuid}/online_page/{page_uuid}/content

输出格式

服务将Wiki页面HTML内容转换为结构化的Markdown格式,包括:

  • ✅ 标题级别(H1-H6)
  • ✅ 段落文本
  • ✅ 有序和无序列表
  • ✅ 表格数据(键值对格式)
  • ✅ 图像描述
  • ✅ 链接信息
  • ❌ 删除线内容(自动过滤)

技术架构

  • Spring Boot 3.4.5 - 应用框架
  • Spring AI MCP - MCP协议支持
  • Jsoup 1.17.2 - HTML解析
  • RestClient - HTTP客户端

安全说明

  • 认证凭据应通过环境变量或配置文件管理
  • 支持HTTPS连接
  • 自动处理ONES平台登录认证

开发

项目结构

src/main/java/org/springframework/ai/mcp/sample/server/
├── McpServerApplication.java    # 主应用
└── OnesWikiService.java        # ONES Wiki服务

运行测试

mvn test

从源代码构建

git clone https://github.com/your-username/ones-wiki-mcp-server.git
cd ones-wiki-mcp-server
mvn clean package

扩展功能

您可以在OnesWikiService中添加更多工具方法,例如:

  • 搜索Wiki页面
  • 获取Wiki目录结构
  • 批量处理多个页面

贡献

  1. 分叉仓库
  2. 创建功能分支 (git checkout -b feature/amazing-feature)
  3. 提交更改 (git commit -m 'Add some amazing feature')
  4. 推送到分支 (git push origin feature/amazing-feature)
  5. 打开Pull Request

许可证

Apache License 2.0