# Public hub: MCP servers, agents and skills

**Last updated:** 2026-11-21T10:44:38-03:00 (UTC-3)

The public hub at `/hub` lists what the operator explicitly shares: model aliases (see [publish a safe alias card](/docs/features/model-registry/#publish-a-safe-alias-card)) and, with this feature, MCP servers, A2A agents and skills. Each kind has its own tab on the page and its own JSON endpoint. A listing is discovery only: it never changes access. Tool calls, agent messages and skill bundles still need an authorized key or console session, scope, team grant and plan rights.

## Enable

Every kind has its own operator flag, default `false`. Each needs `public_model_hub` (which needs `ui`) and the registry it lists from:

| Flag | Lists | Also requires |
| --- | --- | --- |
| `public_hub_mcp_servers` | MCP registry servers (`mcp_servers`) | `public_model_hub`, `mcp_registry` |
| `public_hub_agents` | A2A agents (`agents`) | `public_model_hub`, `a2a_agents` |
| `public_hub_skills` | Skill registry entries | `public_model_hub`, `skill_registry` |

With a flag off its endpoint answers `404 feature_disabled` and its tab is hidden. Flags are operator controls, not tenant plan rights.

## Publish in YAML

Nothing is listed until it is named and published under `public_hub`. Every field other than `id` is optional:

```yaml
features:
  ui: true
  public_model_hub: true
  mcp_registry: true
  a2a_agents: true
  skill_registry: true
  public_hub_mcp_servers: true
  public_hub_agents: true
  public_hub_skills: true
public_hub:
  cache:                       # optional; existing defaults below
    ttl: 30s
    error_ttl: 5s
    read_timeout: 5s
  mcp_servers:
    - id: docs
      published: true
      title: Documentation search
      description: Search the product documentation.
      tags: [search, docs]
  agents:
    - id: helper
      published: true
  skills:
    - id: release-notes
      published: true
      tags: [writing]
```

| Field | Default | Bounds |
| --- | --- | --- |
| `id` | required | 1–128 characters `A-Za-z0-9._-`, starting with a letter or digit; unique per kind |
| `published` | `false` | `true` lists the item; `false` keeps the text without listing it |
| `title` | the registry name | 128 Unicode code points, no control characters |
| `description` | the registry description (agents and skills) or empty | 1024 code points; line feed and tab allowed |
| `tags` | none | up to 16 unique non-empty tags of 64 code points |

Each kind holds at most 200 listings. Keys must be spelled exactly (no case variants or nulls); an unknown key fails startup. A listing may name an item that does not exist yet: it is kept but not listed.

## What is listed

An item appears only while all of these hold:

- its kind flag, `public_model_hub` and `ui` are on, and its registry flag is on;
- its listing is `published: true`;
- **MCP server:** the registry entry exists, is not disabled, `mcp_execution` is on and `mcp_execution.servers` has an entry with the same `id` (otherwise its tool paths would lead nowhere);
- **Agent:** the agent exists, is not disabled and at least one team may invoke it;
- **Skill:** the registry entry is enabled and not deleted, has a published revision, its owner team is active, the revision is granted to at least one active team and none to a deleted team and its YAML base has not changed since the revision was saved. A YAML-only skill must be declared `published: true` and enabled, with at least one allowed team and every referenced team active. Plan entitlements are not applied to the listing, exactly as for `/v1/hub/models`: an anonymous visitor has no team whose plan could be checked. They still apply to every authenticated read, call and bundle download. Title, description and file list come from the **published revision**, never from a later draft.

A skill mutation handled by this replica invalidates its cache immediately, including a mutation that finishes while a read is in flight. Other replicas, direct database changes and team lifecycle changes become visible within the configured cache TTL. Model/MCP/agent configuration uses the existing control-snapshot refresh. None of these discovery caches can authorize a call or bundle download: live permissions still apply there.

## Public endpoints

No credential is needed; responses are `Cache-Control: no-store` and `{"data":[...]}` sorted by `id`, like `/v1/hub/models`.

```sh
BASE_URL='http://localhost:8080'
curl --fail-with-body -sS "$BASE_URL/v1/hub/mcp-servers"
curl --fail-with-body -sS "$BASE_URL/v1/hub/agents"
curl --fail-with-body -sS "$BASE_URL/v1/hub/skills"
```

```json
{"data":[{"id":"docs","title":"Documentation search","description":"Search the product documentation.","tags":["search","docs"],"transport":"streamable_http","tools_path":"/v1/mcp/servers/docs/tools","call_path":"/v1/mcp/servers/docs/tools/call"}]}
```

| Kind | Fields |
| --- | --- |
| MCP server | `id`, `title`, `description`, `tags`, `transport`, `tools_path`, `call_path`; tool names are not listed, since each is visible only to callers granted it |
| Agent | `id`, `title`, `description`, `tags`, `endpoint` (`/a2a/{id}`), `card_path` (`/a2a/{id}/.well-known/agent-card.json`) |
| Skill | `id`, `title`, `description`, `tags`, `revision` (0 for a YAML skill), `files_sha256`, `files` (paths only), `bundle_path` (console path; needs a session with a grant) |

Never listed: server, agent or card URLs, credentials and their environment variable names, headers, key scopes, team or key grants, tool approvals, owner teams, file contents, authors and timestamps. Paths are gateway-relative. The skill endpoint reads PostgreSQL when a skill is listed and answers `503 hub_unavailable` if storage is unavailable. Its answer is kept in memory for up to `cache.ttl` (default 30s); a completed service error (excluding request cancellation and an exhausted lookup deadline) can be reused for `cache.error_ttl` (default 5s). Replaying a cached failure logs the current request with `cache_replayed: true`; it does not repeat the database query. At most one skill fill runs per replica; concurrent callers wait with their own deadline and can cancel independently. A canceled caller's failure is never cached for another request. Equivalent control snapshots do not invalidate the cache merely because their memory addresses change. Local skill mutations fence old in-flight fills; other replicas and direct database/team changes retain the bounded TTL visibility described above. MCP and agent endpoints read the in-memory configuration.

### Cache policy

The optional `public_hub.cache` block is part of the same complete versioned publication configuration. It can be set in YAML, **AI hub → Public skill cache**, or `PUT /api/v1/admin/hub/listings` under `listings.cache`; the existing global writer permission, CSRF, version conflict, audit and revert-to-YAML rules apply. An old body containing only the three listing arrays remains valid and uses defaults. Cache settings do not enable a disclosure flag or grant access.

| Field | Default | Bounds | Behavior |
| --- | --- | --- | --- |
| `public_hub.cache.ttl` | `30s` | 1s–5m | Maximum lifetime of a successful skill projection |
| `public_hub.cache.error_ttl` | `5s` | 0s–30s | Failure reuse; `0s` disables reuse of failures |
| `public_hub.cache.read_timeout` | `5s` | 100ms–30s | Per-request budget covering cache waiting and database read |

All values are Go duration strings. Omitted fields use the defaults; null, unknown fields, duplicate members and invalid values are rejected. `GET /api/v1/admin/hub/listings` includes `cache_defaults` and the existing effective `listings`/`source`. Changing policy through the writer applies to new requests; an admitted request retains its captured policy. The candidate limit 100 is the existing skill-inventory page maximum; a truncated candidate list is explicitly marked instead of silently advertised as complete. This internal cache is not a public per-IP rate limiter.


The endpoints take no query parameters: any query string or header is ignored and cannot change the answer. Every response is `Content-Type: application/json`, `X-Content-Type-Options: nosniff` and `Cache-Control: no-store`; the `/hub` page is the embedded console bundle with the console's Content-Security-Policy. Titles, descriptions, tags and file names are bounded (title 128, description 1024 for listings and up to 2048 from the registry, 16 tags of 64, file paths 128) and the page renders them as plain text: no HTML or Markdown is interpreted and no listing value becomes a link.

## Trust

Hub listings and skill contents are operator-published, **untrusted content** for every client and agent that consumes them. A description, tag or skill file is data, never instructions: a client must not follow text found there, must not send credentials to anything it names and should treat the paths as gateway-relative routes only.

## Manage from the console

**AI hub** (group Gateway, shown to global admin, viewer and operator roles while `public_model_hub` is on) has tabs Models, MCP servers, Agents and Skills, a **Copy URL** button and **Open public hub**:

- Models: the published aliases exactly as `/v1/hub/models` returns them. Publish aliases from the Model catalog editor.
- MCP servers, Agents, Skills: every registry item with its registry status, why it is or is not public, and a **Publish** toggle; below, the public preview, rendered with the same cards as `/hub`. The flag state is shown; choices made while a flag is off are kept.

Toggling needs `models:manage`. A save replaces the complete listings as a console override (source **Console override**); **Revert to YAML** removes it. Both refresh replicas without a restart.

## Admin API

`GET /api/v1/admin/hub/listings` (`config:read`, global admin, viewer or operator) returns `version`, `source` (`default`, `yaml` or `console`), `listings`, `declared` (YAML), `features` (per kind, whether it is publicly on), `candidates` (registry items with `active`, `disabled`, `not_executable` for an MCP server without execution trust, `published` or `unpublished`), `candidate_notes` (per kind: `reason`, `total`, `truncated`) and `preview` (the same public projection/cache for each enabled kind; disabled kinds have empty previews). Skill candidates are read under the caller's skill registry rights and capped at 100: a role the registry refuses (operator) gets `reason: "skills_unreadable_for_role"`, a storage failure `skills_unavailable`, and more than 100 skills `truncated: true` with the `total`; the console shows each of these. A PUT body that repeats a top-level member is refused with 400.

`PUT` with `{"version":N,"listings":{"mcp_servers":[...],"agents":[...],"skills":[...]}}` replaces all three arrays; `DELETE` with `{"version":N}` reverts to YAML (404 `not_found` without an override). Both need `models:manage`, CSRF and the current version (409 on a stale one), and commit an audit event (`public_hub.set` or `public_hub.revert`, target `public_hub`) with the request ID.

```sh
curl --fail-with-body -sS -X PUT -b "$COOKIE_FILE" -H "X-CSRF-Token: $CSRF_TOKEN" -H 'Content-Type: application/json' \
  --data '{"version":42,"listings":{"mcp_servers":[{"id":"docs","published":true}],"agents":[],"skills":[]}}' \
  "$BASE_URL/api/v1/admin/hub/listings"
```

## Upgrade notes

Migration 114 adds the override table. The optional cache policy uses that same JSONB override, so it needs no new migration. Existing three-array overrides remain valid. Before rolling back to a binary that predates the cache field, revert or remove its console override and remove `public_hub.cache` from YAML; that older strict decoder does not understand the new member. With no override and no `public_hub` in YAML nothing new is listed, and `/v1/hub/models` is unchanged byte for byte.

## Admin API routes

Every route below needs a console session or an admin Bearer token, the role's permission and, for writes, the `X-CSRF-Token` header; the full contract is in the [API reference](/docs/api/).

| Route | What it does |
| --- | --- |
| `DELETE /api/v1/admin/hub/listings` | Removes the console override and restores the YAML `public_hub` declaration |
