feat(devtool-mcp-server): fix failed to connect client#1931
feat(devtool-mcp-server): fix failed to connect client#1931colinaaa merged 2 commits intolynx-family:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 394d85a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📝 WalkthroughWalkthroughThis PR introduces patch-level changes to the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
CodSpeed Performance ReportMerging #1931 will not alter performanceComparing Summary
Footnotes
|
Web Explorer#6197 Bundle Size — 366.74KiB (0%).394d85a(current) vs a1e4e19 main#6193(baseline) Bundle metrics
Bundle size by type
|
| Current #6197 |
Baseline #6193 |
|
|---|---|---|
240.72KiB |
240.72KiB |
|
93.8KiB |
93.8KiB |
|
32.22KiB |
32.22KiB |
Bundle analysis report Branch colinaaa:colin/1111/docs-mcp-ser... Project dashboard
Generated by RelativeCI Documentation Report issue
React Example#6167 Bundle Size — 234.35KiB (0%).394d85a(current) vs 835e083 main#6154(baseline) Bundle metrics
|
| Current #6167 |
Baseline #6154 |
|
|---|---|---|
0B |
0B |
|
0B |
0B |
|
0% |
0% |
|
0 |
0 |
|
4 |
4 |
|
164 |
164 |
|
66 |
66 |
|
46.71% |
46.71% |
|
2 |
2 |
|
0 |
0 |
Bundle size by type no changes
| Current #6167 |
Baseline #6154 |
|
|---|---|---|
145.76KiB |
145.76KiB |
|
88.59KiB |
88.59KiB |
Bundle analysis report Branch colinaaa:colin/1111/docs-mcp-ser... Project dashboard
Generated by RelativeCI Documentation Report issue
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.changeset/quiet-poems-turn.md (1)
5-5: Polish the changeset description grammar.The description has a minor grammar issue: "client" should be pluralized or the phrasing should be rephrased for clarity. Consider alternatives like "Fix client connection failures" or "Fix failed connections to clients."
Apply this diff to improve the description:
-Fix failed to connect to client. +Fix client connection failures.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
.changeset/olive-dodos-dress.md(1 hunks).changeset/quiet-poems-turn.md(1 hunks)packages/mcp-servers/devtool-mcp-server/rslib.config.ts(1 hunks)packages/mcp-servers/devtool-mcp-server/src/connector.ts(0 hunks)packages/mcp-servers/devtool-mcp-server/src/index.ts(2 hunks)packages/mcp-servers/devtool-mcp-server/src/tools/Device/ListClients.ts(1 hunks)
💤 Files with no reviewable changes (1)
- packages/mcp-servers/devtool-mcp-server/src/connector.ts
🧰 Additional context used
📓 Path-based instructions (1)
.changeset/*.md
📄 CodeRabbit inference engine (AGENTS.md)
For contributions, generate and commit a Changeset describing your changes
Files:
.changeset/olive-dodos-dress.md.changeset/quiet-poems-turn.md
🧠 Learnings (8)
📓 Common learnings
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/src/connector.ts:347-368
Timestamp: 2025-11-06T01:17:11.892Z
Learning: In the lynx-family/lynx-stack repository, for the devtool-mcp-server package, the getSource and getConsole methods intentionally throw errors when collectors don't exist (rather than returning empty arrays) to provide clear feedback to code agents and automation tools that something is wrong (e.g., debugger not enabled, collectors not initialized), enabling them to take corrective action.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Applied to files:
.changeset/olive-dodos-dress.md.changeset/quiet-poems-turn.md
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Applied to files:
.changeset/olive-dodos-dress.md.changeset/quiet-poems-turn.mdpackages/mcp-servers/devtool-mcp-server/rslib.config.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Applied to files:
.changeset/olive-dodos-dress.md.changeset/quiet-poems-turn.md
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Applied to files:
.changeset/olive-dodos-dress.md.changeset/quiet-poems-turn.md
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Applied to files:
.changeset/olive-dodos-dress.md.changeset/quiet-poems-turn.md
📚 Learning: 2025-11-06T01:17:11.892Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/src/connector.ts:347-368
Timestamp: 2025-11-06T01:17:11.892Z
Learning: In the lynx-family/lynx-stack repository, for the devtool-mcp-server package, the getSource and getConsole methods intentionally throw errors when collectors don't exist (rather than returning empty arrays) to provide clear feedback to code agents and automation tools that something is wrong (e.g., debugger not enabled, collectors not initialized), enabling them to take corrective action.
Applied to files:
.changeset/quiet-poems-turn.md
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Applied to files:
.changeset/quiet-poems-turn.md
🧬 Code graph analysis (2)
packages/mcp-servers/devtool-mcp-server/src/index.ts (1)
packages/mcp-servers/devtool-mcp-server/src/tools/defineTool.ts (1)
ToolDefinition(28-44)
packages/mcp-servers/devtool-mcp-server/src/tools/Device/ListClients.ts (1)
packages/mcp-servers/devtool-mcp-server/src/McpContext.ts (1)
connector(20-22)
🪛 LanguageTool
.changeset/quiet-poems-turn.md
[grammar] ~5-~5: The word ‘client’ is not correct in this context. Use one of the suggestions or replace it with an appropriate verb.
Context: ...rver": patch --- Fix failed to connect to client.
(VB_TO_NN_DT)
🔇 Additional comments (4)
packages/mcp-servers/devtool-mcp-server/src/tools/Device/ListClients.ts (1)
28-40: Good fix for timeout handling when clients connect during wait period.The updated logic correctly handles the case where USB clients connect during the timeout window. Previously, the timeout would unconditionally reject. Now it checks
connector.usbClients.sizeand resolves if clients are present, addressing the "failed to connect client" issue mentioned in the PR title.The
Promise.withResolverspattern ensures only the first resolution (either from the event handler at lines 41-44 or this timeout handler) takes effect, preventing double-resolution issues.packages/mcp-servers/devtool-mcp-server/rslib.config.ts (1)
12-21: LGTM! Correctly prevents bundling Zod types in declarations.The change from
dts: { bundle: true }todts: { bundle: { bundledPackages: [] } }appropriately avoids inlining Zod types in the generated.d.tsfiles. This is necessary because the new public exports (ToolDefinitionandSchemanamespace) expose Zod types (z.ZodRawShape) in the public API, and consumers should use their own Zod version rather than having types bundled.packages/mcp-servers/devtool-mcp-server/src/index.ts (2)
88-88: ExportingregisterToolenables custom tool registration.Making
registerToolpublic is a significant API expansion that allows external consumers to register custom tools. The function signature and implementation are correct and consistent with the internal usage pattern at lines 122-124.
129-130: New public exports provide tool definition capabilities.Exporting
defineTool,ToolDefinition, and theSchemanamespace expands the public API to enable consumers to create and register custom tools. This is consistent with the changeset description and aligns with the rslib.config.ts change that prevents bundling Zod types (since these exports expose Zod-based schemas).Ensure these new exports are documented in the package README or API documentation, as they now form part of the public API contract.
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @lynx-js/rspeedy@0.12.0 ### Minor Changes - Bump Rsbuild v1.6.7 with Rspack v1.6.4. ([#1905](#1905)) ### Patch Changes - Updated dependencies \[]: - @lynx-js/web-rsbuild-server-middleware@0.18.4 ## @lynx-js/devtool-mcp-server@0.4.1 ### Patch Changes - Export `registerTool` and `defineTool`. ([#1931](#1931)) - Fix failed to connect to client. ([#1931](#1931)) ## @lynx-js/react@0.114.5 ### Patch Changes - Reduce `__SetInlineStyles` element API call when attrs in spread not changed ([#1919](#1919)) ## @lynx-js/web-constants@0.18.4 ### Patch Changes - Updated dependencies \[]: - @lynx-js/web-worker-rpc@0.18.4 ## @lynx-js/web-core@0.18.4 ### Patch Changes - feat: builtinTagTransformMap add `'x-input-ng': 'x-input'` ([#1932](#1932)) - Updated dependencies \[]: - @lynx-js/web-constants@0.18.4 - @lynx-js/web-mainthread-apis@0.18.4 - @lynx-js/web-worker-rpc@0.18.4 - @lynx-js/web-worker-runtime@0.18.4 ## @lynx-js/web-core-server@0.18.4 ### Patch Changes - feat: builtinTagTransformMap add `'x-input-ng': 'x-input'` ([#1932](#1932)) - chore: minor bundle output change ([#1946](#1946)) the timing of loading wasm chunk has been changed ## @lynx-js/web-elements@0.8.11 ### Patch Changes - fix: when estimated-main-axis-size-px is not set, should use the height of list ([#1930](#1930)) - Updated dependencies \[]: - @lynx-js/web-elements-template@0.8.11 ## @lynx-js/web-explorer@0.0.13 ### Patch Changes - feat: builtinTagTransformMap add `'x-input-ng': 'x-input'` ([#1932](#1932)) ## @lynx-js/web-mainthread-apis@0.18.4 ### Patch Changes - Updated dependencies \[]: - @lynx-js/web-constants@0.18.4 ## @lynx-js/web-worker-runtime@0.18.4 ### Patch Changes - Updated dependencies \[]: - @lynx-js/web-constants@0.18.4 - @lynx-js/web-mainthread-apis@0.18.4 - @lynx-js/web-worker-rpc@0.18.4 ## create-rspeedy@0.12.0 ## upgrade-rspeedy@0.12.0 ## @lynx-js/web-elements-template@0.8.11 ## @lynx-js/web-rsbuild-server-middleware@0.18.4 ## @lynx-js/web-worker-rpc@0.18.4 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Checklist