All of the mid-session and step-up auth work

This commit is contained in:
Bob Dickinson 2026-07-02 16:35:31 -07:00
commit 562bdd00f1

View file

@ -28,6 +28,10 @@ import {
MutableRedirectUrlProvider,
} from "@inspector/core/auth/index.js";
import { NodeOAuthStorage } from "@inspector/core/auth/node/index.js";
import {
connectInspectorWithOAuth,
withCliAuthRecoveryRetry,
} from "./cliOAuth.js";
import {
DEFAULT_RUNNER_OAUTH_CALLBACK_URL,
formatRunnerOAuthRedirectUrl,
@ -122,9 +126,7 @@ async function callMethod(
null;
let managedPromptsState: ManagedPromptsState | null = null;
try {
await inspectorClient.connect();
const runMethod = async (): Promise<McpResponse> => {
let result: McpResponse;
if (args.method === "tools/list" || args.method === "tools/call") {
@ -248,6 +250,26 @@ async function callMethod(
);
}
return result;
};
try {
await connectInspectorWithOAuth(
inspectorClient,
serverConfig,
redirectUrlProvider,
callbackUrlConfig!,
serverSettings,
);
const result = await withCliAuthRecoveryRetry(
inspectorClient,
redirectUrlProvider,
callbackUrlConfig!,
serverSettings,
runMethod,
);
await awaitableLog(JSON.stringify(result, null, 2));
} finally {
managedToolsState?.destroy();