关于 ZIM MCP Server
ZIM MCP Server 让大模型能够访问和搜索 ZIM 格式的离线知识库,例如 Kiwix 提供的维基百科内容。适合希望在无网络环境下使用本地 AI 模型进行问答和信息检索的用户。
主要功能
- 01列出允许目录中的 ZIM 文件
- 02在 ZIM 文件内容中搜索关键词
- 03支持分页返回搜索结果
- 04按条目路径获取文章完整内容
适用场景
- 01在无网络环境下用本地模型查询维基百科内容
- 02检索 Kiwix 离线资源中的特定条目
- 03将离线参考资料提供给大模型进行问答
MCP 相关
该项目是 MCP 服务,向 MCP 客户端暴露 list_zim_files、search_zim_file 和 get_zim_entry 等工具,用于访问 ZIM 文件。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。
工具
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
ZIM MCP 服务
ZIM(Zeno IMproved)是一种由非营利组织 Kiwix 开发的文件格式,专为离线存储和访问 Wikipedia 及其他大型参考内容而设计。ZIM 格式支持高压缩率和快速搜索,因此可以将完整的 Wikipedia 内容压缩到相对较小的文件中,便于存储和使用,尤其适用于无法连接互联网的环境。
ZIM MCP 服务让大模型能够直接访问和搜索 ZIM 文件中的内容,即使无法联网,人们也可以使用本地 AI 模型从这些离线知识资源中进行问答和信息检索。
关于 Kiwix
Kiwix 是一个非营利组织,致力于让在线知识内容(尤其是 Wikipedia、TED 演讲等)能够离线访问。Kiwix 开发了用于创建、查看和搜索 ZIM 文件的工具,人们可以通过这些工具将大量在线知识资源打包到 ZIM 文件中,以便在本地访问。Kiwix 项目对发展中国家和无法连接互联网的地区尤其重要,因为它能让这些地区的人们获取丰富的知识资源,推动知识传播和教育机会平等。
安装
1. 克隆仓库
git clone https://github.com/ThinkInAI-Hackathon/zim-mcp-server.git
2. 安装 uv
- 在 Windows 上:
- 如果之前尚未设置执行策略,请运行:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" - 否则,可以运行:
irm https://astral.sh/uv/install.ps1 | iex
- 如果之前尚未设置执行策略,请运行:
- 在 MacOS 上:
- 请参阅 uv 官方安装指南。
3. 安装依赖项
cd path\to\zim-mcp-server # (e.g., D:\zim-mcp-server)
uv sync
4. 准备 ZIM 文件
从 Kiwix Library 下载 ZIM 文件(例如 Wikipedia、Wiktionary 等),并将其放入一个目录中,例如:
path\to\zim\files # (e.g., D:\ZIM)
Claude Desktop 配置
Claude Desktop 的配置需要使用克隆仓库的本地路径。
将以下内容添加到 claude_desktop_config.json 中(将路径替换为实际的本地路径):
"zim-mcp-server": {
"command": "uv",
"args": [
"--directory",
"path\\to\\zim-mcp-server", // e.g., D:\\zim-mcp-server
"run",
"server.py",
"path\\to\\zim\\files" // e.g., D:\\ZIM
]
}
"path\\to\\zim-mcp-server":克隆的 zim-mcp-server 仓库的本地路径(例如,D:\zim-mcp-server)。"path\\to\\zim\\files":存放 ZIM 文件的目录(例如,D:\ZIM)。
只有完成此配置后,Claude Desktop 才会识别该服务。
可用工具
list_zim_files - 列出允许目录中的所有 ZIM 文件
无需参数。
search_zim_file - 搜索 ZIM 文件内容
必需参数:
zimFilePath(字符串):ZIM 文件的路径query(字符串):搜索查询词
可选参数:
limit(整数,默认值:10):返回结果的最大数量offset(整数,默认值:0):结果的起始偏移量(用于分页)
get_zim_entry - 获取 ZIM 文件中指定条目的详细内容
必需参数:
zimFilePath(字符串):ZIM 文件的路径entryPath(字符串):条目路径,例如 'A/Some_Article'
可选参数:
maxContentLength(整数,默认值:100000):返回内容的最大长度
示例
列出 ZIM 文件:
{
"name": "list_zim_files"
}
响应:
{
"Found 2 ZIM files in 1 directories:
[
{
"name": "wikipedia_en_all_nopic_2023-07.zim",
"path": "D:/ZIM/wikipedia_en_all_nopic_2023-07.zim",
"directory": "D:/ZIM",
"size": "95123.45 MB",
"modified": "2023-08-01T12:00:00"
},
{
"name": "wiktionary_en_all_nopic_2023-07.zim",
"path": "D:/ZIM/wiktionary_en_all_nopic_2023-07.zim",
"directory": "D:/ZIM",
"size": "1234.56 MB",
"modified": "2023-08-01T12:30:00"
}
]
}
搜索 ZIM 文件:
{
"name": "search_zim_file",
"arguments": {
"zimFilePath": "D:/ZIM/wikipedia_en_all_nopic_2023-07.zim",
"query": "artificial intelligence",
"limit": 3
}
}
响应:
Found 120 matches for "artificial intelligence", showing 1-3:
## 1. Artificial intelligence
Path: A/Artificial_intelligence
Snippet: Artificial intelligence (AI) is intelligence demonstrated by machines, as opposed to intelligence displayed by humans or by other animals. ...
## 2. History of artificial intelligence
Path: A/History_of_artificial_intelligence
Snippet: The history of artificial intelligence (AI) began in antiquity, with myths, stories and rumors of artificial beings endowed with intelligence or consciousness by master craftsmen. ...
## 3. Philosophy of artificial intelligence
Path: A/Philosophy_of_artificial_intelligence
Snippet: The philosophy of artificial intelligence is a branch of the philosophy of technology that explores artificial intelligence and its implications for knowledge, reality, consciousness, and the human mind. ...
获取 ZIM 条目:
{
"name": "get_zim_entry",
"arguments": {
"zimFilePath": "D:/ZIM/wikipedia_en_all_nopic_2023-07.zim",
"entryPath": "A/Artificial_intelligence"
}
}
响应:
# Artificial intelligence
Path: A/Artificial_intelligence
Type: text/html
## Content
Artificial intelligence (AI) is intelligence demonstrated by machines, as opposed to intelligence displayed by humans or by other animals. Examples of specific artificial intelligence applications include expert systems, natural language processing, and computer vision.
Leading AI textbooks define the field as the study of "intelligent agents": any system that perceives its environment and takes actions that maximize its chance of achieving its goals. Some popular accounts use the term "artificial intelligence" to describe machines that mimic "cognitive" functions that humans associate with the human mind, such as "learning" and "problem solving".
...
许可证
MIT
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。