Skip to main content
Glama

Prism

English | 简体中文

Prism 是一个 TypeScript 浏览器智能体 CLI。给它一个网址和一句目标,它会把页面读成一张带编号的可见控件表,让决策模型选择「对哪个元素执行哪个操作」,通过 Chrome DevTools Protocol 执行,直到决策模型判定目标达成。

Prism 架构图

环境要求

  • Node.js >= 22.19

  • 可通过 CDP 连接的 Chrome

  • TYPESAFE_API_KEY

  • 一个 OpenAI 兼容的 key(仅 CLI 模式需要;MCP 宿主支持 sampling 时由宿主自己的模型回答字段文本)

Related MCP server: Agentic Browser

安装

npm install -g @tulipe1735/prism

包含两个可执行入口:prism(CLI)和 prism-mcp(MCP server)

连接 Chrome

请以远程调试模式启动 Chrome。Chrome 136+ 默认 profile 不允许开启远程调试,因此使用独立 profile 并在其中登录一次:

# macOS
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
  --remote-debugging-port=9222 --user-data-dir="$HOME/.prism-chrome"

# Linux
google-chrome --remote-debugging-port=9222 --user-data-dir="$HOME/.prism-chrome"

# Windows
"%PROGRAMFILES%\Google\Chrome\Application\chrome.exe" ^
  --remote-debugging-port=9222 --user-data-dir="%USERPROFILE%\.prism-chrome"

作为 MCP server 使用

prism-mcp 是一个 stdio MCP server,只暴露一个任务级工具:

工具

输入

返回

browser_task

url、goal、max_steps?、record_dir?

status、reason、final_url、final_title、final_text、steps、elapsed_ms

宿主把整个浏览子任务委托出去;observe/decide/act 循环、新鲜度校验、预算和判定都由 Prism 自己负责。每步进度会以 MCP progress notification 上报;取消请求会中止运行并关闭标签页。

宿主声明了 sampling 能力时(opencode 支持),需要填写的字段文本由宿主自己的模型通过 sampling/createMessage 回答,此时不需要 TEXT_MODEL_API_KEY;否则回退到 TEXT_MODEL_*。决策(选哪个控件/目标)始终只走 TypeSafe,不会交给宿主模型。

opencode(opencode.json):

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "prism": {
      "type": "local",
      "command": ["prism-mcp"]
    }
  }
}

prism-mcp 需要在 PATH 上(在仓库根目录执行 pnpm link --global),或把 command 指向 ["node", "/absolute/path/to/prism/dist/mcp.js"]。其他 MCP 客户端同理。key 和 PRISM_BROWSER_URL 从 server 进程的环境变量及其工作目录下的 .env 读取。

注意:不要在配置里用 "environment": { "TYPESAFE_API_KEY": "{env:TYPESAFE_API_KEY}" } 传未设置的变量——空值会覆盖 .env 里的同名 key,导致加载失败。

Respect

src/browser/snapshot.js 来自 browser-use/jev-ultrafast,以 MIT License 使用。详见 THIRD_PARTY_NOTICES.md。

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables LLMs to perform browser automation including web navigation, element interaction, and screenshot capture using Puppeteer. It provides capabilities for executing JavaScript in the browser and monitoring console logs for debugging and data extraction.
    36,709 npm
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables agents to control a real Chromium browser with semantic tools, providing compact observations and outcome-verified actions for web interaction tasks.
    1
    MIT
  • F
    license
    C
    quality
    C
    maintenance
    Provides browser automation tools for AI assistants via the Model Context Protocol, enabling tasks like navigation, clicking, filling forms, screenshots, and script execution through natural language.
    39
    -
  • A
    license
    C
    quality
    B
    maintenance
    Enables AI agents and developers to automate real Chrome/Chromium browsers through the Chrome DevTools Protocol, with token-efficient snapshots, multi-action batching, shadow DOM traversal, system-page control, extension management, and network/WebSocket inspection.
    64
    MIT