Wikipedia与Firecrawl MCP Docker编排

这是一个Docker Compose配置,用于部署Wikipedia MCP服务器和自托管的Firecrawl网页抓取MCP服务器,并通过Cloudflare Tunnel提供安全远程访问,适用于需要维基百科检索和网页爬取/抓取能力的MCP客户端。

  • by kyuumeitai
  • TypeScript
  • 混合部署
  • 1 星标
  • 更新于
在 GitHub 查看 kyuumeitai/docker-wikipedia-mcp

使用说明

Wikipedia & Firecrawl MCP Docker Setup

Docker Compose setup for multiple MCP servers with Cloudflare Tunnel:

Features

  • Wikipedia MCP: 2 language instances (English & Spanish)
  • Firecrawl MCP: Self-hosted Firecrawl with full API stack
    • Playwright-based browser automation
    • Redis for queue management
    • PostgreSQL for data storage
    • Bull Queue dashboard for monitoring
  • Cloudflare Tunnel for secure remote access
  • Support for 140+ Wikipedia languages and countries
  • Caching support
  • Easy configuration via environment variables

Prerequisites

  1. Docker and Docker Compose installed
  2. A Cloudflare account with a domain
  3. Cloudflared CLI installed (for initial tunnel setup)

Setup

1. Create Cloudflare Tunnel

First, install cloudflared and create a tunnel:

# macOS
brew install cloudflared

# Linux
wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
sudo dpkg -i cloudflared-linux-amd64.deb

Authenticate with Cloudflare:

cloudflared tunnel login

Create a tunnel:

cloudflared tunnel create wikipedia-mcp

Get your tunnel token:

  • Go to https://one.dash.cloudflare.com/
  • Navigate to Networks > Tunnels
  • Click on your tunnel
  • Copy the tunnel token

2. Configure Environment

Copy the example environment file:

cp .env.example .env

Edit .env and configure:

# Your app name
APP_NAME=wikipedia

# Wikipedia settings
WIKIPEDIA_LANGUAGE=en
WIKIPEDIA_COUNTRY=US

# Cloudflare Tunnel (REQUIRED)
CLOUDFLARE_TUNNEL_TOKEN=your_tunnel_token_here

# Your domain
CF_BASE_DOMAIN=example.com
MCP_HOST=mcp-wikipedia.example.com

3. Configure Cloudflare Public Hostname

In the Cloudflare Zero Trust dashboard:

  1. Go to Networks > Tunnels
  2. Click on your tunnel
  3. Go to Public Hostname tab
  4. Add a public hostname:
    • Subdomain: mcp-wikipedia
    • Domain: example.com
    • Service:
      • Type: HTTP
      • URL: wikipedia-mcp:3000

4. Start the Services

docker-compose up -d

Check the logs:

docker-compose logs -f

Your Wikipedia MCP server should now be accessible at https://mcp-wikipedia.example.com

Configuration Options

Wikipedia Settings

Variable Default Description
WIKIPEDIA_LANGUAGE en Wikipedia language code (en, es, fr, de, ja, zh, etc.)
WIKIPEDIA_COUNTRY US Country code for regional Wikipedia (US, GB, ES, JP, etc.)
APP_NAME wikipedia Container name prefix

Cloudflare Settings

Variable Required Description
CLOUDFLARE_TUNNEL_TOKEN Yes Tunnel token from Cloudflare dashboard
CF_BASE_DOMAIN Yes Your Cloudflare domain
MCP_HOST Yes Full hostname for MCP server
CLOUDFLARE_TUNNEL_ID No Only needed if using config.yml method

Optional Features

Variable Default Description
ENABLE_CACHE false Enable Wikipedia content caching
ACCESS_TOKEN - Personal access token for authenticated requests

Usage with Claude Desktop

