Conversation
…n integration Replace the stubbed @ant/claude-for-chrome-mcp with a functional local implementation at packages/openclaude-for-chrome-mcp/. This enables the Chrome browser automation integration (extension ID fcoeoabgfenejglbffodgkkbkcdhcgfn) which was previously dead code in the open build. The package provides: - 17 browser tool definitions with full MCP schemas - Unix socket client matching chromeNativeHost.ts protocol (4-byte LE + JSON) - MCP server factory using @modelcontextprotocol/sdk - Lazy connection, backpressure-safe writes, idempotent teardown
There was a problem hiding this comment.
Pull request overview
This PR replaces the previously stubbed proprietary @ant/claude-for-chrome-mcp dependency with a new local package (packages/openclaude-for-chrome-mcp/) that implements an MCP server for Chrome extension–backed browser automation, and updates the build + consumers to use it.
Changes:
- Added a local
openclaude-for-chrome-mcppackage containing types, protocol definitions, tool schemas, a socket client, and an MCP server factory. - Updated build resolution (
scripts/build.ts) and TypeScript path mapping (tsconfig.json) to resolve the local package. - Renamed imports across Chrome-integration consumers from
@ant/claude-for-chrome-mcptoopenclaude-for-chrome-mcp.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
tsconfig.json |
Adds path mapping + includes packages/**/* for typechecking the new local package. |
scripts/build.ts |
Adds a bundler onResolve rule to point openclaude-for-chrome-mcp imports at the local package. |
src/utils/claudeInChrome/mcpServer.ts |
Switches to the local package and updates context typing comment. |
src/utils/claudeInChrome/setup.ts |
Updates tool import to the local package. |
src/utils/claudeInChrome/common.ts |
Updates comment referencing the source of ClaudeForChromeContext. |
src/utils/claudeInChrome/toolRendering.tsx |
Updates comment referencing the tool source package name. |
src/skills/bundled/claudeInChrome.ts |
Uses the local package’s BROWSER_TOOLS for bundled skill tool allowlisting. |
src/services/mcp/client.ts |
Updates dynamic import to the local package for in-process Chrome MCP server. |
packages/openclaude-for-chrome-mcp/types.ts |
Defines the context + logger interfaces used by existing consumers. |
packages/openclaude-for-chrome-mcp/protocol.ts |
Defines socket framing and message types compatible with the native host. |
packages/openclaude-for-chrome-mcp/tools.ts |
Provides the 17 MCP tool schemas used for browser automation. |
packages/openclaude-for-chrome-mcp/socketClient.ts |
Implements the Unix socket client with framing, queueing, and notifications. |
packages/openclaude-for-chrome-mcp/server.ts |
Implements the MCP server factory with ListTools/CallTool forwarding to the socket client. |
packages/openclaude-for-chrome-mcp/index.ts |
Barrel exports for consumers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| context.logger.warn( | ||
| `[OpenClaude Chrome] Failed to connect: ${e}`, |
| /** | ||
| * Send a tool request and wait for the response. | ||
| * Tool calls are sequential (one at a time from the LLM), so a simple | ||
| * FIFO queue handles request/response correlation. | ||
| */ |
| { | ||
| name: 'shortcuts_execute', | ||
| description: | ||
| 'Execute a named keyboard shortcut on the page.', | ||
| inputSchema: { | ||
| type: 'object', | ||
| properties: { | ||
| tabId: { | ||
| type: 'number', | ||
| description: 'The ID of the tab to execute the shortcut in.', | ||
| }, | ||
| shortcutId: { | ||
| type: 'string', | ||
| description: 'The ID of the shortcut to execute (from shortcuts_list).', | ||
| }, | ||
| command: { | ||
| type: 'string', | ||
| description: 'Alternative: a command string to execute.', | ||
| }, | ||
| }, | ||
| required: ['tabId', 'shortcutId'], | ||
| }, |
| ): Server { | ||
| const server = new Server( | ||
| { name: context.serverName, version: '1.0.0' }, |
Replace the proprietary @ant/claude-for-chrome-mcp stub with a local MCP server package enabling Chrome browser automation via the extension. Package (packages/openclaude-for-chrome-mcp/): - 17 browser tool definitions with full MCP schemas - Unix socket client with lazy connection and backpressure-safe writes - MCP server factory using @modelcontextprotocol/sdk - Socket protocol types (4-byte LE + JSON) Build integration: - onResolve redirects openclaude-for-chrome-mcp to local package - Import renames across 4 consumer files
|
@kevincodex1 what do you think |
Vasanthdev2004
left a comment
There was a problem hiding this comment.
Review: PR #673 — Add local openclaude-for-chrome-mcp package (head f545da7)
CI green ✅. 14 files, +1053/-19.
What this does
Replaces the stubbed @ant/claude-for-chrome-mcp with a full local implementation in packages/openclaude-for-chrome-mcp/. This enables Chrome browser automation via the existing Chrome extension (ID fcoeoabgfenejglbffodgkkbkcdhcgfn) through the MCP tool system.
Package structure (6 files)
| File | Assessment |
|---|---|
types.ts |
Clean types for Logger, PermissionMode, ClaudeForChromeContext ✅ |
protocol.ts |
4-byte LE + JSON protocol matching chromeNativeHost.ts ✅ |
tools.ts |
17 browser tools with full MCP schemas, proper required fields ✅ |
socketClient.ts |
Unix socket client with lazy connect, backpressure-safe writes, idempotent teardown, message size limits (1MB), timeouts (5s connect, 120s tool call) ✅ |
server.ts |
MCP server factory with ListTools/CallTool handlers, screenshot support, error handling ✅ |
index.ts |
Barrel export ✅ |
Integration (8 modified files)
scripts/build.ts—onResolveredirectsopenclaude-for-chrome-mcpto local package, removed from native-stub list ✅tsconfig.json— Addedpathsmapping ✅- All 5 consumer files — Clean import rename from
@ant/claude-for-chrome-mcptoopenclaude-for-chrome-mcp✅ src/services/mcp/client.ts— Updated import ✅- No remaining
@ant/claude-for-chrome-mcpreferences ✅
Security
- Socket path from
ClaudeForChromeContext, not user input ✅ MAX_MESSAGE_SIZE= 1MB on both send and receive ✅- Pending requests cleaned up on disconnect ✅
- No shell injection vectors ✅
🟡 Non-blocking
1. server.ts hardcodes version: '1.0.0'
Consider using the package version from package.json or a shared constant to avoid staleness.
2. No unit tests for socketClient.ts
The socket client has non-trivial logic (message framing, pending queue, concurrent connect dedup, disconnect handling). Unit tests with a mock socket would improve confidence. Not a blocker since CI passes and the protocol is well-documented for manual testing.
3. tools.ts tool names must stay in sync with toolRendering.tsx
The comment notes this dependency. Consider generating tool names from a single source of truth (e.g., a shared constant file) to prevent drift.
Verdict: Approve-ready ✅
Clean, well-structured replacement of a stubbed package with a full local implementation. Good security practices, proper protocol documentation, and thorough integration across all consumer files. Non-blocking items are follow-up polish.
|
looks great to me but stil in draft? |
|
This needs to be pushed the sooner the better |
|
closing as abandoned |
Summary
packages/openclaude-for-chrome-mcp/— a local MCP server package that replaces the previously stubbed@ant/claude-for-chrome-mcp, enabling Chrome browser automation via the extension (IDfcoeoabgfenejglbffodgkkbkcdhcgfn)onResolveinscripts/build.ts@ant/claude-for-chrome-mcptoopenclaude-for-chrome-mcpacross 4 consumer filesPackage contents (6 files)
types.tsLogger,PermissionMode,ClaudeForChromeContexttypesprotocol.tschromeNativeHost.ts)tools.tsTool[])socketClient.tsserver.ts@modelcontextprotocol/sdkwithListTools/CallToolhandlersindex.tsModified files (8 files)
scripts/build.ts—onResolvefor local package; removed from native-stub list; dead stubs cleanedtsconfig.json—pathsmapping,rootDir: ".",packages/**/*in includesrc/utils/claudeInChrome/mcpServer.ts— import + obsolete version comment cleanedsrc/utils/claudeInChrome/setup.ts— import renamedsrc/utils/claudeInChrome/common.ts— comment updatedsrc/utils/claudeInChrome/toolRendering.tsx— comment updatedsrc/skills/bundled/claudeInChrome.ts— import renamedsrc/services/mcp/client.ts— dynamic import renamedTest plan
bun run buildsucceedsbun run typecheck— no new errors from the packageBROWSER_TOOLSin bundle contains 17 tool definitions (not[])@ant/claude-for-chrome-mcpremain in sourceopenclaude --chromewith extension installed →tabs_context_mcpreturns results