浏览器 MCP 是一套包含浏览器扩展和 MCP 服务器的工具,它允许用户与当前使用的浏览器进行交互,为用户提供了便捷的浏览器操作体验。
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@djyde/mcp-browser@latest"
]
}
}
}
所有可用工具在 server/src/tools.ts 中列出,以下是部分工具介绍:
get_current_page_markdown:获取当前浏览器页面的Markdown内容。
总结当前页面。
append_style:向当前浏览器页面追加CSS样式。
将当前页面设置为暗黑模式。
history_search:搜索浏览器历史记录。
在浏览历史中搜索“github”。
pnpm i
cd extension
# 对Chrome浏览器构建
npm run build
# 对Edge浏览器构建
npm run build:edge
# 对Firefox浏览器构建
npm run build:firefox
构建完成后,扩展文件位于 extension/.output 目录。
cd server
# 开发模式启动
npm run dev
# 构建服务器
npm run build
server/dist/cli.js 是MCP服务器的入口文件。
tools.ts 文件中的 tools 数组。extension/calls.ts 中实现可扩展调用处理函数。server/src/tools.ts 中为工具添加处理器。使用 call 函数调用扩展端的处理程序。本项目采用 AGPL-3.0 或更高版本的授权协议。