chromium-mcp

chromium-mcp

MCP server for web fetching and automation using Chromium headless browser. Enables fetching pages as markdown, taking screenshots, automating interactions, and extracting data via CSS selectors.

Category
访问服务器

README

Chromium MCP

MCP server for web fetching and automation using Chromium headless browser.

Reason behind this repository

I didn't wanna waste my "limited" tokens on Z.ai coding plan, therefore I made my own MCP to interact with the web, feel free to propose enhancements or new features.

Features

  • fetch_page: Fetch web pages and convert to markdown/HTML
  • screenshot: Take screenshots of web pages or specific elements
  • interact: Automate browser interactions (click, fill, scroll, wait)
  • extract_data: Extract structured data using CSS selectors
  • get_link: Get link information and follow redirects

Installation

From Git Repository

# Clone the repository
git clone https://github.com/gzigurella/chromium-mcp.git
cd chromium-mcp

# Create virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install the package
pip install -e .

# Install Chromium browser (required)
playwright install chromium

With uv (recommended)

# Clone and enter directory
git clone https://github.com/gzigurella/chromium-mcp.git
cd chromium-mcp

# Install with uv
uv pip install -e .

# Install Chromium
playwright install chromium

Integration

OpenCode

Add to your ~/.config/opencode/opencode.json:

{
  "mcpServers": {
    "chromium-fetch": {
      "type": "local",
      "command": [
        "/path/to/chromium-mcp/venv/bin/python",
        "-m",
        "chromium_mcp"
      ],
      "enabled": true
    }
  }
}

Claude Desktop

Add to your Claude Desktop config:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "chromium-fetch": {
      "command": "/path/to/chromium-mcp/venv/bin/python",
      "args": ["-m", "chromium_mcp"]
    }
  }
}

Generic MCP Client

For any MCP-compatible client:

# Start the server directly
/path/to/venv/bin/python -m chromium_mcp

The server communicates via stdio using the MCP protocol.

Tools

fetch_page

Fetch a web page and return content as markdown or HTML.

Parameter Type Required Default Description
url string Yes - URL to fetch
format string No "markdown" Output format: "markdown" or "html"
timeout integer No 30 Timeout in seconds
wait_for string No null CSS selector to wait for
{
  "url": "https://example.com",
  "format": "markdown",
  "timeout": 30,
  "wait_for": ".main-content"
}

screenshot

Take a screenshot of a web page.

Parameter Type Required Default Description
url string Yes - URL to screenshot
format string No "png" Image format: "png" or "jpeg"
quality integer No 80 JPEG quality (1-100)
full_page boolean No false Capture full page
selector string No null CSS selector for element
timeout integer No 30 Timeout in seconds
{
  "url": "https://example.com",
  "format": "png",
  "full_page": true
}

interact

Interact with web page elements sequentially.

Parameter Type Required Default Description
url string Yes - URL to interact with
actions array Yes - List of actions
timeout integer No 30 Timeout in seconds

Action Types:

  • click: Click element by selector
  • fill: Fill input field
  • select: Select dropdown option
  • scroll: Scroll page
  • wait: Wait for element
{
  "url": "https://example.com/search",
  "actions": [
    {"type": "fill", "selector": "input[name='q']", "value": "test search"},
    {"type": "click", "selector": "button[type='submit']"},
    {"type": "wait", "selector": ".results", "milliseconds": 2000}
  ]
}

extract_data

Extract structured data using CSS selectors.

Parameter Type Required Default Description
url string Yes - URL to extract from
selectors array Yes - List of extraction rules
timeout integer No 30 Timeout in seconds
{
  "url": "https://example.com/products",
  "selectors": [
    {"name": "titles", "selector": "h2.product-title", "multiple": true},
    {"name": "prices", "selector": ".price", "multiple": true},
    {"name": "links", "selector": "a.product-link", "attribute": "href", "multiple": true}
  ]
}

get_link

Get link href and text, optionally following navigation.

Parameter Type Required Default Description
url string Yes - URL of page containing link
selector string Yes - CSS selector for anchor
click boolean No false Follow the link
timeout integer No 30 Timeout in seconds
{
  "url": "https://example.com",
  "selector": "a.download",
  "click": true
}

Configuration

Environment Variables

Variable Default Description
CHROMIUM_PATH auto Path to Chromium executable
HEADLESS true Run browser in headless mode
TIMEOUT 30 Default operation timeout
DEBUG false Enable debug logging
# Example
export TIMEOUT=60
export HEADLESS=false
python -m chromium_mcp

Development

Running Tests

source venv/bin/activate
pytest

# With coverage
pytest --cov=src --cov-report=html

Project Structure

chromium-mcp/
├── src/chromium_mcp/
│   ├── __init__.py
│   ├── __main__.py
│   ├── server.py
│   └── tools/
│       ├── __init__.py
│       ├── fetch_page.py
│       ├── screenshot.py
│       ├── interact.py
│       ├── extract_data.py
│       └── get_link.py
├── tests/
├── pyproject.toml
└── README.md

Troubleshooting

Browser Not Found

playwright install chromium

Permission Issues (Linux)

sudo sysctl -w kernel.shmmax=268435456

Timeout Errors

export TIMEOUT=60

Security

  • file:// URLs are blocked
  • Credentials are never logged
  • Browser processes are always cleaned up
  • All operations have configurable timeouts

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选