MCP Fetch
Enables browser automation using Puppeteer through the MCP interface. Allows launching browsers, creating pages, and executing arbitrary JavaScript for web scraping, testing, and debugging tasks.
README
MCP Fetch
A Model Context Protocol server for browser automation using Puppeteer. Control browsers, create pages, and execute arbitrary JavaScript - all through the MCP interface.
Configuration
Add this to your MCP settings configuration file:
{
"mcp-fetch": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"mcp-fetch"
]
}
}
Features
- 🌐 Browser Management: Launch, list, and close browser instances
- 📄 Page Control: Create, list, and close pages (tabs) in browsers
- 🔧 Flexible Execution: Execute arbitrary JavaScript on pages with full Puppeteer API access
- 📋 Comprehensive Docs: Built-in documentation via
get-rulestool
Available Tools
Browser Management
launch-browser
Launch a new browser instance with customizable settings.
Parameters:
headless(boolean, optional): Run in headless mode. Default:falsewidth(number, optional): Browser window width. Default:1280height(number, optional): Browser window height. Default:720
Returns:
{
"success": true,
"browserId": "browser_1234567890_abc123",
"message": "Browser launched successfully with ID: browser_1234567890_abc123",
"config": {
"headless": false,
"width": 1280,
"height": 720
}
}
list-browsers
List all active browser instances with their details.
Parameters: None
Returns:
{
"success": true,
"browserCount": 1,
"browsers": [{
"id": "browser_1234567890_abc123",
"createdAt": "2025-01-15T10:30:00.000Z",
"tabCount": 2,
"tabs": [{
"index": 0,
"url": "https://example.com",
"title": "Example Domain"
}],
"isConnected": true
}]
}
close-browser
Close a browser instance and clean up resources.
Parameters:
browserId(string, required): The ID of the browser to close
Returns:
{
"success": true,
"message": "Browser browser_1234567890_abc123 closed successfully",
"cleanedPagesCount": 2
}
Page Management
create-page
Create a new page (tab) in a specified browser instance.
Parameters:
browserId(string, required): The ID of the browser to create a page in
Returns:
{
"success": true,
"pageId": "page_1234567890_xyz789",
"browserId": "browser_1234567890_abc123",
"message": "Page created successfully with ID: page_1234567890_xyz789"
}
list-pages
List all active pages across all browser instances.
Parameters: None
Returns:
{
"success": true,
"pageCount": 2,
"pages": [{
"id": "page_1234567890_xyz789",
"browserId": "browser_1234567890_abc123",
"browserExists": true,
"createdAt": "2025-01-15T10:31:00.000Z",
"url": "https://example.com",
"title": "Example Domain",
"isClosed": false
}]
}
close-page
Close a specific page and remove it from active pages.
Parameters:
pageId(string, required): The ID of the page to close
Returns:
{
"success": true,
"message": "Page page_1234567890_xyz789 closed successfully"
}
Page Interaction
exec-page
Execute arbitrary JavaScript code on a page with full Puppeteer API access.
Parameters:
pageId(string, required): The ID of the page to execute code onsource(string, required): JavaScript code to execute. Has access to thepageobject
Returns:
{
"success": true,
"result": "The return value from your code as a string"
}
Example Usage:
// Navigate and interact with a page
await page.goto('https://example.com');
await page.type('#search', 'hello world');
await page.click('#submit');
// Extract data
const title = await page.title();
const results = await page.$$eval('.result', els => els.length);
return { title, resultCount: results };
Documentation
get-rules
Get comprehensive documentation about this MCP server.
Parameters: None
Returns: Complete documentation including schemas, use cases, and best practices.
Use Cases
Web Development & Debugging
Launch browsers to test your web applications during development. View real-time changes, debug JavaScript, inspect elements, and test responsive designs.
// Launch a visible browser
launch-browser({ headless: false })
// Create a page and navigate to your dev server
create-page({ browserId: "browser_id" })
exec-page({
pageId: "page_id",
source: `
await page.goto('http://localhost:3000');
const title = await page.title();
return title;
`
})
Automated Testing
Run automated tests in headless mode to verify functionality, take screenshots, or perform regression testing.
// Launch headless browser for testing
launch-browser({ headless: true })
// Run your test suite
exec-page({
pageId: "page_id",
source: `
await page.goto('https://myapp.com');
await page.click('#login');
await page.type('#username', 'test@example.com');
await page.type('#password', 'password');
await page.click('#submit');
// Wait for navigation
await page.waitForNavigation();
// Check if login was successful
const url = page.url();
return url.includes('/dashboard') ? 'Login successful' : 'Login failed';
`
})
Web Scraping
Extract data from websites that require JavaScript execution or complex interactions.
exec-page({
pageId: "page_id",
source: `
await page.goto('https://news.site.com');
// Wait for content to load
await page.waitForSelector('.article');
// Extract article data
const articles = await page.$$eval('.article', elements =>
elements.map(el => ({
title: el.querySelector('.title')?.textContent,
summary: el.querySelector('.summary')?.textContent,
link: el.querySelector('a')?.href
}))
);
return articles;
`
})
Best Practices
- Always close browsers when done to free up system resources
- Use headless mode for automation tasks to improve performance
- Use headed mode (headless: false) for debugging and development
- Store browser and page IDs to manage multiple instances
- Check existing browsers with
list-browsersbefore launching new ones - Handle errors gracefully - browsers may crash or become unresponsive
- For exec-page: Always return a value at the end of your code
- For exec-page: Use try-catch blocks for better error handling
Installation
The browser (Chromium) will be automatically downloaded on first use. If you encounter issues, you can manually install it:
npx puppeteer browsers install chrome
Limitations
- Browser instances are stored in memory and will be lost if the MCP server restarts
- Each browser instance consumes system resources (RAM, CPU)
- Puppeteer requires Chromium to be downloaded (happens automatically)
License
MIT
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。