PyPen MCP
Provides capabilities for bypassing Cloudflare Turnstile captchas and interacting with Cloudflare-protected sites.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@PyPen MCPCapture network requests from the login page and check for security issues"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
PyPen MCP
Model Context Protocol server for browser-based penetration testing using PyDoll.
Overview
PyPen MCP provides a comprehensive set of tools for LLM-powered browser automation and security testing. It leverages PyDoll's Chrome DevTools Protocol integration for reliable, webdriver-free browser control.
Features
Browser Management
Launch/close browser instances with configurable options
Navigation control (navigate, back, forward, refresh)
Headless mode, proxy support, custom user agents
Incognito mode and resource blocking
Network Operations
Monitoring: Capture all HTTP traffic, analyze requests/responses
Interception: Block, modify, or mock requests in real-time
Authenticated Requests: Make API calls that inherit browser session/cookies
DOM Manipulation
Find elements by CSS selector, XPath, or attributes
Click, type, scroll, and interact with elements
Extract page source, element text, and HTML
Human-like scrolling with physics simulation
JavaScript Execution
Execute arbitrary JavaScript in browser context
Access localStorage and sessionStorage
Extract global variables, forms, and links
Session Management
Cookie manipulation (get, set, delete, clear)
Import/export cookies in multiple formats
Session-aware HTTP requests
Captcha Handling
Turnstile Bypass: Automatic Cloudflare Turnstile interaction
Human Intervention: Request human help for unsolvable captchas (ReCAPTCHA v2, hCaptcha)
Detection: Identify captcha types on the page
Debugging
Screenshots (full page or elements)
Viewport control
Performance metrics
Element highlighting
Installation
pip install pypen-mcpOr install from source:
git clone https://github.com/your-repo/pypen-mcp
cd pypen-mcp
pip install -e .Configuration
Add to your MCP client configuration:
{
"mcpServers": {
"pypen": {
"command": "pypen-mcp"
}
}
}For development:
{
"mcpServers": {
"pypen": {
"command": "/path/to/pypen-mcp/.venv/bin/pypen-mcp"
}
}
}Usage Examples
Basic Browser Automation
# Launch browser
browser_launch(headless=True)
# Navigate to target
browser_navigate(url="https://example.com")
# Extract page content
dom_get_source()
# Find and interact with elements
dom_find_element(css_selector="#username")
dom_type(selector="#username", text="admin")
dom_click(selector="button[type=submit]")
# Take screenshot for documentation
debug_screenshot(path="/tmp/screenshot.png")
# Close when done
browser_close()Network Monitoring
# Enable traffic capture
network_enable_monitoring()
# Navigate and capture
browser_navigate(url="https://api.example.com")
# Get captured requests
network_get_logs(filter_url="/api/")
# Get response body for specific request
network_get_response_body(request_id="abc123")
# Disable when done
network_disable_monitoring()Request Interception
# Set up interception rules
network_setup_handler(
block_patterns=["analytics", "tracking", "ads"],
modify_headers={"Authorization": "Bearer token123"},
mock_responses={"/api/config": {"status": 200, "body": {"debug": true}}}
)
# Navigate with interception active
browser_navigate(url="https://example.com")Session-Based Requests
# Login via UI (handles complex auth)
browser_navigate(url="https://app.com/login")
dom_type(selector="#email", text="user@example.com")
dom_type(selector="#password", text="password123")
dom_click(selector="button[type=submit]")
# Make authenticated API calls
session_make_request(
url="https://app.com/api/user/profile",
method="GET"
)Captcha Handling
# Enable automatic Turnstile bypass
captcha_enable_turnstile_bypass(time_to_wait_captcha=10.0)
# Navigate to protected site
browser_navigate(url="https://protected-site.com")
# Wait for captcha processing
# ... automation continues ...
# For unsolvable captchas, request human help
captcha_detect_type() # Check what's on page
captcha_request_human_intervention(
captcha_type="recaptcha_v2",
message="Please solve the ReCAPTCHA to continue"
)
# Wait for human to solve
captcha_wait_for_resolution(request_id="abc123", timeout=300)Tool Reference
Browser Tools
Tool | Description |
| Launch browser with options (headless, proxy, etc.) |
| Close the browser instance |
| Navigate to a URL |
| Navigate back in history |
| Navigate forward in history |
| Refresh current page |
| Get current URL and title |
Network Tools
Tool | Description |
| Start capturing HTTP traffic |
| Stop traffic capture |
| Get captured requests (with optional filter) |
| Get response body for a request |
| Enable request interception |
| Disable interception |
| Configure auto interception rules |
DOM Tools
Tool | Description |
| Find element by selector |
| Find multiple elements |
| Get element text content |
| Get element HTML |
| Click an element |
| Type text into input |
| Scroll the page |
| Get full page HTML |
| Wait for element to appear |
JavaScript Tools
Tool | Description |
| Execute JavaScript code |
| Get console logs |
| Extract global variables |
| Get localStorage data |
| Get sessionStorage data |
| Set localStorage value |
| Get all forms with inputs |
| Get all links on page |
Session Tools
Tool | Description |
| Get all cookies |
| Get specific cookie |
| Set a cookie |
| Delete a cookie |
| Clear all cookies |
| Export cookies (json/netscape/header) |
| Import cookies from JSON |
| Make session-authenticated HTTP request |
Captcha Tools
Tool | Description |
| Enable auto Turnstile handling |
| Disable Turnstile handling |
| Detect captcha type on page |
| Auto-handle detected captcha |
| Request human help |
| Get unresolved requests |
| Mark intervention as resolved |
| Wait for human to solve |
Debug Tools
Tool | Description |
| Take page screenshot |
| Get viewport size |
| Set viewport size |
| Get performance metrics |
| Highlight matching elements |
Important Notes
Browser Session Persistence
The browser session persists until explicitly closed with
browser_closeAll operations (DOM, JS, network) use the same active session
Cookies and session state are maintained across navigations
Captcha Success Factors
Turnstile bypass success depends on:
IP Reputation: Use residential proxies with good reputation
Browser Fingerprint: Configure realistic browser options
Behavioral Patterns: Add realistic delays and interactions
Human Intervention Workflow
Detect captcha:
captcha_detect_type()Try auto-handling:
captcha_handle_auto()If fails, request help:
captcha_request_human_intervention()Wait for resolution:
captcha_wait_for_resolution()Continue automation
License
MIT
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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/D4D25A/PyPen'
If you have feedback or need assistance with the MCP directory API, please join our Discord server