()
| 1480 | } |
| 1481 | |
| 1482 | async clientInformation(): Promise<OAuthClientInformation | undefined> { |
| 1483 | const storage = getSecureStorage() |
| 1484 | const data = storage.read() |
| 1485 | const serverKey = getServerKey(this.serverName, this.serverConfig) |
| 1486 | |
| 1487 | // Check session credentials first (from DCR or previous auth) |
| 1488 | const storedInfo = data?.mcpOAuth?.[serverKey] |
| 1489 | if (storedInfo?.clientId) { |
| 1490 | logMCPDebug(this.serverName, `Found client info`) |
| 1491 | return { |
| 1492 | client_id: storedInfo.clientId, |
| 1493 | client_secret: storedInfo.clientSecret, |
| 1494 | } |
| 1495 | } |
| 1496 | |
| 1497 | // Fallback: pre-configured client ID from server config |
| 1498 | const configClientId = this.serverConfig.oauth?.clientId |
| 1499 | if (configClientId) { |
| 1500 | const clientConfig = data?.mcpOAuthClientConfig?.[serverKey] |
| 1501 | logMCPDebug(this.serverName, `Using pre-configured client ID`) |
| 1502 | return { |
| 1503 | client_id: configClientId, |
| 1504 | client_secret: clientConfig?.clientSecret, |
| 1505 | } |
| 1506 | } |
| 1507 | |
| 1508 | // If we don't have stored client info, return undefined to trigger registration |
| 1509 | logMCPDebug(this.serverName, `No client info found`) |
| 1510 | return undefined |
| 1511 | } |
| 1512 | |
| 1513 | async saveClientInformation( |
| 1514 | clientInformation: OAuthClientInformationFull, |
no test coverage detected