mediawiki-mcp

mediawiki-mcp

An MCP server for MediaWiki instances with multi-wiki support, providing full read/write access via REST and Action APIs across multiple named wikis.

Category
访问服务器

README

MediaWiki MCP Server

A Model Context Protocol (MCP) server for MediaWiki instances with multi-wiki support. Uses the modern REST API (MediaWiki 1.42+) and Action API for full read/write access across multiple named wikis.

Features

  • Multi-Wiki Support: Register named wikis, fan-out searches across all of them
  • REST API: Uses the modern /rest.php/v1/ endpoints for page CRUD, search, and revisions
  • Bot Password Auth: Logs in via Special:BotPasswords with per-wiki credentials
  • Page Operations: Read, create, update, delete, and undelete pages
  • Search: Full-text and prefix search across all registered wikis
  • File Operations: Get file metadata, upload files from data or URL
  • Category Browsing: List categories and their members with pagination
  • History & Revisions: Access revision history, view individual revisions
  • Recent Changes: Track wiki activity across all wikis
  • Link Analysis: Explore outgoing links and backlinks
  • Pagination: All list endpoints support continuation tokens
  • Retry Logic: Exponential backoff on 429/5xx errors

Installation

Prerequisites

  • Node.js 18 or higher
  • MediaWiki 1.42 or higher

Local Installation

git clone https://github.com/ttpears/mediawiki-mcp.git
cd mediawiki-mcp
npm install
npm run build

Claude Code Installation

Register the published npm package directly with claude mcp add. Repeat --env for each variable, put all flags before the server name, and use -- to mark the start of the spawned command. --scope picks where the entry lives: local (default, current project), user (every project), or project (.mcp.json for team check-in).

Single-wiki:

claude mcp add mediawiki \
  --scope user \
  --env MEDIAWIKI_BASE_URL=https://wiki.example.com \
  --env MEDIAWIKI_USERNAME=Admin@mcp \
  --env MEDIAWIKI_PASSWORD=your-bot-password \
  -- npx -y mediawiki-mcp

Multi-wiki — register wikis as Name:URL pairs in MEDIAWIKI_WIKIS, then provide MEDIAWIKI_USERNAME_<NAME> and MEDIAWIKI_PASSWORD_<NAME> per wiki (uppercase). MEDIAWIKI_DEFAULT_WIKI picks the wiki used when a tool call doesn't specify one:

claude mcp add mediawiki \
  --scope user \
  --env MEDIAWIKI_WIKIS=Main:https://wiki.example.com,Dev:https://dev.wiki.example.com \
  --env MEDIAWIKI_DEFAULT_WIKI=Main \
  --env MEDIAWIKI_USERNAME_MAIN=Admin@mcp \
  --env MEDIAWIKI_PASSWORD_MAIN=your-bot-password \
  --env MEDIAWIKI_USERNAME_DEV=Admin@mcp \
  --env MEDIAWIKI_PASSWORD_DEV=your-bot-password \
  -- npx -y mediawiki-mcp

Docker Installation

cp .env.example .env
# Edit .env with your wiki URLs and credentials
docker compose up -d

Authentication

This server uses MediaWiki bot passwords for API authentication. Bot passwords are scoped credentials that limit what the bot can do, separate from your real account password.

