Skip to main content
Glama

Offline Kiwix Wikipedia MCP Server

An MCP (Model Context Protocol) server that provides offline access to Wikipedia and other ZIM content through a local Kiwix instance.

Overview

This MCP server bridges AI language models (like those in LM Studio) with your local Kiwix server, enabling:

  • Offline Wikipedia searches — No internet required once ZIM files are loaded

  • Multi-ZIM support — Access Wikipedia, Wiktionary, and other ZIM libraries

  • Token-efficient summaries — Get just the intro paragraphs to conserve context window

  • Full article retrieval — Pull complete article text when needed

Related MCP server: Kiwix Wiki MCP Server

Features

Feature

Description

Search

Search within specific ZIM files

Search with Snippets

Search and get short content previews (~200 chars) for relevance evaluation (token-saving)

Full Content

Retrieve complete article text

Summaries

Get only introductory paragraphs (token-saving)

ZIM Listing

Discover all available ZIM files in your Kiwix instance

Prerequisites

  • Kiwix server running with ZIM files loaded

  • Node.js 18+ installed

  • Local network access to the Kiwix server

Installation

1. Clone and install dependencies

npm install

2. Configure environment

Copy the example environment file and update it for your setup:

cp .env.example .env

Edit .env to point to your Kiwix server:

# Kiwix server address
KIWIX_BASE_URL=http://192.168.1.5:8080

# Default ZIM file (can be overridden per-tool call)
DEFAULT_ZIM=wikipedia_en_all_maxi_2026-02

Variable

Description

Default

KIWIX_BASE_URL

URL of your Kiwix server

http://192.168.1.5:8080

DEFAULT_ZIM

Default ZIM file name

wikipedia_en_all_maxi_2026-02

Available Tools

search_zim

Search for entries within a specific ZIM file.

Parameters:

Parameter

Required

Description

query

Yes

Search query string

zim_file

No

Target ZIM file (defaults to DEFAULT_ZIM)

count

No

Number of results (default: 3)

Example:

{
  "name": "search_zim",
  "arguments": {
    "query": "quantum physics",
    "zim_file": "wikipedia_en_all_maxi_2026-02",
    "count": 5
  }
}

search_with_snippets

Search for articles and return short content snippets (~200 chars) from each result. Use this to evaluate relevance before fetching full content with get_content. This is the most token-efficient way to explore multiple articles at once.

Parameters:

Parameter

Required

Description

query

Yes

Search query string

zim_file

No

Target ZIM file (defaults to DEFAULT_ZIM)

count

No

Number of results (default: 3). Each result includes a ~200 character content snippet.

Example:

{
  "name": "search_with_snippets",
  "arguments": {
    "query": "quantum physics",
    "zim_file": "wikipedia_en_all_maxi_2026-02",
    "count": 3
  }
}

Response format (JSON array):

[
  {
    "title": "Quantum mechanics",
    "snippet": "Quantum mechanics is a fundamental theory in physics that describes the physical properties of nature at the scale of atoms and subatomic particles. It provides a mathematical framework for understanding phenomena...",
    "url": "/wikipedia_en_all_maxi_2026-02/Quantum_mechanics"
  },
  {
    "title": "Quantum field theory",
    "snippet": "Quantum field theory (QFT) is the theoretical framework describing the physics of quantum fields. QFT is used in particle physics and condensed matter physics to construct physical models...",
    "url": "/wikipedia_en_all_maxi_2026-02/Quantum_field_theory"
  }
]

Token-efficient workflow:

  1. Use search_with_snippets to get previews of multiple articles

  2. Evaluate relevance from the snippets (~200 chars each)

  3. Only call get_content or get_content_summary for the most relevant article(s)

get_content

Retrieve the full text content of an article. Tables (infoboxes, comparison tables), navigation elements, images, and reference footers are automatically stripped to minimize token usage while preserving article body text.

Parameters:

Parameter

Required

Description

title

Yes

Article title

