Skip to main content

Professional browser automation for Claude Code and MCP clients powered by DrissionPage

Project description

DrissionPage MCP Server

Professional browser automation for Claude Code and MCP clients powered by DrissionPage

PyPI Downloads License Python Version Status

Official Repositories: GitHub | GitCode

English Version | 中文版本


🚀 What is DrissionPage MCP?

DrissionPage MCP Server is a local Model Context Protocol (MCP) server that brings DrissionPage browser automation tools to Claude Code, Claude Desktop, and other MCP clients.

Unlike screenshot-based approaches, it provides structured, deterministic web automation through 21 powerful tools that leverage the efficiency of DrissionPage, a high-performance browser automation framework.

🌟 Why Choose DrissionPage MCP?

  • LLM-Optimized: Works with structured data instead of requiring vision models
  • Deterministic: Reliable element selection with CSS and XPath support
  • Fast & Lightweight: Built on DrissionPage's efficient engine with minimal overhead
  • Type-Safe: Full type hints and Pydantic validation for all tools
  • Open-source Friendly: Includes compatibility notes, troubleshooting, and CI checks for maintainable contributions
  • Easy Integration: Simple pip install + JSON configuration

⚡ First Success Path

# Install from PyPI
python -m pip install -U drissionpage-mcp

# Verify package and environment
drissionpage-mcp --version
drissionpage-mcp doctor

Then add the MCP client configuration below and restart your client.


📦 Setup in Claude Code (30 seconds)

  1. Edit MCP configuration:

    • macOS/Linux: ~/.config/claude-code/mcp_settings.json
    • Windows: %APPDATA%\claude-code\mcp_settings.json
  2. Add this configuration:

    {
      "mcpServers": {
        "drissionpage": {
          "command": "drissionpage-mcp"
        }
      }
    }
    
  3. Restart Claude Code and start using!


🎯 Quick Examples

Navigate and Screenshot

"Visit https://example.com and take a screenshot for me"

Search and Extract

"Go to Wikipedia, search for Python, and get the first paragraph"

Form Automation

"Fill out the form at https://httpbin.org/forms/post and submit it"

Data Scraping

"Get the top 10 news headlines from news.ycombinator.com"

🛠️ 21 Powerful Tools

🌐 Navigation (4 tools)

  • page_navigate - Navigate to any URL
  • page_go_back / page_go_forward - Browser history
  • page_refresh - Reload current page

🎯 Element Interaction & Extraction (8 tools)

  • element_find - Find elements by CSS selector or XPath
  • element_click - Click any element
  • element_type / element_input_text - Input text into elements
  • element_get_text - Get element or page text
  • element_get_attribute - Get an HTML attribute
  • element_get_property - Get a live DOM property such as an input value
  • element_get_html - Get element or page HTML

📸 Page Operations (5 tools)

  • page_screenshot - Capture full page or viewport
  • page_resize - Adjust browser window
  • page_click_xy - Click by coordinates
  • page_close - Close browser
  • page_get_url - Get current URL

⏱️ Wait Operations (4 tools)

  • wait_for_element - Wait for element to appear (with timeout)
  • wait_for_url - Wait until the current URL contains text
  • wait_time / wait_sleep - Delay execution

📚 Documentation

Guide Description
README.md Installation, tools, and architecture
docs/compatibility.md Supported Python, DrissionPage, MCP, and browser versions
docs/tool-contract.md Public MCP tool names, inputs, annotations, and response shape
docs/troubleshooting.md Doctor command, browser startup, and client setup fixes
docs/release-checklist.md Release validation and publishing checklist
examples/README.md MCP client configuration examples
CHANGELOG.md Release notes

🏗️ Architecture

Built with clean, modular design:

DrissionMCP/
├── drissionpage_mcp/
│   ├── cli.py              # Entry point
│   ├── server.py           # MCP server
│   ├── context.py          # Browser management
│   ├── response.py         # Response formatting
│   ├── tab.py              # Page operations
│   └── tools/              # 21 automation tools
├── examples/               # Configuration templates
├── tests/                  # Unit tests
└── playground/             # Testing utilities

Key Principles:

  • ✅ Type-safe Pydantic models for all tools
  • ✅ Async/await throughout
  • ✅ Clean separation of concerns
  • ✅ Comprehensive error handling
  • ✅ Unit and protocol test coverage for core tool registration/response behavior

🔧 Configuration

Basic Setup (Recommended)

{
  "mcpServers": {
    "drissionpage": {
      "command": "drissionpage-mcp"
    }
  }
}

Advanced Setup

{
  "mcpServers": {
    "drissionpage": {
      "command": "drissionpage-mcp",
      "args": ["--log-level", "DEBUG"],
      "env": {
        "CHROME_PATH": "/custom/path/to/chrome"
      }
    }
  }
}

See examples/README.md for more configuration options.


