Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
feat: split MCP access and add plugin registry
Rahmana78d916b793c
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex b0557265..7cdfb61a 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -6,6 +6,10 @@ this is the *what*, and it is what Settings → About shows as “What's new”.## 2026-09-09+**Added**++- split MCP access and add plugin registry+**Fixed**- `security` eliminate parser gaps and enforce strict SAST coveragediff --git a/frontend/slices/os-settings/components/mcp-direction.test.ts b/frontend/slices/os-settings/components/mcp-direction.test.tsnew file mode 100644index 00000000..6a229ac6--- /dev/null+++ b/frontend/slices/os-settings/components/mcp-direction.test.ts@@ -0,0 +1,6 @@+import { describe, expect, it } from "vitest";+import { pagesForDirection } from "./mcp-navigation";+describe("MCP direction navigation", () => {+ it("keeps external clients accessing MSO in the inbound direction", () => expect(pagesForDirection("inbound").map(page => page.id)).toEqual(["connect", "access", "activity", "tools", "connection"]));+ it("keeps registry declarations in the outbound direction", () => expect(pagesForDirection("outbound").map(page => page.id)).toEqual(["registry"]));+});diff --git a/frontend/slices/os-settings/components/mcp-navigation.tsx b/frontend/slices/os-settings/components/mcp-navigation.tsxindex 3e4e636b..51f37405 100644--- a/frontend/slices/os-settings/components/mcp-navigation.tsx+++ b/frontend/slices/os-settings/components/mcp-navigation.tsx@@ -10,10 +10,13 @@ export const MCP_PAGES = [{ id: "activity", title: "Recent activity", description: "Review the latest actions requested through MCP.", icon: ListChecks },{ id: "tools", title: "Tools & updates", description: "Check the server tool catalog and your last client refresh reminder.", icon: Wrench },{ id: "connection", title: "Connection details", description: "Server address, reachability checks, tunnels, and manual OAuth settings.", icon: Settings2 },+ { id: "registry", title: "Plugins / Registry", description: "Review built-ins or validate a custom portable plugin declaration.", icon: Wrench },] as const;export type McpPage = "overview" | (typeof MCP_PAGES)[number]["id"];+export type McpDirection = "inbound" | "outbound";+export const pagesForDirection = (direction: McpDirection) => MCP_PAGES.filter(page => direction === "inbound" ? page.id !== "registry" : page.id === "registry");-export function McpNavigation({ active, onSelect, activeCount }: { active: McpPage; onSelect: (page: McpPage) => void; activeCount: number }) {+export function McpNavigation({ active, onSelect, activeCount, direction }: { active: McpPage; onSelect: (page: McpPage) => void; activeCount: number; direction: McpDirection }) {if (active !== "overview") return (<nav aria-label="MCP navigation" className="flex flex-wrap items-center gap-2 text-sm"><Button variant="ghost" className="min-h-11 px-2" onClick={() => onSelect("overview")}><ArrowLeft className="size-4" /> MCP overview</Button>@@ -24,10 +27,10 @@ export function McpNavigation({ active, onSelect, activeCount }: { active: McpPareturn (<nav aria-label="MCP navigation"><SettingsBlock className="!p-0 divide-y divide-border">- {MCP_PAGES.map(({ id, title, description, icon: Icon }) => (+ {pagesForDirection(direction).map(({ id, title, description, icon: Icon }) => (<Button key={id} variant="ghost" onClick={() => onSelect(id)} className="h-auto min-h-20 w-full justify-start gap-3 whitespace-normal rounded-none px-4 py-4 text-left"><Icon className="size-5 shrink-0 text-muted-foreground" aria-hidden />- <span className="min-w-0 flex-1"><span className="block text-sm font-medium">{title}{id === "access" ? ` (${activeCount})` : ""}</span><span className="mt-1 block text-sm font-normal leading-relaxed text-muted-foreground">{description}</span></span>+ <span className="min-w-0 flex-1"><span className="block text-sm font-medium">{title}{id === "access" ? ` (${activeCount})` : ""}</span><span className="mt-1 block text-sm font-normal leading-relaxed text-foreground">{description}</span></span><ChevronRight className="size-4 shrink-0 text-muted-foreground" aria-hidden /></Button>))}diff --git a/frontend/slices/os-settings/components/mcp-plugin-registry.tsx b/frontend/slices/os-settings/components/mcp-plugin-registry.tsxnew file mode 100644index 00000000..5a03deb0--- /dev/null+++ b/frontend/slices/os-settings/components/mcp-plugin-registry.tsx@@ -0,0 +1,152 @@+"use client";++import { Button } from "@/components/ui/button";+import { Textarea } from "@/components/ui/textarea";+import { SettingsBlock } from "@/features/shell-settings";+import {+ BUILT_IN_PLUGINS,+ PLUGIN_MANIFEST_SCHEMA,+ type PluginManifest,+ validatePluginManifest,+} from "@/lib/plugins/manifest";+import { useEffect, useState } from "react";++const STORAGE_KEY = "mso:custom-plugin-registry:v1";++function restoreCustomPlugins(raw: string | null) {+ if (!raw) return [];+ try {+ const parsed: unknown = JSON.parse(raw);+ if (!Array.isArray(parsed)) return [];+ const builtInIds = new Set(BUILT_IN_PLUGINS.map((plugin) => plugin.id));+ const custom: PluginManifest[] = [];+ const seen = new Set<string>();+ for (const candidate of parsed) {+ const result = validatePluginManifest(candidate);+ if (!result.ok || builtInIds.has(result.manifest.id) || seen.has(result.manifest.id)) continue;+ seen.add(result.manifest.id);+ custom.push(result.manifest);+ }+ return custom;+ } catch {+ return [];+ }+}++export function McpPluginRegistry() {+ const [custom, setCustom] = useState<PluginManifest[]>([]);+ const [source, setSource] = useState("");+ const [message, setMessage] = useState(+ "Custom manifests are validated only. Registration never installs or runs plugin code.",+ );++ useEffect(() => {+ const restore = window.setTimeout(() => {+ setCustom(restoreCustomPlugins(window.localStorage.getItem(STORAGE_KEY)));+ }, 0);+ return () => window.clearTimeout(restore);+ }, []);++ function persist(next: PluginManifest[]) {+ window.localStorage.setItem(STORAGE_KEY, JSON.stringify(next));+ setCustom(next);+ }++ function add() {+ try {+ const result = validatePluginManifest(JSON.parse(source));+ if (!result.ok) {+ setMessage(result.error);+ return;+ }+ if ([...BUILT_IN_PLUGINS, ...custom].some((item) => item.id === result.manifest.id)) {+ setMessage("A plugin with this id is already registered.");+ return;+ }+ persist([...custom, result.manifest]);+ setSource("");+ setMessage(`Registered ${result.manifest.metadata.name}. Activation remains a separate approved action.`);+ } catch {+ setMessage("Enter valid JSON matching portable plugin manifest v1.");+ }+ }++ function remove(id: string) {+ const plugin = custom.find((item) => item.id === id);+ persist(custom.filter((item) => item.id !== id));+ setMessage(plugin ? `Removed ${plugin.metadata.name} from this browser registry.` : "Plugin removed.");+ }++ const plugins = [...BUILT_IN_PLUGINS, ...custom];++ return (+ <div className="space-y-4">+ <SettingsBlock className="space-y-3 py-4">+ <div className="flex flex-wrap items-center gap-2">+ <p className="text-sm font-medium">Plugins / Registry</p>+ <span className="rounded-full bg-secondary px-2 py-0.5 text-xs text-muted-foreground">declarations only</span>+ </div>+ <p className="text-sm text-muted-foreground">+ SI-Coder, Batonly, and custom plugins use the same portable manifest. A declaration may describe Agent Skills and+ MCP surfaces, but never credentials, environment values, headers, or shell commands.+ </p>+ <ul className="grid gap-2 sm:grid-cols-2" aria-label="Registered plugins">+ {plugins.map((plugin) => {+ const isCustom = custom.some((item) => item.id === plugin.id);+ return (+ <li key={plugin.id} className="rounded-md border border-border p-3">+ <div className="flex items-start justify-between gap-3">+ <div className="min-w-0">+ <div className="flex flex-wrap items-center gap-2">+ <p className="text-sm font-medium">{plugin.metadata.name}</p>+ <span className="text-xs text-muted-foreground">v{plugin.version}</span>+ <span className="rounded-full bg-muted px-1.5 py-0.5 text-[11px] text-muted-foreground">+ {isCustom ? "Custom" : "Built-in"}+ </span>+ </div>+ <p className="mt-1 text-sm text-muted-foreground">{plugin.metadata.description}</p>+ <p className="mt-2 text-xs text-muted-foreground">+ {plugin.skills?.length ?? 0} skill{(plugin.skills?.length ?? 0) === 1 ? "" : "s"} · {plugin.mcp?.length ?? 0} MCP+ {(plugin.mcp?.length ?? 0) === 1 ? "" : "s"}+ </p>+ </div>+ {isCustom ? (+ <Button type="button" variant="ghost" size="sm" onClick={() => remove(plugin.id)} aria-label={`Remove ${plugin.metadata.name}`}>+ Remove+ </Button>+ ) : null}+ </div>+ </li>+ );+ })}+ </ul>+ </SettingsBlock>++ <SettingsBlock className="space-y-3 py-4">+ <div>+ <label htmlFor="custom-plugin-manifest" className="text-sm font-medium">+ Custom plugin manifest+ </label>+ <p className="mt-1 text-xs text-muted-foreground">+ Valid manifests are stored in this browser only. Activation and credentials stay separate from the registry.+ </p>+ </div>+ <Textarea+ id="custom-plugin-manifest"+ value={source}+ onChange={(event) => setSource(event.target.value)}+ className="min-h-40 font-mono text-xs"+ placeholder={`{"$schema":"${PLUGIN_MANIFEST_SCHEMA}","schemaVersion":1,"version":"1.0.0","id":"example-plugin","metadata":{"name":"Example","description":"Safe declaration"}}`}+ aria-describedby="custom-plugin-status"+ spellCheck={false}+ />+ <Button type="button" variant="secondary" onClick={add} className="min-h-11">+ Validate and register+ </Button>+ <p id="custom-plugin-status" role="status" className="text-sm text-muted-foreground">+ {message}+ </p>+ </SettingsBlock>+ </div>+ );+}diff --git a/frontend/slices/os-settings/components/mcp-section.tsx b/frontend/slices/os-settings/components/mcp-section.tsxindex 3492e6ed..f6154448 100644--- a/frontend/slices/os-settings/components/mcp-section.tsx+++ b/frontend/slices/os-settings/components/mcp-section.tsx@@ -7,6 +7,7 @@ import { SettingsBlock, SettingsSection } from "@/features/shell-settings";import { IS_DEMO } from "@/lib/demo";import { Lock, Plug } from "lucide-react";import { useRef, useState } from "react";+import { cn } from "@/lib/utils";import { McpActivity } from "./mcp-activity";import { McpConnectionSection } from "./mcp-connection-section";import { McpCopyField } from "./mcp-copy-field";@@ -15,6 +16,7 @@ import { McpSetupGuide } from "./mcp-setup-guide";import { useMcpState } from "./mcp-state";import { McpTokenSection } from "./mcp-token-section";import { McpToolsetCard } from "./mcp-toolset-card";+import { McpPluginRegistry } from "./mcp-plugin-registry";export function McpSection() {const { status, role } = useSession();@@ -34,7 +36,9 @@ export function McpSection() {function OwnerMcpSection() {const { state, error, reload } = useMcpState();const [page, setPage] = useState<McpPage>("overview");+ const [direction, setDirection] = useState<"inbound" | "outbound">("inbound");const top = useRef<HTMLDivElement>(null);+ function selectDirection(next: "inbound" | "outbound") { setDirection(next); setPage("overview"); }function navigate(next: McpPage) {setPage(next);requestAnimationFrame(() => { top.current?.focus(); top.current?.scrollIntoView({ block: "nearest" }); });@@ -52,13 +56,20 @@ function OwnerMcpSection() {);return (<div ref={top} tabIndex={-1} data-slot="mcp-page" className="space-y-4 outline-none">- {page === "overview" && <p className="text-sm leading-relaxed text-muted-foreground">Connect an AI app to this server, then manage its access here. Each app receives only the permissions you approve.</p>}- <McpNavigation active={page} onSelect={navigate} activeCount={state.tokens.filter(token => token.status === "active").length} />+ <div className="space-y-3">+ <div role="tablist" aria-label="MCP direction" className="grid grid-cols-2 gap-2 rounded-lg bg-secondary p-1">+ {[{ id: "inbound", title: "Access MSO", copy: "External clients and agents → MSO" }, { id: "outbound", title: "MSO Access", copy: "MSO → external MCPs, services, and projects" }].map(item => <button key={item.id} id={`mcp-${item.id}-tab`} type="button" role="tab" aria-selected={direction === item.id} aria-controls="mcp-direction-panel" tabIndex={direction === item.id ? 0 : -1} onClick={() => selectDirection(item.id as "inbound" | "outbound")} onKeyDown={event => { if (event.key === "ArrowLeft" || event.key === "ArrowRight") { event.preventDefault(); selectDirection(direction === "inbound" ? "outbound" : "inbound"); } }} className={cn("min-h-11 rounded-md px-3 py-2 text-left text-sm", direction === item.id ? "bg-card shadow-sm" : "text-muted-foreground")}><span className="block font-medium">{item.title}</span><span className="block text-xs leading-relaxed">{item.copy}</span></button>)}+ </div>+ <p id="mcp-direction-panel" role="tabpanel" aria-labelledby={`mcp-${direction}-tab`} className="text-sm leading-relaxed text-muted-foreground">{direction === "inbound" ? "Inbound: approve how external clients and agents access this MSO host." : "Outbound: choose how this MSO host reaches external MCPs, services, and project capabilities."}</p>+ </div>+ {page === "overview" && direction === "outbound" && <SettingsBlock className="space-y-2 py-4"><p className="text-sm font-medium">External connections</p><p className="text-sm text-muted-foreground">Manage external MCP and service credentials through Integrations. Registry entries remain descriptive until a separate approved connection or activation is completed.</p><Button asChild variant="secondary"><Link href="/integrations">Open Integrations</Link></Button></SettingsBlock>}+ <McpNavigation active={page} onSelect={navigate} activeCount={state.tokens.filter(token => token.status === "active").length} direction={direction} />{page === "connect" && <McpSetupGuide origin={state.origin} maxScope={state.maxScope} />}{page === "connection" && <McpConnectionSection origin={state.origin} />}{page === "access" && <McpTokenSection tokens={state.tokens} onChanged={reload} onConnect={() => navigate("connect")} />}{page === "activity" && <McpActivity />}{page === "tools" && <McpToolsetCard info={state.toolset} />}+ {page === "registry" && <McpPluginRegistry />}</div>);}diff --git a/lib/plugins/manifest.test.ts b/lib/plugins/manifest.test.tsnew file mode 100644index 00000000..58cdc517--- /dev/null+++ b/lib/plugins/manifest.test.ts@@ -0,0 +1,71 @@+import { describe, expect, it } from "vitest";+import {+ BUILT_IN_PLUGINS,+ PLUGIN_MANIFEST_SCHEMA,+ createPluginRegistry,+ validatePluginManifest,+} from "./manifest";++const valid = {+ $schema: PLUGIN_MANIFEST_SCHEMA,+ schemaVersion: 1,+ version: "1.2.3",+ id: "sample-plugin",+ metadata: {+ name: "Sample",+ description: "A safe portable plugin.",+ homepage: "https://example.test/plugin",+ },+ skills: [{ id: "help", path: "skills/help/SKILL.md" }],+ mcp: [{ transport: "https", endpoint: "https://mcp.example.test/v1" }],+} as const;++describe("portable plugin manifest v1", () => {+ it("ships SI-Coder and Batonly through the same host-neutral contract", () => {+ expect(BUILT_IN_PLUGINS.map((plugin) => plugin.id)).toEqual(["si-coder", "batonly"]);+ for (const plugin of BUILT_IN_PLUGINS) {+ expect(plugin.$schema).toBe(PLUGIN_MANIFEST_SCHEMA);+ expect(validatePluginManifest(plugin)).toEqual({ ok: true, manifest: plugin });+ }+ });++ it("registers safe custom declarations without installing or executing them", () => {+ expect(createPluginRegistry([valid]).map((plugin) => plugin.id)).toEqual(["si-coder", "batonly", "sample-plugin"]);+ });++ it("rejects unknown schema versions and unknown fields", () => {+ expect(validatePluginManifest({ ...valid, schemaVersion: 2 }).ok).toBe(false);+ expect(validatePluginManifest({ ...valid, $schema: "urn:other:v1" }).ok).toBe(false);+ expect(validatePluginManifest({ ...valid, extra: true }).ok).toBe(false);+ });++ it.each([+ { ...valid, apiToken: "nope" },+ { ...valid, command: "echo nope" },+ { ...valid, metadata: { ...valid.metadata, authorizationHeader: "nope" } },+ ])("rejects secret or executable-shaped fields", (bad) => {+ expect(validatePluginManifest(bad).ok).toBe(false);+ });++ it.each([+ { ...valid, skills: [{ id: "help", path: "../help/SKILL.md" }] },+ { ...valid, skills: [{ id: "help", path: "/tmp/help/SKILL.md" }] },+ { ...valid, mcp: [{ transport: "stdio", entrypoint: "../mcp.js", catalog: "machine/functions.json" }] },+ { ...valid, mcp: [{ transport: "https", endpoint: "http://mcp.example.test" }] },+ { ...valid, mcp: [{ transport: "https", endpoint: "https://user:[email protected]" }] },+ { ...valid, mcp: [{ transport: "https", endpoint: "https://mcp.example.test?token=nope" }] },+ { ...valid, mcp: [{ transport: "https", endpoint: "https://mcp.example.test/#secret" }] },+ ])("rejects traversal, absolute paths, or unsafe remote descriptors", (bad) => {+ expect(validatePluginManifest(bad).ok).toBe(false);+ });++ it("deduplicates custom ids against built-ins and prior custom declarations", () => {+ const duplicateBuiltin = { ...valid, id: "si-coder" };+ const duplicateCustom = { ...valid, metadata: { ...valid.metadata, name: "Second" } };+ expect(createPluginRegistry([duplicateBuiltin, valid, duplicateCustom]).map((plugin) => plugin.id)).toEqual([+ "si-coder",+ "batonly",+ "sample-plugin",+ ]);+ });+});diff --git a/lib/plugins/manifest.ts b/lib/plugins/manifest.tsnew file mode 100644index 00000000..a3aafe9b--- /dev/null+++ b/lib/plugins/manifest.ts@@ -0,0 +1,208 @@+export const PLUGIN_MANIFEST_SCHEMA = "urn:agent-plugin:manifest:v1" as const;+export const PLUGIN_MANIFEST_VERSION = 1 as const;++export type PluginSkillDescriptor = {+ id: string;+ path: string;+};++export type PluginMcpDescriptor =+ | { transport: "stdio"; entrypoint: string; catalog: string }+ | { transport: "https"; endpoint: string };++export type PluginManifest = {+ $schema?: typeof PLUGIN_MANIFEST_SCHEMA;+ schemaVersion: typeof PLUGIN_MANIFEST_VERSION;+ version: string;+ id: string;+ metadata: {+ name: string;+ description: string;+ homepage?: string;+ };+ skills?: PluginSkillDescriptor[];+ mcp?: PluginMcpDescriptor[];+};++export type ManifestValidation =+ | { ok: true; manifest: PluginManifest }+ | { ok: false; error: string };++const ID = /^[a-z0-9][a-z0-9-]{0,62}$/;+const SEMVER = /^\d+\.\d+\.\d+(?:[-+][A-Za-z0-9.-]+)?$/;+const CONTROL = /[\u0000-\u001f\u007f]/;+const SAFE_RELATIVE_PATH = /^[A-Za-z0-9][A-Za-z0-9._/-]*$/;+const SENSITIVE_TOKENS = new Set([+ "secret",+ "token",+ "password",+ "credential",+ "authorization",+ "header",+ "env",+ "command",+ "shell",+ "argv",+ "script",+]);++function isRecord(value: unknown): value is Record<string, unknown> {+ return Boolean(value) && typeof value === "object" && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;+}++function sensitiveKey(key: string) {+ const tokens = key+ .replace(/([a-z0-9])([A-Z])/g, "$1_$2")+ .toLowerCase()+ .split(/[^a-z0-9]+/)+ .filter(Boolean);+ return tokens.some((token) => SENSITIVE_TOKENS.has(token));+}++function scanSensitiveKeys(value: unknown): string | null {+ if (!value || typeof value !== "object") return null;+ for (const [key, child] of Object.entries(value as Record<string, unknown>)) {+ if (sensitiveKey(key)) return key;+ const nested = scanSensitiveKeys(child);+ if (nested) return nested;+ }+ return null;+}++function exactKeys(object: Record<string, unknown>, allowed: readonly string[]) {+ return Object.keys(object).every((key) => allowed.includes(key));+}++function safeText(value: unknown, max: number) {+ return typeof value === "string" && value.trim().length > 0 && value.length <= max && !CONTROL.test(value);+}++function safeId(value: unknown) {+ return typeof value === "string" && ID.test(value);+}++function safeRelativePath(value: unknown) {+ if (typeof value !== "string" || value.length < 1 || value.length > 512 || CONTROL.test(value)) return false;+ if (!SAFE_RELATIVE_PATH.test(value) || value.startsWith("/") || value.includes("\\")) return false;+ return !value.split("/").some((segment) => segment === ".." || segment === ".");+}++function safeHttpsUrl(value: unknown) {+ if (typeof value !== "string" || value.length < 1 || value.length > 2048 || CONTROL.test(value)) return false;+ try {+ const url = new URL(value);+ return url.protocol === "https:" && !url.username && !url.password && !url.search && !url.hash;+ } catch {+ return false;+ }+}++export function validatePluginManifest(value: unknown): ManifestValidation {+ if (!isRecord(value)) return { ok: false, error: "Manifest must be a JSON object." };+ const sensitive = scanSensitiveKeys(value);+ if (sensitive) return { ok: false, error: `Manifest contains a sensitive or executable field: ${sensitive}.` };+ if (!exactKeys(value, ["$schema", "schemaVersion", "version", "id", "metadata", "skills", "mcp"])) {+ return { ok: false, error: "Manifest has unsupported fields." };+ }+ if (value.$schema !== undefined && value.$schema !== PLUGIN_MANIFEST_SCHEMA) {+ return { ok: false, error: `Unsupported plugin schema. Expected ${PLUGIN_MANIFEST_SCHEMA}.` };+ }+ if (value.schemaVersion !== PLUGIN_MANIFEST_VERSION) {+ return { ok: false, error: `Unsupported manifest schema version. Expected ${PLUGIN_MANIFEST_VERSION}.` };+ }+ if (typeof value.version !== "string" || !SEMVER.test(value.version)) {+ return { ok: false, error: "Plugin version must be semantic versioning." };+ }+ if (!safeId(value.id)) return { ok: false, error: "Plugin id must be a portable lowercase identifier." };++ if (!isRecord(value.metadata) || !exactKeys(value.metadata, ["name", "description", "homepage"])) {+ return { ok: false, error: "Plugin metadata is invalid." };+ }+ if (!safeText(value.metadata.name, 120) || !safeText(value.metadata.description, 1000)) {+ return { ok: false, error: "Plugin name or description is invalid." };+ }+ if (value.metadata.homepage !== undefined && !safeHttpsUrl(value.metadata.homepage)) {+ return { ok: false, error: "Plugin homepage must be a plain HTTPS URL." };+ }++ const skills = value.skills ?? [];+ if (!Array.isArray(skills) || skills.length > 100) {+ return { ok: false, error: "Plugin skills must contain at most 100 declarations." };+ }+ for (const skill of skills) {+ if (!isRecord(skill) || !exactKeys(skill, ["id", "path"]) || !safeId(skill.id) || !safeRelativePath(skill.path)) {+ return { ok: false, error: "Plugin skill declarations must use a safe id and package-relative path." };+ }+ if (!(skill.path as string).endsWith("SKILL.md")) {+ return { ok: false, error: "Plugin skill paths must point to SKILL.md." };+ }+ }++ const mcp = value.mcp ?? [];+ if (!Array.isArray(mcp) || mcp.length > 20) {+ return { ok: false, error: "Plugin MCP declarations must contain at most 20 entries." };+ }+ for (const descriptor of mcp) {+ if (!isRecord(descriptor)) return { ok: false, error: "Plugin MCP descriptor is invalid." };+ if (descriptor.transport === "stdio") {+ if (+ !exactKeys(descriptor, ["transport", "entrypoint", "catalog"]) ||+ !safeRelativePath(descriptor.entrypoint) ||+ !safeRelativePath(descriptor.catalog)+ ) {+ return { ok: false, error: "stdio MCP descriptors require safe package-relative entrypoint and catalog paths." };+ }+ continue;+ }+ if (descriptor.transport === "https") {+ if (!exactKeys(descriptor, ["transport", "endpoint"]) || !safeHttpsUrl(descriptor.endpoint)) {+ return { ok: false, error: "HTTPS MCP descriptors require one plain HTTPS endpoint." };+ }+ continue;+ }+ return { ok: false, error: "MCP transport must be stdio or https." };+ }++ return { ok: true, manifest: value as PluginManifest };+}++export const BUILT_IN_PLUGINS: readonly PluginManifest[] = Object.freeze([+ {+ $schema: PLUGIN_MANIFEST_SCHEMA,+ schemaVersion: 1,+ version: "0.9.8",+ id: "si-coder",+ metadata: {+ name: "SI-Coder",+ description: "Portable Agent Skills and MCP tools for building and publishing web applications.",+ homepage: "https://github.com/rahmanef63/si-coder-agent",+ },+ skills: [{ id: "si-coder-skills", path: "skills/sc/SKILL.md" }],+ mcp: [{ transport: "stdio", entrypoint: "scripts/sc-mcp.js", catalog: "machine/functions.json" }],+ },+ {+ $schema: PLUGIN_MANIFEST_SCHEMA,+ schemaVersion: 1,+ version: "1.19.0",+ id: "batonly",+ metadata: {+ name: "Batonly",+ description: "Project delivery collaboration MCP with a portable operating skill.",+ homepage: "https://batonly.site",+ },+ skills: [{ id: "baton", path: "plugin/skills/baton/SKILL.md" }],+ mcp: [{ transport: "https", endpoint: "https://site.batonly.site/mcp" }],+ },+]);++export function createPluginRegistry(custom: unknown[] = []) {+ const seen = new Set(BUILT_IN_PLUGINS.map((plugin) => plugin.id));+ const accepted: PluginManifest[] = [];+ for (const value of custom) {+ const result = validatePluginManifest(value);+ if (!result.ok || seen.has(result.manifest.id)) continue;+ seen.add(result.manifest.id);+ accepted.push(result.manifest);+ }+ return [...BUILT_IN_PLUGINS, ...accepted];+}