Skip to main content
Glama

kiwix-mcp

Status: Active Run Unit Tests

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 catalog href attributes

  • 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

Related MCP server: openzim-mcp

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 \
  -p 8000:8000 \
  oscillatelabs/kiwix-mcp

Defaults to streamable-http transport bound on 0.0.0.0:8000. Override with env vars:

docker run \
  -e KIWIX_BASE_URL=http://your-kiwix-server:8080 \
  -e TRANSPORT=sse \
  -e HOST=0.0.0.0 \
  -e PORT=8000 \
  -e CORS_ALLOW_ORIGINS="http://localhost:3000" \
  -p 8000:8000 \
  oscillatelabs/kiwix-mcp

Options

Flag

Default

Env

--base-url

KIWIX_BASE_URL

--transport

stdio

TRANSPORT

--host

127.0.0.1

HOST

--port

8000

PORT

--cors-allow-origins

*

CORS_ALLOW_ORIGINS

Client library

from kiwix_client import KiwixClient, strip_html

c = KiwixClient("http://localhost:8080")

# List all books
books = c.list_books()

# Filter by title keyword
books = c.list_books(q="wikipedia")

# Search
sr = c.search("query")

# Search within a specific book
sr = c.search("query", books="devdocs_en_rust_2025-10")

# Fetch article as plain text
html = c.fetch_article(sr.results[0].url)
plain = strip_html(html)

How the Kiwix API works

kiwix-serve exposes three HTTP surfaces used by this client:

  • OPDS catalog (/catalog/v2/entries) — Atom XML with book metadata and slugs; supports ?q=, ?count=, ?start= params

  • Full-text search (/search?pattern=…&books.name=…&start=…) — HTML; 25 results/page; books.name= scopes to a specific ZIM slug

  • Articles (/{book_slug}/A/{path}) — HTML; use strip_html for plain text

There is no JSON API. Full-text search requires ZIMs built with _ftindex:yes — not all ZIMs include it. Servers with books spanning multiple languages require a book scope for any search request.

Testing

# Install with dev dependencies
pip install -e ".[dev]"

# Run the test suite (no network required)
pytest

Available Tools

3 tools
kiwix_fetch_articleA

Fetch an article from the Kiwix server and return its content as plain text. Use the URL field from kiwix_search results.

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided. Description only states it returns plain text, missing details like error handling, size limits, or rate limits. Significant gap for a tool with no annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences: first states purpose, second gives usage hint. No wasted words, front-loaded with key information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool is simple with one param and output schema (signal true). Description covers usage and purpose adequately, but lacks behavioral details. Still acceptable for a straightforward tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Only one parameter 'url' with 0% schema coverage. Description adds context: URL must come from kiwix_search results, which provides semantic meaning beyond schema type.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states verb (fetch), resource (article), and output format (plain text). Also ties to sibling tool via 'URL field from kiwix_search results', differentiating it.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly instructs to use URL from kiwix_search results, which guides when to use. Lacks explicit when-not-to-use or alternatives, but context is sufficient.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

kiwix_list_booksA

List ZIM books available on the Kiwix server. Optionally filter by title keyword.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It states a simple read operation ('List') and optional filtering, but lacks details on performance, pagination, or error behavior. Adequate for a straightforward list.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no redundant words. Every part is essential: action, resource, context, and parameter hint.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with one optional parameter and an output schema, the description is sufficient. It could mention that it returns a list of books, but the output schema likely covers that.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% description coverage; the description adds that the 'query' parameter filters by title keyword, providing basic meaning. However, it doesn't explain matching behavior (case sensitivity, partial match).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'List ZIM books available on the Kiwix server' with an action verb and specific resource. It distinguishes from siblings like kiwix_search and kiwix_fetch_article, which have different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for listing books but does not explicitly state when to use this tool vs alternatives (kiwix_search, kiwix_fetch_article). No exclusion criteria or context provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev1.5.1
    • Addedkiwix_list_books
  2. 1 tool updatev1.4.1
    • Removedkiwix_list_books
  3. 3 tool updatesv1.3.0
    • First observedkiwix_fetch_article
    • First observedkiwix_list_books
    • First observedkiwix_search

TDQS

A4.1/5.0

Scored across 3 tools

Disambiguation5/5

Each tool has a distinct purpose: listing books, full-text search, and fetching articles. No overlap in functionality.

Naming Consistency5/5

All tools share the 'kiwix_' prefix and follow a verb_noun pattern (list_books, search, fetch_article), ensuring predictable naming.

Tool Count4/5

With only 3 tools, the set is minimal but covers the core read-only workflow for a Kiwix ZIM server. Slightly low but not deficient.

Completeness4/5

The tools cover the essential operations: listing available books, searching within them, and retrieving full articles. Missing book metadata or browsing, but acceptable for a basic reader.

Maintenance

ActivityMaintained
ResponsivenessUnresponsive

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    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.
    4
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    MCP server for reading and searching ZIM archives, optimized for single-user deployments with a persistent Wikipedia archive.
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    OpenZIM MCP Server provides AI models structured, offline access to ZIM format knowledge archives (Wikipedia, Wiktionary, Stack Exchange, Kiwix Library) via a Model Context Protocol server with smart namespace navigation, full-text search with suggestions, structure-aware retrieval (sections, tables of contents, related articles), link-graph extraction, archive-type presets, and both Simple (single natural-language tool) and Advanced (8 specialized tools) modes with streamable HTTP transport, bearer auth, and per-entry resources with subscriptions.
    MIT