📋 Requirements

  • Python 3.10+ (3.11+ recommended)
  • Chrome or Chromium browser
  • Any MCP-compatible client: Claude Code, Claude Desktop, Cursor, VS Code, etc.

🧪 Testing

Verify Installation

# Environment diagnostics; add --launch-browser for a browser startup check
drissionpage-mcp doctor
drissionpage-mcp doctor --launch-browser

# Source checkout tests
python -m pip install -e ".[dev]"
python -m pytest tests/

Try It Out

# Interactive testing
python playground/local_test.py

# Quick start validation
python playground/quick_start.py

🚀 Use Cases

Automated Testing - Test web applications ✅ Data Scraping - Extract structured data from websites ✅ Form Automation - Fill and submit forms ✅ Monitoring - Check for updates or changes ✅ Screenshot Verification - Capture and verify page state ✅ Content Analysis - Analyze web content programmatically


🐛 Troubleshooting

Tools Not Loading?

drissionpage-mcp --version

Should output the installed package version, for example drissionpage-mcp 0.3.0.

Browser Issues?

# Check browser installation
which google-chrome    # Linux
which chromium         # macOS

Claude Code Not Finding Server?

  • Verify config file path
  • Restart Claude Code after changes
  • Check logs: drissionpage-mcp --log-level DEBUG

See docs/troubleshooting.md for the complete troubleshooting guide.


📊 Project Status

Component Status
Core Features ✅ Complete
Testing ✅ Unit/protocol checks, optional browser smoke
Documentation ✅ Setup, compatibility, troubleshooting, release checklist
Package ✅ PyPI metadata and build checks
Status 🟡 Beta; real browser behavior depends on local Chrome/Chromium and target sites

Version: 0.3.0 | License: Apache 2.0 | Maintained: ✅ Active


🗺️ Roadmap

Current (v0.3.0)

  • 21 core automation tools
  • stdio MCP server integration
  • Doctor diagnostics for local setup
  • Compatibility and troubleshooting documentation
  • PyPI distribution

Future (v0.2+)

  • Form handling utilities
  • File upload support
  • Shadow DOM selectors
  • Session persistence
  • Proxy support
  • Network interception

📖 Integration Examples

Claude Code

{
  "mcpServers": {
    "drissionpage": {
      "command": "drissionpage-mcp"
    }
  }
}

Claude Desktop

{
  "mcpServers": {
    "drissionpage": {
      "command": "drissionpage-mcp"
    }
  }
}

See examples/ for more client configurations.


🤝 Contributing

Contributions are welcome!

  1. Fork the repository
  2. Create a feature branch
  3. Make focused changes
  4. Run the relevant checks
  5. Submit a pull request

See CONTRIBUTING.md for setup, validation, and compatibility expectations.


🔒 Security

  • Runs locally in your environment
  • Uses a local browser that may have access to authenticated sessions, cookies, downloads, and page content
  • Can open and interact with any site reachable from the local machine
  • Does not require external API credentials

Best Practices:

  • Use a dedicated browser profile for sensitive workflows
  • Review MCP client prompts before allowing actions on authenticated or production systems
  • Respect website terms of service, robots.txt, and rate limits
  • See SECURITY.md for reporting and safe-usage guidance

📄 License

Licensed under Apache License 2.0 - see LICENSE


🙏 Acknowledgments


💬 Support


📈 Statistics

Downloads PyPI Version


🌟 Show Your Support

If you find this project useful, please consider:

  • ⭐ Starring on GitHub
  • 📤 Sharing with your network
  • 💬 Leaving feedback or suggestions
  • 🐛 Reporting issues to help improve

Made with ❤️ by Wukunyun

Ready to automate your workflows? Install now: python -m pip install -U drissionpage-mcp

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drissionpage_mcp-0.3.0.tar.gz (48.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

drissionpage_mcp-0.3.0-py3-none-any.whl (33.8 kB view details)

Uploaded Python 3

File details

Details for the file drissionpage_mcp-0.3.0.tar.gz.

File metadata

  • Download URL: drissionpage_mcp-0.3.0.tar.gz
  • Upload date:
  • Size: 48.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for drissionpage_mcp-0.3.0.tar.gz
Algorithm Hash digest
SHA256 066a5a9b5254688596be55285dcf58cedef8e83295199c7df19774dd1138c44c
MD5 f35f055d6fa467d7d3e1e07ec433982f
BLAKE2b-256 44a15c552761ace893a206abfeead1a00c46034ffeb180990c867031eba9e013

See more details on using hashes here.

File details

Details for the file drissionpage_mcp-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for drissionpage_mcp-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ddf56e4a384b128ccf4774c66e54491ad8981f51f8ee6a98dce329850c6d732
MD5 c8ad378faa06f2d1db0c544a2cd5d332
BLAKE2b-256 15f0a0235bf42980e339e6d8879b67854b8287592c6fb93ebf1f105718490ae3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page