Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
7a2e475
feat(claude-code): emit installationPreference in marketplace.json en…
devin-ai-integration[bot] Sep 16, 2026
7415cd3
fix(claude-code): satisfy marketplace CI checks
devin-ai-integration[bot] Sep 16, 2026
bff08db
fix(claude-code): qualify marketplace entry as read only
devin-ai-integration[bot] Sep 16, 2026
e90116e
fix(claude-code): suppress typed marketplace assembly warning
devin-ai-integration[bot] Sep 16, 2026
ad32751
Merge remote-tracking branch 'origin/main' into litellm_marketplace_i…
mateo-berri Sep 29, 2026
d51f84c
fix(claude-code): restrict installation_preference to the documented …
mateo-berri Sep 29, 2026
4caf394
fix(claude-code): echo installation_preference on the public skill hub
mateo-berri Sep 29, 2026
19a6c00
refactor(claude-code): read installation_preference with one membersh…
mateo-berri Sep 30, 2026
7653a59
test(integration): audit installation_preference on the Claude Code m…
mateo-berri Oct 1, 2026
56c7df6
test(integration): kill a serving worker in the marketplace chaos cell
mateo-berri Oct 1, 2026
1ec6486
test(integration): give the marketplace worker-kill cell the two-boot…
mateo-berri Oct 1, 2026
1c16857
merge: main into litellm_marketplace_installation_preference
mateo-berri Oct 13, 2026
442ed5a
fix(proxy): keep installationPreference on the MarketplacePluginEntry…
mateo-berri Oct 13, 2026
9688a2d
fix(proxy): refuse self-installing preferences off sha256 archives, a…
mateo-berri Oct 13, 2026
3ed7796
Merge remote-tracking branch 'origin/main' into litellm_marketplace_i…
mateo-berri Oct 14, 2026
3796319
fix(claude-code): serve installation_preference only on archive plugi…
mateo-berri Oct 14, 2026
5b7205b
fix(claude-code): read the preference spelling that carries a value w…
mateo-berri Oct 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 52 additions & 2 deletions litellm/proxy/_lazy_openapi_snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -5704,6 +5704,22 @@
"title": "Id",
"type": "string"
},
"installation_preference": {
"anyOf": [
{
"enum": [
"available",
"auto_install",
"required"
],
"type": "string"
},
{
"type": "null"
}
],
"title": "Installation Preference"
},
"keywords": {
"anyOf": [
{
Expand Down Expand Up @@ -5898,6 +5914,23 @@
"description": "Plugin homepage URL",
"title": "Homepage"
},
"installation_preference": {
"anyOf": [
{
"enum": [
"available",
"auto_install",
"required"
],
"type": "string"
},
{
"type": "null"
}
],
"description": "Emitted as installationPreference on this plugin's marketplace.json entry. Claude Desktop auto-installs an 'auto_install' plugin when the marketplace is served from its inference gateway origin and the plugin is an archive source with a sha256",
"title": "Installation Preference"
},
"keywords": {
"anyOf": [
{
Expand Down Expand Up @@ -6048,6 +6081,23 @@
"description": "Plugin homepage URL",
"title": "Homepage"
},
"installation_preference": {
"anyOf": [
{
"enum": [
"available",
"auto_install",
"required"
],
"type": "string"
},
{
"type": "null"
}
],
"description": "Emitted as installationPreference on this plugin's marketplace.json entry. Claude Desktop auto-installs an 'auto_install' plugin when the marketplace is served from its inference gateway origin and the plugin is an archive source with a sha256",
"title": "Installation Preference"
},
"keywords": {
"anyOf": [
{
Expand Down Expand Up @@ -6242,7 +6292,7 @@
]
},
"post": {
"description": "Register a new plugin in the LiteLLM marketplace.\n\nLiteLLM acts as a registry/discovery layer. Plugins are hosted on\nGitHub/GitLab/Bitbucket or as a zip archive on any https host (e.g. S3).\nClaude Code clones the git source or downloads the archive when users install.\n\nThis endpoint is create-only and never overwrites. If a plugin with\nthe same name already exists it returns 409 Conflict; use\nPUT /claude-code/plugins/{plugin_name} to update an existing plugin.\n\nRequires a proxy admin API key.\n\nParameters:\n - name: Plugin name (kebab-case)\n - source: Plugin source reference (github, url, git-subdir, or archive format)\n - version: Semantic version (optional)\n - description: Plugin description (optional)\n - author: Author information (optional)\n - homepage: Plugin homepage URL (optional)\n - keywords: Search keywords (optional)\n - category: Plugin category (optional)\n\nReturns:\n Registration status (action is always \"created\") and plugin information.\n\nExample:\n ```bash\n curl -X POST http://localhost:4000/claude-code/plugins \\\n -H \"Authorization: Bearer sk-...\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"name\": \"my-plugin\",\n \"source\": {\"source\": \"github\", \"repo\": \"org/my-plugin\"},\n \"version\": \"1.0.0\",\n \"description\": \"My awesome plugin\"\n }'\n ```",
"description": "Register a new plugin in the LiteLLM marketplace.\n\nLiteLLM acts as a registry/discovery layer. Plugins are hosted on\nGitHub/GitLab/Bitbucket or as a zip archive on any https host (e.g. S3).\nClaude Code clones the git source or downloads the archive when users install.\n\nThis endpoint is create-only and never overwrites. If a plugin with\nthe same name already exists it returns 409 Conflict; use\nPUT /claude-code/plugins/{plugin_name} to update an existing plugin.\n\nRequires a proxy admin API key.\n\nParameters:\n - name: Plugin name (kebab-case)\n - source: Plugin source reference (github, url, git-subdir, or archive format)\n - version: Semantic version (optional)\n - description: Plugin description (optional)\n - author: Author information (optional)\n - homepage: Plugin homepage URL (optional)\n - keywords: Search keywords (optional)\n - category: Plugin category (optional)\n - installation_preference: 'available', 'auto_install', or 'required' (optional)\n\nReturns:\n Registration status (action is always \"created\") and plugin information.\n\nExample:\n ```bash\n curl -X POST http://localhost:4000/claude-code/plugins \\\n -H \"Authorization: Bearer sk-...\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"name\": \"my-plugin\",\n \"source\": {\"source\": \"github\", \"repo\": \"org/my-plugin\"},\n \"version\": \"1.0.0\",\n \"description\": \"My awesome plugin\"\n }'\n ```",
"operationId": "register_plugin_claude_code_plugins_post",
"requestBody": {
"content": {
Expand Down Expand Up @@ -6377,7 +6427,7 @@
]
},
"put": {
"description": "Update an existing plugin in the LiteLLM marketplace.\n\nThe plugin is identified by its name in the path, which is the resource\nidentity and cannot be changed here. This is a full replace, not a merge:\nthe manifest is rebuilt from the request body, so any optional field left\nout is reset to its default (e.g. an omitted version is cleared, not kept).\nSend the full desired state.\n\nReturns 404 if no plugin with the given name exists; use\nPOST /claude-code/plugins to create a new plugin.\n\nRequires a proxy admin API key.\n\nParameters:\n - plugin_name: Name of the plugin to update (path parameter)\n - source: Plugin source reference (github, url, git-subdir, or archive format)\n - version: Semantic version (optional)\n - description: Plugin description (optional)\n - author: Author information (optional)\n - homepage: Plugin homepage URL (optional)\n - keywords: Search keywords (optional)\n - category: Plugin category (optional)\n\nReturns:\n Update status (action is always \"updated\") and plugin information.\n\nExample:\n ```bash\n curl -X PUT http://localhost:4000/claude-code/plugins/my-plugin \\\n -H \"Authorization: Bearer sk-...\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"source\": {\"source\": \"github\", \"repo\": \"org/my-plugin\"},\n \"version\": \"2.0.0\",\n \"description\": \"My awesome plugin\"\n }'\n ```",
"description": "Update an existing plugin in the LiteLLM marketplace.\n\nThe plugin is identified by its name in the path, which is the resource\nidentity and cannot be changed here. This is a full replace, not a merge:\nthe manifest is rebuilt from the request body, so any optional field left\nout is reset to its default (e.g. an omitted version is cleared, not kept).\nSend the full desired state.\n\nReturns 404 if no plugin with the given name exists; use\nPOST /claude-code/plugins to create a new plugin.\n\nRequires a proxy admin API key.\n\nParameters:\n - plugin_name: Name of the plugin to update (path parameter)\n - source: Plugin source reference (github, url, git-subdir, or archive format)\n - version: Semantic version (optional)\n - description: Plugin description (optional)\n - author: Author information (optional)\n - homepage: Plugin homepage URL (optional)\n - keywords: Search keywords (optional)\n - category: Plugin category (optional)\n - installation_preference: 'available', 'auto_install', or 'required' (optional)\n\nReturns:\n Update status (action is always \"updated\") and plugin information.\n\nExample:\n ```bash\n curl -X PUT http://localhost:4000/claude-code/plugins/my-plugin \\\n -H \"Authorization: Bearer sk-...\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"source\": {\"source\": \"github\", \"repo\": \"org/my-plugin\"},\n \"version\": \"2.0.0\",\n \"description\": \"My awesome plugin\"\n }'\n ```",
"operationId": "update_plugin_claude_code_plugins__plugin_name__put",
"parameters": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

from fastapi import APIRouter, Depends, HTTPException, Request
from fastapi.responses import JSONResponse
from typing_extensions import ReadOnly

from litellm._logging import verbose_proxy_logger
from litellm.proxy._types import CommonProxyErrors, ProxyException, UserAPIKeyAuth
Expand All @@ -37,6 +38,7 @@
from litellm.proxy.common_utils.resource_ownership import is_proxy_admin
from litellm.repositories.table_repositories import ClaudeCodePluginRepository
from litellm.types.proxy.claude_code_endpoints import (
InstallationPreference,
ListPluginsResponse,
PluginListItem,
PluginResponse,
Expand Down Expand Up @@ -70,6 +72,18 @@
homepage: object
keywords: object
category: object
installationPreference: ReadOnly[InstallationPreference]


def _get_installation_preference(manifest: Mapping[str, object]) -> InstallationPreference | None:
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
value: Final = manifest.get("installation_preference")
if not isinstance(value, str):
return None
match value:
case "available" | "auto_install" | "required":
return value
case _:
return None


async def _get_prisma_client() -> object:
Expand Down Expand Up @@ -136,10 +150,16 @@
verbose_proxy_logger.warning("Plugin %s has no source field, skipping", plugin.name)
continue

entry: _MarketplaceEntry = {
"name": plugin.name,
"source": manifest["source"],
}
installation_preference = _get_installation_preference(manifest)
entry: _MarketplaceEntry = (
{"name": plugin.name, "source": manifest["source"]}
if installation_preference is None
else {
"name": plugin.name,
"source": manifest["source"],
"installationPreference": installation_preference,
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.
Resolved
}
)

if plugin.version:
entry["version"] = plugin.version
Expand Down Expand Up @@ -306,6 +326,7 @@
- homepage: Plugin homepage URL (optional)
- keywords: Search keywords (optional)
- category: Plugin category (optional)
- installation_preference: 'available', 'auto_install', or 'required' (optional)

Returns:
Registration status (action is always "created") and plugin information.
Expand Down Expand Up @@ -435,6 +456,7 @@
category=manifest.get("category"),
domain=manifest.get("domain"),
namespace=manifest.get("namespace"),
installation_preference=_get_installation_preference(manifest),
enabled=p.enabled,
created_at=p.created_at.isoformat() if p.created_at else None,
updated_at=p.updated_at.isoformat() if p.updated_at else None,
Expand Down Expand Up @@ -508,6 +530,7 @@
"homepage": manifest.get("homepage"),
"keywords": manifest.get("keywords"),
"category": manifest.get("category"),
"installation_preference": _get_installation_preference(manifest),
"enabled": plugin.enabled,
"created_at": plugin.created_at.isoformat() if plugin.created_at else None,
"updated_at": plugin.updated_at.isoformat() if plugin.updated_at else None,
Expand Down Expand Up @@ -558,6 +581,7 @@
- homepage: Plugin homepage URL (optional)
- keywords: Search keywords (optional)
- category: Plugin category (optional)
- installation_preference: 'available', 'auto_install', or 'required' (optional)

Returns:
Update status (action is always "updated") and plugin information.
Expand Down
13 changes: 13 additions & 0 deletions litellm/types/proxy/claude_code_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
Claude Code Marketplace endpoint types for LiteLLM Proxy
"""

from typing import Literal, TypeAlias

from pydantic import BaseModel, Field

InstallationPreference: TypeAlias = Literal["available", "auto_install", "required"]


class PluginAuthor(BaseModel):
"""Plugin author information."""
Expand Down Expand Up @@ -41,6 +45,14 @@ class PluginSpec(BaseModel):
category: str | None = Field(None, description="Plugin category")
domain: str | None = Field(None, description="Skill domain (e.g., 'Productivity')")
namespace: str | None = Field(None, description="Skill namespace within domain (e.g., 'workflows')")
installation_preference: InstallationPreference | None = Field(
None,
description=(
"Emitted as installationPreference on this plugin's marketplace.json entry. Claude Desktop auto-installs "
"an 'auto_install' plugin when the marketplace is served from its inference gateway origin and the "
"plugin is an archive source with a sha256"
),
)


class RegisterPluginRequest(PluginSpec):
Expand Down Expand Up @@ -104,6 +116,7 @@ class PluginListItem(BaseModel):
category: str | None = None
domain: str | None = None
namespace: str | None = None
installation_preference: InstallationPreference | None = None
enabled: bool
created_at: str | None
updated_at: str | None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@
"""

import json
from unittest.mock import AsyncMock, MagicMock

import pytest
from fastapi import HTTPException
from unittest.mock import AsyncMock, MagicMock
from pydantic import ValidationError

import litellm
from litellm.proxy._types import LiteLLM_ObjectPermissionTable, ProxyException, UserAPIKeyAuth
from litellm.proxy.proxy_server import LitellmUserRoles
from litellm.types.proxy.claude_code_endpoints import (
RegisterPluginRequest,
UpdatePluginRequest,
)
from litellm.proxy.anthropic_endpoints.claude_code_endpoints import claude_code_marketplace
from litellm.proxy.anthropic_endpoints.claude_code_endpoints.claude_code_marketplace import (
delete_plugin,
Expand All @@ -28,6 +24,11 @@
register_plugin,
update_plugin,
)
from litellm.proxy.proxy_server import LitellmUserRoles
from litellm.types.proxy.claude_code_endpoints import (
RegisterPluginRequest,
UpdatePluginRequest,
)


def _make_mock_prisma():
Expand Down Expand Up @@ -363,6 +364,94 @@ async def _fake_auth(request, api_key: str) -> UserAPIKeyAuth:
assert exc_info.value.code == "401"


@pytest.mark.asyncio
@pytest.mark.parametrize("preference", ["available", "auto_install", "required"])
async def test_get_marketplace_emits_installation_preference(preference):
await register_plugin(
request=RegisterPluginRequest(
name="s3-skill",
source=_ARCHIVE_SOURCE,
installation_preference=preference,
),
user_api_key_dict=_USER,
)

marketplace = json.loads((await get_marketplace(request=MagicMock())).body)

assert marketplace["plugins"] == [
{"name": "s3-skill", "source": _ARCHIVE_SOURCE, "version": "1.0.0", "installationPreference": preference}
]


@pytest.mark.parametrize(
"build_request",
[
lambda preference: RegisterPluginRequest(
name="s3-skill", source=_ARCHIVE_SOURCE, installation_preference=preference
),
lambda preference: UpdatePluginRequest(source=_ARCHIVE_SOURCE, installation_preference=preference),
],
ids=["register", "update"],
)
def test_plugin_request_rejects_unknown_installation_preference(build_request):
with pytest.raises(ValidationError, match="installation_preference"):
build_request("auto-install")


@pytest.mark.asyncio
async def test_get_marketplace_omits_installation_preference_when_unset():
await register_plugin(
request=RegisterPluginRequest(name="manual-install-plugin", source=_GIT_SUBDIR_SOURCE),
user_api_key_dict=_USER,
)

marketplace = json.loads((await get_marketplace(request=MagicMock())).body)

assert "installationPreference" not in marketplace["plugins"][0]


@pytest.mark.asyncio
async def test_update_plugin_propagates_installation_preference_to_get_and_list():
name = "updated-install-plugin"
await register_plugin(
request=RegisterPluginRequest(name=name, source=_GIT_SUBDIR_SOURCE),
user_api_key_dict=_USER,
)

await update_plugin(
plugin_name=name,
request=UpdatePluginRequest(
source=_GIT_SUBDIR_SOURCE,
installation_preference="auto_install",
),
user_api_key_dict=_USER,
)

plugin = await get_plugin(plugin_name=name, user_api_key_dict=_USER)
listed_plugin = (await list_plugins(user_api_key_dict=_USER)).plugins[0]

assert plugin["installation_preference"] == "auto_install"
assert listed_plugin.installation_preference == "auto_install"


@pytest.mark.asyncio
async def test_update_plugin_without_installation_preference_clears_it():
name = "cleared-install-plugin"
await register_plugin(
request=RegisterPluginRequest(name=name, source=_ARCHIVE_SOURCE, installation_preference="auto_install"),
user_api_key_dict=_USER,
)

await update_plugin(
plugin_name=name,
request=UpdatePluginRequest(source=_ARCHIVE_SOURCE),
user_api_key_dict=_USER,
)

marketplace = json.loads((await get_marketplace(request=MagicMock())).body)
assert "installationPreference" not in marketplace["plugins"][0]


@pytest.mark.asyncio
async def test_register_plugin_git_subdir_missing_url():
"""git-subdir without url field raises HTTP 400."""
Expand Down
Loading
Loading