Add to your Claude Desktop configuration:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%/Claude/claude_desktop_config.json Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "wikipedia-en": {
      "url": "https://wikipedia-mcp.example.com",
      "transport": "sse"
    },
    "wikipedia-es": {
      "url": "https://wikipedia-mcp-es.example.com",
      "transport": "sse"
    },
    "firecrawl": {
      "url": "https://firecrawl-mcp.example.com",
      "transport": "sse"
    }
  }
}

Available MCP Tools

Wikipedia MCP Server

The Wikipedia MCP server provides tools for:

  • Searching Wikipedia articles
  • Retrieving full article content
  • Getting article summaries
  • Accessing article metadata
  • And more Wikipedia operations

See the Wikipedia MCP documentation for full details on available tools.

Firecrawl MCP Server

The Firecrawl MCP server provides tools for:

  • Scraping: Extract content from single web pages
  • Crawling: Recursively crawl entire websites
  • Mapping: Generate sitemaps of websites
  • Searching: Search the web with Google/Bing
  • Extracting: Use LLMs to extract structured data from pages

See the Firecrawl documentation for full details on available tools.

Firecrawl Configuration

Required Settings

The Firecrawl stack is fully self-hosted and requires no external API keys for basic operation:

# Bull Queue dashboard authentication
FIRECRAWL_BULL_AUTH_KEY=secure_changeme_key_2025

# Optional: Block images/media to reduce bandwidth
BLOCK_MEDIA=false

Optional Features

LLM Integration (for extract features)

To use Firecrawl's extract features with LLMs:

OPENAI_API_KEY=your_openai_api_key_here
OPENAI_BASE_URL=https://api.openai.com/v1
MODEL_NAME=gpt-4

Search API Integration

For web search capabilities:

# Serper (Google Search API)
SERPER_API_KEY=your_serper_api_key_here

# SearchAPI
SEARCHAPI_API_KEY=your_searchapi_api_key_here

Proxy Configuration

For using a proxy with both Firecrawl API and Playwright:

PROXY_SERVER=http://proxy.example.com:8080
PROXY_USERNAME=your_proxy_username
PROXY_PASSWORD=your_proxy_password

Accessing Firecrawl Services

Once running, you can access:

  • Firecrawl MCP: Via Cloudflare Tunnel at https://firecrawl-mcp.example.com
  • Firecrawl API (internal): http://localhost:3002 or http://firecrawl-api:3002 from other containers
  • Bull Queue Dashboard: http://localhost:3002/admin/CHANGEME/queues (use your FIRECRAWL_BULL_AUTH_KEY)

Testing Firecrawl API

You can test the Firecrawl API directly:

# Test scrape endpoint
curl -X POST http://localhost:3002/v1/scrape \
  -H 'Content-Type: application/json' \
  -d '{"url": "https://example.com"}'

# Test crawl endpoint
curl -X POST http://localhost:3002/v1/crawl \
  -H 'Content-Type: application/json' \
  -d '{"url": "https://firecrawl.dev"}'

Maintenance

View Logs

# All services
docker-compose logs -f

# Specific service
docker-compose logs -f wikipedia-mcp
docker-compose logs -f cloudflared

Restart Services

docker-compose restart

Stop Services

docker-compose down

Update to Latest Version

docker-compose pull
docker-compose up -d --build

Clean Up

# Stop and remove containers, networks, and volumes
docker-compose down -v

Troubleshooting

Container won't start

  1. Check the logs: docker-compose logs wikipedia-mcp
  2. Verify your .env file is properly configured
  3. Ensure Docker has internet access to pull images

Cloudflare Tunnel not working

  1. Verify your tunnel token is correct in .env
  2. Check that the tunnel is active in the Cloudflare dashboard
  3. Ensure the public hostname is properly configured
  4. Check cloudflared logs: docker-compose logs cloudflared
  5. Test if the service is accessible internally: docker-compose exec wikipedia-mcp wget -O- http://localhost:3000

Cannot connect to Wikipedia

  1. Verify internet connectivity from the container
  2. Check if Wikipedia is accessible from your network
  3. Try different language/country codes

