Skip to content

Extension library: one instance list of MCP servers and skills with per-item limits, replacing profiles #3509

Closed

Description

@integry

Problem

Today an administrator must first create an extension profile bound to repositories and agents, then add MCP servers and skills inside it. Profiles can overlap, the same server may be configured (with its secret) in several profiles, and it is unclear which profile a run will use.

Target model

  • Library: one instance-wide list of items. An item is an MCP server (https or catalog, same fields as today) or a skill bundle reference. Server names are unique across the library.
  • Each item has:
    • enabled: deactivates the item without removing it. A disabled item keeps its whole configuration, its limits and its stored secret, applies to no run, and can be re-enabled at any time. Disabling is never refused, including when an automation adds the item explicitly (the automation then runs without it and the item is reported as skipped).
    • repositories: optional list of owner/repo; empty means every repository
    • agents: optional list of agent aliases; empty means every agent (shown as an advanced option in the UI)
    • autoApply: boolean, default true for new items. When false the item is used only where it is added explicitly (an automation's additional extensions).
  • No profiles. The profile entity is removed. An automation definition instead carries extensions: { servers: string[], skills: string[] }: library server names and skill bundle ids added to that automation on top of whatever applies automatically.
  • The library has one revision stream (every save or secret replacement creates a new library revision with timestamp and administrator actor, as profile revisions do today). Secrets are bound to the library, so a server's credential is stored once.

This issue delivers the data model, store, REST API, the automation field and the migration. It does not yet auto-apply to issue tasks and pull request follow-ups (next issue) and does not rework the settings screen (third issue), but the existing screens must keep working or be adapted minimally so nothing is broken in between.

Requirements

  1. Shared contract (packages/shared/src/extensionProfiles.ts): schemas and types for library items and the library revision, and a pure function resolveExtensionSet(library, { repository, agentAlias, runtime, additional?: { servers, skills } }). It returns the servers and skill bundles that apply, in a deterministic order (by name):
    • items with autoApply: true that are enabled and whose repositories and agents limits match, plus
    • items named in additional that are enabled and whose limits match (these ignore autoApply).
      An additional entry that names a missing, disabled or non-matching item is reported in a skipped list with a reason and is not an error. Library limits: up to 32 servers and 32 skill bundles. The per-run limits stay 8 servers and 8 bundles: when a resolved set exceeds them, explicitly added items take priority, then auto-applied items by name, and the items left out are returned so callers can report them.
  2. Store (packages/core/src/extensions/extensionProfileStore.ts): read/save the library with optimistic concurrency on its revision; per-item secret replacement; a single-item enable/disable operation that changes only enabled (new library revision, secret untouched). Removing or renaming a library item that an automation adds explicitly is refused with a message naming the automations. Keep authorize (durable administrator with instance.manage_settings) for every management call.
  3. Automations: add the extensions field to the automation definition contract (packages/shared/src/automationDefinitions.ts), store, REST, MCP automation tools and CLI where the definition is read or written; replace the extensionProfile selection. Saving an automation validates that every named item exists; setting or changing the field requires the same administrator permission that selecting a profile requires today.
  4. Launch: executeWithExtensions (packages/core/src/extensions/extensionLaunch.ts) resolves through resolveExtensionSet against the current library revision at launch. In this issue only automation runs use it (auto-applied items plus the automation's additional items); issue tasks follow in the next issue. All existing launch checks stay: capability policy, endpoint policy, catalog digest check, write servers only with the run's write authorization (automation action phases keep their explicit phase policy), grant creation and revocation, skill digest verification and staging, and fencing between launch preparation and container start. The authority for a launch is the library revision (saved only by an administrator); no selecting administrator is required at launch, and the revision's audit actor is recorded as provenance.
  5. REST API under /api/instance/extensions/v1: read library + skill bundles + operator catalog in one call; save library; enable/disable one item; existing skill import, validate and tool discovery routes keep working. Remove the profile routes once nothing calls them. Update packages/api/openapi schemas and regenerate the spec and client types.
  6. Migration of existing data (application-level, idempotent, run at startup, safe to re-run):
    • Every server and skill of every existing profile becomes a library item. Its repositories and agents come from the profile's scopes. autoApply is false for all migrated items so the upgrade changes no run's behaviour.
    • Identical servers appearing in several profiles (same kind, url or catalog id, tools, capability) merge into one item whose limits are the union; if any source profile had an empty scope the merged limit is empty. Different servers that share a name get a deterministic suffix and the rename is logged.
    • Each automation that selected a profile gets extensions listing that profile's (possibly renamed) items, so it launches with the same servers and skills as before.
    • Queued New Task submissions that still carry a profile selection keep working for their initial task: keep a small legacy mapping from old profile id to the migrated item names for this purpose.
    • Encrypted Bearer tokens are re-bound to the library. If a secret cannot be decrypted (wrong key root), the item is migrated with the secret marked not configured and a warning is logged; migration never aborts startup.
    • Old tables stay readable until the migration reports success; do not drop data in this issue.
  7. Native database export / restore rules stay equivalent: the public library is exported, encrypted credentials are erased, run grants removed.

Out of scope

Auto-apply for issue tasks and PR follow-ups, labels, New Task changes, the settings screen rework, OAuth sign-in.

Acceptance criteria

  • Unit tests for resolveExtensionSet: no limits; repository limit; agent limit; disabled item; autoApply false excluded unless added explicitly; explicit item that is missing, disabled or out of limits lands in skipped; over-limit truncation with explicit items kept first; deterministic order.
  • Store tests: revision conflict; secret stored once and write-only; disabling and re-enabling an item keeps its configuration and secret and is allowed while an automation adds it; removing an item an automation adds is refused; non-administrator and stale-session denial still hold.
  • Automation tests: definition round-trips extensions through REST, MCP and CLI; a run launches with auto-applied plus additional items; an automation whose added item is disabled launches without it and reports it skipped; an automation with neither launches without extensions.
  • Migration tests: two profiles sharing an identical server merge; name collision renamed; scopes become item limits; all migrated items have autoApply false; an automation bound to an old profile launches with the same servers and skills; a queued submission with a profile selection still launches; undecryptable secret handled; re-running the migration changes nothing.
  • Existing extension tests (gateway, endpoint policy, staging, launch fencing) pass, adapted only where the selection shape changed.
  • OpenAPI spec and generated client types are regenerated; OpenAPI coverage and conformance, MCP docs and observable-surface tests pass.
  • docs/docs/features/agent-extensions.md and the automations docs describe the library, item limits, enabled, autoApply, additional extensions on automations, and the migration. No profile wording remains.

Implementation

  1. Shared: new schemas/types and resolveExtensionSet in packages/shared/src/extensionProfiles.ts (split into a second file if it grows); keep EXTENSION_LIMITS for per-run limits and add library limits. Automation contract in packages/shared/src/automationDefinitions.ts.
  2. DB: new knex migration adding library tables (extension_library_revisions holding the item list JSON and encrypted secrets, bound to extension_instance_identity), the automation extensions column, and the legacy profile mapping. Follow packages/core/src/db/migrations/20261013210000_extension_profiles.js for conventions.
  3. Core store: rework ExtensionProfileStore into a library store with read/save, single-item enable/disable, secret custody re-bound to instance + library revision, and a launch assertion that resolves through the library without an actor.
  4. Automations: packages/core/src/services/agents/agentDefinitionStore.ts, agentRunTrigger.ts, packages/api/routes/automationDefinitionRoutes.ts, src/jobs/agentRuns/agentTaskOptions.ts, src/jobs/processAgentRunJob.ts, src/jobs/processAgentActionJob.ts, MCP automation definition tools and CLI.
  5. Data migration module run at API/worker startup behind an idempotency marker; reuse privateSecrets.ts for decrypt/re-encrypt.
  6. API: packages/api/routes/extensionProfileRoutes.ts and route registration in packages/api/server.ts; OpenAPI schemas; npm run gen:openapi.
  7. Minimal UI adaptation in propr-ui/src/api/extensionProfilesApi.ts, AgentExtensionsSection.tsx, ExtensionProfileSelector.tsx and the automation editor so current screens still load and save (full redesign is a later issue).
  8. Tests in packages/core/test, packages/shared/test, packages/api/test, following the existing extension tests.

Notes

Security invariants that must not weaken: secrets never leave Core in readable form; write-capability servers need the run's explicit write authorization; catalog digest mismatch fails closed; launch fencing against disable, deletion and secret rotation. ProPR runs on SQLite only: do not add code or tests for other databases. Read docs/docs/features/agent-extensions.md first.

Activity

  1. propr-dev commented on Nov 12, 2026

    @propr-dev
    Contributor

    🤖 AI processing has started for this issue using claude agent with claude-opus-5-5 model.

    I'll analyze the problem and work on a solution. This may take a few minutes.

    Processing Details:

    • Agent: claude
    • Model: claude-opus-5-5
    • Branch: 3509/claude-opus-5-5-extension-library-one-ins-20261112-2236-jn4
    • Base Branch: 3509-epic-extensions-library-14j
    • Worktree: issue-3509-20261112-2236-claude-opus-5-5-jn4

    🔍 Track Task Execution

  2. added a commit that references this issue on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions