# MediaWiki MCP

> MediaWiki MCP Server connects your AI client directly to any wiki instance—like Wikipedia or a corporate knowledge base. It lets you query content, track page history via `get_page_revisions`, list categories, and even execute changes using tools like `edit_page` through natural language prompts.

## Overview
- **Category:** collaboration
- **Price:** Free
- **Tags:** wiki, wikipedia, documentation, knowledge-base, mediawiki-api

## Description

**MediaWiki MCP Server** connects your AI client straight into any wiki instance—whether it's Wikipedia or some corporate knowledge base you gotta deal with. Your agent doesn't just look at pages; it gets the whole scoop, letting you query content, map out site structure, and even make changes using natural language prompts.

### Finding Stuff & Mapping Out the Site Structure

Your agent runs a full-text search across every page using `search_pages` to pinpoint exactly what info you need. Need to know if a specific piece of content exists at all? You can use `get_page_info` for basic details on any given wiki page, or run `list_all_pages` to enumerate every single namespace that's built into the site.

To figure out where things fit together, you get the full picture. Your agent pulls a list of all categories associated with a specific page using `get_page_categories`, and if you want to see everything in one spot, it lists all members within a category name via `list_category_members`. You also find every internal link baked into a page's body by calling `get_page_links`.

### Digging Into History & Auditing Changes

If you need to know who changed what and when, your agent pulls an ordered log of recent edits using `list_recent_changes`, showing the details for every modification across the site. For deep dives, it retrieves historical content, metadata, or specific revisions for any page via `get_page_revisions`. You can also check out general settings and high-level info about the whole wiki setup with `get_site_info`.

Curious about who's logged in? Your agent fetches details about the user currently authenticated to the site using `get_user_info`. For a complete record, it lets you get basic information about the entire site structure itself. 

### Making Changes and User Management

Need write access? It ain't automatic. First, your agent has to grab necessary tokens—like CSRF or account credentials—by calling `get_tokens`. Once you've got those tokens, you can create a brand new user account on the wiki using `create_account`. If you gotta update content, your agent edits and updates an existing page's content directly via `edit_page`.

This server gives your AI client the keys to the kingdom. You get granular control over reading data—searching pages with **`search_pages`**, listing all pages with **`list_all_pages`**, mapping categories with **`get_page_categories`**, and checking out history with **`get_page_revisions`**—and you also gain the power to modify content by calling **`edit_page`**. You'll see your agent pull user data through **`get_user_info`**, grab tokens using **`get_tokens`**, or list recent changes across the board with **`list_recent_changes`**.

## Tools

### list_all_pages
Enumerates and lists every single page that exists within the entire wiki namespace.

### list_category_members
Retrieves a list of all pages belonging to a specified category name.

### create_account
Creates a new user account on the wiki, requiring tokens fetched via `get_tokens`.

### edit_page
Edits and updates an existing wiki page's content, requiring a CSRF token from `get_tokens`.

### get_page_categories
Lists all the categories associated with a specified wiki page.

### get_page_info
Fetches basic, structured information about a specific wiki page.

### get_page_links
Lists all internal links found within the body of a specified wiki page.

### get_page_revisions
Retrieves historical content, metadata, or specific revisions for any given wiki page.

### list_recent_changes
Returns an ordered log of the most recent edits and changes made across the wiki site.

### search_pages
Performs a full-text search query against the content of all pages in the wiki.

### get_site_info
Gathers general settings and high-level information about the entire wiki site structure.

### get_tokens
Fetches necessary tokens (like CSRF or account tokens) required for data modification actions.

### get_user_info
Retrieves details about the user who is currently authenticated to the wiki site.

## Prompt Examples

**Prompt:** 
```
Search the wiki for pages related to 'Artificial Intelligence'.
```

**Response:** 
```
I've searched the wiki using `search_pages`. I found several relevant entries including 'Artificial Intelligence', 'Machine Learning', and 'Neural Networks'. Which one would you like to explore?
```

**Prompt:** 
```
Get the latest content for the page 'Project_Roadmap'.
```

**Response:** 
```
Using `get_page_revisions`, I've retrieved the latest content for 'Project_Roadmap'. It includes sections on Q3 goals, current blockers, and the team directory. Would you like a summary of the Q3 goals?
```

**Prompt:** 
```
Show me the 5 most recent changes made to the wiki.
```

**Response:** 
```
I've called `list_recent_changes` with a limit of 5. Recent edits include updates to 'API Documentation' by User:Admin and a new page 'Draft:Policy' created by User:Editor1. Would you like details on any of these?
```

## Capabilities

### Search Wiki Content
Run a full-text search across all pages in the wiki to locate specific information.

### Review Page History and Metadata
Retrieve detailed revisions, metadata, and internal links for any given page.

