(userId: string, workspaceId: string)
| 714 | } |
| 715 | |
| 716 | async getServerSummaries(userId: string, workspaceId: string): Promise<McpServerSummary[]> { |
| 717 | const requestId = generateRequestId() |
| 718 | |
| 719 | try { |
| 720 | logger.info(`[${requestId}] Getting server summaries for workspace ${workspaceId}`) |
| 721 | |
| 722 | const servers = await this.getWorkspaceServers(workspaceId) |
| 723 | const summaries: McpServerSummary[] = [] |
| 724 | |
| 725 | for (const config of servers) { |
| 726 | try { |
| 727 | const { config: resolvedConfig, resolvedIP } = await this.resolveConfigEnvVars( |
| 728 | config, |
| 729 | userId, |
| 730 | workspaceId |
| 731 | ) |
| 732 | const client = await this.createClient(resolvedConfig, resolvedIP, userId) |
| 733 | const tools = await client.listTools() |
| 734 | await client.disconnect() |
| 735 | |
| 736 | summaries.push({ |
| 737 | id: config.id, |
| 738 | name: config.name, |
| 739 | url: config.url, |
| 740 | transport: config.transport, |
| 741 | status: 'connected', |
| 742 | toolCount: tools.length, |
| 743 | lastSeen: new Date(), |
| 744 | error: undefined, |
| 745 | }) |
| 746 | } catch (error) { |
| 747 | if ( |
| 748 | error instanceof McpOauthAuthorizationRequiredError || |
| 749 | error instanceof UnauthorizedError |
| 750 | ) { |
| 751 | summaries.push({ |
| 752 | id: config.id, |
| 753 | name: config.name, |
| 754 | url: config.url, |
| 755 | transport: config.transport, |
| 756 | status: 'disconnected', |
| 757 | toolCount: 0, |
| 758 | lastSeen: undefined, |
| 759 | error: undefined, |
| 760 | }) |
| 761 | continue |
| 762 | } |
| 763 | summaries.push({ |
| 764 | id: config.id, |
| 765 | name: config.name, |
| 766 | url: config.url, |
| 767 | transport: config.transport, |
| 768 | status: 'error', |
| 769 | toolCount: 0, |
| 770 | lastSeen: undefined, |
| 771 | error: getErrorMessage(error, 'Connection failed'), |
| 772 | }) |
| 773 | } |
nothing calls this directly
no test coverage detected