playwright-mcp-fetch
Current version: 0.1.5
This tool provides a Model Context Protocol (MCP) server for fetching content from websites and converting it to different formats using Playwright.
Requirements
- Python 3.10 or higher
Features
fetch_html: Fetch the raw HTML content from a websitefetch_markdown: Fetch content from a website and convert it to Markdown formatfetch_txt: Fetch and return plain text content from a website (HTML tags removed)fetch_json: Fetch and parse JSON content
Installation
From Source
git clone https://github.com/kevinwatt/playwright-mcp-fetch.git
cd playwright-mcp-fetch
pip install -e .
Install Dependencies
pip install -r requirements.txt
# Install Playwright browsers
playwright install
Usage
Run as stdio MCP Server
playwright-mcp-fetch
Run as SSE MCP Server
# Run with the SSE transport
playwright-mcp-fetch-sse
This will start an HTTP server providing the following endpoints:
GET /: Server status pageGET /sse: SSE connection endpointPOST /api/list-tools: List available toolsPOST /api/call-tool: Call a tool
Environment Variables
PORT: HTTP server port (default: 3000)TRANSPORT_TYPE: Transport type, eitherstdioorsse(default:stdio)fetch_html: Whether to enable thefetch_htmltool, eitherEnableorDisable(default:Disable)
MCP Client Configuration
To use this server in an MCP client, use the following configuration:
SSE Transport
{
"mcpServers": {
"fetch-tools": {
"enabled": true,
"transport": "sse",
"url": "http://localhost:3000/sse"
}
}
}
stdio Transport
{
"mcpServers": {
"fetch-tools": {
"enabled": true,
"transport": "stdio",
"command": "uvx",
"args": ["playwright-mcp-fetch"]
}
}
}
You can replace fetch-tools with any name you prefer, and adjust the URL or command according to your deployment environment.
API Examples
List Tools
curl -X POST http://localhost:3000/api/list-tools
Call a Tool
curl -X POST http://localhost:3000/api/call-tool \
-H "Content-Type: application/json" \
-d '{"name": "fetch_markdown", "arguments": {"url": "https://example.com"}}'
SSE Client Example
import json
import aiohttp
import asyncio
async def sse_client():
async with aiohttp.ClientSession() as session:
async with session.get("http://localhost:3000/sse") as response:
async for line in response.content:
if line.startswith(b"data: "):
data = json.loads(line[6:].decode("utf-8"))
print(f"Received event: {data}")
asyncio.run(sse_client())
Development
# Install in development mode
pip install -e .
# Run tests
pytest
Docker Support
Build and run with Docker:
docker build -t playwright-mcp-fetch .
docker run -p 3000:3000 -e TRANSPORT_TYPE=sse playwright-mcp-fetch
Or use Docker Compose:
docker-compose up -d
License
MIT
Metadata
Release files for playwright-mcp-fetch 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| playwright_mcp_fetch-0.1.5.tar.gz | 15.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| playwright_mcp_fetch-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.6 kB
Release files / playwright_mcp_fetch-0.1.5.tar.gz
| Download URL | playwright_mcp_fetch-0.1.5.tar.gz |
|---|---|
| Size | 15.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
384923f278a0519af4840a3649298e3e418f079603d59229a5e7813441d644d0
|
|
BLAKE2b-256 checksum How to use checksums |
3b146ddce59e794e19a9e69b034f297b2baf3330d1370eab21ad35349248c733
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.7
|
Release files / playwright_mcp_fetch-0.1.5-py3-none-any.whl
| Download URL | playwright_mcp_fetch-0.1.5-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
305c62db28840c826efa6fac4b3271d8ce751bf9c0728ae550f85a670cfb34a3
|
|
BLAKE2b-256 checksum How to use checksums |
2c23f25c05e04d6c8868ea5bab248a1a7401e3c6c134b72a73382161925ef619
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.7
|