Refactor: Clean up code formatting and improve readability across multiple files (#387)

This commit is contained in:
samanhappy
2025-10-26 19:27:30 +08:00
committed by GitHub
parent f79028ed64
commit 9105507722
9 changed files with 111 additions and 109 deletions

View File

@@ -333,7 +333,7 @@ export class MCPHubOAuthProvider implements OAuthClientProvider {
const updatedConfig = await persistTokens(this.serverName, {
accessToken: tokens.access_token,
refreshToken: refreshTokenProvided ? tokens.refresh_token ?? null : undefined,
refreshToken: refreshTokenProvided ? (tokens.refresh_token ?? null) : undefined,
clearPendingAuthorization: hadPending,
});
@@ -421,7 +421,9 @@ export class MCPHubOAuthProvider implements OAuthClientProvider {
async saveCodeVerifier(verifier: string): Promise<void> {
this._codeVerifier = verifier;
try {
const updatedConfig = await updatePendingAuthorization(this.serverName, { codeVerifier: verifier });
const updatedConfig = await updatePendingAuthorization(this.serverName, {
codeVerifier: verifier,
});
if (updatedConfig) {
this.serverConfig = updatedConfig;
}
@@ -490,7 +492,10 @@ export class MCPHubOAuthProvider implements OAuthClientProvider {
if (scope === 'client' || scope === 'all') {
const supportsDynamicClient = currentConfig.oauth.dynamicRegistration?.enabled === true;
if (supportsDynamicClient && (currentConfig.oauth.clientId || currentConfig.oauth.clientSecret)) {
if (
supportsDynamicClient &&
(currentConfig.oauth.clientId || currentConfig.oauth.clientSecret)
) {
removeRegisteredClient(this.serverName);
const updated = await clearOAuthData(this.serverName, 'client');
assignUpdatedConfig(updated);

View File

@@ -380,10 +380,10 @@ export const initializeClientsFromSettings = async (
try {
for (const conf of allServers) {
const { name } = conf;
// Expand environment variables in all configuration values
const expandedConf = replaceEnvVars(conf as any) as ServerConfigWithName;
// Skip disabled servers
if (expandedConf.enabled === false) {
console.log(`Skipping disabled server: ${name}`);