Skip to content

Commit 21eed88

Browse files
build: fix typescript issue
Comments inline. I don't blame codex for missing this.
1 parent 70b1f7b commit 21eed88

File tree

2 files changed

+10
-3
lines changed
  • packages
    • configure-mcp-server/src/configure/client
    • mcp-server-utils/src/auth

2 files changed

+10
-3
lines changed

packages/configure-mcp-server/src/configure/client/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { RemoteMcpTargets } from '@gleanwork/mcp-server-utils/util';
1212
import { isOAuthEnabled } from '../../common/env.js';
1313

1414
import connectMcpPackageJson from '@gleanwork/connect-mcp-server/package.json' with { type: 'json' };
15-
let connectMcpServerVersion = connectMcpPackageJson.version;
15+
const connectMcpServerVersion = connectMcpPackageJson.version;
1616

1717
export interface MCPConfigPath {
1818
configDir: string;

packages/mcp-server-utils/src/auth/auth.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,21 +546,28 @@ async function authorize(config: GleanOAuthConfig): Promise<Tokens | null> {
546546
).catch((e) => {
547547
error('prompting user for verification page', e);
548548
});
549-
const tokenResponse = await tokenPoller;
549+
const polledTokenResponse = await tokenPoller;
550550

551551
// Clean up the readline interface now that we have the token
552552
abortController.abort();
553553

554554
if (cause !== undefined) {
555555
throw cause;
556556
}
557+
558+
// tokenResponse is void | TokenResponse because of the catch handler
559+
// attached to pollForToken, which sets cause and resolves to void. But
560+
// right above here we throw if cause !== undefined so we can guarantee
561+
// tokenResponse is TokenResponse and not void.
562+
const tokenResponse = polledTokenResponse as TokenResponse;
563+
557564
if (tokenResponse.refresh_token === undefined) {
558565
throw new AuthError(
559566
`Your OAuth Authorization Server issued an access token but not a refresh token. Please configure your OAuth application with id: ${config.clientId} to issue refresh tokens.`,
560567
{ code: AuthErrorCode.RefreshTokenNotIssued },
561568
);
562569
}
563-
return Tokens.buildFromTokenResponse(tokenResponse as TokenResponse);
570+
return Tokens.buildFromTokenResponse(tokenResponse);
564571
} catch (cause: any) {
565572
// Clean up the readline interface on error as well
566573
abortController.abort();

0 commit comments

Comments
 (0)