# Clone the repo
git clone <repo-url>
cd camoufox-mcp
# Start the server
docker compose up -d camoufox
# Or with VNC debugging (view browser at http://localhost:6080)
docker compose --profile debug up -d
选项2:Docker运行
# Build the image
docker build -t camoufox-mcp .
# Run for MCP
docker run -i --rm camoufox-mcp
# Enable VNC server (for debugging)
ENABLE_VNC=true
# VNC port (default: 5900)
VNC_PORT=5900
# noVNC web viewer port (default: 6080)
NOVNC_PORT=6080
# Screenshot settings
CAMOUFOX_SCREENSHOT_DIR=/tmp/camoufox_screenshots # Directory for auto-saved screenshots
CAMOUFOX_SCREENSHOT_AUTO_SAVE=true # Always save to file (no base64)
卷
Docker设置仍然存在:
./data/screenshots/ -已保存的屏幕截图
./data/downloads/ -已下载的文件
camoufox-cache -浏览器缓存(用于更快的启动)
可用工具(共55个)
浏览器管理
工具
说明
launch_browser
启动带有反检测选项的迷彩服(无头、代理、操作系统欺骗、人性化)
close_browser
关闭浏览器并清理资源
new_page
创建新的浏览器选项卡
switch_page
在选项卡之间切换
list_pages
列出所有打开的带有URL的选项卡
get_browser_info
获取浏览器会话状态
导航
工具
说明
goto
导航到URL
reload
重新加载当前页面
go_back
返回历史记录
go_forward
在历史中向前导航
get_url
获取当前页面URL
get_page_title
获取页面标题
页面交互
工具
说明
click
单击元素(支持CSS、XPath)
fill
用值填充输入/文本区域
type_text
逐个字符键入文本(类人)
press_key
按键盘键(Enter、Tab等)
select_option
按值/标签/索引选择下拉选项
check
选中复选框或单选按钮
uncheck
取消选中复选框
hover
将鼠标悬停在元素上
scroll
滚动页面或元素进入视图
upload_file
上传文件到文件输入
复合动作(令牌高效)
工具
说明
batch_actions
在一次通话中执行多个操作(点击、填写、键入、按下、选择等)
fill_form
使用可选提交功能一次填写多个表单字段
click_text
按文本内容单击元素(不需要选择器)
click_role
按ARIA角色(按钮、链接等)单击元素
fill_by_label
按标签文本填充输入(不需要选择器)
fill_placeholder
用占位符文本填充输入(不需要选择器)
内容提取
工具
说明
get_text
从元素或页面获取文本内容
get_html
获取HTML(内部或外部)
get_attribute
获取元素属性值
query_selector_all
查询多个元素,提取数据
inspect_element
获取详细的元素信息(标签、rect、属性)
网络分析
工具
说明
get_network_log
通过过滤获取捕获的请求
clear_network_log
清除捕获的网络日志
set_network_capture
启用/禁用捕获,包括身体
wait_for_request
等待特定的请求模式
wait_for_response
等待特定的响应模式
屏幕截图和视口
工具
说明
screenshot
截图(保存到文件,返回路径-无base64保存上下文)
get_viewport_size
获取当前视口尺寸
set_viewport_size
设置视口尺寸
JavaScript
工具
说明
evaluate
在页面上下文中执行JavaScript
evaluate_on_element
对特定元素执行JS
等待
工具
说明
wait_for_selector
等待元素状态(可见、隐藏等)
wait_for_load_state
等待页面加载状态
wait
等待指定的毫秒
Cookie和存储
工具
说明
get_cookies
获取所有Cookie
set_cookie
设置cookie
clear_cookies
清除所有Cookie
get_local_storage
获取本地存储数据
set_local_storage
设置本地存储项
框架和对话框
工具
说明
list_frames
列出页面中的所有框架
frame_locator
与iframe中的元素交互
handle_dialog
设置对话框(警报/确认/提示)处理程序
get_console_logs
捕获控制台日志
使用示例
基本Web剪贴
User: Launch a browser and go to example.com, then get the page title
Claude: [Uses launch_browser, goto, get_page_title]
表单自动化(令牌高效)
User: Fill out the login form with username "test" and password "secret", then submit
Claude: [Uses fill_form with {"#username": "test", "#password": "secret"} and submit_selector]
# OR uses fill_by_label for "Username" and "Password" fields
# OR uses batch_actions with multiple fill + click actions
网络分析
User: Go to the website and show me all API calls it makes
Claude: [Uses set_network_capture, goto, get_network_log with filtering]
调试会话
User: Take a screenshot and inspect the submit button element
Claude: [Uses screenshot, inspect_element]
运行测试
本地
uv run pytest test_server.py -v --tb=short
码头工人
docker compose --profile test run --rm test
发展
# Run server directly (for debugging)
uv run python main.py
# Check available tools
uv run python -c "from main import mcp; print([t.name for t in mcp._tool_manager._tools.values()])"
# Build Docker image
docker build -t camoufox-mcp .
# Run with VNC for debugging
ENABLE_VNC=true docker compose --profile debug up
建筑
camoufox-mcp/
├── main.py # MCP server with 49 tools
├── test_server.py # Comprehensive test suite (16 tests)
├── Dockerfile # Multi-stage Docker build
├── docker-compose.yml # Compose config with profiles
├── docker-entrypoint.sh # Xvfb + VNC startup script
├── pyproject.toml # Python dependencies
└── README.md # This file