Skip to content

fix(mcp): client add default description avoid err #239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 20, 2025
Merged
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
14 changes: 11 additions & 3 deletions packages/agent-infra/mcp-client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
import { EventEmitter } from 'node:events';
import { v4 as uuidv4 } from 'uuid';
import { type Client } from '@modelcontextprotocol/sdk/client/index.js';
import { type StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
import {
StdioServerParameters,
type StdioClientTransport,
} from '@modelcontextprotocol/sdk/client/stdio.js';
import {
type Tool,
CallToolResultSchema,
Expand Down Expand Up @@ -187,12 +190,14 @@ export class MCPClient<
},
);

const transport = new this.Transport({
const transportOpts: StdioServerParameters = {
command: cmd,
args,
stderr: process.platform === 'win32' ? 'pipe' : 'inherit',
env: mergedEnv as Record<string, string>,
});
};
console.log('transportOpts', transportOpts);
const transport = new this.Transport(transportOpts);

await client.connect(transport);
this.clients[name] = client;
Expand Down Expand Up @@ -362,6 +367,7 @@ export class MCPClient<
return tools.map((tool: Tool) => {
tool.serverName = serverName;
tool.id = 'f' + uuidv4().replace(/-/g, '');
tool.description = tool.description || `${serverName} - ${tool.name}`;
return tool as MCPTool;
});
} else {
Expand All @@ -377,6 +383,8 @@ export class MCPClient<
tools.map((tool: Tool) => {
tool.serverName = clientName;
tool.id = 'f' + uuidv4().replace(/-/g, '');
tool.description =
tool.description || `${clientName} - ${tool.name}`;
return tool as MCPTool;
}),
);
Expand Down