Creating a Bot Password

  1. Log in to your MediaWiki wiki as a user with the permissions you want the bot to have
  2. Navigate to Special:BotPasswords (e.g., https://wiki.example.com/wiki/Special:BotPasswords)
  3. Enter a bot name (e.g., mcp) and click Create
  4. Select the grants (permissions) the bot needs:
    • High-volume (bot) access — required for API usage
    • Edit existing pages — for update-page
    • Edit protected pages — if the bot needs to edit protected pages
    • Create, edit, and move pages — for create-page, update-page
    • Delete pages and revisions — for delete-page / undelete-page
    • Upload, replace, and move files — for upload-file / upload-file-from-url
    • Patrol changes to pages — if using activity monitoring
    • Rollback changes to pages — if using rollback features
  5. Click Create to generate the password

MediaWiki will display credentials in this format:

Username: Admin@mcp
Password: your-bot-password-here

You need both values. The username (Admin@mcp) goes in MEDIAWIKI_USERNAME_* and the password goes in MEDIAWIKI_PASSWORD_*. The server uses these to log in via the Action API (action=login) and maintains a cookie-based session for all subsequent requests.

Repeat for Each Wiki

If you have multiple wikis, create a bot password on each one. You'll have a username/password pair per wiki.

Configuration

Multi-Wiki Setup

Create a .env file (see .env.example):

# Register multiple wikis (Name:URL pairs, comma-separated)
MEDIAWIKI_WIKIS=Main:https://wiki.example.com,Dev:https://dev.wiki.example.com

# Default wiki when none is specified
MEDIAWIKI_DEFAULT_WIKI=Main

# Per-wiki bot password credentials (uppercase wiki name)
MEDIAWIKI_USERNAME_MAIN=Admin@mcp
MEDIAWIKI_PASSWORD_MAIN=your-bot-password-here
MEDIAWIKI_USERNAME_DEV=Admin@mcp
MEDIAWIKI_PASSWORD_DEV=your-bot-password-here

Single-Wiki Setup

MEDIAWIKI_BASE_URL=https://wiki.example.com
MEDIAWIKI_USERNAME=Admin@mcp
MEDIAWIKI_PASSWORD=your-bot-password-here

HTTP Transport

MEDIAWIKI_MCP_PORT=8009
MEDIAWIKI_MCP_HOST=0.0.0.0

Usage

Stdio Mode (Local)

npm start

HTTP Mode (Remote / Docker)

npm run start:http

Endpoint: http://localhost:8009/mcp

LibreChat Integration

1. Add wiki credentials to the LibreChat .env

Add the MEDIAWIKI_* variables to your LibreChat .env file (e.g. /srv/docker/LibreChat/.env):

# MediaWiki MCP
MEDIAWIKI_WIKIS=Main:https://wiki.example.com,Dev:https://dev.wiki.example.com
MEDIAWIKI_DEFAULT_WIKI=Main
MEDIAWIKI_USERNAME_MAIN=Admin@mcp
MEDIAWIKI_PASSWORD_MAIN=your-bot-password-here
MEDIAWIKI_USERNAME_DEV=Admin@mcp
MEDIAWIKI_PASSWORD_DEV=your-bot-password-here

2. Add to docker-compose.override.yml

services:
  mediawiki-mcp:
    build: /srv/docker/mediawiki-mcp
    container_name: mediawiki-mcp
    env_file:
      - .env
    environment:
      - MEDIAWIKI_MCP_HOST=0.0.0.0
    restart: unless-stopped
    networks:
      - default

This builds the container from source and starts it alongside LibreChat. No need to install Node.js on the host — Docker handles the build.

3. Configure in librechat.yaml

mcpServers:
  mediawiki:
    type: streamable-http
    url: http://mediawiki-mcp:8009/mcp

If you have allowedDomains configured in LibreChat, add mediawiki-mcp to the list.

Tools

All tools that accept a wiki parameter will use the default wiki when omitted. Search and listing tools fan out across all registered wikis when wiki is not specified.

Wiki Management

Tool Description
add-wiki Register a new named wiki (name, url, username, password)
remove-wiki Remove a registered wiki
list-wikis Show all registered wikis

Search (Fan-Out)

Tool Description
search-pages Full-text search across wikis
search-pages-by-prefix Title prefix search across wikis

Parameters: query, wiki?, limit?

Page Operations (Single Wiki)

Tool Description
get-page Get page content (wikitext or HTML) and metadata
create-page Create a new page
update-page Edit an existing page (requires latest_timestamp from get-page)
delete-page Delete a page
undelete-page Restore a deleted page

History (Single Wiki)

Tool Description
get-page-history Paginated revision list for a page
get-revision Get details of a specific revision by ID

Categories

Tool Description
list-categories List categories with member counts (fan-out)
get-category-members List pages in a category (single wiki, paginated)

Files (Single Wiki)

Tool Description
get-file Get file metadata, dimensions, and URLs
upload-file Upload from base64-encoded data
upload-file-from-url Upload from a remote URL

Activity (Fan-Out)

Tool Description
get-recent-changes Recent edits, creations, and deletions across wikis

Links (Single Wiki)

Tool Description
get-page-links Get outgoing links or backlinks for a page

Development

npm run dev        # Watch mode
npm run type-check # Type checking
npm run build      # Build
npm test           # Run tests (85 tests)
npm run test:watch # Watch mode tests

Architecture

src/
├── index.ts                # Entry point (stdio)
├── stdio.ts                # Stdio transport
├── http-transport.ts       # Streamable HTTP transport
├── wiki-registry.ts        # Named wiki storage and env parsing
├── wiki-orchestrator.ts    # Fan-out routing and client management
├── types.ts                # TypeScript types
├── clients/
│   ├── rest-client.ts      # REST API (/rest.php/v1/)
│   └── action-client.ts    # Action API (/api.php) + bot password login
└── tools/
    ├── index.ts            # Tool registration barrel
    ├── wiki-tools.ts       # Wiki management
    ├── search-tools.ts     # Search (fan-out)
    ├── page-tools.ts       # Page CRUD
    ├── history-tools.ts    # Revision history
    ├── category-tools.ts   # Categories
    ├── link-tools.ts       # Links and backlinks
    ├── file-tools.ts       # File operations
    └── activity-tools.ts   # Recent changes
Transport Layer (stdio.ts, http-transport.ts)
         ↓
   WikiOrchestrator (fan-out / routing)
     ↓              ↓
RestClient      ActionClient
(/rest.php/v1)  (/api.php)
     ↑              ↑
     └── shared session cookies (bot password login)

License

MIT

Contributing

Contributions welcome! Please open issues or pull requests.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选