@@ -82,6 +82,11 @@ You can create multiple registries from the same sources to serve different
8282audiences. For example, a ` public ` registry with no claims and a ` team-internal `
8383registry with team-scoped claims — both backed by the same source data.
8484
85+ Source names must be valid DNS subdomain labels: lowercase alphanumeric
86+ characters and hyphens, maximum 63 characters (for example, ` toolhive ` ,
87+ ` platform-tools ` , ` k8s-prod ` ). This is required because source names are used as
88+ Kubernetes lease name suffixes for leader election.
89+
8590## Command-line flags
8691
8792| Flag | Description | Required | Default |
@@ -354,21 +359,18 @@ registry entries for deployed MCP servers in your cluster.
354359
355360:::note[Operator-managed source]
356361
357- When using the ToolHive operator, a single Kubernetes source named `default` is
358- automatically created and managed. You cannot configure additional Kubernetes
359- sources through the `MCPRegistry` CR or configuration file, as only one
360- Kubernetes source instance is supported per Registry Server instance.
361-
362- The configuration example below is for reference when running the Registry
363- Server standalone (without the operator).
362+ When using the ToolHive operator, a Kubernetes source named `default` is
363+ automatically created and managed. The configuration examples below are for
364+ reference when running the Registry Server standalone (without the operator).
364365
365366:: :
366367
367- By default, the Registry server discovers resources in all namespaces
368- (cluster-wide). You can restrict discovery to specific namespaces using the
369- ` THV_REGISTRY_WATCH_NAMESPACE` environment variable. See
370- [Workload discovery](./deploy-manual.mdx#workload-discovery) for configuration
371- details and RBAC requirements.
368+ You can configure multiple Kubernetes sources, each watching different
369+ namespaces. By default, a Kubernetes source discovers resources in all
370+ namespaces (cluster-wide). You can restrict discovery to specific namespaces
371+ using the `namespaces` field or the `THV_REGISTRY_WATCH_NAMESPACE` environment
372+ variable. See [Workload discovery](./deploy-manual.mdx#workload-discovery) for
373+ RBAC requirements.
372374
373375` ` ` yaml title="config-kubernetes.yaml"
374376sources:
@@ -383,35 +385,45 @@ registries:
383385
384386**Configuration options:**
385387
386- - `kubernetes` (required) : Empty object or claim mapping configuration (see
387- below)
388+ - `kubernetes` (required) : Empty object or namespace configuration (see below)
389+ - `kubernetes.namespaces` (optional) : List of Kubernetes namespaces to watch. If
390+ empty, falls back to the `THV_REGISTRY_WATCH_NAMESPACE` environment variable,
391+ or all namespaces if neither is set
388392- No sync policy required (Kubernetes sources query live deployments on-demand)
389- - Only one Kubernetes source is supported per Registry Server instance
390393
391- # ### Claim mapping
394+ # ### Per-entry claims via annotation
392395
393- You can map Kubernetes labels or annotations to authorization claims using the
394- ` claimMapping` field. This allows entries discovered from Kubernetes workloads
395- to inherit claims based on their metadata — for example, mapping a `team` label
396- to a claim so that only members of that team can see the entry.
396+ You can set authorization claims on individual Kubernetes workloads using the
397+ ` toolhive.stacklok.dev/authz-claims` JSON annotation. This controls which
398+ authenticated callers can see each entry.
397399
398- ` ` ` yaml title="config-kubernetes-claims.yaml"
399- sources:
400- - name: default
401- format: toolhive
402- kubernetes:
403- claimMapping:
404- 'toolhive.stacklok.dev/team': 'team'
405-
406- registries:
407- - name: default
408- sources: ['default']
400+ ` ` ` yaml title="mcp-server-with-claims.yaml"
401+ apiVersion: toolhive.stacklok.dev/v1alpha1
402+ kind: MCPServer
403+ metadata:
404+ name: deploy-helper
405+ annotations:
406+ toolhive.stacklok.dev/registry-export: 'true'
407+ toolhive.stacklok.dev/registry-url: 'https://mcp.example.com/deploy-helper'
408+ toolhive.stacklok.dev/registry-description: 'Deployment assistant'
409+ # highlight-next-line
410+ toolhive.stacklok.dev/authz-claims: '{"org": "acme", "team": "platform"}'
411+ spec:
412+ # ...
409413` ` `
410414
411- In this example, a workload annotated with
412- `toolhive.stacklok.dev/team : platform` would produce entries with
413- `claims : {team: "platform"}`. See [Authorization](./authorization.mdx) for how
414- claims control entry visibility.
415+ Entry claims come exclusively from the annotation — source-level claims are
416+ **not** inherited. Entries without the annotation have no claims, which means
417+ they are visible in anonymous mode but invisible when authorization is
418+ configured.
419+
420+ If the annotation contains invalid JSON or unsupported claim value types
421+ (anything other than strings or arrays of strings), the entry is **skipped
422+ entirely** and a warning is logged. The entry will not sync until the annotation
423+ is fixed.
424+
425+ See [Authorization](./authorization.mdx) for how claims control entry
426+ visibility.
415427
416428:::info[How does it work?]
417429
@@ -454,6 +466,7 @@ spec:
454466| `toolhive.stacklok.dev/registry-title` | No | Human-friendly display name for the registry entry (overrides the generated name) |
455467| `toolhive.stacklok.dev/tools` | No | JSON array of tool name strings (e.g., `["get_weather","get_forecast"]`) |
456468| `toolhive.stacklok.dev/tool-definitions` | No | JSON array of tool definitions with MCP tool metadata (name, description, schema) |
469+ | `toolhive.stacklok.dev/authz-claims` | No | JSON object of authorization claims for per-entry visibility control |
457470
458471**Tool definitions format:**
459472
@@ -492,8 +505,8 @@ The registry URL from the `registry-url` annotation becomes a key in the JSON
492505structure.
493506
494507This feature requires the Registry server to be granted access to those
495- resources via a Service Account, check the details in the
496- [deployment section](./deploy-manual.mdx#workload-discovery).
508+ resources via a Service Account. See the
509+ [deployment section](./deploy-manual.mdx#workload-discovery) for details .
497510
498511:: :
499512
0 commit comments