MediaWiki
About
Interact with MediaWiki installations through the MediaWiki API as a bot user.
Details
- Author
- entanglr
- Categories
- Developer Tools, Other, Knowledge Base, API
Jump to
Setup
Install MediaWiki in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/entanglr/mediawiki-api-mcp
Follow the installation instructions in the repository README, then restart your MCP client.
A Model Context Protocol (MCP) server that allows LLMs to interact with MediaWiki installations through the MediaWiki API as a bot user.
The server provides various MCP tools with thewiki_prefix:
- Clone the repository and checkout themainbranch
- Install dependencies using UV:
export MEDIAWIKI_API_URL="http://mediawiki.test/api.php" export MEDIAWIKI_API_BOT_USERNAME="YourUserName@YourBotName" export MEDIAWIKI_API_BOT_PASSWORD="YourBotPassword" export MEDIAWIKI_API_BOT_USER_AGENT="MediaWiki-MCP-Bot/1.0 (your.email@mediawiki.test)" # Optional
- macOS:~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:%APPDATA%\Claude\claude_desktop_config.json
Add to your Claude Desktop configuration file:
{ "mcpServers": { "mediawiki-api": { "command": "uv", "args": [ "--directory", "/absolute/path/to/mediawiki-api-mcp", "run", "mediawiki-api-mcp" ], "env": { "MEDIAWIKI_API_URL": "http://mediawiki.test/api.php", "MEDIAWIKI_API_BOT_USERNAME": "YourUserName@YourBotName", "MEDIAWIKI_API_BOT_PASSWORD": "YourBotPassword", "MEDIAWIKI_API_BOT_USER_AGENT": "MediaWiki-MCP-Bot/1.0 (your.email@mediawiki.test)" } } } }
- Replace/absolute/path/to/mediawiki-api-mcpwith the actual absolute path to this project directory
- UpdateMEDIAWIKI_API_URLwith your MediaWiki installation's API endpoint
- SetMEDIAWIKI_API_BOT_USERNAMEto your bot username (typically in formatYourUserName@YourBotName)
- SetMEDIAWIKI_API_BOT_PASSWORDto the generated bot password from your wiki'sSpecial:BotPasswordspage
- CustomizeMEDIAWIKI_API_BOT_USER_AGENTwith appropriate contact information (optional)
Create bot credentials at e.g.:http://mediawiki.test/index.php/Special:BotPasswords
- Basic rights: Read pages
- High-volume editing: Edit existing pages, Create, edit, and move pages
- Additional permissions as needed for your specific use case
- Keep your bot credentials secure and never commit them to version control
- Use the principle of least privilege when setting bot permissions
- Monitor bot activity through your MediaWiki's logging interface
- Consider using IP restrictions for additional security
- MCP SDK: mcp >= 1.2.0 (using FastMCP pattern)
- HTTP Client: httpx >= 0.27.0 for MediaWiki API calls
- Data Validation: pydantic >= 2.0.0 for configuration models
- Environment: python-dotenv >= 1.0.0 for configuration
- Testing: pytest with pytest-asyncio for async testing
- Code Quality: ruff for linting, mypy for type checking
- FastMCP server with@mcp.tool()decorators
- Separation of concerns: server → handler → client → MediaWiki API
- AsyncIO throughout for non-blocking operations
- Environment-based configuration for MediaWiki credentials
Client Layer (client.py and client_modules/)
- Handles MediaWiki API authentication and requests
- Manages CSRF tokens and session state
- Provides typed methods for API operations
- Defines MCP tool schemas using JSON Schema
- Separated by functional area (edit, search)
- Ensures all tools havewiki_prefix
- Implements actual tool logic
- Handles argument validation and error handling
- Returns properly formatted MCP responses
Server Layer (server.py and server_tools/)
- Main MCP server orchestration
- Routes tool calls to appropriate handlers
- Manages configuration and client lifecycle
The project is organized into modular components for maintainability:
mediawiki-api-mcp/ ├── mediawiki_api_mcp/ │ ├── __init__.py │ ├── server.py # FastMCP server with tool definitions │ ├── client.py # MediaWiki API client │ ├── client_modules/ # Client modules for API operations │ │ ├── __init__.py # Client module exports │ │ └── client_.py # Individual client modules │ ├── handlers/ # Business logic handlers │ │ ├── __init__.py # Handler exports │ │ └── wiki_.py # Individual tool handlers │ ├── tools/ # Tool schemas │ │ ├── __init__.py # Tool schema exports │ │ └── wiki_.py # Individual tool schemas │ └── server_tools/ # Tool definitions │ ├── __init__.py # Tool definition exports │ └── wiki_.py # Individual tool definitions ├── tests/ # Test suite │ └── test_.py # Test files matching handlers ├── docs/ # Documentation │ └── tools/ # Tool-specific documentation │ └── wiki_.md # Individual tool docs ├── pyproject.toml # Project configuration └── uv.lock # Dependency lock file
uv run pytest tests/test_server.py uv run pytest tests/test_tools.py uv run pytest tests/test_wiki_page_edit.py uv run pytest tests/test_wiki_search.py uv run pytest tests/test_wiki_opensearch.py
# Linting uv run ruff check # Type checking uv run mypy mediawiki_api_mcp
The server implements comprehensive error handling:
- Configuration errors: Missing environment variables
- Authentication errors: Invalid credentials or permissions
- API errors: Network issues, invalid requests
- Tool errors: Missing parameters, invalid arguments
All errors are returned as MCPTextContentresponses for LLM visibility.
- Bot credentials are required for editing operations
- All API requests include proper User-Agent headers
- CSRF tokens are automatically managed
- Input validation on all tool parameters
This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.
An MCP server for the Frappe Framework, enabling AI assistants to interact with Frappe's REST API for document management and schema operations.
An MCP server for interacting with Bookstack, built with the mcp-framework for Node.js.
Search and access academic paper metadata from Crossref.
An MCP server for the esa.io API, allowing you to search, read, create, update, and delete posts.
MCP server and CLI for managing INCEpTION projects, documents, and exports through the AERO v1 REST API.
Integrates with the Kibela API to manage knowledge-based content.
An MCP server for integrating with the Kibela API, allowing LLMs to access and manage content on the knowledge-sharing platform.
Manages BookStack documentation for the SoftCroft multi-agent system, aiding in Sage 200 to Odoo 17 migration.
Read and write a self-hosted TriliumNext knowledge base over its ETAPI. Ten tools: create/get/update/append/delete notes, full search, labels and relations.
Integrates with Wiki.js, enabling AI to read and update documentation.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