zim_file

Yes

Target ZIM file

Example:

{
  "name": "get_content",
  "arguments": {
    "title": "Quantum mechanics",
    "zim_file": "wikipedia_en_all_maxi_2026-02"
  }
}

get_content_summary

Get only the introductory summary of an article (token-efficient).

Parameters:

Parameter

Required

Description

title

Yes

Article title

zim_file

No

Target ZIM file (defaults to DEFAULT_ZIM)

paragraphs

No

Number of paragraphs to return (default: 2)

Example:

{
  "name": "get_content_summary",
  "arguments": {
    "title": "Quantum mechanics",
    "paragraphs": 3
  }
}

list_all_zims

List all ZIM files available in your Kiwix instance.

Parameters: None

Usage in LM Studio

  1. Open LM Studio

  2. Navigate to the MCP Servers settings (under the AI Server tab)

  3. Click + Add MCP Server

  4. Configure:

    • Name: kiwix-wiki

    • Type: stdio

    • Command: node server.js

    • Working Directory: Path to this project (e.g., c:\Users\scott\kiwix-wiki-mcp)

The server will start automatically and make the tools available to your AI model.

Usage in Other MCP Clients

This server uses the stdio transport protocol, which is supported by most MCP clients. Configure it with:

  • Transport: stdio

  • Command: node server.js

  • Working Directory: Project root

Testing

A comprehensive test harness is included to verify your Kiwix instance is working correctly.

Run All Tests

npm test

This runs 17 tests covering:

Category

Tests

Connectivity

Server reachability, home page content

ZIM Files

List all available ZIM files (XML/JSON parsing)

Search

Basic search, no results, count parameter, special characters, multi-ZIM

Content

Article retrieval, invalid ZIM handling

Performance

Search response time, content response time

Search with Snippets

Basic functionality, count parameter, empty results, content quality

Test Output

Results are printed to the console and saved to test-results.json:

{
  "timestamp": "2026-06-13T07:42:24.152Z",
  "target": "http://192.168.1.5:8080",
  "defaultZim": "wikipedia_en_all_maxi_2026-02",
  "totalTests": 17,
  "passedTests": 17,
  "failedTests": 0,
  "successRate": "100.0%",
  "results": [...]
}

Custom Configuration

Override defaults via environment variables:

KIWIX_BASE_URL=http://192.168.1.100:8080 DEFAULT_ZIM=my_custom_zim npm test

Running Manually

For development or testing:

npm start

The server runs in stdio mode — it reads from stdin and writes to stdout. To test interactively, you can use an MCP client SDK or the @modelcontextprotocol/cli:

npx @modelcontextprotocol/cli install
npx @modelcontextprotocol/cli list-tools

Project Structure

kiwix-wiki-mcp/
├── .env.example      # Environment template
├── .env              # Your configuration (gitignored)
├── .gitignore        # Git ignore rules
├── server.js         # MCP server implementation
├── test-harness.js   # Test harness for Kiwix connectivity testing
├── test-results.json # Generated test results (JSON format)
├── package.json      # Dependencies and scripts
└── README.md         # This file

Token Optimization Tips

Automatic Optimizations

Feature

Description

Savings

Table stripping

Infoboxes, comparison tables, and reference footers are excluded from get_content, get_content_summary, and search_with_snippets output

10-30% per article

Navigation stripping

Sidebars, category links, and navigation elements are removed

~5-10% per article

Citation removal

Numeric citation brackets like [1], [2][3] are stripped from all content tools

~200-800 tokens per article

[edit] marker removal

Section heading markers like "Quantum mechanics[edit]" are cleaned

~50-200 tokens per article

Low-value section removal

"See also", "Further reading", "External links", and "References" sections are stripped from get_content output

~1,000-4,000 tokens per full article

For the most token-efficient RAG workflow, follow this pattern:

