节点驱动MCP服务器
nodrive 基础MCP服务器。作为MCP协议提供浏览器自动化、滚动和CDP直接调用。
要求
- Chrome/Chromium浏览器
- Python>=3.10
- 紫外线 (包括uvx)
安装
A.uvx直接运行(无需安装,推荐)
uvx --from git+https://github.com/hyeok8055/nodriver-mcp-server.git nodriver-mcpB.uv tool install(全局安装)
uv tool install git+https://github.com/hyeok8055/nodriver-mcp-server.git安装后 nodriver-mcp 可以直接使用命令。
C.用于本地开发
git clone https://github.com/hyeok8055/nodriver-mcp-server.git
cd nodriver-mcp-server
uv venv && uv pip install -e .Windows 11配置文件路径
| 工具 | 配置文件路径 |
|---|---|
Claude Code(全球) C:\Users\\.claude\settings.json | |
| 克劳德桌面 | C:\Users\\AppData\Roaming\Claude\claude_desktop_config.json |
| VSCode | .vscode\mcp.json (工作空间根目录) |
| Gemini CLI | C:\Users\\.gemini\settings.json |
| Codex CLI | C:\Users\\.codex\config.toml |
在Claude Code中使用
在项目根目录中 .mcp.json创建,或全局设置(C:\Users\\.claude\settings.json):
{
"mcpServers": {
"nodriver": {
"command": "uvx",
"args": ["--from", "git+https://github.com/hyeok8055/nodriver-mcp-server.git", "nodriver-mcp"]
}
}
}全局安装(uv tool install)后使用:
{
"mcpServers": {
"nodriver": {
"command": "nodriver-mcp"
}
}
}注册确认: claude mcp list
在Claude Desktop中使用
C:\Users\\AppData\Roaming\Claude\claude_desktop_config.json添加到:
{
"mcpServers": {
"nodriver": {
"command": "uvx",
"args": ["--from", "git+https://github.com/hyeok8055/nodriver-mcp-server.git", "nodriver-mcp"]
}
}
}在VSCode中使用(需要VS Code 1.99+、GitHub Copilot)
在工作空间根目录中 .vscode/mcp.json 创建文件:
{
"servers": {
"nodriver": {
"type": "stdio",
"command": "uvx",
"args": ["--from", "git+https://github.com/hyeok8055/nodriver-mcp-server.git", "nodriver-mcp"]
}
}
}注意:VSCode的密钥名为servers(其他工具的mcpServers与)。"type": "stdio"字段为必填字段。
在Gemini CLI中使用
C:\Users\\.gemini\settings.json添加到:
{
"mcpServers": {
"nodriver": {
"command": "uvx",
"args": ["--from", "git+https://github.com/hyeok8055/nodriver-mcp-server.git", "nodriver-mcp"]
}
}
}设置后重新启动Gemini CLI。 /mcp 请使用命令检查连接状态。
请参见:uvx是.exe因为是文件,所以在Windows上cmd /c无需包装器即可直接使用。
在OpenAI Codex CLI中使用
C:\Users\\.codex\config.toml添加到(TOML格式):
[mcp_servers.nodriver]
command = "uvx"
args = ["--from", "git+https://github.com/hyeok8055/nodriver-mcp-server.git", "nodriver-mcp"]注意:Codex CLI的Windows支持是实验性的。
提供工具(Tools)
| 类别 | 工具 |
|---|---|
| 会话 | browser_start_session, browser_stop_session, browser_session_info, browser_cleanup_stale, browser_healthcheck |
| 标签 | browser_new_tab, browser_switch_tab, browser_close_tab, browser_list_tabs |
| 导航 | browser_navigate, browser_go_back, browser_go_forward, browser_refresh, browser_wait_for |
| 交互 | browser_click_by_selector, browser_click_by_text, browser_fill, browser_select_text, browser_select_value, browser_hover, browser_press_key, browser_scroll |
| 提取页面 | page_get_content, page_get_html, page_get_text, page_get_links, page_get_resources |
| 存储 | page_set_local_storage, page_get_local_storage, page_clear_local_storage |
| 文件/拖动 | element_send_file, element_mouse_drag |
| 客户数据平台 | cdp_call, cdp_subscribe, cdp_unsubscribe |
| 网络/控制台 | network_capture_start, network_capture_stop, browser_capture_console |
| 截图 | browser_screenshot |
响应格式
所有工具返回相同的结构:
{
"ok": true,
"session_id": "...",
"tab_id": "...",
"data": {},
"artifacts": [],
"warnings": [],
"elapsed_ms": 0,
"error_code": null,
"error_detail": null
}故障排除
如果找不到Chrome
browser_start_session 呼叫时 config在中直接指定Chrome可执行文件路径:
{
"extra_chromium_args": ["--no-sandbox"],
"browser_executable_path": "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
}如果找不到uvx命令
where uvx验证路径后,在配置文件中 "command" 绝对路径值(例如: C:\Users\\.local\bin\uvx.exe)。
Gemini CLI无法识别MCP服务器
重新启动Gemini CLI后 /mcp 运行命令检查连接状态。
