Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/olive-dodos-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@lynx-js/devtool-mcp-server": patch
---

Export `registerTool` and `defineTool`.
Comment thread
colinaaa marked this conversation as resolved.
5 changes: 5 additions & 0 deletions .changeset/quiet-poems-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@lynx-js/devtool-mcp-server": patch
---

Fix failed to connect to client.
11 changes: 10 additions & 1 deletion packages/mcp-servers/devtool-mcp-server/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@ export default defineConfig({
pluginPublint({ throwOn: 'suggestion' }),
],
lib: [
{ format: 'esm', syntax: 'es2022', dts: { bundle: true } },
{
format: 'esm',
syntax: 'es2022',
dts: {
bundle: {
// Avoid bundling `zod` types.
bundledPackages: [],
},
},
},
{
format: 'esm',
syntax: 'es2022',
Expand Down
7 changes: 0 additions & 7 deletions packages/mcp-servers/devtool-mcp-server/src/connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,13 +496,6 @@ export async function ensureLynxConnected(): Promise<DebugRouterConnector> {
if (devices.length === 0) {
throw new Error('Failed to connect to Lynx: no device found.');
}
devices.forEach((device) => {
device.startWatchClient();
});
} else {
for (const device of connector.devices.values()) {
device.startWatchClient();
}
}

return connector;
Expand Down
5 changes: 4 additions & 1 deletion packages/mcp-servers/devtool-mcp-server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const TOOLS = [
ListConsole,
] as unknown as ToolDefinition[];

function registerTool(mcpServer: McpServer, tool: ToolDefinition): void {
export function registerTool(mcpServer: McpServer, tool: ToolDefinition): void {
mcpServer.registerTool(
tool.name,
{
Expand Down Expand Up @@ -125,3 +125,6 @@ export function setupServer(mcpServer: McpServer): void {

return;
}

export { defineTool, type ToolDefinition } from './tools/defineTool.ts';
export * as Schema from './schema/index.ts';
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,16 @@ export const ListClients = /*#__PURE__*/ defineTool({
connector.on('client-connected', onClientConnected);
setTimeout(() => {
connector.off('client-connected', onClientConnected);
reject(
new Error(
'List clients timeout. Please open App with Lynx Engine and try again.',
),
);

if (connector.usbClients.size === 0) {
reject(
new Error(
'List clients timeout. Please open App with Lynx Engine and try again.',
),
);
} else {
resolve();
}
}, 1000);
function onClientConnected() {
connector.off('client-connected', onClientConnected);
Expand Down
Loading