1. search_with_snippets → Get ~200 char previews of N articles (~500-800 tokens total)
2. Evaluate relevance from snippets (no additional tokens consumed)
3. get_content_summary → Fetch only the most relevant article's intro (~200-400 tokens)
4. get_content → Only if full details are needed (~5,000-20,000+ tokens)

Best Practices

Practice

Benefit

Always start with search_with_snippets

Avoid fetching content for irrelevant articles

Use count: 1-3 in search

Limit results to the most relevant articles

Prefer get_content_summary over get_content

Get intro paragraphs at ~5% of the token cost

Specify zim_file explicitly

Avoid searching wrong ZIM files and wasting queries

Use descriptive search queries

More specific queries return more relevant results

License

MIT License. See LICENSE file for details.

Buy Me A Coffee

Available Tools

4 tools
get_contentA

Retrieve the complete text content of an article from a ZIM file. Returns all sections as plain text (no HTML). Use this when you need full article details; for quick overviews, use 'get_content_summary' instead. WARNING: Full articles can be very long and token-intensive.

ParametersJSON Schema
NameRequiredDescriptionDefault
titleYesArticle or entry title (spaces are automatically converted)
zim_fileYesName of the ZIM file (required). Example: 'wikipedia_en_all_maxi_2026-02'

TDQS

A4.6/5.0
Behavior4/5

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

No annotations provided, so description carries full burden. It discloses that articles can be 'very long and token-intensive', which is a key behavioral trait. It also states output format ('plain text, no HTML'). Missing details about potential errors or exactness of title matching, but overall informative.

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?

Three sentences, each earning its place: first sentence states purpose and output format, second provides usage guidance and sibling reference, third warns about length. No redundant information. Well front-loaded.

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?

Given no annotations, no output schema, and simple parameters, the description covers purpose, usage, and a behavioral warning. It could mention if the tool returns an error for missing titles, but completeness is adequate for the complexity level.

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?

Schema coverage is 100% (both parameters have descriptions). Description adds value: for 'title' it notes 'spaces are automatically converted', and for 'zim_file' provides an example format. These extras help beyond the schema definitions.

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 'Retrieve the complete text content of an article from a ZIM file'. It specifies returns 'plain text (no HTML)' and distinguishes from sibling 'get_content_summary'. The verb 'Retrieve' and resource 'complete text content of an article from a ZIM file' are specific.

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

Usage Guidelines5/5

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

Explicitly tells when to use ('need full article details') and when not ('for quick overviews, use 'get_content_summary' instead'). Also includes a warning about token intensity, guiding agents on resource implications.

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

get_content_summaryA

Get the first few paragraphs of an article's introduction section. Returns plain text (no HTML) containing only the opening section of the page. Use this for quick topic overviews instead of 'get_content' which returns the full article.

ParametersJSON Schema
NameRequiredDescriptionDefault
titleYesArticle title (spaces are automatically converted to underscores)
zim_fileNoZIM file name. Only specify if different from your default ZIM file. Example: 'wikipedia_en_all_maxi_2026-02'
paragraphsNoNumber of opening paragraphs to return (default: 2). Use 1-2 for brief overview, 3-5 for detailed summary.

TDQS

A4.8/5.0
Behavior4/5

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

No annotations provided, but description discloses return format (plain text, no HTML) and scope (opening section only). Implies read-only behavior, but does not explicitly state no side effects.

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, no wasted words. Action verb 'Get' at start. Information well-structured and efficient.

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

Completeness5/5

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

Complete for a simple tool without output schema. Covers purpose, usage, parameter details, and differentiation from sibling tools.

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

Parameters5/5

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

Schema coverage is 100%. Description adds valuable guidance: for 'paragraphs' suggests 1-2 vs 3-5 range, for 'title' notes underscore conversion, for 'zim_file' explains default vs override.

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 'Get the first few paragraphs of an article's introduction section' with a specific verb and resource. It distinguishes from sibling 'get_content' which returns the full article.

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

Usage Guidelines5/5

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