### Map Site Structure
List all pages in a category or enumerate every single page existing on the wiki instance.

### Audit Recent Changes
Get an ordered list of recent edits, showing who changed what and when.

### Modify Content and Users
Create new user accounts or directly edit the content of existing wiki pages (requires tokens).

## Use Cases

### Developer needs API context for a new feature.
A developer is building a microservice and needs to know the exact parameters used in an old design spec. They ask their agent: 'What are the core links on the Project X page, and what is its current status?' The agent calls `get_page_links` and then `get_page_info`, providing all necessary metadata for the developer to proceed without interrupting a subject matter expert.

### Compliance officer needs to verify policy adherence.
The compliance team suspects that department policies are outdated. They ask: 'Show me all pages in the 'HR Policy' category and list the last five edits on any of them.' The agent calls `list_category_members` followed by `list_recent_changes`, giving the officer a full audit trail for immediate review.

### Academic researcher needs to compare source material across multiple departments.
A student is writing about 'Climate Change' and needs input from three separate corporate wikis. Instead of logging into three different systems, they prompt their agent: 'Search all relevant pages for 'GHG Emissions'.' The agent runs `search_pages` against the connected wiki instance, consolidating results instantly.

### Content team needs to update a master document.
The content lead must update the 'Product Roadmap' page. They first call `get_tokens` for write access. Then, they use `edit_page` and provide all new text sections in one go, ensuring the change is logged correctly.

## Benefits

- Stop manual searching. Instead of clicking through pages to find a keyword, run `search_pages` and get immediate results across the entire knowledge base.
- Audit documentation changes instantly. Use `list_recent_changes` to see who edited what page, when, and why, without navigating the admin dashboard.
- Understand content context deeply. `get_page_revisions` lets you look at not just the current text, but every previous version of a page—critical for compliance checks.
- Map the whole site's architecture. Running `list_all_pages` or `list_category_members` gives your agent an instant inventory of available documentation, no matter how big the wiki is.
- Maintain data integrity. If you need to update a policy, use `get_tokens` first, then run `edit_page`. This ensures you're authenticated before making changes.

## How It Works

The bottom line is: your AI client runs the specific MediaWiki API calls needed to pull or push data, bypassing manual web navigation entirely.

1. First, subscribe to the server and enter your target MediaWiki API URL. If you need write access, fetch necessary credentials using `get_tokens`.
2. Next, instruct your AI agent on the specific data you need—for example, 'List all pages in the 'Finance' category.'
3. The agent executes the appropriate tool (e.g., `list_category_members`), and you receive a structured list of results.

## Frequently Asked Questions

**How do I search the wiki using the `search_pages` tool?**
You simply tell your agent to run `search_pages` and provide the keywords. It executes a full-text query against all indexed content, returning relevant pages directly.

**Do I need `get_tokens` before using `edit_page`?**
Yes. You must call `get_tokens` first to retrieve the necessary CSRF or account tokens. These temporary credentials are required by the `edit_page` tool for successful data modification.

**`list_recent_changes` vs `get_page_revisions`, what's the difference?**
`list_recent_changes` gives you an ordered log of *all* recent edits across the whole site. `get_page_revisions` lets you deep-dive into the specific version history of one single page.

**How can I find all related documentation for a topic?**
Use `list_category_members`. If you know the category name (e.g., 'API Documentation'), this tool will list every page that belongs to it, giving you a complete scope view.

**What happens if I try to use the `edit_page` tool, but my account lacks proper permissions?**
The agent will return a specific API error code indicating insufficient write access. You need to verify your user role on the wiki or ensure the credentials used by your AI client have editor-level rights.

**Is it efficient to use `list_all_pages` when I only want information about a specific subject?**
No, calling `list_all_pages` generates a massive list of slugs and is slow. For targeted data, always start by using `search_pages` or checking the contents of a known category with `list_category_members`.

**What specific types of data can I retrieve about the current user using `get_user_info`?**
It provides core account details, including the username, join date, and sometimes last login information. This is useful for auditing or confirming who originally created a piece of content.

**How does the `get_page_links` tool help me trace cross-references on a page?**
The tool lists every internal link found within the source code of that single page. It doesn't just provide titles; it shows exactly which other pages or sections are linked to from this location.

**How do I get the actual text content of a specific wiki page?**
Use the `get_page_revisions` tool with the page title. You can specify `rvprop` as 'content' to retrieve the full text of the latest revision.

**Can I see all pages that belong to a specific category like 'Physics'?**
Yes! Use the `list_category_members` tool and provide the category title (e.g., 'Category:Physics'). It will return a list of all pages filed under that category.

**How do I check the general settings and namespaces of the wiki?**
Simply run the `get_site_info` tool. It fetches general information about the MediaWiki site, including its configuration and available namespaces.