剧作家元数据库
- 作者仓库星标 47,548
- 作者仓库 metabase
- 领域
- 人工智能
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @metabase · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 即装即用
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
# Browser Automation with Playwright MCP (Metabase)
A Playwright MCP server is configured in `.mcp.json`. Load the tool schemas first with `ToolSearch`: `select:mcp__playwright__browser_navigate,mcp__playwright__browser_snapshot,mcp__playwright__browser_click,mcp__playwright__browser_fill,mcp__playwright__browser_type,mcp__playwright__browser_press_key,mcp__playwright__browser_hover,mcp__playwright__browser_take_screenshot,mcp__playwright__browser_close`
If ToolSearch says "MCP servers still connecting," wait a few seconds and retry — the server takes a moment to start on first use.
## Core pattern: Snapshot → Act → Check
1. **`browser_snapshot`** — see what's on screen, get element refs
2. **Act** — `browser_click`, `browser_fill`, `browser_type`, etc. using refs from the snapshot
3. **Check the inline response** — every action returns a snapshot in its response. Read it.
**When to take a separate `browser_snapshot` after acting:**
- The inline response snapshot looks wrong, empty, or unchanged — take a fresh one (async rendering may not have completed)
- You need refs for your NEXT action — the inline snapshot's refs are valid, use them directly
- You're unsure if the action worked — take one more snapshot to confirm
**When you do NOT need a separate snapshot after acting:**
- The inline response already shows the expected change (e.g., you clicked a link and the response shows the new page)
- You're about to take a screenshot anyway (`browser_take_screenshot` shows the current state)
- You're doing a chain of actions on the same form (e.g., filling multiple fields) — snapshot once at the end, not after each fill
**Element refs go stale after every action.** Use refs from the most recent snapshot or inline response — never from an earlier one.
## How to interact with Metabase's UI components
Metabase uses Mantine UI components. Most interactions work with a plain `browser_click`. The hover-before-click pattern is only needed for specific component types.
**Regular buttons, links, form inputs, checkboxes, tabs:**
Just `browser_click` them directly. No hover needed.
**Buttons that open dropdown menus (e.g., "+ New", "..." action menus, filter type pickers):**
These use Mantine's `<Menu>` component which has a race condition with direct clicks. **Hover before clicking** these:
1. `browser_hover` on the button
2. `browser_click` on the button
3. Check the inline response — if the menu appeared, use its refs directly
How to tell if a button opens a dropdown menu: it usually has a chevron/arrow icon, a "..." label, or is labeled as creating something new (like "+ New"). If unsure, try a direct click first — if it doesn't work, retry with hover.
**Select and dropdown components (e.g., database picker, column picker):**
Mantine Select/MultiSelect are NOT native `<select>` elements. `browser_select_option` will NOT work. Instead:
1. `browser_click` on the input/trigger
2. `browser_click` on the option you want (use refs from the inline response)
You can also type into the input to filter options before clicking.
**Modals and dialogs:**
To dismiss: `browser_click` the close/action button, or `browser_press_key` with `Escape`.
**⚠️ Mantine `Escape`-inside-modal trap:** Pressing `Escape` while focus is inside a Mantine popover/Select/MultiSelect that is *itself* nested in a modal closes the **entire modal** and discards every form field you've already filled. To dismiss just an open dropdown, prefer `browser_click` outside the dropdown (or click another field). Only press `Escape` when you actually want the whole modal gone.
**Mantine portals + scoped snapshots:** Mantine renders dropdowns, popovers, and tooltips into a portal at `<body>` level — they are NOT children of the `[role=dialog]` element. If you scope `browser_snapshot` to the modal, dropdown options will be missing. Take a full-page snapshot when interacting with portaled content.
## Login
1. `browser_navigate` to `http://localhost:$MB_JETTY_PORT/auth/login`
2. `browser_snapshot` → `browser_fill` email and password → `browser_click` sign-in button
3. **`browser_navigate` to `http://localhost:$MB_JETTY_PORT/`** — always navigate explicitly to the home page after login. Do NOT rely on the login redirect alone. The redirect can leave the browser session in a state where clicks don't register.
4. `browser_snapshot` to confirm you're logged in
## Quick login via API (alternative)
Get a session token via API and set it as a cookie — faster than filling the login form:
```bash
./bin/mage -bot-api-call /api/session --method POST --body '{"username":"<email>","password":"<password>"}'
```
Extract the `id` from the response, then use `browser_evaluate` with script:
```javascript
document.cookie = 'metabase.SESSION=<token>;path=/'
```
Then `browser_navigate` to the target page. Use the credentials from `./bin/mage -bot-server-info`.
## When clicks don't work
1. Take a fresh snapshot (async rendering). 2. Try hover + click (menu triggers). 3. Try keyboard (focus + Enter). 4. After 3 attempts, report and move on.
## Rules
- Always use `http://localhost:$MB_JETTY_PORT`
- Close the browser when done
- Use inline response snapshots when sufficient — only take separate `browser_snapshot` when needed
- Browser is pre-configured: 1440x900 viewport, full snapshot mode, isolated session, 10s action timeout
章节与文件索引
按说明文件中的顺序排列。
核心模式:快照→行动→检查
如何与 Metabase 的 UI 组件交互
登录
通过API快速登录(替代)
当点击不起作用时
文件/命令 -> .mcp.json · ToolSearch · browser_snapshot · browser_click · browser_fill · browser_type · browser_take_screenshot · <Menu>
内容校验值 -> 706df07222c1
当前原文的自动摘译,尚未人工审校。
核心模式:快照→行动→检查
browser_snapshot— 查看屏幕上的内容,获取元素引用 Act —browser_click、browser_fill、browser_type等使用快照中的引用 检查内联响应 — 每个操作都会在其响应中返回一个快照。阅读它。何时在执行后拍摄单独的browser_snapshot:内联响应快照看起来错误、空或未更改 - 拍摄一个新的(异步渲染可能尚未完成)如何与 Metabase 的 UI 组件交互
Metabase 使用 Mantine UI 组件。大多数交互都可以使用简单的
browser_click。仅特定组件类型需要单击前悬停模式。常规按钮、链接、表单输入、复选框、选项卡:直接使用browser_click即可。无需悬停。打开下拉菜单的按钮(例如,“+ New”、“...”操作菜单、过滤器类型选择器):这些按钮使用 Mantine 的<Menu>组件,该组件具有直接单击的竞争条件。单击这些之前将鼠标悬停:登录
browser_navigate至http://localhost:$MB_JETTY_PORT/auth/loginbrowser_snapshot→browser_fill电子邮件和密码 →browser_click登录按钮browser_navigate至http://localhost:$MB_JETTY_PORT/— 登录后始终明确导航至主页。不要单独依赖登录重定向。重定向可能会使浏览器会话处于不记录点击的状态。browser_snapshot确认您已登录通过API快速登录(替代)
通过 API 获取会话令牌并将其设置为 cookie — 比填写登录表单更快:从响应中提取
id,然后将browser_evaluate与脚本一起使用:然后browser_navigate到目标页面。使用./bin/mage -bot-server-info的凭据。当点击不起作用时
拍摄新快照(异步渲染)。 2. 尝试悬停 + 单击(菜单触发器)。 3. 尝试键盘(焦点 + Enter)。 4. 尝试 3 次后,报告并继续。