Explicitly advises 'Use this for quick topic overviews instead of 'get_content' which returns the full article', providing clear when-to-use and alternative.

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

list_all_zimsA

List all available ZIM files currently loaded in your Kiwix instance. Returns JSON with file details including names, titles, and descriptions.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.8/5.0
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states it returns JSON with details, but does not mention any potential side effects, authentication needs, rate limits, or error scenarios. For a read-only list, this minimal disclosure is slightly lacking.

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 consists of two clear sentences with no superfluous information. It is front-loaded with the main action and scope, and every sentence contributes value.

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?

Given the tool's simplicity (listing all ZIMs with details) and lack of output schema, the description is mostly complete. However, it could mention typical fields returned or any limitations (e.g., no pagination, no filtering). For a basic list, this is adequate but not exhaustive.

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?

The tool has zero parameters, and schema description coverage is 100% (trivially). The description does not need to add parameter semantics, and the high coverage yields a baseline of 4. No additional value is needed or missing.

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 uses a specific verb ('List') and resource ('ZIM files') and clearly states the scope ('currently loaded in your Kiwix instance'). It effectively distinguishes from sibling tools like get_content or search_zim which operate on content within ZIMs.

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 getting an overview of available ZIMs, but provides no explicit guidance on when to use vs alternatives or when not to use. There are no exclusions or context boundaries stated.

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

search_zimC

Search for entries within a specific ZIM file. Returns results in JSON format with entry titles and URLs. Use keyword search terms to find relevant articles.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesSearch terms or keywords to find in the ZIM file content
zim_fileNoThe specific ZIM file to search. If omitted, defaults to your default ZIM file.
countNoMaximum number of results to return (default: 3). Use lower values (1-3) to save tokens.

TDQS

C2.9/5.0
Behavior2/5

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

No annotations are provided, and the description does not disclose behavioral traits like whether it is read-only, performance implications, or any side effects. The description bears full burden but adds little beyond basic functionality.

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

Conciseness4/5

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

Two sentences, concise and front-loaded. No unnecessary words, but could benefit from slightly more structure.

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

Completeness3/5

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

Mentions return format (JSON with titles and URLs) and search terms, but lacks details on error handling, default behavior for 'zim_file', or pagination. Adequate for a simple search tool.

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?

Schema description coverage is 100%, so the schema already documents parameters adequately. The description does not add additional meaning beyond what is in the schema.

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

Purpose4/5

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

Clearly states it searches within a ZIM file and returns results with titles and URLs. However, it does not explicitly differentiate from sibling tools like 'get_content' or 'list_all_zims'.

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

Usage Guidelines2/5

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

Only says 'use keyword search terms' but provides no guidance on when to use this tool versus alternatives such as 'get_content' or 'list_all_zims'. No exclusions or context for selection.

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

TDQS

A3.9/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: get_content for full articles, get_content_summary for quick overviews, list_all_zims for available ZIM files, and search_zim for finding entries. No ambiguity.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern in snake_case, making the pattern predictable and easy to understand.

Tool Count4/5

With 4 tools, the server is slightly on the smaller side but well-scoped for its purpose of accessing ZIM content. Each tool is necessary and there is no bloat.

Completeness4/5

The tool set covers the core workflows: listing ZIMs, searching, retrieving summaries, and full content. Minor gaps like a dedicated get_metadata tool are absent but agents can work around.

Maintenance

ActivityStale
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    Enables AI models to access and search offline Wikipedia and other knowledge bases stored in ZIM format files. Provides intelligent content retrieval, structured browsing, advanced search capabilities, and metadata extraction for comprehensive offline knowledge access.
    8
    125
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables offline CRUD and semantic search on Wikipedia ZIM archives via MCP tools for reading, writing, editing, deleting, and searching articles.
    1
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides offline search and retrieval of Wikipedia articles using Kiwix .zim files, enabling LLMs to access full Wikipedia content without internet.
    2
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/scottyphillips/kiwix-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server