playwright-min-network-mcp
A minimal network monitoring MCP tool for Playwright browser automation. Just 5 simple tools to capture, filter, and analyze network traffic during web automation with MCP context efficiency.
README
playwright-min-network-mcp
A minimal network monitoring MCP tool for Playwright browser automation. Just 5 simple tools to capture, filter, and analyze network traffic during web automation with MCP context efficiency.
graph LR
A[Claude AI] --> B[🔍 Network MCP<br/>monitoring only]
A --> C[🎮 Playwright MCP<br/>operation only]
B --> D[Chrome Browser<br/>CDP: 9222]
C --> D
style B fill:#fff3e0
style C fill:#f3e5f5
style D fill:#e1f5fe
flowchart TD
Start([Start]) --> A[🔍 Network MCP startup]
A --> B[🌐 Launch browser<br/>CDP: 9222 waiting]
B --> C[🎮 Playwright MCP startup]
C --> D[🎮 Connect to existing browser via CDP]
D --> E[Both MCPs sharing browser state]
E -->|🔍 Network MCP| F[🔍 Start network monitoring]
E -->|🎮 Playwright MCP| G[🎮 Execute browser operations]
subgraph Browser["🌐"]
F --> H[🔍 Record requests/responses]
G --> I[🎮 Page navigation & clicks]
end
H --> J[🔍 Get monitoring results]
I --> K[🎮 Operation complete]
J --> End([Complete])
K --> End
style A fill:#fff3e0
style B fill:#f0f8ff,stroke:#4682b4,stroke-width:2px
style C fill:#f3e5f5
style D fill:#f3e5f5
style E fill:#e8f5e8
style Browser fill:#f0f8ff,stroke:#4682b4,stroke-width:3px
style F fill:#fff3e0
style G fill:#f3e5f5
style H fill:#fff3e0
style I fill:#f3e5f5
style J fill:#fff3e0
style K fill:#f3e5f5
Features
- 📡 Network Capture: Real-time request/response monitoring via Chrome DevTools Protocol
- 🔍 Smart Filtering: Content-type, URL patterns, and HTTP method filtering
- ⚡ MCP Context Safe: 512B previews + 50KB detail limits prevent token overflow
- 🔄 Dynamic Updates: Change filters without browser restart
- 🤝 Playwright Integration: Works seamlessly with Playwright MCP
Prerequisites
1. Install Playwright
This tool requires Playwright to be installed for browser automation:
npm install playwright
# Install browser binaries
npx playwright install chromium
2. Install Network Monitor MCP
npm install playwright-min-network-mcp
Quick Start
Basic MCP Configuration
Add to your .mcp.json:
{
"mcpServers": {
"network-monitor": {
"command": "npx",
"args": ["playwright-min-network-mcp"]
}
}
}
Combined with Playwright MCP
{
"mcpServers": {
"network-monitor": {
"command": "npx",
"args": ["playwright-min-network-mcp"]
},
"playwright": {
"command": "npx",
"args": ["@playwright/mcp", "--cdp-endpoint", "http://localhost:9222"]
}
}
}
Usage Examples
Basic Workflow
// 1. Start monitoring (launches visible Chrome browser)
{
"tool": "start_monitor"
}
// 2. Use Playwright MCP to interact with web pages
// The browser will automatically connect to the same CDP endpoint
// 3. Retrieve captured network requests (compact overview with 512B previews)
{
"tool": "get_recent_requests",
"arguments": {
"count": 50
}
}
// 4. Get detailed request info by UUID (limited to 50KB, headers optional)
{
"tool": "get_request_detail",
"arguments": {
"uuid": "123e4567-e89b-12d3-a456-426614174000",
"include_headers": false
}
}
// 5. Stop monitoring when done
{
"tool": "stop_monitor"
}
Filtering Examples
// Include everything (CSS, JS, images, etc.)
{"tool": "start_monitor", "arguments": {"filter": {"content_types": "all"}}}
// Custom content types
{"tool": "start_monitor", "arguments": {"filter": {"content_types": ["application/json", "text/css"]}}}
// Update filters without restarting browser
{"tool": "update_filter", "arguments": {"filter": {"content_types": ["application/json"], "url_include_patterns": ["api/"], "methods": ["POST"]}}}
API Reference
Tools
- start_monitor: Launch browser and start monitoring
- update_filter: Change filters without browser restart
- stop_monitor: Stop monitoring
- get_recent_requests: Get compact overview with 512B previews
- get_request_detail: Get full details by UUID (50KB limit)
Default Filtering
Captures API and form data by default:
application/json,application/x-www-form-urlencoded,multipart/form-data,text/plain- Excludes CSS, JS, images (use
content_types: "all"to include)
Output Format
Compact overview (get_recent_requests) with 512B request/response body previews:
{
"total_captured": 156,
"showing": 30,
"requests": [
{
"uuid": "123e4567-e89b-12d3-a456-426614174000",
"method": "POST",
"status": 200,
"url": "https://api.github.com/graphql",
"mimeType": "application/json",
"requestBodyPreview": "{\"query\": \"query GetRepository...",
"requestBodySize": 2048,
"responseBodyPreview": "{\"data\": {\"repository\": {...",
"responseBodySize": 4096,
"timestamp": 1641472496000,
"responseTimestamp": 1641472496123
}
]
}
Full request details (via get_request_detail with UUID, limited to 50KB):
{
"id": "request-123",
"uuid": "123e4567-e89b-12d3-a456-426614174000",
"url": "https://api.github.com/graphql",
"method": "POST",
"headers": undefined,
"timestamp": 1641472496000,
"type": "request",
"body": "{\"query\": \"query GetRepository($owner: String!, $name: String!) { ... }\"}",
"response": {
"status": 200,
"headers": undefined,
"mimeType": "application/json",
"body": "{\"data\": {\"repository\": {...}}} \n... [truncated from 67647 bytes]"
},
"responseTimestamp": 1641472496123
}
Requirements
- Node.js ≥18.0.0
- Playwright (
npm install playwright && npx playwright install chromium)
Development
# Clone and install
git clone https://github.com/bun913/playwright-min-network-mcp.git
cd playwright-min-network-mcp
npm install
# Build
npm run build
# Test
npm run test:ci
# Development mode
npm run dev
# Debug with MCP Inspector
npm run debug
License
MIT License - see LICENSE file for details.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。