mcpzim
An MCP server that provides offline access to ZIM file archives, including Wikipedia, medical knowledge, and maps. It dynamically exposes tools like search, article retrieval, and driving route planning based on available ZIM files.
README
mcpzim
An MCP server that makes a group of offline ZIM files available to local LLM agents. Point it at a directory of ZIMs and the server will:
- Inventory what's there (
list_libraries) and advertise aggregate capabilities (general knowledge, medical knowledge, maps/routing) based on what's loaded. - Expose search and article retrieval across every ZIM (
search,get_article,get_main_page). - When it detects a streetzim ZIM
built with
--routing, it additionally exposesplan_driving_route,geocode, androute_from_placesso a local agent can ask "give me a driving route from A to B" and get street-by-street directions, distance, and an estimated time.
The design principle is opportunistic capability: start with one Wikipedia
ZIM and you get a Wikipedia server. Drop in mdwiki_en_all_*.zim and it also
answers medical questions. Drop in a streetzim ZIM and it can also plan driving
routes for the area the ZIM covers. Tools appear only when the underlying data
is present, so the agent's tool list never lies about what the server can do.
Install
Requires Python 3.10+.
pip install mcpzim # once published
# or, from a checkout:
pip install -e .
libzim is a native wheel; prebuilt wheels exist for macOS (x86_64/arm64),
Linux (x86_64/aarch64, glibc and musl) and Windows x64. On other platforms pip
will build from source and you'll need a C++ toolchain.
Run
Drop your ZIM files into one directory and run:
export ZIM_DIR=~/zims
mcpzim # stdio transport (Claude Desktop / Code)
mcpzim ~/zims/wikipedia.zim ~/zims/streetzim_ma.zim # explicit paths
mcpzim --transport streamable-http --host 0.0.0.0 --port 8765 # LAN
Add to ~/.config/claude-desktop/claude_desktop_config.json (or the
equivalent for your MCP client):
{
"mcpServers": {
"mcpzim": {
"command": "mcpzim",
"env": { "ZIM_DIR": "/Users/me/zims" }
}
}
}
Tools
Always available:
| Tool | What it does |
|---|---|
list_libraries |
Inventory: list every ZIM with kind, title, language, and the aggregate capabilities (general_knowledge, medical, maps, ...). Call this first. |
search |
Full-text search across every ZIM (uses libzim's Xapian index when present, falls back to title-prefix suggestions). Accepts an optional kind filter. |
get_article |
Fetch an entry by path; HTML is stripped of navbox / infobox / script cruft so the LLM sees clean text. |
get_main_page |
Main page of one ZIM, or of every loaded ZIM. |
Only present when a streetzim ZIM with routing data is loaded:
| Tool | What it does |
|---|---|
plan_driving_route |
A* over the streetzim routing graph. Input: two lat/lon pairs. Output: total distance, duration, polyline, and a road-segment list coalesced by street name. |
geocode |
Resolve a place/address string to coordinates using streetzim's prefix-chunked search index. |
route_from_places |
Convenience: geocode both endpoints then plan a route. |
Cost/heuristic in the router match streetzim's JS viewer exactly:
edge_cost = distance_m / (speed_kmh / 3.6) and heuristic = haversine / (100/3.6), so results are identical to what the in-browser
viewer would produce.
Supported ZIMs
Type detection runs at scan time and uses a combination of filename prefix, the
ZIM's Name / Tags / Creator / Publisher metadata, and signature entries
inside the archive. Out of the box:
- Wikipedia — any
wikipedia_*.zim(Creator: Wikipedia, taggedwikipedia). - mdwiki —
mdwiki_*.zimfrom the WikiProjectMed Foundation (taggedmdwiki/medical). - streetzim — detected by the presence of
routing-data/graph.binormap-config.jsoninside the archive. - generic — anything else (a
*.zimstill gets served; only theZimKind.GENERICdefault toolset applies).
Example session
> list_libraries
{"zims": [
{"path": ".../wikipedia_en_all_nopic_2026-03.zim", "kind": "wikipedia", ...},
{"path": ".../mdwiki_en_all_2026-03.zim", "kind": "mdwiki", ...},
{"path": ".../streetzim_ma.zim", "kind": "streetzim", "has_routing": true, ...}
],
"by_kind": {"wikipedia": 1, "mdwiki": 1, "streetzim": 1},
"capabilities": ["encyclopedia", "general_knowledge", "geocode",
"get_article", "list_libraries", "maps", "medical",
"plan_route", "search"]}
> route_from_places {"origin": "Boston Common", "destination": "Fenway Park"}
{"origin_resolved": {"name": "Boston Common", "lat": 42.3554, "lon": -71.0655, ...},
"destination_resolved": {"name": "Fenway Park", "lat": 42.3467, "lon": -71.0972, ...},
"distance_km": 3.27, "duration_min": 9.4,
"roads": [
{"name": "Beacon Street", "distance_m": 412.3, "duration_s": 44.0},
...
],
"turn_by_turn": ["Beacon Street for 0.41 km (~0.7 min)", ...],
"polyline": [[42.3554, -71.0655], ...]}
Mobile
Concrete paths that actually work, matched to the on-device LLM hosts people are shipping in 2026:
| Platform | LLM host | Path | Status |
|---|---|---|---|
| Desktop | Claude Desktop / Code, any MCP client | This Python server via stdio or streamable-http |
Works today |
| Android | Google AI Edge Gallery (Gemma 4 + LiteRT-LM, Apache 2.0) | Small Kotlin fork — add a @Tool fun callMcp(...) that talks JSON-RPC/HTTP to this Python server |
See mobile/android/README.md — ~80 lines of Kotlin + one SKILL.md |
| Android (fully offline) | same | Run mcpzim under Termux on the same device |
Works; Termux has to build libzim from source (pkg install python clang cmake) |
| iOS | Swift-Gemma4-Core (MIT, iOS 17+) | Link swift/MCPZimKit — pure-Swift port of the routing graph parser, A*, geocoder + a transport-agnostic MCP tool adapter. Host app supplies a ZimReader backed by CoreKiwix.xcframework from the Kiwix project. |
See swift/README.md |
| iOS | Google AI Edge Gallery | Not possible — the iOS app is closed-source. | Waiting on Google |
The short version: on Android the open-source Agent Chat host already knows how
to call a tool, so a short Kotlin patch makes it speak to this Python server.
On iOS, the LLM host has no tool-calling layer yet, so the companion Swift
package ships (a) the same algorithms in pure Swift for in-process use, and (b)
a transport-agnostic MCP adapter you can plug into the official
modelcontextprotocol/swift-sdk
when you want the model to call tools over LAN.
swift/MCPZimKit's SZRG v2 parser, A* router, and prefix geocoder are
line-for-line ports of the Python implementations; the Python test suite and
the Swift test suite in swift/Tests/MCPZimKitTests/ cover the same cases, so
if both green, you know the two agree.
Development
pip install -e '.[dev]'
pytest
Tests do not require any real ZIM files; the routing tests build a tiny SZRG v2
graph in-memory using mcpzim.routing.encode_graph_v2, and the library tests
exercise the classifier directly.
License
MIT.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。