Skip to content

thv llm: tool adapter registry and per-tool implementations #5030

@yrobla

Description

@yrobla

Context

Part of #5016 (RFC: stacklok/toolhive-rfcs#70). Depends on #5028 (token lifecycle) and #5029 (proxy).

Scope

Registry interface:

  • Detect() bool, Apply(config) error, Revert() error interface for tool adapters
  • Auto-discovery registry — adding a new tool requires only implementing the interface and registering; no changes to setup/teardown orchestration

Token helper (direct) mode tools:

  • Claude Code — patches apiKeyHelper and base URL in ~/.claude/settings.json
  • Gemini CLI — patches token command and base URL in Gemini CLI's config

Proxy mode tools:

  • Cursor — patches base URL and placeholder API key in Cursor's config
  • VS Code (GitHub Copilot) — patches base URL and placeholder API key in VS Code's settings
  • Apple Xcode — patches base URL and placeholder API key in Xcode's config

Acceptance Criteria

  • AT: Claude Code is configured as a token helper tool — setup patches apiKeyHelper and base URL in ~/.claude/settings.json
  • AT: Gemini CLI is configured as a token helper tool — setup patches token command and base URL in Gemini CLI's config
  • AT: Cursor is configured as a proxy-mode tool — setup patches base URL and placeholder API key in Cursor's config
  • AT: VS Code (GitHub Copilot) is configured as a proxy-mode tool — setup patches base URL and placeholder API key in VS Code's settings
  • AT: Apple Xcode is configured as a proxy-mode tool — setup patches base URL and placeholder API key in Xcode's config
  • Adding a new tool requires only implementing Detect/Apply/Revert and registering — no changes to orchestration, proxy, or token source

Dependencies

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliChanges that impact CLI functionalityenhancementNew feature or requestgoPull requests that update go codellm gatewayLLM gateway authentication feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions