
Kiwix HTTP服务器的MCP服务器和Python客户端库.
概览
Kiwix HTTP服务器的MCP服务器和Python客户端库. 被测试的针对(德比亚书虫包)和更新型的部署. 任何标准的kiwix-serve部署都应该奏效. - kiwix- serve 释放出在 OPDS 目录href 属性中的未脱逃( & 在 OPDS 分类href 属性中) - 当库跨越多语言时, Newer 服务器需要一个书目范围—— 客户端会用此情况下的指令返回一个明显的错误 - Newer 服务器使用路径前置的 URL 方案( 如 /kiwix/content/book slug) —— shit和文章 URL 处理会自动调整 克洛德桌面配置(~/图书馆/应用程序支持/Claude/claude desktop config.json): Claude Code——在用户范围添加,以便在所有项目中都可以使用: 然后将您的 MCP 客户端指向 http://localhost:8000/sse. 然后指向您的 MCP 客户端 http://localhost:8000/mcp. 当使用基于浏览器的MCP客户端(例如:lama-server WebUI)的HTTP传输时,会自动添加CORS头. 默认情况下,所有来源都是允许的.
概述(AI 翻译)
Kiwix HTTP服务器的MCP服务器和Python客户端库.
□ 兼容性
对kiwix-tool(Debian [T0])包和更新型的libkiwix基于部署进行测试. 任何标准[T1]的部署都应该奏效。
已知的怪事处理透明:
- kiwix- serve 释放在 OPDS 目录 [[T3] 属性中未脱逃
& - 更新服务器在图书馆跨越多种语言时需要图书范围——客户端返回一个明显错误,并附有在这种情况下的指示
- 更新服务器使用路径前置的 URL 方案(例如
/kiwix/content/book_slug) —— swit和文章 URL 处理会自动适应
□ 工具
- 工具 * * 描述 * * |------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- QQ[ [T5]] 列出可用的ZIM书;可选标题过滤器 QQ [T6] 在所有书籍或特定书籍中进行全文搜索 QQ[ [T7] 以 URL 的纯文本获取文章
□ 安装
或与v:
□ 使用量
& stdio( Claude 桌面/ Claude 代码)
Claude 桌面配置 ([T8]) :
Claude Code——在用户范围添加,以便在所有项目中都可以使用:
• SSE
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
kiwix-mcp
MCP server and Python client library for Kiwix HTTP servers.
Compatibility
Tested against kiwix-tools (Debian bookworm package) and newer libkiwix-based deployments. Any standard kiwix-serve deployment should work.
Known quirks handled transparently:
- kiwix-serve emits unescaped
&in OPDS cataloghrefattributes - Newer servers require a book scope when the library spans multiple languages — the client returns a clear error with instructions in that case
- Newer servers use a path-prefixed URL scheme (e.g.
/kiwix/content/book_slug) — slug and article URL handling adapts automatically
Tools
| Tool | Description |
|---|---|
kiwix_list_books |
List available ZIM books; optional title filter |
kiwix_search |
Full-text search across all books or a specific book |
kiwix_fetch_article |
Fetch an article as plain text by URL |
Installation
pip install kiwix-mcp
Or with uv:
uv pip install kiwix-mcp
Usage
stdio (Claude Desktop / Claude Code)
kiwix-mcp --base-url http://localhost:8080
# or
KIWIX_BASE_URL=http://localhost:8080 kiwix-mcp
Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"kiwix": {
"command": "kiwix-mcp",
"args": ["--base-url", "http://localhost:8080"]
}
}
}
Claude Code — add at user scope so it’s available in all projects:
claude mcp add --scope user --transport http kiwix https://your-kiwix-mcp-host/mcp/
SSE
kiwix-mcp --transport sse --base-url http://localhost:8080
Then point your MCP client at http://localhost:8000/sse.
HTTP (streamable)
kiwix-mcp --transport streamable-http --base-url http://localhost:8080
Then point your MCP client at http://localhost:8000/mcp.
CORS (browser-based clients)
When using HTTP transports with browser-based MCP clients (e.g. llama-server WebUI), CORS headers are added automatically. By default all origins are allowed.
To restrict allowed origins:
kiwix-mcp --transport streamable-http --base-url http://localhost:8080 \
--cors-allow-origins "http://localhost:3000,http://myapp.example.com"
# or
CORS_ALLOW_ORIGINS="http://localhost:3000" kiwix-mcp --transport streamable-http --base-url http://localhost:8080
CORS has no effect on stdio transport.
Docker
安装
docker run -e KIWIX_BASE_URL=http://your-kiwix-server:8080 \配置
{
"mcpServers": {
"kiwix": {
"command": "kiwix-mcp",
"args": ["--base-url", "http://localhost:8080"]
}
}
}