Skip to content

Commit 4bb80f0

Browse files
JAORMXclaude
andauthored
Refresh docs/arch/ to match current codebase (#5388)
The architecture docs had drifted since the v1beta1 graduation and the migration of several packages into toolhive-core. This refresh cross-references every claim against the current code in both repos and brings the docs back in sync. Highlights: - Repoint moved packages: pkg/permissions, pkg/registry/types, pkg/registry/data/registry.json, secrets/aes key derivation, runtime monitor, and the registry-api manager - Expand the operator CRD inventory: add EmbeddingServer (Auxiliary, StatefulSet) and MCPWebhookConfig; rename ToolConfig -> MCPToolConfig - Fix CRD field paths: spec.config.compositeToolRefs; spec.incomingAuth.oidcConfigRef on VirtualMCPServer; MCPGroupRef consumers expanded to all four CRDs - Rewrite vMCP middleware order to match server.go wrap order; correct Reporter interface naming; note logging reporter is Debug-level - Add Cluster mode to the auth-server storage doc; flatten the timeouts CRD shape; fix sentinelTls casing; surface DCRCredentialStore - Replace stale registry pieces: built-in catalog source, legacy top-level JSON examples, registry-API endpoint paths (/v0.1/servers, /v0.1/servers/:name/versions/latest), deprecation of thv group run - Expand transport docs: NamedMiddleware constructor type; MCP env vars emitted only by pkg/runtime/setup.go; 127.0.0.1 default lives in the config builder; SSE rewrite in sse_response_processor.go - Complete middleware enumeration in 02 and 05 (upstreamswap, awssts, obo, ratelimit, usagemetrics, recovery, header-forward, validating- webhook, mutating-webhook); fix authz -> authorization constant - Restore pkg/secrets/types.go reference (EnvVarPrefix + Provider interface); point pod builder at pkg/controllerutil - Skills: replace nonexistent skillsvc.go with real file inventory; add GET /content endpoint; mark oci_tags as reserved; correct OCI artifact name-match (last path component) - Smaller fixes: OrbStack across runtime lists; runtime detection order Podman -> Docker -> Colima; drop bogus TOOLHIVE_DETACHED env var and SENTRY_TRACES_SAMPLE_RATE env-var fallback; add unknown and policy_stopped lifecycle states; add inspector transport - Preserve correct StatefulSet wording throughout (proxy-runner is a Deployment; the MCP server pod is a StatefulSet created via pkg/container/kubernetes/client.go applyStatefulSet) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8fbc935 commit 4bb80f0

15 files changed

Lines changed: 299 additions & 227 deletions

docs/arch/00-overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ thv run go://package-name
8787

8888
Manages MCP servers in Kubernetes clusters using custom resources.
8989

90-
The operator watches for `MCPServer`, `MCPRegistry`, `MCPToolConfig`, `MCPExternalAuthConfig`, `MCPGroup`, and `VirtualMCPServer` CRDs, reconciling them into Kubernetes resources (Deployments, StatefulSets, Services).
90+
The operator watches a layered set of CRDs (Core: `MCPServer`, `MCPRemoteProxy`, `MCPServerEntry`; Organization: `MCPGroup`; Aggregation: `VirtualMCPServer`, `VirtualMCPCompositeToolDefinition`; Discovery: `MCPRegistry`; Configuration: `MCPToolConfig`, `MCPExternalAuthConfig`, `MCPOIDCConfig`, `MCPTelemetryConfig`, `MCPWebhookConfig`; Auxiliary: `EmbeddingServer`) and reconciles them into Kubernetes resources (proxy-runner Deployments and Services; ConfigMaps; the MCP server itself is created as a StatefulSet by the proxy-runner, while `EmbeddingServer`'s StatefulSet is created by the operator directly). See [Operator Architecture](09-operator-architecture.md) for the full taxonomy.
9191

9292
**For details**, see:
9393
- [`cmd/thv-operator/README.md`](../../cmd/thv-operator/README.md) - Operator overview and usage
@@ -173,7 +173,7 @@ Via [ToolHive Studio](https://github.com/stacklok/toolhive-studio):
173173

174174
Everything is driven by `thv-operator`:
175175
- Listens for Kubernetes custom resources
176-
- Creates Kubernetes-native resources (Deployments, StatefulSets, Services)
176+
- Creates Kubernetes-native resources (Deployments, Services, ConfigMaps for the proxy-runner; StatefulSets are created by the proxy-runner for MCP server pods)
177177
- Uses `thv-proxyrunner` binary (not `thv`)
178178
- Provides cluster-scale management
179179

docs/arch/01-deployment-modes.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ graph LR
1515
Operator[Operator Mode<br/>thv-operator]
1616
end
1717
18-
CLI --> Docker[Docker/Podman<br/>Colima<br/>Rancher Desktop]
18+
CLI --> Docker[Docker/Podman<br/>Colima<br/>Rancher Desktop<br/>OrbStack]
1919
UI --> Docker
2020
Operator --> K8s[Kubernetes]
2121
@@ -31,7 +31,7 @@ graph LR
3131
| Feature | Local CLI | Local UI | Kubernetes |
3232
|---------|-----------|----------|------------|
3333
| **Binary** | `thv` | `thv` (API server) | `thv-operator` + `thv-proxyrunner` |
34-
| **Container Runtime** | Docker/Podman/Colima/Rancher | Docker/Podman/Colima/Rancher | Kubernetes |
34+
| **Container Runtime** | Docker/Podman/Colima/Rancher/OrbStack | Docker/Podman/Colima/Rancher/OrbStack | Kubernetes |
3535
| **Process Management** | Detached processes | API-managed | Operator-managed |
3636
| **State Storage** | Local filesystem | Local filesystem | etcd (K8s API) |
3737
| **Scaling** | Single machine | Single machine | Cluster-wide |
@@ -45,7 +45,7 @@ graph LR
4545
graph TB
4646
User[User] -->|CLI Commands| THV[thv binary]
4747
THV -->|spawn detached| Proxy[Proxy Process]
48-
Proxy -->|Docker API| Runtime[Container Runtime<br/>Docker/Podman/Colima]
48+
Proxy -->|Docker API| Runtime[Container Runtime<br/>Docker/Podman/Colima<br/>Rancher Desktop/OrbStack]
4949
Runtime -->|creates| Container[MCP Server Container]
5050
Proxy -->|stdin/stdout or HTTP| Container
5151
Client[MCP Client] -->|HTTP/SSE/Streamable| Proxy
@@ -65,7 +65,7 @@ graph TB
6565
- Instantiates workloads API (`pkg/workloads/manager.go`)
6666

6767
3. **Workload Manager**:
68-
- Detects available container runtime (Podman → ColimaDocker)
68+
- Detects available container runtime (Podman → DockerColima)
6969
- Creates container via Runtime API
7070
- Spawns detached proxy process
7171

@@ -76,13 +76,14 @@ graph TB
7676
- Exposes local HTTP endpoint for MCP clients
7777

7878
5. **State Management**:
79-
- RunConfig saved to `~/.toolhive/state/` (or XDG equivalent)
80-
- PID file for process management
81-
- Status file for workload state tracking
79+
- RunConfig saved under `$XDG_STATE_HOME/toolhive/runconfigs/`
80+
- PID file in `$XDG_DATA_HOME/toolhive/pids/` for process management
81+
- Status file in `$XDG_DATA_HOME/toolhive/statuses/` for workload state tracking
82+
- See the platform path table below for full XDG layout
8283

8384
### Container Runtime Selection
8485

85-
**Implementation**: `pkg/container/factory.go`
86+
**Implementation**: `pkg/container/docker/sdk/factory.go` (with per-runtime socket discovery in `pkg/container/docker/sdk/client_unix.go`)
8687

8788
The CLI automatically detects container runtimes in this order:
8889

@@ -93,18 +94,18 @@ The CLI automatically detects container runtimes in this order:
9394
- `~/.local/share/containers/podman/machine/podman.sock` (Podman Machine on macOS)
9495
- `$TMPDIR/podman/*-api.sock` (Podman Machine API on macOS)
9596

96-
2. **Colima** - Checks for Colima socket at:
97-
- `$TOOLHIVE_COLIMA_SOCKET` (if set)
98-
- `~/.colima/default/docker.sock`
99-
100-
3. **Docker** (including Docker Desktop, Rancher Desktop, and OrbStack) - Checks for Docker socket at:
97+
2. **Docker** (including Docker Desktop, Rancher Desktop, and OrbStack) - Checks for Docker socket at:
10198
- `$TOOLHIVE_DOCKER_SOCKET` (if set)
10299
- `/var/run/docker.sock`
103100
- `~/.docker/run/docker.sock` (Docker Desktop on macOS)
104101
- `~/.docker/desktop/docker.sock` (Docker Desktop on Linux)
105102
- `~/.rd/docker.sock` (Rancher Desktop on macOS)
106103
- `~/.orbstack/run/docker.sock` (OrbStack on macOS)
107104

105+
3. **Colima** - Checks for Colima socket at:
106+
- `$TOOLHIVE_COLIMA_SOCKET` (if set)
107+
- `~/.colima/default/docker.sock`
108+
108109
### Detached Process Model
109110

110111
When running in detached mode (`thv run` without `--foreground`):
@@ -129,9 +130,8 @@ sequenceDiagram
129130

130131
**Key Implementation**:
131132
- `pkg/workloads/manager.go` - `RunWorkloadDetached` method
132-
- Uses `exec.Command` with `SysProcAttr` to detach
133-
- Sets `TOOLHIVE_DETACHED=true` environment variable
134-
- Redirects stdout/stderr to log file: `~/.toolhive/logs/<workload>.log`
133+
- Uses `exec.Command` with `SysProcAttr` (`Setsid` on Unix, equivalent flag on Windows) to detach from the parent session
134+
- Redirects stdout/stderr to log file under `$XDG_DATA_HOME/toolhive/logs/<workload>.log`
135135

136136
### File Locations
137137

@@ -186,7 +186,7 @@ graph TB
186186

187187
5. **Runtime Selection**:
188188
- Picks runtime driver based on environment
189-
- Docker, Podman, or Rancher Desktop
189+
- Docker, Podman, Colima, OrbStack, or Rancher Desktop (same set as CLI mode)
190190
- Uses driver API to spawn containers
191191

192192
### API Endpoints
@@ -231,7 +231,7 @@ Available flags:
231231
|------|-------------|-------------|
232232
| `--sentry-dsn` | `SENTRY_DSN` | Sentry Data Source Name (required to enable) |
233233
| `--sentry-environment` | `SENTRY_ENVIRONMENT` | Environment name (e.g. `production`, `development`) |
234-
| `--sentry-traces-sample-rate` | `SENTRY_TRACES_SAMPLE_RATE` | Trace sampling rate, 0.0–1.0 (default: `1.0`) |
234+
| `--sentry-traces-sample-rate` | | Trace sampling rate, 0.0–1.0 (default: `1.0`) |
235235

236236
When no DSN is configured, all Sentry operations are no-ops with zero overhead.
237237

@@ -281,7 +281,7 @@ graph TB
281281

282282
3. **Operator creates Deployment**:
283283
- Runs `thv-proxyrunner` container
284-
- Mounts RunConfig as ConfigMap or secret
284+
- Mounts RunConfig as ConfigMap
285285
- Applies middleware configuration
286286

287287
4. **Proxy runner creates StatefulSet**:

docs/arch/02-core-concepts.md

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ A **workload** is the fundamental deployment unit in ToolHive. It represents eve
3838
- `error` - Workload encountered an error
3939
- `unhealthy` - Workload is running but unhealthy
4040
- `unauthenticated` - Remote workload cannot authenticate (expired tokens)
41+
- `unknown` - Workload status cannot be determined
42+
- `policy_stopped` - Workload was stopped by policy enforcement
4143

4244
**Implementation:**
4345
- Interface: `pkg/workloads/manager.go`
@@ -50,7 +52,7 @@ A **workload** is the fundamental deployment unit in ToolHive. It represents eve
5052

5153
A **transport** defines how MCP clients communicate with MCP servers. It encapsulates the protocol and proxy implementation.
5254

53-
**Three types:**
55+
**Transport types:**
5456

5557
1. **stdio**: Standard input/output communication
5658
- Container speaks stdin/stdout
@@ -67,6 +69,10 @@ A **transport** defines how MCP clients communicate with MCP servers. It encapsu
6769
- Transparent HTTP proxy (same as SSE)
6870
- Session management via headers
6971

72+
4. **inspector**: Debug-only transport
73+
- Special transport used for the MCP Inspector tooling
74+
- Not intended for production workloads
75+
7076
**Implementation:**
7177
- Interface: `pkg/transport/types/transport.go`
7278
- Types: `pkg/transport/types/transport.go`
@@ -112,18 +118,24 @@ A **proxy** is the component that sits between MCP clients and MCP servers, forw
112118

113119
- **Authentication** (`auth`) - JWT token validation
114120
- **Token Exchange** (`tokenexchange`) - OAuth token exchange
121+
- **Upstream Swap** (`upstreamswap`) - Swap ToolHive JWTs for upstream IdP tokens (embedded auth server)
122+
- **AWS STS** (`awssts`) - Exchange tokens for AWS STS credentials
123+
- **OBO** (`obo`) - On-Behalf-Of token flow
115124
- **MCP Parser** (`mcp-parser`) - JSON-RPC parsing
116125
- **Tool Filter** (`tool-filter`) - Filter and override tools in `tools/list` responses
117126
- **Tool Call Filter** (`tool-call-filter`) - Validate and map `tools/call` requests
127+
- **Rate Limit** (`ratelimit`) - Per-client request rate limiting
118128
- **Usage Metrics** (`usagemetrics`) - Anonymous usage metrics for ToolHive development (opt-out: `thv config usage-metrics disable`)
119129
- **Telemetry** (`telemetry`) - OpenTelemetry instrumentation
120130
- **Authorization** (`authorization`) - Cedar policy evaluation
121131
- **Audit** (`audit`) - Request logging
132+
- **Recovery** (`recovery`) - Panic recovery for the proxy chain
133+
- **Header Forward** (`header-forward`) - Forward selected request headers to upstream
134+
- **Validating Webhook** (`validating-webhook`) - Call external validating webhooks
135+
- **Mutating Webhook** (`mutating-webhook`) - Call external mutating webhooks
122136

123137
**Execution order (request flow):**
124-
Middleware applied in reverse configuration order. Requests flow through: Audit* → Authorization* → Telemetry* → Usage Metrics* → Parser → Token Exchange* → Auth → Tool Call Filter* → Tool Filter* → MCP Server
125-
126-
(*optional middleware, only present if configured)
138+
Middleware is applied in reverse configuration order, and the chain composed for a given workload depends on which features are enabled. See [`docs/middleware.md`](../middleware.md) for the complete chain, ordering rules, and per-middleware semantics.
127139

128140
**Implementation:**
129141
- Interface: `pkg/transport/types/transport.go`
@@ -187,9 +199,7 @@ A **permission profile** defines security boundaries for MCP servers:
187199
- `network` - Full network access
188200

189201
**Implementation:**
190-
- Definition: `pkg/permissions/profile.go`
191-
- Network: `pkg/permissions/profile.go`
192-
- Mount declarations: `pkg/permissions/profile.go`
202+
- Definition, network permissions, and mount declarations: `github.com/stacklok/toolhive-core/permissions` (imported as `permissions` in `pkg/runner/`)
193203

194204
**Related concepts:** RunConfig, Workload, Security
195205

@@ -323,7 +333,7 @@ A **registry** is a catalog of MCP server definitions with metadata, configurati
323333
- `groups` - Predefined groups of servers
324334

325335
**Implementation:**
326-
- Registry types: `pkg/registry/types.go`
336+
- Registry types: `github.com/stacklok/toolhive-core/registry/types`
327337
- Provider abstraction: `pkg/registry/provider.go`, `pkg/registry/factory.go`
328338
- Local provider: `pkg/registry/provider_local.go`
329339
- Remote provider: `pkg/registry/provider_remote.go`
@@ -389,11 +399,15 @@ A **runtime** is an abstraction over container orchestration systems. It provide
389399
- `IsWorkloadRunning` - Check if running
390400

391401
**Runtime detection:**
392-
Order: Podman → Colima → Docker → Kubernetes (via env)
402+
Runtimes are registered with a numeric `Priority` (lower wins) in the runtime registry (`pkg/container/runtime/registry.go`). Today the registered runtimes are:
403+
404+
- **Docker runtime** (`Priority: 100`, registered in `pkg/container/docker/register.go`) — covers Docker, Podman, Colima, Rancher Desktop, and OrbStack via per-runtime socket discovery (Podman → Docker → Colima).
405+
- **Kubernetes runtime** (`Priority: 200`, registered in `pkg/container/kubernetes/register.go`) — activated when running in-cluster (via `KUBERNETES_SERVICE_HOST`) or when `TOOLHIVE_RUNTIME=kubernetes` is set.
393406

394407
**Implementation:**
395408
- Interface: `pkg/container/runtime/types.go`
396-
- Factory: `pkg/container/factory.go`
409+
- Registry: `pkg/container/runtime/registry.go`
410+
- Docker SDK factory and socket discovery: `pkg/container/docker/sdk/factory.go`, `pkg/container/docker/sdk/client_unix.go`
397411
- Detection: `pkg/container/runtime/types.go`
398412

399413
**Related concepts:** Deployer, Workload, Container
@@ -449,7 +463,7 @@ A **skill** is an Agent Skill -- a markdown-based instruction set (SKILL.md) tha
449463
5. **Uninstall** - Remove files and metadata
450464

451465
**Implementation:**
452-
- Service: `pkg/skills/skillsvc/skillsvc.go`
466+
- Service interface: `pkg/skills/service.go`; implementation in `pkg/skills/skillsvc/` (entry point `pkg/skills/skillsvc/service.go`)
453467
- Types: `pkg/skills/types.go`
454468
- Storage: `pkg/storage/sqlite/skill_store.go`
455469
- CLI: `cmd/thv/app/skill*.go`
@@ -480,7 +494,7 @@ A **skill** is an Agent Skill -- a markdown-based instruction set (SKILL.md) tha
480494
2. Start proxy
481495
3. Configure authentication (if needed)
482496
4. Apply middleware
483-
4. Update state
497+
5. Update state
484498

485499
**Commands:**
486500
- `thv run <image|url>` - Deploy and start
@@ -717,7 +731,7 @@ See `pkg/audit/mcp_events.go` for complete list of event types.
717731
- Shutdown if unhealthy
718732

719733
**Implementation:**
720-
- Monitor: `pkg/container/docker/monitor.go`
734+
- Monitor: `pkg/container/runtime/monitor.go`
721735
- Health checker: `pkg/healthcheck/healthcheck.go`
722736

723737
**Related concepts:** Workload, Transport, Proxy
@@ -759,7 +773,7 @@ graph LR
759773
style Chain fill:#fff9c4
760774
```
761775

762-
Requests pass through up to 9 middleware components (Auth, Token Exchange, Tool Filter, Tool Call Filter, Parser, Usage Metrics, Telemetry, Authorization, Audit). See `docs/middleware.md` for complete middleware architecture and execution order.
776+
Requests pass through a configurable chain of middleware components. See [`docs/middleware.md`](../middleware.md) for the complete chain and execution order.
763777

764778
### Data Hierarchy
765779

docs/arch/03-transport-architecture.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,9 @@ graph LR
226226
```
227227

228228
**Implementation:**
229-
- `pkg/transport/types/transport.go` - MiddlewareFunction type
229+
- `pkg/transport/types/transport.go` - `MiddlewareFunction` and `NamedMiddleware` types
230230
- Middleware applied in reverse order (last registered = outermost)
231-
- Each transport type accepts `[]MiddlewareFunction` in constructor
231+
- Each transport type accepts `[]NamedMiddleware` in constructor (each wraps a `MiddlewareFunction` with its name for logging)
232232

233233
## Remote MCP Server Proxying
234234

@@ -446,25 +446,23 @@ ToolHive uses two port concepts:
446446

447447
### MCP Environment Variables
448448

449-
**Implementation**: `pkg/transport/http.go`
449+
**Implementation**: `pkg/environment/environment.go` sets `MCP_TRANSPORT`, `MCP_PORT`, and `FASTMCP_PORT` for the CLI/local path. `pkg/runtime/setup.go` sets all four variables (`MCP_TRANSPORT`, `MCP_PORT`, `FASTMCP_PORT`, and `MCP_HOST`) when deploying workloads through the runtime (used by both local and Kubernetes/proxy-runner paths). The `TargetHost` default of `127.0.0.1` (`transport.LocalhostIPv4`) is established by `WithTargetHost` in `pkg/runner/config_builder.go` (around line 204), not by the env-emitting code — both code paths simply read `RunConfig.TargetHost`.
450450

451451
Environment variables set automatically for container configuration:
452452

453453
- `MCP_TRANSPORT`: Transport type (stdio, sse, streamable-http)
454454
- `MCP_PORT`: Target port (for SSE/Streamable HTTP)
455-
- `MCP_HOST`: Target host - always `127.0.0.1` (both local and Kubernetes)
455+
- `MCP_HOST`: Target host - defaults to `127.0.0.1` (`transport.LocalhostIPv4`), with the default applied by `WithTargetHost` in `pkg/runner/config_builder.go` when `RunConfig.TargetHost` is empty
456456
- `FASTMCP_PORT`: Alias for `MCP_PORT` (legacy support)
457457

458458
**Architecture distinction:**
459-
- **Target host** (`MCP_HOST` env var): Where container listens - always `127.0.0.1`
460-
- **Proxy host**: Where proxy binds - `127.0.0.1` in local mode, `0.0.0.0` in Kubernetes for cluster access
459+
- **Target host** (`MCP_HOST` env var): Where the container's MCP server listens - defaults to `127.0.0.1`
460+
- **Proxy host**: Where the proxy binds - `127.0.0.1` in local mode, `0.0.0.0` in Kubernetes for cluster access
461461

462462
**Merge strategy**:
463463
- User-provided values take precedence
464464
- ToolHive sets deployment-appropriate defaults
465465

466-
**Reference**: PR #1890 - Runtime Authoring Guide
467-
468466
## Container Attach (Stdio Transport)
469467

470468
For stdio transport, ToolHive attaches to container stdin/stdout:
@@ -484,7 +482,7 @@ stdin, stdout, err := t.deployer.AttachToWorkload(ctx, t.containerName)
484482
5. **Framing** - Newline-delimited JSON-RPC messages
485483

486484
**Monitoring:**
487-
- Container monitor detects exit: `pkg/container/docker/monitor.go`
485+
- Container monitor detects exit: `pkg/container/runtime/monitor.go`
488486
- Proxy automatically stopped on container exit
489487
- Workload status updated
490488

@@ -625,7 +623,7 @@ spec:
625623
trustProxyHeaders: true
626624
```
627625
628-
**Implementation**: `pkg/transport/proxy/transparent/transparent_proxy.go` - `rewriteEndpointURL()`, `getSSERewriteConfig()`
626+
**Implementation**: `pkg/transport/proxy/transparent/sse_response_processor.go` - `rewriteEndpointURL()`, `getSSERewriteConfig()`
629627

630628
## Transport Factory
631629

docs/arch/04-secrets-management.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ graph LR
2626

2727
## Provider Types
2828

29-
**Implementation**: `pkg/secrets/types.go`
29+
**Implementation**:
30+
- `pkg/secrets/factory.go` (`ProviderType` enum: `EncryptedType`, `OnePasswordType`, `EnvironmentType`)
31+
- `pkg/secrets/types.go` defines the `Provider` interface (the contract every provider implements) and the `EnvVarPrefix` constant (`"TOOLHIVE_SECRET_"`) used by the environment provider
3032

3133
### 1. Encrypted
3234

@@ -68,7 +70,7 @@ MCPServer resources reference Kubernetes Secrets via `SecretRef`. Secrets are in
6870

6971
**Implementation**:
7072
- CRD types: `cmd/thv-operator/api/v1beta1/mcpserver_types.go`
71-
- Pod builder: `cmd/thv-operator/controllers/mcpserver_podtemplatespec_builder.go`
73+
- Pod builder: `cmd/thv-operator/pkg/controllerutil/podtemplatespec_builder.go`
7274

7375
### External Authentication Secrets
7476

@@ -79,7 +81,7 @@ OAuth/OIDC client secrets are stored in Kubernetes Secrets and referenced using
7981
- **Secret injection**: `cmd/thv-operator/pkg/controllerutil/tokenexchange.go`
8082

8183
2. **OIDC Authentication (MCPOIDCConfig)**: OIDC client secrets for token introspection
82-
- **CRD field**: `InlineOIDCSharedConfig.ClientSecretRef` in `cmd/thv-operator/api/v1beta1/mcpoidcconfig_types.go`
84+
- **CRD field**: `spec.inline.clientSecretRef` on the `MCPOIDCConfig` resource (Go: `MCPOIDCConfig.Spec.Inline.ClientSecretRef`, where `Inline` is of type `*InlineOIDCSharedConfig`), defined in `cmd/thv-operator/api/v1beta1/mcpoidcconfig_types.go`
8385
- **Secret injection**: `cmd/thv-operator/pkg/controllerutil/oidc.go`
8486
- **Runtime loading**: `pkg/auth/token.go` (via `TOOLHIVE_OIDC_CLIENT_SECRET` environment variable)
8587

@@ -134,7 +136,7 @@ thv run my-server --secret "api-key,target=API_KEY"
134136
- Log exposure: ✅
135137
- Malicious container: ❌ (has env access)
136138

137-
**Implementation**: `pkg/secrets/aes/aes.go`, `pkg/secrets/keyring/`
139+
**Implementation**: `pkg/secrets/aes/aes.go` (AES-256-GCM), `pkg/secrets/keyring/` (OS keyring storage), `pkg/secrets/factory.go` (SHA-256 key derivation via `sha256.Sum256(secretsPassword)`)
138140

139141
## Integration Points
140142

0 commit comments

Comments
 (0)