(workspaceId: string)
| 158 | } |
| 159 | |
| 160 | private async getWorkspaceServers(workspaceId: string): Promise<McpServerConfig[]> { |
| 161 | const whereConditions = [ |
| 162 | eq(mcpServers.workspaceId, workspaceId), |
| 163 | eq(mcpServers.enabled, true), |
| 164 | isNull(mcpServers.deletedAt), |
| 165 | ] |
| 166 | |
| 167 | const servers = await db |
| 168 | .select() |
| 169 | .from(mcpServers) |
| 170 | .where(and(...whereConditions)) |
| 171 | |
| 172 | return servers |
| 173 | .map((server) => ({ |
| 174 | id: server.id, |
| 175 | name: server.name, |
| 176 | description: server.description || undefined, |
| 177 | transport: server.transport as McpTransport, |
| 178 | url: server.url || undefined, |
| 179 | authType: (server.authType as McpServerConfig['authType']) ?? 'headers', |
| 180 | workspaceId: server.workspaceId, |
| 181 | headers: (server.headers as Record<string, string>) || {}, |
| 182 | timeout: server.timeout || 30000, |
| 183 | retries: server.retries || 3, |
| 184 | enabled: server.enabled, |
| 185 | createdAt: server.createdAt.toISOString(), |
| 186 | updatedAt: server.updatedAt.toISOString(), |
| 187 | })) |
| 188 | .filter((config) => isMcpDomainAllowed(config.url)) |
| 189 | } |
| 190 | |
| 191 | private async createClient( |
| 192 | config: McpServerConfig, |
no test coverage detected