Skip to main content
Glama
shiquda

mediawiki-mcp-server

by shiquda

search

Find wiki pages across MediaWiki sites like Wikipedia and Fandom by entering search terms, returning relevant results for research and information gathering.

Instructions

Search for a wiki page. The shorter the request, the better, preferably containing only the main term to be searched. Args: query: The query to search for limit: The number of results to return Returns: A list of pages that match the query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
limitNo

Implementation Reference

  • The main handler function for the 'search' MCP tool. It takes a query and limit, constructs API parameters, calls the make_request helper to query the MediaWiki search API, and returns the response.
    @mcp.tool() async def search(query: str, limit: int = 5): """ Search for a wiki page. The shorter the request, the better, preferably containing only the main term to be searched. Args: query: The query to search for limit: The number of results to return Returns: A list of pages that match the query """ path = "search/page" params = { "q": query, "limit": limit, } response = await make_request(path, params) return response
  • Input schema defined by type hints (query: str, limit: int=5) and docstring describing parameters and return value.
    async def search(query: str, limit: int = 5): """ Search for a wiki page. The shorter the request, the better, preferably containing only the main term to be searched. Args: query: The query to search for limit: The number of results to return Returns: A list of pages that match the query """
  • The @mcp.tool() decorator registers the search function as an MCP tool with FastMCP instance.
    @mcp.tool()
  • Helper function to make HTTP requests to the MediaWiki API, handling proxies, redirects, and errors. Used by the search tool.
    async def make_request(path: str, params: dict) -> httpx.Response: headers = { "User-Agent": USER_AGENT, } url = config.base_url + config.path_prefix + path proxies = get_proxy_settings() async with httpx.AsyncClient(proxies=proxies, follow_redirects=True) as client: try: response = await client.get(url, headers=headers, params=params) if response.status_code in (301, 302, 303, 307, 308): final_response = await client.get( response.headers["Location"], headers=headers ) return final_response.json() return response.json() except httpx.HTTPStatusError as e: logger.error(e) return {"error": e}
Install Server

Other Tools

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/shiquda/mediawiki-mcp-server'

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