ZIM MCP Server について
ZIM MCP Server は、Kiwix などが提供する ZIM 形式のオフラインナレッジベース(ウィキペディアのデータなど)を LLM が検索できるようにする MCP サーバーです。ネットワークがない環境で、ローカルの AI モデルによる質問応答や情報検索を行いたい人に適しています。
主な機能
- 01許可されたディレクトリ内の ZIM ファイルの一覧表示
- 02ZIM ファイル内コンテンツのキーワード検索
- 03limit と offset による検索結果のページ分割
- 04エントリパスによる記事全文の取得
活用シーン
- 01ネットワークがない環境でのローカルモデルによるウィキペディア検索
- 02Kiwix のオフラインリソースにおける特定エントリの参照
- 03オフライン参考資料を用いた LLM による質問応答
MCP 対応
MCP サーバーとして、list_zim_files、search_zim_file、get_zim_entry などのツールを MCP クライアントに公開し、ZIM ファイルへのアクセスを提供します。
設定
ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。
このサーバーのパッケージやリモートエンドポイントはまだ取得できていません。プロジェクトの README の手順に従ってください。
ツール
ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。
詳細
ZIM MCP サーバー
ZIM(Zeno IMproved)は、非営利団体のKiwixが開発したファイル形式です。Wikipediaなどの大規模な参照コンテンツをオフラインで保存・閲覧するために特化して設計されています。ZIM形式は高い圧縮率と高速検索に対応しており、Wikipedia全体を比較的小さなファイルに圧縮して、特にインターネットに接続できない環境で便利に保存・利用できます。
ZIM MCP サーバーを使うと、LLMが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(string):ZIMファイルへのパスquery(string):検索語
オプションのパラメーター:
limit(integer、デフォルト:10):返す結果の最大数offset(integer、デフォルト:0):結果の開始位置(ページネーション用)
get_zim_entry - ZIMファイル内の特定のエントリの詳細なコンテンツを取得する
必須パラメーター:
zimFilePath(string):ZIMファイルへのパスentryPath(string):エントリのパス。例:'A/Some_Article'
オプションのパラメーター:
maxContentLength(integer、デフォルト: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 サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。