From 68689e3054cebd17d1720c88a5fac80a369d4786 Mon Sep 17 00:00:00 2001 From: haosenwang1018 Date: Thu, 19 Mar 2026 13:46:33 +0000 Subject: [PATCH 1/2] fix: silence stdio stderr by default --- src/client.ts | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/client.ts b/src/client.ts index 50731cf..7f0e3da 100644 --- a/src/client.ts +++ b/src/client.ts @@ -243,15 +243,12 @@ export async function connectToServer( } else { transport = createStdioTransport(config); - // Capture stderr for debugging - attach BEFORE connect - // Always stream stderr immediately so auth prompts are visible + // Capture stderr before connect so failed startups can surface + // helpful diagnostics without streaming server noise by default. const stderrStream = transport.stderr; if (stderrStream) { stderrStream.on('data', (chunk: Buffer) => { - const text = chunk.toString(); - stderrChunks.push(text); - // Always stream stderr immediately so users can see auth prompts - process.stderr.write(`[${serverName}] ${text}`); + stderrChunks.push(chunk.toString()); }); } } @@ -268,16 +265,6 @@ export async function connectToServer( throw error; } - // For successful connections, forward stderr to console - if (!isHttpServer(config)) { - const stderrStream = (transport as StdioClientTransport).stderr; - if (stderrStream) { - stderrStream.on('data', (chunk: Buffer) => { - process.stderr.write(chunk); - }); - } - } - return { client, close: async () => { From 7d550f80be15f6afe357b3b3b276262825618692 Mon Sep 17 00:00:00 2001 From: haosenwang1018 Date: Sat, 21 Mar 2026 13:37:49 +0000 Subject: [PATCH 2/2] fix(client): add pagination support for listTools to prevent missing tools When connecting to MCP servers with many tools, only a subset was showing up because listTools() sent a single request and didn't follow the nextCursor for paginated responses. This fix implements pagination support by: 1. Checking for nextCursor in each response 2. Making additional requests with the cursor until all pages are fetched 3. Combining all tools from all pages Fixes #206 --- src/client.ts | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/client.ts b/src/client.ts index 7f0e3da..2e9b7ea 100644 --- a/src/client.ts +++ b/src/client.ts @@ -315,16 +315,26 @@ function createStdioTransport(config: StdioServerConfig): StdioClientTransport { } /** - * List all tools from a connected client with retry logic + * List all tools from a connected client with retry logic and pagination support */ export async function listTools(client: Client): Promise { return withRetry(async () => { - const result = await client.listTools(); - return result.tools.map((tool: Tool) => ({ - name: tool.name, - description: tool.description, - inputSchema: tool.inputSchema as Record, - })); + const allTools: ToolInfo[] = []; + let cursor: string | undefined; + + do { + const result = await client.listTools(cursor ? { cursor } : undefined); + allTools.push( + ...result.tools.map((tool: Tool) => ({ + name: tool.name, + description: tool.description, + inputSchema: tool.inputSchema as Record, + })), + ); + cursor = result.nextCursor as string | undefined; + } while (cursor); + + return allTools; }, 'list tools'); }