Building a Stable WeChat Article Search Tool: A Playwright-Powered Claude MCP Solution

Introduction: The Search Stability Problem

Have you encountered these frustrations when searching WeChat articles?

  • Third-party APIs suddenly stopping working
  • Incomplete or missing data in search results
  • Frequent access restrictions and rate limits

The WeChat Article Search MCP Tool solves these exact challenges. By leveraging Playwright to directly access Sogou’s WeChat search, this open-source solution delivers unmatched reliability while being specially optimized for Claude MCP. Let’s explore how it works and how you can implement it.


Core Advantages Explained

🛡️ Reliability Engineering

Traditional Solutions This Tool’s Approach
Dependent on third-party APIs Direct connection to Sogou’s official search
Frequent rate limiting Simulates real browser behavior
Fragile parsing rules Multiple selector fallback strategy

⚙️ Intelligent Parsing System

# Sample parsing logic (simplified)
def extract_article_data(page):
    # Primary extraction strategy
    title_element = page.query_selector('.title-box')
    if not title_element:
        # Secondary fallback strategy
        title_element = page.query_selector('.txt-box h3')
    return title_element.text if title_element else "Auto-recovery successful"

This multi-layered selector strategy ensures consistent extraction of titles, sources, publication dates, and summaries even when website structures change.


Complete Implementation Guide

Step 1: Environment Setup

# Clone the repository
git clone https://github.com/zacfire/weixin-search-playwright-mcp.git
cd weixin-search-playwright-mcp

# Install dependencies
pip install -r requirements.txt
playwright install chromium

Step 2: Claude MCP Integration

Add this configuration to your Claude Desktop settings file:

{
  "mcpServers": {
    "wechat-search": {
      "command": "/usr/local/bin/python3",  // Use 'which python3' to verify path
      "args": ["/full/path/to/mcp_server.py"],
      "description": "WeChat article search service",
      "cwd": "/full/path/to/project_directory"
    }
  }
}

Step 3: Restart Claude Desktop

After configuration, restart the application to activate the MCP service module.


Practical Usage Examples

Basic Search Command

Search WeChat articles: artificial intelligence

Sample output:

1. [Title] Breakthrough Applications of AI in Healthcare
   [Source] Tech Frontiers | [Date] 2025-08-18
   [Abstract] Examining how AI transforms diagnostic processes...
   [URL] https://weixin.sogou.com/link?...

Advanced Parameter Combinations

Search latest 10 articles about "machine learning" time_filter=week

Parameter reference table:

Parameter Accepted Values Default Purpose
query Any string Required Search keywords
max_results Integer (1-20) 5 Result count limit
time_filter day/week/month/year None Time-range filtering

Technical Implementation Insights

Browser Automation Workflow

  1. Launch headless browser: Playwright initiates Chromium
  2. Navigate to Sogou WeChat: Direct loading of https://weixin.sogou.com
  3. Execute search: Automatic keyword entry and submission
  4. Smart loading detection: Monitors page element readiness
  5. Structured data extraction: CSS-based information capture

Validation System

# Run test script to verify functionality
python test_search.py --search

Test coverage includes:

  • Search success rate across keywords
  • Time filter accuracy
  • Error handling in edge cases

Troubleshooting Guide

❓ MCP Connection Failures

Resolution steps:

  1. Examine Claude Desktop logs
  2. Confirm Python path accuracy (use which python)
  3. Restart Claude Desktop services

❓ Empty Search Results

Diagnostic process:

graph TD
    A[No Results] --> B{Network Connection}
    B -->|Functional| C[Keyword Validation]
    B -->|Problem| D[Check Firewall Settings]
    C -->|Valid| E[Check Sogou Status]
    C -->|Invalid| F[Modify Keywords]

❓ ZodError Protocol Issues

Ensure:

  • Using latest mcp_server.py version
  • No version conflicts in project directory
  • Original protocol structure remains unmodified

Real-World Applications

Academic Research Tracking

“Search this week’s articles about ‘quantum computing'”
Enables rapid discovery of field advancements

Competitive Intelligence

“Search 10 articles about ‘electric vehicles market analysis'”
Supports data-driven business decisions

Content Creation

“Search this month’s ‘healthy eating’ articles”
Streamlines research for creators


Version Evolution

  • v1.0: Basic search with title/source extraction
  • v1.1: Added time filters (day/week/month/year)
  • v1.2: 40% parsing success rate improvement
  • Current: Full MCP protocol compliance

Conclusion: The Value Proposition

This solution addresses three critical needs:

  1. Stability: Direct access eliminates API limitations
  2. Timeliness: Real-time article retrieval
  3. Compatibility: Deep Claude ecosystem integration

The technical workflow delivers:

Raw Data → Intelligent Parsing → Structured Output → MCP Integration

creating a reliable information pipeline for knowledge professionals.

Project Repository: https://github.com/zacfire/weixin-search-playwright-mcp
Contributions welcome through Issues and PRs!


Technical FAQ

▸ Does this require WeChat login?

No. The tool accesses public Sogou WeChat search data without accounts.

▸ Can I use other search engines?

Currently optimized for WeChat; architecture supports future expansion.

▸ How does it avoid blocking?

Randomized delays and human-like interaction patterns reduce detection risk.

▸ What’s the data freshness?

Near real-time synchronization with Sogou (typically <1 hour delay).

▸ Is commercial use permitted?

Yes. The MIT license allows business integration.