chore: include pre-built dist for github install

This commit is contained in:
Robin Mordasiewicz
2026-03-14 04:56:50 +00:00
parent a7f0a4cf46
commit bce8ff3a75
1011 changed files with 150081 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
export type OAuthCallbackResult = {
code: string;
state: string;
};
export type CallbackServer = {
port: number;
waitForCallback: () => Promise<OAuthCallbackResult>;
close: () => void;
};
export declare function findAvailablePort(startPort?: number): Promise<number>;
export declare function startCallbackServer(startPort?: number): Promise<CallbackServer>;
+34
View File
@@ -0,0 +1,34 @@
export type ClientRegistrationRequest = {
redirect_uris: string[];
client_name: string;
grant_types: ["authorization_code", "refresh_token"];
response_types: ["code"];
token_endpoint_auth_method: "none" | "client_secret_post";
};
export type ClientCredentials = {
clientId: string;
clientSecret?: string;
};
export type ClientRegistrationStorage = {
getClientRegistration: (serverIdentifier: string) => ClientCredentials | null;
setClientRegistration: (serverIdentifier: string, credentials: ClientCredentials) => void;
};
export type DynamicClientRegistrationOptions = {
registrationEndpoint?: string | null;
serverIdentifier?: string;
clientName: string;
redirectUris: string[];
tokenEndpointAuthMethod: "none" | "client_secret_post";
clientId?: string | null;
storage: ClientRegistrationStorage;
fetch?: DcrFetch;
};
export type DcrFetch = (input: string, init?: {
method?: string;
headers?: Record<string, string>;
body?: string;
}) => Promise<{
ok: boolean;
json: () => Promise<unknown>;
}>;
export declare function getOrRegisterClient(options: DynamicClientRegistrationOptions): Promise<ClientCredentials | null>;
+8
View File
@@ -0,0 +1,8 @@
export interface OAuthServerMetadata {
authorizationEndpoint: string;
tokenEndpoint: string;
registrationEndpoint?: string;
resource: string;
}
export declare function discoverOAuthServerMetadata(resource: string): Promise<OAuthServerMetadata>;
export declare function resetDiscoveryCache(): void;
+26
View File
@@ -0,0 +1,26 @@
export type OAuthCallbackResult = {
code: string;
state: string;
};
export declare function generateCodeVerifier(): string;
export declare function generateCodeChallenge(verifier: string): string;
export declare function buildAuthorizationUrl(authorizationEndpoint: string, options: {
clientId: string;
redirectUri: string;
codeChallenge: string;
state: string;
scopes?: string[];
resource?: string;
}): string;
export declare function startCallbackServer(port: number): Promise<OAuthCallbackResult>;
export declare function runAuthorizationCodeRedirect(options: {
authorizationEndpoint: string;
callbackPort: number;
clientId: string;
redirectUri: string;
scopes?: string[];
resource?: string;
}): Promise<{
code: string;
verifier: string;
}>;
+29
View File
@@ -0,0 +1,29 @@
import type { OAuthTokenData } from "./storage";
import type { OAuthServerMetadata } from "./discovery";
import type { ClientCredentials } from "./dcr";
import { buildAuthorizationUrl, generateCodeChallenge, generateCodeVerifier, startCallbackServer } from "./oauth-authorization-flow";
export type McpOAuthProviderOptions = {
serverUrl: string;
clientId?: string;
scopes?: string[];
};
export declare class McpOAuthProvider {
private readonly serverUrl;
private readonly configClientId;
private readonly scopes;
private storedCodeVerifier;
private storedClientInfo;
private callbackPort;
constructor(options: McpOAuthProviderOptions);
tokens(): OAuthTokenData | null;
saveTokens(tokenData: OAuthTokenData): boolean;
clientInformation(): ClientCredentials | null;
redirectUrl(): string;
saveCodeVerifier(verifier: string): void;
codeVerifier(): string | null;
redirectToAuthorization(metadata: OAuthServerMetadata): Promise<{
code: string;
}>;
login(): Promise<OAuthTokenData>;
}
export { generateCodeVerifier, generateCodeChallenge, buildAuthorizationUrl, startCallbackServer };
+2
View File
@@ -0,0 +1,2 @@
export declare function getResourceIndicator(url: string): string;
export declare function addResourceToParams(params: URLSearchParams, resource: string): void;
+6
View File
@@ -0,0 +1,6 @@
import { z } from "zod";
export declare const McpOauthSchema: z.ZodObject<{
clientId: z.ZodOptional<z.ZodString>;
scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
}, z.core.$strip>;
export type McpOauth = z.infer<typeof McpOauthSchema>;
+8
View File
@@ -0,0 +1,8 @@
export interface StepUpInfo {
requiredScopes: string[];
error?: string;
errorDescription?: string;
}
export declare function parseWwwAuthenticate(header: string): StepUpInfo | null;
export declare function mergeScopes(existing: string[], required: string[]): string[];
export declare function isStepUpRequired(statusCode: number, headers: Record<string, string>): StepUpInfo | null;
+17
View File
@@ -0,0 +1,17 @@
export interface OAuthTokenData {
accessToken: string;
refreshToken?: string;
expiresAt?: number;
clientInfo?: {
clientId: string;
clientSecret?: string;
};
}
type TokenStore = Record<string, OAuthTokenData>;
export declare function getMcpOauthStoragePath(): string;
export declare function loadToken(serverHost: string, resource: string): OAuthTokenData | null;
export declare function saveToken(serverHost: string, resource: string, token: OAuthTokenData): boolean;
export declare function deleteToken(serverHost: string, resource: string): boolean;
export declare function listTokensByHost(serverHost: string): TokenStore;
export declare function listAllTokens(): TokenStore;
export {};