添加MCP客户端超时配置和连接管理改进
添加了MCP客户端的超时配置功能,包括启动超时和工具调用超时参数。 改进了HTTP客户端和标准IO客户端的超时处理机制,确保请求在指定时间内完成或取消。 增加了对MCP服务器数量的限制,防止配置过多服务器导致系统不稳定。 增强了错误处理机制,当连接异常时能够正确清理资源并移除桥接主机。 添加了对大型MCP消息的大小验证,防止过大的请求导致系统问题。 优化了密钥更改后的处理流程,确保在修改密钥时停用服务器并要求重新测试。
This commit is contained in:
@@ -142,7 +142,20 @@ async function save() {
|
||||
}
|
||||
|
||||
function executionChanged(server: McpServer, input: McpServerInput) {
|
||||
return JSON.stringify([server.transport, server.command, server.args, server.url, server.headers, Object.keys(server.secret_headers)]) !== JSON.stringify([input.transport, input.command, input.args, input.url, input.headers, input.secret_header_keys])
|
||||
const sortedEntries = (value: Record<string, string>) => Object.entries(value).sort(([left], [right]) => left.localeCompare(right))
|
||||
const current = [
|
||||
server.transport, server.command, server.args, server.url,
|
||||
sortedEntries(server.headers), sortedEntries(server.environment),
|
||||
Object.keys(server.secret_headers).sort(), Object.keys(server.secret_environment).sort(),
|
||||
[...server.permissions].sort(), server.startup_timeout_seconds, server.tool_timeout_seconds,
|
||||
]
|
||||
const next = [
|
||||
input.transport, input.command, input.args, input.url,
|
||||
sortedEntries(input.headers), sortedEntries(input.environment),
|
||||
[...input.secret_header_keys].sort(), [...input.secret_environment_keys].sort(),
|
||||
[...input.permissions].sort(), input.startup_timeout_seconds, input.tool_timeout_seconds,
|
||||
]
|
||||
return JSON.stringify(current) !== JSON.stringify(next)
|
||||
}
|
||||
|
||||
async function approve(server: McpServer): Promise<McpServer | null> {
|
||||
|
||||
Reference in New Issue
Block a user