Skip to main content
Glama

nodriver-mcp

一个本地 Codex MCP 服务器,用于使用 nodriver 进行经过身份验证的浏览器研究。它在两次运行之间保留专用的 Chromium/Helium 配置文件,并热重载特定任务的 Python 爬虫。

设置

需要 Python 3.11+、uv 以及基于 Chromium 的浏览器。

uv sync --locked

将其添加到 ~/.codex/config.toml,并将每个占位符替换为绝对路径:

[mcp_servers.nodriver]
command = "uv"
args = ["--directory", "<path-to-nodriver-mcp>", "run", "--frozen", "nodriver-mcp"]
startup_timeout_sec = 30
tool_timeout_sec = 600

[mcp_servers.nodriver.env]
NODRIVER_MCP_BROWSER_EXECUTABLE = "<path-to-helium-or-chromium>"
NODRIVER_MCP_USER_DATA_DIR = "<path-to-a-dedicated-browser-profile>"
NODRIVER_MCP_SCRIPTS_DIR = "<path-to-nodriver-mcp>/scrapers"
NODRIVER_MCP_ARTIFACTS_DIR = "<path-to-nodriver-mcp>/artifacts"

更改 MCP 配置后重新启动 Codex。浏览器会延迟启动。默认情况下浏览器是可见的,因此您可以登录专用配置文件一次;其 Cookie 会持久保存。当提示明确要求无头浏览时,Codex 会传入 headless=true,否则选择可见模式。切换模式会重新启动受管浏览器,同时保留配置文件。

Related MCP server: scout-mcp-server

使用

例如,对 Codex 说:

使用我的浏览器会话在 example.com 上查找匹配的项目。检查页面,创建可重用的爬虫,运行它,并将大量结果保存为工件。以无头模式运行。

Codex 可以使用浏览器工具检查页面,然后保存并运行爬虫。每次 scraper_run 都会重新读取文件,因此无需重启 MCP 服务器即可应用编辑:

async def scrape(ctx, params):
    if url := params.get("url"):
        await ctx.goto(url)

    items = await ctx.evaluate_json("""
        Array.from(document.querySelectorAll('article')).map(item => ({
            title: (item.querySelector('h2')?.innerText || '').trim(),
            href: item.querySelector('a')?.href || null
        }))
    """)
    return {"items": items}

入口点必须是 async def scrape(ctx, params) 并返回与 JSON 兼容的数据。建议使用一次批量 ctx.evaluate_json(...) 调用。对于大量结果,请使用 ctx.write_artifact(...)。爬虫必须使用异步操作,并在返回前完成所有任务。

测试

uv run --frozen ruff check src tests
uv run --frozen pytest

安全性

仅在 STDIO 上本地运行此服务器。爬虫是未经沙箱化的 Python,拥有 MCP 进程的操作系统访问权限以及对经过身份验证的浏览器的控制权。切勿暴露 Cookie、令牌、密码或 DevTools 端点;将页面内容视为不可信;仅使用您有权访问的数据;并遵守站点条款和速率限制。浏览器配置文件、生成的爬虫和工件可能包含私人数据,不应提交。

Install Server
F
license - not found
A
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    MCP server for browser automation with anti-detection. Scout pages, find elements, interact with websites, and monitor network traffic from any AI client that supports the Model Context Protocol.
    21
    1
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Remote MCP server for web scraping with anti-bot evasion. Provides stealth HTTP fetching, headless browser with Cloudflare bypass, CSS selectors, YouTube transcripts, and Markdown conversion.
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    MCP server for controlling a local camofox-browser instance, enabling LLM agents to perform web automation tasks such as navigation, interaction, snapshotting, and content extraction.
    53
    MIT

View all related MCP servers

Related MCP Connectors

  • Browser MCP for logged-in tasks. Uses your Chrome — credentials stay local. Zero-token replay.

  • Hosted real Google Chrome MCP with per-user persistent state. Navigate, click, type, screenshot.

  • An MCP server for deep research or task groups

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/namecallfilter/nodriver-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server