feat(mcp): add reconnect command and implement auto-reconnect logic

- Added a new reconnect command to the MCP CLI.
- Implemented auto-reconnect functionality in DiscoveredMCPToolInvocation to handle connection errors with retry logic.
- Enhanced tests to cover reconnect scenarios and ensure reliability during connection failures.
This commit is contained in:
qqqys 2026-03-16 23:25:33 +08:00
parent 9391779cd0
commit 8a2bda67ed
6 changed files with 874 additions and 95 deletions

View file

@ -9,6 +9,7 @@ import type { CommandModule, Argv } from 'yargs';
import { addCommand } from './mcp/add.js';
import { removeCommand } from './mcp/remove.js';
import { listCommand } from './mcp/list.js';
import { reconnectCommand } from './mcp/reconnect.js';
export const mcpCommand: CommandModule = {
command: 'mcp',
@ -18,6 +19,7 @@ export const mcpCommand: CommandModule = {
.command(addCommand)
.command(removeCommand)
.command(listCommand)
.command(reconnectCommand)
.demandCommand(1, 'You need at least one command before continuing.')
.version(false),
handler: () => {