@@ -2246,6 +2246,213 @@ _Response:_
22462246
22472247* result: ` {} `
22482248
2249+ ## Provider Management
2250+
2251+ ### List Providers (↩️)
2252+
2253+ Returns all known providers with their current authentication status and available models.
2254+
2255+ _ Request:_
2256+
2257+ * method: ` providers/list `
2258+ * params: ` {} `
2259+
2260+ _ Response:_
2261+
2262+ * result: ` ProvidersListResult ` defined as follows:
2263+
2264+ ``` typescript
2265+ interface ProvidersListResult {
2266+ providers: ProviderStatus [];
2267+ }
2268+
2269+ interface ProviderStatus {
2270+ /** Provider identifier (e.g. "anthropic", "openai"). */
2271+ id: string ;
2272+ /** Human-readable label (e.g. "GitHub Copilot"). */
2273+ label? : string ;
2274+ /** Whether this provider exists in the resolved config. */
2275+ configured: boolean ;
2276+ /** Current authentication state. */
2277+ auth: ProviderAuth ;
2278+ /** Login methods available for this provider, if any. */
2279+ login? : { methods: LoginMethod [] };
2280+ /** Models currently available for this provider. */
2281+ models: ProviderModel [];
2282+ /** Provider-level config key-vals (api, url, fetchModels, httpClient, retryRules, etc.). */
2283+ settings? : Record <string , any >;
2284+ }
2285+
2286+ interface ProviderAuth {
2287+ /** Authentication status. */
2288+ status: ' authenticated' | ' expiring' | ' expired' | ' unauthenticated' | ' local' | ' not-running' ;
2289+ /** Authentication type. */
2290+ type? : ' oauth' | ' api-key' ;
2291+ /** How the credential was resolved. */
2292+ source? : ' config' | ' login' | ' env' ;
2293+ /** Login mode used (e.g. "max", "console", "manual", "pro"). */
2294+ mode? : string ;
2295+ /** Token expiry as epoch seconds. */
2296+ expiresAt? : number ;
2297+ /** Environment variable name when source is "env". */
2298+ envVar? : string ;
2299+ }
2300+
2301+ interface LoginMethod {
2302+ /** Method identifier (e.g. "max", "pro", "api-key", "device"). */
2303+ key: string ;
2304+ /** Human-readable label. */
2305+ label: string ;
2306+ }
2307+
2308+ interface ProviderModel {
2309+ /** Model name without provider prefix. */
2310+ id: string ;
2311+ /** Model capabilities. */
2312+ capabilities: {
2313+ reason: boolean ;
2314+ vision: boolean ;
2315+ tools: boolean ;
2316+ webSearch: boolean ;
2317+ };
2318+ /** Token costs per 1M tokens. */
2319+ cost? : { input: number ; output: number };
2320+ /** Model-level config key-vals (modelName, extraPayload, extraHeaders, reasoningHistory, variants). */
2321+ settings? : Record <string , any >;
2322+ }
2323+ ```
2324+
2325+ ### Login Provider (↩️)
2326+
2327+ Initiates a login flow for a provider. Two-round-trip design: calling without a method returns
2328+ available methods to choose from; calling with a method starts the authentication flow and
2329+ returns an action descriptor telling the client what to render.
2330+
2331+ _ Request:_
2332+
2333+ * method: ` providers/login `
2334+ * params: ` ProvidersLoginParams ` defined as follows:
2335+
2336+ ``` typescript
2337+ interface ProvidersLoginParams {
2338+ /** The provider to log in to (e.g. "anthropic"). */
2339+ provider: string ;
2340+ /** The login method to use. Omit on first call to get available methods. */
2341+ method? : string ;
2342+ }
2343+ ```
2344+
2345+ _ Response:_
2346+
2347+ * result: One of the following action descriptors:
2348+
2349+ ``` typescript
2350+ /** Multiple methods available — client should present choice and re-call with method. */
2351+ interface ChooseMethodAction {
2352+ action: ' choose-method' ;
2353+ methods: LoginMethod [];
2354+ }
2355+
2356+ /** Browser-based OAuth — client opens URL, optionally collects a code. */
2357+ interface AuthorizeAction {
2358+ action: ' authorize' ;
2359+ /** The OAuth authorization URL to open in the browser. */
2360+ url: string ;
2361+ /** Instructional message for the user. */
2362+ message: string ;
2363+ /**
2364+ * Fields to collect after browser auth (e.g. authorization code).
2365+ * If absent, the server handles the callback automatically and
2366+ * completion is signaled via providers/updated notification.
2367+ */
2368+ fields? : InputField [];
2369+ }
2370+
2371+ /** GitHub device flow — client shows code for user to enter at URL. */
2372+ interface DeviceCodeAction {
2373+ action: ' device-code' ;
2374+ /** The verification URL. */
2375+ url: string ;
2376+ /** The user code to enter. */
2377+ code: string ;
2378+ /** Instructional message for the user. */
2379+ message: string ;
2380+ }
2381+
2382+ /** Collect input fields (API key, URL, models). */
2383+ interface InputAction {
2384+ action: ' input' ;
2385+ fields: InputField [];
2386+ }
2387+
2388+ /** Login completed immediately. */
2389+ interface DoneAction {
2390+ action: ' done' ;
2391+ }
2392+
2393+ interface InputField {
2394+ /** Field identifier. */
2395+ key: string ;
2396+ /** Human-readable label. */
2397+ label: string ;
2398+ /** Field type: "secret" for passwords/keys, "text" for regular input. */
2399+ type: ' secret' | ' text' ;
2400+ }
2401+ ```
2402+
2403+ ### Login Provider Input (↩️)
2404+
2405+ Submits collected input data (API key, authorization code, URL, models) to complete a login flow.
2406+
2407+ _ Request:_
2408+
2409+ * method: ` providers/loginInput `
2410+ * params: ` ProvidersLoginInputParams ` defined as follows:
2411+
2412+ ``` typescript
2413+ interface ProvidersLoginInputParams {
2414+ /** The provider being logged in to. */
2415+ provider: string ;
2416+ /** The collected input data. Keys match the field keys from the action descriptor. */
2417+ data: Record <string , string >;
2418+ }
2419+ ```
2420+
2421+ _ Response:_
2422+
2423+ * result: ` { action: 'done' } `
2424+
2425+ ### Logout Provider (↩️)
2426+
2427+ Clears authentication for a provider and re-syncs available models.
2428+
2429+ _ Request:_
2430+
2431+ * method: ` providers/logout `
2432+ * params: ` ProvidersLogoutParams ` defined as follows:
2433+
2434+ ``` typescript
2435+ interface ProvidersLogoutParams {
2436+ /** The provider to log out of. */
2437+ provider: string ;
2438+ }
2439+ ```
2440+
2441+ _ Response:_
2442+
2443+ * result: ` {} `
2444+
2445+ ### Provider Updated (⬅️)
2446+
2447+ A server notification sent when a provider's authentication state or available models change.
2448+ Sent after login completion, logout, token renewal, or model sync. Contains the full provider
2449+ status (same shape as items in ` providers/list ` response).
2450+
2451+ _ Notification:_
2452+
2453+ * method: ` providers/updated `
2454+ * params: ` ProviderStatus ` (see ` providers/list ` response above)
2455+
22492456## General features
22502457
22512458### progress (⬅️)
0 commit comments