feat(cli) - Define shared interface for storage (#7049)

Co-authored-by: Shi Shu <shii@google.com>
This commit is contained in:
shishu314
2025-08-26 17:03:11 -04:00
committed by GitHub
parent bfef867ba7
commit 366483853e
6 changed files with 57 additions and 47 deletions

View File

@@ -8,7 +8,7 @@ import * as http from 'node:http';
import * as crypto from 'node:crypto';
import { URL } from 'node:url';
import { openBrowserSecurely } from '../utils/secure-browser-launcher.js';
import type { MCPOAuthToken } from './oauth-token-storage.js';
import type { OAuthToken } from './token-storage/types.js';
import { MCPOAuthTokenStorage } from './oauth-token-storage.js';
import { getErrorMessage } from '../utils/errors.js';
import { OAuthUtils } from './oauth-utils.js';
@@ -583,7 +583,7 @@ export class MCPOAuthProvider {
serverName: string,
config: MCPOAuthConfig,
mcpServerUrl?: string,
): Promise<MCPOAuthToken> {
): Promise<OAuthToken> {
// If no authorization URL is provided, try to discover OAuth configuration
if (!config.authorizationUrl && mcpServerUrl) {
console.log(
@@ -777,7 +777,7 @@ export class MCPOAuthProvider {
throw new Error('No access token received from token endpoint');
}
const token: MCPOAuthToken = {
const token: OAuthToken = {
accessToken: tokenResponse.access_token,
tokenType: tokenResponse.token_type || 'Bearer',
refreshToken: tokenResponse.refresh_token,
@@ -863,7 +863,7 @@ export class MCPOAuthProvider {
);
// Update stored token
const newToken: MCPOAuthToken = {
const newToken: OAuthToken = {
accessToken: newTokenResponse.access_token,
tokenType: newTokenResponse.token_type,
refreshToken: newTokenResponse.refresh_token || token.refreshToken,