@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
48 lines • 2.34 kB
TypeScript
import type { OAuthClientProvider, OAuthDiscoveryState } from "@modelcontextprotocol/sdk/client/auth.js";
import type { OAuthClientInformationFull, OAuthClientInformationMixed, OAuthClientMetadata, OAuthTokens } from "@modelcontextprotocol/sdk/shared/auth.js";
import type { McpLogger } from "../log.ts";
import { type McpGrantContext } from "./oauth-grant.ts";
import type { McpTokenStore } from "./token-store.ts";
export interface McpOAuthProviderOptions {
serverName: string;
serverUrl: string;
store: McpTokenStore;
redirectUrl?: string | URL;
/** This flow sends an authorize request: reuse only a stored registration naming `redirectUrl` (senpi#6327). */
requireRegisteredRedirect?: boolean;
scopes?: string[];
clientId?: string;
clientMetadataUrl?: string;
logger?: McpLogger;
onRedirect?: (url: URL) => void | Promise<void>;
}
export declare class McpOAuthProvider implements OAuthClientProvider {
#private;
constructor(options: McpOAuthProviderOptions);
get lastAuthorizationUrl(): URL | undefined;
get redirectUrl(): string | URL | undefined;
get clientMetadataUrl(): string | undefined;
get clientMetadata(): OAuthClientMetadata & {
application_type?: "native" | "web";
};
state(): string;
consumeState(candidate: string | undefined): boolean;
clientInformation(): OAuthClientInformationMixed | undefined;
saveClientInformation(info: OAuthClientInformationFull): Promise<void>;
saveDiscoveryState(state: OAuthDiscoveryState): Promise<void>;
discoveryState(): OAuthDiscoveryState | undefined;
tokens(): OAuthTokens | undefined;
withFreshAuthorization<T>(exchange: () => Promise<T>): Promise<T>;
saveTokens(tokens: OAuthTokens): Promise<void>;
saveCodeVerifier(codeVerifier: string): Promise<void>;
codeVerifier(): string;
redirectToAuthorization(authorizationUrl: URL): Promise<void>;
validateResourceURL(serverUrl: string | URL, resource?: string): Promise<URL | undefined>;
invalidateCredentials(scope: "all" | "client" | "tokens" | "verifier" | "discovery"): Promise<void>;
get serverName(): string;
get serverUrl(): string;
get store(): McpTokenStore;
get scopes(): string[] | undefined;
get grantContext(): McpGrantContext;
}
//# sourceMappingURL=oauth-provider.d.ts.map