@khalilgharbaoui/opencode-claude-code-plugin 0.48.0 → 0.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -404,6 +404,7 @@ interface ClaudeCodeConfig {
404
404
  mcpConfig?: string | string[];
405
405
  strictMcpConfig?: boolean;
406
406
  bridgeOpencodeMcp?: boolean;
407
+ bridgeMcpOauthTokens?: boolean;
407
408
  controlRequestBehavior?: ControlRequestBehavior;
408
409
  controlRequestToolBehaviors?: Record<string, ControlRequestBehavior>;
409
410
  controlRequestDenyMessage?: string;
@@ -586,6 +587,25 @@ interface ClaudeCodeProviderSettings {
586
587
  * the same MCP servers opencode is configured with.
587
588
  */
588
589
  bridgeOpencodeMcp?: boolean;
590
+ /**
591
+ * Give a bridged remote MCP server the OAuth bearer token opencode already
592
+ * holds for it, so the Claude CLI can use a server you authenticated
593
+ * through opencode's own OAuth flow instead of reporting it `needs-auth`
594
+ * for the whole session.
595
+ *
596
+ * **Off by default, and deliberately.** You authenticated that server to
597
+ * opencode; this copies the token into the private config file the plugin
598
+ * writes for a second program, which then lets a model drive calls with it.
599
+ * That is your decision rather than a default. Nothing is read from
600
+ * opencode's credential store unless this is `true`.
601
+ *
602
+ * opencode 1 only: opencode 2 keeps MCP credentials in its database behind
603
+ * a typed plugin domain rather than in the `mcp-auth.json` file this reads,
604
+ * so the option finds nothing there. A server with no usable token is
605
+ * bridged exactly as it is today, never dropped, and an `Authorization`
606
+ * header you set yourself always wins.
607
+ */
608
+ bridgeMcpOauthTokens?: boolean;
589
609
  /**
590
610
  * Behavior for Claude CLI `control_request` permission checks
591
611
  * (`subtype: can_use_tool`) when `skipPermissions` is false.
@@ -1388,6 +1408,17 @@ declare class ClaudeCodeLanguageModel implements LanguageModelV3 {
1388
1408
  }
1389
1409
 
1390
1410
  type McpHostApi = "v1" | "v2";
1411
+ /**
1412
+ * How a bridge call reaches opencode's MCP OAuth store.
1413
+ *
1414
+ * `oauthTokens` is the `bridgeMcpOauthTokens` provider option and is false
1415
+ * unless the operator set it. `stateDir` exists so a spec can point the read
1416
+ * at a scratch directory; production callers never pass it.
1417
+ */
1418
+ interface McpBridgeAuthOptions {
1419
+ oauthTokens?: boolean;
1420
+ stateDir?: string;
1421
+ }
1391
1422
  interface BridgedMcp {
1392
1423
  /** Path to the temp file containing the translated `--mcp-config`. */
1393
1424
  path: string;
@@ -1429,8 +1460,12 @@ type RuntimeMcpStatus = Record<string, string>;
1429
1460
  * translate each server to Claude CLI format, write a scratch file, and
1430
1461
  * return its path + a stable hash. Returns null when no enabled MCP servers
1431
1462
  * remain after the merge + overlay.
1463
+ *
1464
+ * @param stateDir Override the opencode state directory (`~/.local/share/opencode`
1465
+ * by default) where `mcp-auth.json` is read from. Exposed for
1466
+ * testing; production callers should omit it.
1432
1467
  */
1433
- declare function bridgeOpencodeMcp(cwd: string, runtimeStatus?: RuntimeMcpStatus, excludeServers?: ReadonlySet<string>, hostApi?: McpHostApi): BridgedMcp | null;
1468
+ declare function bridgeOpencodeMcp(cwd: string, runtimeStatus?: RuntimeMcpStatus, excludeServers?: ReadonlySet<string>, hostApi?: McpHostApi, auth?: McpBridgeAuthOptions): BridgedMcp | null;
1434
1469
 
1435
1470
  type AgentRecord = {
1436
1471
  mode?: string;