fix(mcp/ui): show Reject for active servers; show submit form to non-admins with team-key note

This commit is contained in:
Ishaan Jaffer 2026-03-10 11:52:43 -07:00
parent 0b742d1f68
commit 45c49a1c0c
2 changed files with 55 additions and 30 deletions

View file

@ -322,24 +322,35 @@ function MCPServerCard({ server, onApprove, onReject, requiredFields }: MCPServe
)}
</div>
{/* Approve/Reject when no checks panel (no rules configured) */}
{checks.length === 0 && (approvalStatus === "pending_review" || approvalStatus === "rejected") && (
{checks.length === 0 && approvalStatus !== "rejected" && (
<div className="flex items-center gap-2 flex-shrink-0">
{approvalStatus !== "active" && (
<button
type="button"
onClick={onApprove}
className="text-xs bg-green-500 hover:bg-green-600 text-white px-3 py-1.5 rounded-md transition-colors font-medium"
>
Approve
</button>
)}
<button
type="button"
onClick={onReject}
className="text-xs border border-red-300 text-red-600 hover:bg-red-50 px-3 py-1.5 rounded-md transition-colors font-medium"
>
Reject
</button>
</div>
)}
{checks.length === 0 && approvalStatus === "rejected" && (
<div className="flex items-center gap-2 flex-shrink-0">
<button
type="button"
onClick={onApprove}
className="text-xs bg-green-500 hover:bg-green-600 text-white px-3 py-1.5 rounded-md transition-colors font-medium"
>
Approve
Re-approve
</button>
{approvalStatus === "pending_review" && (
<button
type="button"
onClick={onReject}
className="text-xs border border-red-300 text-red-600 hover:bg-red-50 px-3 py-1.5 rounded-md transition-colors font-medium"
>
Reject
</button>
)}
</div>
)}
</div>
@ -377,8 +388,8 @@ function MCPServerCard({ server, onApprove, onReject, requiredFields }: MCPServe
</div>
</div>
{/* Approve / Reject in header */}
{(approvalStatus === "pending_review" || approvalStatus === "rejected") && (
<div className="flex items-center gap-2 flex-shrink-0">
<div className="flex items-center gap-2 flex-shrink-0">
{approvalStatus !== "active" && approvalStatus !== "rejected" && (
<button
type="button"
onClick={onApprove}
@ -386,17 +397,26 @@ function MCPServerCard({ server, onApprove, onReject, requiredFields }: MCPServe
>
Approve
</button>
{approvalStatus === "pending_review" && (
<button
type="button"
onClick={onReject}
className="text-xs border border-red-300 text-red-600 hover:bg-red-50 bg-white px-3 py-1.5 rounded-md transition-colors font-medium"
>
Reject
</button>
)}
</div>
)}
)}
{approvalStatus === "rejected" && (
<button
type="button"
onClick={onApprove}
className="text-xs bg-green-600 hover:bg-green-700 text-white px-3 py-1.5 rounded-md transition-colors font-medium"
>
Re-approve
</button>
)}
{approvalStatus !== "rejected" && (
<button
type="button"
onClick={onReject}
className="text-xs border border-red-300 text-red-600 hover:bg-red-50 bg-white px-3 py-1.5 rounded-md transition-colors font-medium"
>
Reject
</button>
)}
</div>
</div>
{/* Individual check rows */}

View file

@ -373,7 +373,6 @@ const CreateMCPServer: React.FC<CreateMCPServerProps> = ({
console.log(`Payload: ${JSON.stringify(payload)}`);
if (accessToken != null) {
const isAdmin = isAdminRole(userRole);
const response = isAdmin
? await createMCPServer(accessToken, payload)
: await registerMCPServer(accessToken, payload);
@ -468,11 +467,9 @@ const CreateMCPServer: React.FC<CreateMCPServerProps> = ({
}
}, [isModalVisible]);
// rendering
if (!isAdminRole(userRole)) {
return null;
}
const isAdmin = isAdminRole(userRole);
// rendering
return (
<Modal
title={
@ -496,7 +493,9 @@ const CreateMCPServer: React.FC<CreateMCPServerProps> = ({
objectFit: "contain",
}}
/>
<h2 className="text-xl font-semibold text-gray-900">Add New MCP Server</h2>
<h2 className="text-xl font-semibold text-gray-900">
{isAdmin ? "Add New MCP Server" : "Submit MCP Server for Review"}
</h2>
</div>
}
open={isModalVisible}
@ -517,6 +516,12 @@ const CreateMCPServer: React.FC<CreateMCPServerProps> = ({
layout="vertical"
className="space-y-6"
>
{!isAdmin && (
<div className="rounded-md bg-blue-50 border border-blue-200 px-4 py-3 text-sm text-blue-800">
Your submission will be sent for admin review before it becomes active.
{" "}Note: the request must be made with a team-scoped API key.
</div>
)}
<div className="grid grid-cols-1 gap-6">
<Form.Item
label={