Skeleton MCP Server
A template project for building Model Context Protocol servers with FastMCP framework, providing example CRUD API implementations, Docker support, and development best practices.
README
Playwright MCP Proxy
A proxy server for Microsoft's playwright-mcp that provides efficient handling of large binary data (screenshots, PDFs) through blob storage.
Features
- Playwright Browser Automation: Full access to all playwright-mcp browser automation tools
- Efficient Binary Handling: Large screenshots and PDFs are automatically stored as blobs to reduce token usage
- Blob Storage: Built-in blob management using mcp-mapped-resource-lib
- Automatic Cleanup: TTL-based automatic expiration of old blobs
- Docker Support: Containerized deployment with multi-runtime support (Python + Node.js + Playwright)
- Configurable: Extensive configuration options for both playwright and blob storage
Quick Start
Prerequisites
- Python 3.10 or higher
- Node.js 18+ (for playwright-mcp)
- uv package manager (recommended)
- Docker (optional, for containerized deployment)
Installation
- Clone this repository:
git clone <this-repo> playwright-proxy-mcp
cd playwright-proxy-mcp
- Install dependencies:
uv sync
- Create your environment file:
cp .env.example .env
# Edit .env with your configuration (defaults are sensible)
- Run the server:
uv run playwright-proxy-mcp
The server will:
- Start the playwright-mcp subprocess via npx
- Initialize blob storage
- Listen for MCP client connections on stdio
Docker Deployment
Build and run with Docker Compose:
docker compose up -d
This will:
- Build a container with Python, Node.js, and Playwright browsers
- Create persistent volumes for blob storage and playwright output
- Start the proxy server on port 8000
Configuration
Configure the proxy via environment variables in .env:
Playwright Browser Settings
PLAYWRIGHT_BROWSER: Browser to use (chromium, firefox, webkit) - default: chromiumPLAYWRIGHT_HEADLESS: Run headless - default: truePLAYWRIGHT_CAPS: Capabilities (vision,pdf,testing,tracing) - default: vision,pdfPLAYWRIGHT_TIMEOUT_ACTION: Action timeout in ms - default: 5000PLAYWRIGHT_TIMEOUT_NAVIGATION: Navigation timeout in ms - default: 60000
Blob Storage Settings
BLOB_STORAGE_ROOT: Storage directory - default: /mnt/blob-storageBLOB_MAX_SIZE_MB: Max size per blob - default: 500BLOB_TTL_HOURS: Time-to-live for blobs - default: 24BLOB_SIZE_THRESHOLD_KB: Size threshold for blob storage - default: 50BLOB_CLEANUP_INTERVAL_MINUTES: Cleanup frequency - default: 60
See .env.example for all available options.
How It Works
Binary Data Interception
The proxy automatically detects large binary data in playwright tool responses:
- When playwright tools return screenshots or PDFs
- If the data size exceeds the threshold (default: 50KB)
- The proxy stores the binary data as a blob
- The response is transformed to include a blob reference instead
Before (direct playwright-mcp):
{
"screenshot": "data:image/png;base64,iVBORw0KGgo...500KB of data..."
}
After (through proxy):
{
"screenshot": "blob://1733577600-a3f2c1d9e4b5.png",
"screenshot_size_kb": 500,
"screenshot_mime_type": "image/png",
"screenshot_blob_retrieval_tool": "get_blob",
"screenshot_expires_at": "2024-12-08T10:00:00Z"
}
Retrieving Blobs
Use the get_blob tool to retrieve binary data when needed:
result = await get_blob("blob://1733577600-a3f2c1d9e4b5.png")
# Returns the original base64-encoded image data
Available Tools
Playwright Tools (Proxied)
All playwright-mcp tools are available:
playwright_navigate: Navigate to a URLplaywright_click: Click an elementplaywright_fill: Fill a form fieldplaywright_screenshot: Take a screenshot (auto-stored as blob if large)playwright_get_visible_text: Get page text- And many more...
Blob Management Tools
get_blob(blob_id): Retrieve binary data by blob IDlist_blobs(mime_type, tags, limit): List available blobs with filteringdelete_blob(blob_id): Delete a blob from storage
Architecture
┌─────────────────────────────────┐
│ MCP Client (Claude Desktop) │
└────────────┬────────────────────┘
│ stdio
┌────────────▼────────────────────┐
│ FastMCP Proxy (Python) │
│ - Binary Interception │
│ - Blob Storage Integration │
│ - Tool Forwarding │
└────────────┬────────────────────┘
│ stdio
┌────────────▼────────────────────┐
│ playwright-mcp (Node.js/npx) │
│ - Browser Automation │
│ - Screenshot/PDF Generation │
└─────────────────────────────────┘
Testing
Run the test suite:
uv run pytest -v
Lint the code:
uv run ruff check src/ tests/
uv run ruff format src/ tests/
Project Structure
src/playwright_proxy_mcp/
├── server.py # Main MCP proxy server
├── types.py # TypedDict definitions
├── playwright/ # Playwright proxy components
│ ├── config.py # Configuration loading
│ ├── process_manager.py # Subprocess management
│ ├── blob_manager.py # Blob storage wrapper
│ ├── middleware.py # Binary interception
│ └── proxy_client.py # Proxy client integration
└── api/
└── blob_tools.py # Blob retrieval tools
Benefits
Token Savings
Large screenshots can consume 50,000+ tokens. With blob storage:
- Screenshots stored as blobs use ~100 tokens for the reference
- Retrieve full data only when needed
- Automatic cleanup prevents storage bloat
Performance
- Faster response times for tool calls
- Reduced context window usage
- Efficient deduplication of identical screenshots
Troubleshooting
npx not found
Ensure Node.js is installed and npx is in your PATH:
node --version
npx --version
Playwright browser installation fails
Install browsers manually:
npx playwright@latest install chromium --with-deps
Blob storage permissions
Ensure the blob storage directory is writable:
chmod -R 755 /mnt/blob-storage
License
MIT
Contributing
Contributions welcome! Please open an issue or pull request.
Resources
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
E2B
Using MCP to run code via e2b.