Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-- Restore BYOM approval workflow columns that were accidentally dropped by
-- 20260311180521_schema_sync. That migration was auto-generated because the
-- root schema.prisma was not updated when PR #23205 added the submission
-- workflow. This migration re-adds the columns and index.

ALTER TABLE "LiteLLM_MCPServerTable"
ADD COLUMN IF NOT EXISTS "source_url" TEXT,
ADD COLUMN IF NOT EXISTS "approval_status" TEXT DEFAULT 'active',
ADD COLUMN IF NOT EXISTS "submitted_by" TEXT,
ADD COLUMN IF NOT EXISTS "submitted_at" TIMESTAMP(3),
ADD COLUMN IF NOT EXISTS "reviewed_at" TIMESTAMP(3),
ADD COLUMN IF NOT EXISTS "review_notes" TEXT;

-- Back-fill existing rows: anything already in the table is implicitly active.
-- Also normalise the old "approved" default written by a prior schema version
-- that used @default("approved") instead of @default("active").
UPDATE "LiteLLM_MCPServerTable"
SET "approval_status" = 'active'
WHERE "approval_status" IS NULL OR "approval_status" = 'approved';

-- CreateIndex
CREATE INDEX IF NOT EXISTS "LiteLLM_MCPServerTable_approval_status_idx"
ON "LiteLLM_MCPServerTable"("approval_status");
6 changes: 5 additions & 1 deletion litellm-proxy-extras/litellm_proxy_extras/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,15 @@ model LiteLLM_MCPServerTable {
is_byok Boolean @default(false)
byok_description String[] @default([])
byok_api_key_help_url String?
approval_status String @default("approved")
source_url String?
// BYOM submission lifecycle
approval_status String? @default("active")
submitted_by String?
submitted_at DateTime?
reviewed_at DateTime?
review_notes String?

@@index([approval_status])
}

// Per-user BYOK credentials for MCP servers
Expand Down
21 changes: 11 additions & 10 deletions litellm/proxy/management_endpoints/mcp_management_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -1288,17 +1288,18 @@ async def add_session_mcp_server(
# Validate and normalize payload fields (alias/server name rules)
validate_and_normalize_mcp_server_payload(payload)

# Restrict to proxy admins similar to the persistent create endpoint
if LitellmUserRoles.PROXY_ADMIN != user_api_key_dict.user_role:
raise HTTPException(
status_code=status.HTTP_403_FORBIDDEN,
detail={
"error": "User does not have permission to create temporary mcp servers. You can only create temporary mcp servers if you are a PROXY_ADMIN."
},
)

# Session servers are ephemeral (in-memory, ~5 min TTL, no DB write) so
# any authenticated user may create one. This lets non-admin users run
# the OAuth auth-test before submitting a server for review.
created_by = user_api_key_dict.user_id or LITELLM_PROXY_ADMIN_NAME
payload_with_credentials = _inherit_credentials_from_existing_server(payload)
# Only proxy admins may inherit credentials from an existing permanent
# server. Allowing non-admins to do so would let any key holder supply
# a known server_id and silently acquire that server's stored secrets
# (OAuth client_secret, AWS keys, etc.) into their session cache entry.
if user_api_key_dict.user_role == LitellmUserRoles.PROXY_ADMIN:
payload_with_credentials = _inherit_credentials_from_existing_server(payload)
else:
payload_with_credentials = payload
temp_record = _build_temporary_mcp_server_record(
payload_with_credentials,
created_by,
Expand Down
9 changes: 9 additions & 0 deletions schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,15 @@ model LiteLLM_MCPServerTable {
is_byok Boolean @default(false)
byok_description String[] @default([])
byok_api_key_help_url String?
source_url String?
// BYOM submission lifecycle
approval_status String? @default("active")
submitted_by String?
submitted_at DateTime?
reviewed_at DateTime?
review_notes String?

@@index([approval_status])
}

// Per-user BYOK credentials for MCP servers
Expand Down
Loading