diff options
Diffstat (limited to 'packages/sdk/js/src')
| -rw-r--r-- | packages/sdk/js/src/gen/sdk.gen.ts | 91 | ||||
| -rw-r--r-- | packages/sdk/js/src/gen/types.gen.ts | 175 |
2 files changed, 249 insertions, 17 deletions
diff --git a/packages/sdk/js/src/gen/sdk.gen.ts b/packages/sdk/js/src/gen/sdk.gen.ts index d04277cbc..af69b42ff 100644 --- a/packages/sdk/js/src/gen/sdk.gen.ts +++ b/packages/sdk/js/src/gen/sdk.gen.ts @@ -148,6 +148,18 @@ import type { McpAddData, McpAddResponses, McpAddErrors, + McpAuthRemoveData, + McpAuthRemoveResponses, + McpAuthRemoveErrors, + McpAuthStartData, + McpAuthStartResponses, + McpAuthStartErrors, + McpAuthCallbackData, + McpAuthCallbackResponses, + McpAuthCallbackErrors, + McpAuthAuthenticateData, + McpAuthAuthenticateResponses, + McpAuthAuthenticateErrors, LspStatusData, LspStatusResponses, FormatterStatusData, @@ -847,6 +859,68 @@ class App extends _HeyApiClient { } } +class Auth extends _HeyApiClient { + /** + * Remove OAuth credentials for an MCP server + */ + public remove<ThrowOnError extends boolean = false>(options: Options<McpAuthRemoveData, ThrowOnError>) { + return (options.client ?? this._client).delete<McpAuthRemoveResponses, McpAuthRemoveErrors, ThrowOnError>({ + url: "/mcp/{name}/auth", + ...options, + }) + } + + /** + * Start OAuth authentication flow for an MCP server + */ + public start<ThrowOnError extends boolean = false>(options: Options<McpAuthStartData, ThrowOnError>) { + return (options.client ?? this._client).post<McpAuthStartResponses, McpAuthStartErrors, ThrowOnError>({ + url: "/mcp/{name}/auth", + ...options, + }) + } + + /** + * Complete OAuth authentication with authorization code + */ + public callback<ThrowOnError extends boolean = false>(options: Options<McpAuthCallbackData, ThrowOnError>) { + return (options.client ?? this._client).post<McpAuthCallbackResponses, McpAuthCallbackErrors, ThrowOnError>({ + url: "/mcp/{name}/auth/callback", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }) + } + + /** + * Start OAuth flow and wait for callback (opens browser) + */ + public authenticate<ThrowOnError extends boolean = false>(options: Options<McpAuthAuthenticateData, ThrowOnError>) { + return (options.client ?? this._client).post<McpAuthAuthenticateResponses, McpAuthAuthenticateErrors, ThrowOnError>( + { + url: "/mcp/{name}/auth/authenticate", + ...options, + }, + ) + } + + /** + * Set authentication credentials + */ + public set<ThrowOnError extends boolean = false>(options: Options<AuthSetData, ThrowOnError>) { + return (options.client ?? this._client).put<AuthSetResponses, AuthSetErrors, ThrowOnError>({ + url: "/auth/{id}", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }) + } +} + class Mcp extends _HeyApiClient { /** * Get MCP server status @@ -871,6 +945,7 @@ class Mcp extends _HeyApiClient { }, }) } + auth = new Auth({ client: this._client }) } class Lsp extends _HeyApiClient { @@ -1042,22 +1117,6 @@ class Tui extends _HeyApiClient { control = new Control({ client: this._client }) } -class Auth extends _HeyApiClient { - /** - * Set authentication credentials - */ - public set<ThrowOnError extends boolean = false>(options: Options<AuthSetData, ThrowOnError>) { - return (options.client ?? this._client).put<AuthSetResponses, AuthSetErrors, ThrowOnError>({ - url: "/auth/{id}", - ...options, - headers: { - "Content-Type": "application/json", - ...options.headers, - }, - }) - } -} - class Event extends _HeyApiClient { /** * Get events diff --git a/packages/sdk/js/src/gen/types.gen.ts b/packages/sdk/js/src/gen/types.gen.ts index c640f41a7..5267c0e51 100644 --- a/packages/sdk/js/src/gen/types.gen.ts +++ b/packages/sdk/js/src/gen/types.gen.ts @@ -1103,6 +1103,21 @@ export type McpLocalConfig = { timeout?: number } +export type McpOAuthConfig = { + /** + * OAuth client ID. If not provided, dynamic client registration (RFC 7591) will be attempted. + */ + clientId?: string + /** + * OAuth client secret (if required by the authorization server) + */ + clientSecret?: string + /** + * OAuth scopes to request during authorization + */ + scope?: string +} + export type McpRemoteConfig = { /** * Type of MCP server connection @@ -1123,6 +1138,10 @@ export type McpRemoteConfig = { [key: string]: string } /** + * OAuth authentication configuration for the MCP server. Set to false to disable OAuth auto-detection. + */ + oauth?: McpOAuthConfig | false + /** * Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified. */ timeout?: number @@ -1583,7 +1602,21 @@ export type McpStatusFailed = { error: string } -export type McpStatus = McpStatusConnected | McpStatusDisabled | McpStatusFailed +export type McpStatusNeedsAuth = { + status: "needs_auth" +} + +export type McpStatusNeedsClientRegistration = { + status: "needs_client_registration" + error: string +} + +export type McpStatus = + | McpStatusConnected + | McpStatusDisabled + | McpStatusFailed + | McpStatusNeedsAuth + | McpStatusNeedsClientRegistration export type LspStatus = { id: string @@ -3321,6 +3354,146 @@ export type McpAddResponses = { export type McpAddResponse = McpAddResponses[keyof McpAddResponses] +export type McpAuthRemoveData = { + body?: never + path: { + name: string + } + query?: { + directory?: string + } + url: "/mcp/{name}/auth" +} + +export type McpAuthRemoveErrors = { + /** + * Not found + */ + 404: NotFoundError +} + +export type McpAuthRemoveError = McpAuthRemoveErrors[keyof McpAuthRemoveErrors] + +export type McpAuthRemoveResponses = { + /** + * OAuth credentials removed + */ + 200: { + success: true + } +} + +export type McpAuthRemoveResponse = McpAuthRemoveResponses[keyof McpAuthRemoveResponses] + +export type McpAuthStartData = { + body?: never + path: { + name: string + } + query?: { + directory?: string + } + url: "/mcp/{name}/auth" +} + +export type McpAuthStartErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * Not found + */ + 404: NotFoundError +} + +export type McpAuthStartError = McpAuthStartErrors[keyof McpAuthStartErrors] + +export type McpAuthStartResponses = { + /** + * OAuth flow started + */ + 200: { + /** + * URL to open in browser for authorization + */ + authorizationUrl: string + } +} + +export type McpAuthStartResponse = McpAuthStartResponses[keyof McpAuthStartResponses] + +export type McpAuthCallbackData = { + body?: { + /** + * Authorization code from OAuth callback + */ + code: string + } + path: { + name: string + } + query?: { + directory?: string + } + url: "/mcp/{name}/auth/callback" +} + +export type McpAuthCallbackErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * Not found + */ + 404: NotFoundError +} + +export type McpAuthCallbackError = McpAuthCallbackErrors[keyof McpAuthCallbackErrors] + +export type McpAuthCallbackResponses = { + /** + * OAuth authentication completed + */ + 200: McpStatus +} + +export type McpAuthCallbackResponse = McpAuthCallbackResponses[keyof McpAuthCallbackResponses] + +export type McpAuthAuthenticateData = { + body?: never + path: { + name: string + } + query?: { + directory?: string + } + url: "/mcp/{name}/auth/authenticate" +} + +export type McpAuthAuthenticateErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * Not found + */ + 404: NotFoundError +} + +export type McpAuthAuthenticateError = McpAuthAuthenticateErrors[keyof McpAuthAuthenticateErrors] + +export type McpAuthAuthenticateResponses = { + /** + * OAuth authentication completed + */ + 200: McpStatus +} + +export type McpAuthAuthenticateResponse = McpAuthAuthenticateResponses[keyof McpAuthAuthenticateResponses] + export type LspStatusData = { body?: never path?: never |
