浏览器交互记录服务

一个自动启动浏览器并实时记录用户交互行为的MCP服务器,所有操作步骤以英文编号形式保存到格式化文本文件中。

  • by siddhartha-panda-ptc
  • JavaScript
  • 本地部署
  • 更新于
在 GitHub 查看 siddhartha-panda-ptc/MCP_AI

使用说明

步骤记录器MCP服务器

自动启动浏览器并捕获实时用户交互的MCP(模型上下文协议)服务器。所有浏览器操作(点击、打字、导航、滚动等)都以英文记录,并带有步骤号,并保存到格式化的文本文件中。

特性

✨ 自动浏览器捕获模式(新增!)

自动启动浏览器并捕获所有真实的用户交互:

  • 🚀 自动启动 -服务器启动时,浏览器以Google.com打开
  • 🎯 实时捕获 -记录每次点击、键入、悬停、滚动、导航
  • 📝 英文说明 -每个动作都用清晰的英语记录,并附有步骤号
  • 💾 自动保存 -实时保存为格式化文本文件
  • 🔇 静音模式 -无权限提示,全自动捕捉
  • ✅ 仅限真实互动 -捕获实际用户操作,而不是模拟步骤

捕捉互动

  • 点击 -使用选择器和文本点击元素
  • 文本输入 -带字段名称和值的键盘输入
  • 导航 -使用URL进行页面导航
  • 悬停 -将鼠标悬停在交互元素上
  • 滚动 -按方向和金额滚动事件
  • 全部实时自动记录!

可用工具

  • get_step -检索所有捕获的浏览器交互
  • clear_steps -清除所有捕获的交互
  • 记录_手册_备注 -在录音中添加手动注释

资源

  • 整数eractions://live -实时查看所有捕获的浏览器交互

文件输出

  • browser-interactions.txt -格式精美的文件,包括:
    • 会话时间戳
    • 交互总数
    • 每个步骤都用英文描述编号
    • 每个操作的时间戳
    • 会话摘要

代理示例

此项目包括演示如何使用步骤记录器MCP的示例代理:

  • 任务代理 (examples/task-agent.ts)-按顺序执行任务,并记录步骤
  • 浏览器自动化代理 (examples/browser-agent.ts)-浏览器自动化,具有全面的步骤跟踪功能
  • 快速开始 (examples/quick-start.js)-展示概念的最小示例

运行示例:

npx playwright install chromium
npm run example:quick     # Quick start demo
npm run agent:task        # Task agent demo
npm run agent:browser     # Browser automation agent demo

看 示例/README.md 有关代理商的详细文件。

安装

npm install
npm run build

快速开始

🚀 启动浏览器捕获模式

选项1:直接运行

node build/browser-capture-index.js

选项2:使用批处理文件(Windows)

start-browser-capture.bat

发生了什么:

  1. ✅ MCP服务器启动
  2. ✅ 浏览器随Google.com自动启动
  3. ✅ 您的所有浏览器交互都会实时捕获
  4. ✅ 步骤保存到 browser-interactions.txt

🎯 使用浏览器

启动后,只需正常使用浏览器:

  • 点击任意位置→ 捕获
  • 键入文本→ 捕获
  • 浏览页面→ 捕获
  • 滚动→ 捕获
  • 将鼠标悬停在元素上→ 捕获

所有操作都会自动记录,没有提示!

🛑 停止录制

按 Ctrl+C 在终端中停止服务器并关闭浏览器。所有捕获的交互都保留在文件中。

MCP客户端的配置

使用克劳德桌面

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json 视窗: %APPDATA%\Claude\claude_desktop_config.json 服务器启动**-MCP服务器初始化并启动Chromium浏览器 2. 浏览器打开 -自动导航到http://google.com 3. 事件侦听器已激活 -注入JavaScript以捕获所有用户交互 4. 实时捕捉 -每个操作都会触发记录到文件的事件处理程序 5. 自动保存 -每次交互都会立即保存到 browser-interactions.txt 6. 无中断 -静音捕获模式,无权限提示

技术细节

服务器使用Playwright来:

  • 启动headless=假Chromium浏览器
  • 通过以下方式注入客户端事件侦听器 page.addInitScript()
  • 公开功能(recordClick, recordInput等)以捕捉事件
  • 跟踪导航、点击、输入、悬停和滚动事件
  • 实时格式化和保存交互 “command”:“node”, “args”:[“C:\mcp\build\browser capture-index.js”] } } }

### With VS Code

Create `.vscode/mcp.json`:

```json
{
  "servers": {
    "step-recorder": {
      "type": "stdio",
      "command": "node",
      "args": ["C:\\mcp\\build\\browser-capture-
      "args": ["C:\\mcp\\build\\index.js"]
    }
  }
}
```Output

### Sample `browser-interactions.txt`:

═══════════════════════════════════════════════════════ 捕获实时浏览器交互 ═══════════════════════════════════════════════════════

会议开始时间:2026-01-20T10:30:00.000Z 互动总数:8

───────────────────────────────────────────────────────

步骤1:浏览器成功启动 时间:上午10:30:00

步骤2:导航到http://google.com 时间:上午10:30:01

步骤3:点击“文本区域#APjFqb”(搜索) 时间:上午10:30:15

第四步:在文本区输入“剧作家自动化” 时间:上午10:30:18

步骤5:点击“输入(谷歌搜索)” 时间:上午10:30:20

步骤6:导航到https://www.google.com/search?q=playwright... 时间:上午10:30:21

StepMCP工具使用

// Get all captured interactions
const result = await client.request({
  method: "tools/call",
  params: {
    name: "get_steps",
    arguments: {}
  }
});
// Returns: List of all captured browser interactions

// Clear captured interactions
await client.request({
  method: "tools/call",
  params: {
    name: "clear_steps",
    arguments: {}
  }
});
// Clears all recorded interactions

// Add a manual note
await client.request({
  method: "tools/call",
  params: {
    name: "record_manual_note",
    arguments: { note: "Starting checkout flow test" }
  }
});
// Adds custom note to the recording
User: I need to record my browser interactions
AI: I'll record the browser operations for you.

[User clicks on login button]
AI: [Calls record_browser_operation with operation="click", element="login button"]
    Browser operation recorded: Clicked on login button

[User navigates to dashboard]
AI: [Calls record_browser_operation with operation="navigate", url="https://example.com/dashboard"]
    Browser operation recorded: Navigated to https://example.com/dashboard

[User enters username]
AI: [Calls record_browser_operation with operation="type", element="username field", value="john@example.com"]
    Browser operation recorded: Entered "john@example.com" into username field

User: Show me all recorded steps
AI: [Calls get_steps]
    Here are all your recorded steps:
    1. [2026-01-20T05:30:00.000Z] Clicked on login button
    2. [2026-01-20T05:30:15.000Z] Navigated to https://example.com/dashboard
    3. [2026-01-20T05:30:30.000Z] Entered "john@example.com" into username field

发展

项目结构

c:\mcp\
├── src/
│   └── index.ts          # Main server implementation
├── build/                # Compiled JavaScript output
├── package.json          # Project configuration
├── tsconfig.json         # TypeScript configuration
└── README.md            # This file

建筑

npm run build

这将把TypeScript代码编译为JavaScript build/ 目录。

许可证

麻省理工学院 项目结构

c:\mcp\
├── src/
│   ├── browser-capture-index.ts    # Auto browser capture server (NEW!)
│   ├── index.ts                     # Original step recorder
│   └── auto-browser-recorder.ts     # Standalone recorder
├── build/                           # Compiled JavaScript output
├── browser-interactions.txt         # Captured interactions (generated)
├── start-browser-capture.bat        # Quick start script
├── package.json
├── tsconfig.json
└── README.md

发展

建筑

npm run build

运行不同模式

# Auto browser capture mode (recommended)
node build/browser-capture-index.js

# Original step recorder
node build/index.js
```Key Benefits

✅ **Zero Setup** - Just start the server, browser launches automatically  
✅ **No Code Required** - Use the browser normally, everything captured  
✅ **Real Interactions** - Captures actual user actions, not simulations  
✅ **English Descriptions** - Clear, numbered steps anyone can understand  
✅ **Silent Mode** - No permission prompts or interruptions  
✅ **Auto-Save** - Real-time file updates, nothing lost  
✅ **Session Tracking** - Full timeline of all interactions  

## Use Cases

- 🧪 **Manual Testing** - Document test execution steps automatically
- 📝 **Bug Reports** - Provide detailed reproduction steps
- 📚 **Documentation** - Create user guides from real usage
- 🎓 **Training** - Record workflows for training materials  
- 🔍 **Analysis** - Understand user behavior patterns
- ✅ **QA Validation** - Verify feature usage and flows

## Troubleshooting

**Browser doesn't open:**
```bash
npx playwright install chromium

端口已在使用中:

  • 停止任何其他正在运行的MCP服务器
  • 检查终端运行过程

未捕获的交互:

  • 确保浏览器窗口有焦点
  • 检查 browser-interactions.txt 可写入
  • 验证服务器控制台是否显示“浏览器捕获已激活!”