ONES Wiki MCP服务器
基于Spring AI MCP的服务,用于检索ONES Wiki内容并将其转换为AI友好的文本格式。
特性
- 🔐 ONES平台身份验证支持
- 🌐 从Wiki URL到API端点的自动转换
- 📄 提取并格式化Wiki页面内容
- 🤖 AI友好的文本输出格式
- ⚙️ 通过属性文件或命令行参数进行配置
先决条件
- Java 17或更高版本
- Maven 3.6或更高版本
- 访问ONES平台实例
快速开始
1.建设项目
mvn clean package2.配置身份验证
选项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.sh3.在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:
Please get the content of this Wiki page: https://your-ones-host.com/wiki/#/team/TEAM_UUID/space/SPACE_UUID/page/PAGE_UUIDURL格式
支持的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)
- ✅ 段落文本
- ✅ 有序和无序列表
- ✅ 表数据(键值格式)
- ✅ 图像描述
- ✅ 链接信息
- ❌ 删除内容(自动过滤)
技术架构
- 弹簧靴3.4.5 -应用框架
- 春季AI MCP -MCP协议支持
- 是1.17.2 -HTML解析
- RestClient -HTTP客户端
安全说明
- 身份验证凭据应通过环境变量或配置文件进行管理
- 支持HTTPS连接
- ONES平台登录认证的自动处理
发展
项目结构
src/main/java/org/springframework/ai/mcp/sample/server/
├── McpServerApplication.java # Main application
└── OnesWikiService.java # ONES Wiki service运行测试
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目录结构
- 批量处理多个页面
贡献
- 分叉存储库
- 创建要素分支(
git checkout -b feature/amazing-feature) - 提交您的更改(
git commit -m 'Add some amazing feature') - 推到分支(
git push origin feature/amazing-feature) - 打开拉取请求
许可证
Apache许可证2.0