SSL/Certificate Errors

Cloudflare Tunnel automatically handles SSL certificates. If you're getting SSL errors:

  1. Ensure you're accessing via https://
  2. Check that the public hostname is properly configured in Cloudflare
  3. Wait a few minutes for DNS propagation

Architecture

┌─────────────────────────────────────────────────────────────────┐
│  Internet / Claude Desktop                                      │
└───────────────────────────┬─────────────────────────────────────┘
                            │ HTTPS
                            ▼
┌─────────────────────────────────────────────────────────────────┐
│  Cloudflare Tunnel                                              │
│  - SSL/TLS termination                                          │
│  - DDoS protection                                              │
│  - DNS routing for multiple MCP endpoints                       │
└───────────────────────────┬─────────────────────────────────────┘
                            │
                            ▼
┌─────────────────────────────────────────────────────────────────┐
│  Docker Network (mcp-network)                                   │
│                                                                 │
│  ┌──────────────────────────────────────────────────────────┐  │
│  │  cloudflared                                             │  │
│  └──────────────────────────────────────────────────────────┘  │
│                            │                                    │
│      ┌─────────────────────┼─────────────────────┐             │
│      ▼                     ▼                     ▼             │
│  ┌─────────┐         ┌─────────┐          ┌──────────────┐    │
│  │ wiki-en │         │ wiki-es │          │ firecrawl-   │    │
│  │ :3000   │         │ :3001   │          │ mcp :4000    │    │
│  └─────────┘         └─────────┘          └──────┬───────┘    │
│                                                   │            │
│                                                   ▼            │
│  ┌──────────────────────────────────────────────────────────┐  │
│  │  Firecrawl Stack                                         │  │
│  │  ┌────────────────┐  ┌──────────────┐  ┌──────────────┐ │  │
│  │  │ firecrawl-api  │  │ playwright   │  │ nuq-postgres │ │  │
│  │  │ :3002/3004/3005│  │ :3003        │  │ :5432        │ │  │
│  │  └────────┬───────┘  └──────┬───────┘  └──────┬───────┘ │  │
│  │           │                 │                  │         │  │
│  │           └─────────────────┴──────────────────┘         │  │
│  │                          │                               │  │
│  │                          ▼                               │  │
│  │                   ┌──────────────┐                       │  │
│  │                   │ redis :6379  │                       │  │
│  │                   └──────────────┘                       │  │
│  └──────────────────────────────────────────────────────────┘  │
└─────────────────────────────────────────────────────────────────┘
                            │
                            ▼
                 ┌──────────────────────┐
                 │  External APIs       │
                 │  - Wikipedia         │
                 │  - OpenAI (optional) │
                 │  - Search (optional) │
                 └──────────────────────┘

Port Allocations

Exposed Services (via Cloudflare Tunnel):

  • wikipedia-mcp-en: Port 3000 → https://wikipedia-mcp.example.com
  • wikipedia-mcp-es: Port 3001 → https://wikipedia-mcp-es.example.com
  • firecrawl-mcp: Port 4000 → https://firecrawl-mcp.example.com

Internal Services:

  • playwright-service: Port 3003 (accessible only within Docker network)
  • firecrawl-api: Ports 3002 (API), 3004 (extract worker), 3005 (worker)
  • redis: Port 6379 (queue management)
  • nuq-postgres: Port 5432 (PostgreSQL database)

All services communicate on the mcp-network Docker bridge network.

Security Notes

  • The Wikipedia MCP server runs with minimal privileges
  • Cloudflare Tunnel provides secure access without exposing ports
  • Keep your tunnel token secure and never commit it to version control
  • Add .env to your .gitignore (already configured)
  • All traffic is encrypted via Cloudflare's SSL/TLS

License

This Docker setup is provided as-is. The Wikipedia MCP server is maintained by Rudra-ravi.

Links

Wikipedia MCP

Firecrawl

General