Skip to content

Fandom wikis return 403 due to Cloudflare blocking rest.php requests #217

@mertkasar

Description

@mertkasar

Problem

When using this MCP server with Fandom wikis, all tool calls that hit rest.php/v1/ endpoints fail with HTTP 403. The response is a Cloudflare JS challenge page instead of JSON.

This affects search-page, get-page, and likely all other tools that use the REST API.

Root Cause

Fandom sites are behind Cloudflare bot protection. Cloudflare blocks automated requests to rest.php/v1/* endpoints, but does not block the legacy api.php endpoint.

Verified with curl:

# Blocked (403 + Cloudflare challenge)
curl "https://<wiki>.fandom.com/rest.php/v1/search/page?q=test&limit=3"

# Works (200 + JSON response)
curl "https://<wiki>.fandom.com/api.php?action=query&titles=Main_Page&format=json"

Suggested Fix

Fall back to the api.php action API (action=query&list=search, action=parse, etc.) when rest.php returns a 403 or Cloudflare challenge. The mwn library already supports both API surfaces.

Alternatively, expose a configuration option to prefer api.php over rest.php for environments where the REST API is blocked.

Environment

  • Server version: 0.6.0 (via npx)
  • Affected wikis: Any Fandom wiki (*.fandom.com)
  • Works fine with: Wikipedia, self-hosted MediaWiki, wiki.gg

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions