
Corlabs
dev.corlabs由 corlabs.dev 發布v0.1.7更新於 Oct 29, 2026
Scored, maintainable locators from a live page for AI coding agents, with checks and repairs.
概覽
本機 MCP 伺服器:在瀏覽器中開啟頁面,為元素回傳排序並評分的測試定位器,並支援檢查與修復。
- 可以做什麼
- 開啟頁面並列出其中的控制項,或對大型頁面的某一區域做快照
- 為指定元素提供排序、評分的定位器,並以可放入定位器檔案的條目形式回傳
- 在頁面上點擊、填寫與按鍵,並回報頁面變化
- 用 COR 的 id 檢查檔案中的定位器、為自己寫的定位器評分,並為失效的定位器提出修復方案
- 完成後關閉瀏覽器
- 適用情境
- 適合程式碼代理撰寫或維護 Playwright、Cypress、WebdriverIO 的 UI 測試時,從實際頁面取得穩定選擇器,並在之後檢查與修復它們。
- 執行需求
- 透過 npx 在本機執行,需要 Node 18+,以及 Google Chrome、Microsoft Edge 或 Playwright 的 Chromium。未宣告帳號、API 金鑰或環境變數。可選參數有 --headless、--idle-minutes、--no-records,專案根目錄可選放 cor.config.js。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Corlabs,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
@corlabsdev/mcp
An MCP server that lets a coding agent open a page, pick an element, and get ranked, graded locators for it in the test framework you use.
More at corlabs.dev.
Install
Requires Node 18+ and Google Chrome (Microsoft Edge, or Playwright's Chromium, also work). Nothing is installed globally: your agent runs the server with npx.
Add COR to your client. Every client runs the same command, npx -y @corlabsdev/mcp.
Claude Code
To share it with your team, put it in .mcp.json at the project root instead:
GitHub Copilot (VS Code) — create .vscode/mcp.json (or run MCP: Add Server from the Command Palette):
Then open Copilot Chat, switch to Agent mode, and enable cor in the tools list.
Codex (CLI and IDE extension)
or add this to ~/.codex/config.toml:
Cursor — .cursor/mcp.json, and Claude Desktop — claude_desktop_config.json:
Any other MCP client: register a stdio server whose command is npx with arguments -y @corlabsdev/mcp.
Restart the client (or reload the window), then ask your agent to open your page: "Use COR to open https://example.com/login and write the locators for the sign-in form."
If no browser is found the server says so; install Chrome, or run npx playwright-core install chromium.
Options (append to args, or after -- in claude mcp add):
Tools
Workflow
cor_openthe page, thencor_inspectevery element the test touches, in one call.- Place each entry as given, its
// COR cor:…comment included, in the file it names. - Run
cor_checkbefore the tests. When a test breaks on a locator,cor_gradeit andcor_healif it is broken.
Updating
npx -y @corlabsdev/mcp runs the latest version each time it starts. To pin one, use npx -y @corlabsdev/[email protected].
Setup: COR as the only browser tool
Configure COR MCP instead of Playwright MCP for test authoring, not alongside it: COR drives the browser (open, click, fill, press), returns locators as entries for your locator files, checks them (cor_check) and repairs them (cor_heal). With a second browser server attached, an agent falls back to its snapshots and types its own selectors — which cor_check will then fail.
Settings are optional. COR infers your test framework and conventions from the repo; to override them, add a cor.config.js at the project root. framework names the test framework and the rest go under locators. Every field is optional; cor_open reports what was inferred and what was overridden:
Entry records: what is written inside your project
Every cor_inspect that recommends a locator also gives it an entry: the code to place in your locator file, the file and member it belongs in, and a comment carrying a short id, // COR cor:7f3a2c · … (in a YAML map, # COR cor:…). Keep that comment: cor_check uses the id to tell COR's locators from typed ones, and a later repair uses it to find what the locator pointed at. COR never edits your files — the agent places the entry.
Where: .cor/records/<id>.json in your project root (where your test framework's package.json is), one small file per element. Inspecting the same element again reuses its id and refreshes its file. For a JSON locator map, which cannot hold comments, COR also keeps .cor/ids.json ("file#key": "id") — it never adds keys to your map.
Commit them. They are how a repair works on a teammate's machine or in a CI checkout: the id travels in your code and the record travels with the repo. Add .cor/records/ to .gitignore if you would rather keep them on one machine.
What each record holds: the page (origin and path, masked), the element's position as a tag path, the entry's member name, the element's fingerprint — its tag; aria-label, aria-labelledby, name, placeholder, type, role, title, alt, href, for if present; up to 80 characters of its own text; its first five class names — and up to 12 locators ranked for it, stored as data ({ "kind": "testId", "value": "[data-test=\"…\"]" }), not as code to paste. COR never shows a record's contents to the agent.
What is never stored: what anyone typed into a field (input values), cookies, local storage, or anything from a storage-state file you pass to cor_open.
Masking. On an authenticated page the fields above can contain account data, so before anything is written:
Short numbers and ordinary words are kept, because a heal needs them ("Step 2", "Qty 12", "Pay now"). Values are masked, not hashed. A heal compares stored values with the live page as plain text, so a hashed value could never match again.
Turning it off: start the server with --no-records or set COR_RECORDS=off (the old --no-fingerprints / COR_FINGERPRINTS=off still work): no record is written; entries still carry an id, and cor_check then checks ids for presence only. The ~/.cor/fingerprints/ store of earlier versions is no longer written or read; deleting it is safe.
Telemetry: anonymous usage metrics
The server sends anonymous usage metrics to help us see how COR is installed and used. Two events:
mcp_installed, once per install, on the first start: package version, Node version, OS platform.mcp_tool_called, once per tool call: tool name, duration in milliseconds, outcome (ok,tool_error,exception, ortimeout), package version.
Each install has a random anonymous ID, stored in ~/.cor/install-id. The first start prints one line on stderr saying so.
Never sent: page URLs or origins, element text, locators, file paths, input values, cookies, storage, record contents, error messages, or any email address. Every field is listed in the code (src/telemetry.js), and nothing else is added.
Turning it off: set COR_TELEMETRY=off (or COR_OFFLINE=true, which stops all outbound data). Nothing is sent and no ID file is written.
來源:README.md,提交 2d6b750
工具
0版本歷史
1- v0.1.7最新Oct 29, 2026
評分
已滿足適用檢查項的 40%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
請在儲存庫或註冊中心條目中宣告授權條款。