UNPKG

decocms

Version:

Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools

2 lines (1 loc) • 3.75 kB
import{U as b}from"./url-slug-CII_0B7H.js";import{aJ as o,cs as a,bF as t,aK as e,dD as i,dB as r,dH as h,eu as m,dC as _,ct as g}from"./index-ztdGKvBm.js";const f=o({authorizationEndpoint:e().url(),tokenEndpoint:e().url(),introspectionEndpoint:e().url().optional(),clientId:e(),clientSecret:e().optional(),scopes:t(e()),grantType:a(["authorization_code","client_credentials"])}),s=o({type:h("object"),properties:i(e(),r()).optional(),required:t(e()).optional()}).catchall(r()),S=m.extend({inputSchema:s,outputSchema:s.optional()}),T=o({headers:i(e(),e()).optional()}),y=o({command:e().describe("Command to run (e.g., 'npx', 'node')"),args:t(e()).optional().describe("Command arguments"),cwd:e().optional().describe("Working directory"),envVars:i(e(),e()).optional().describe("Environment variables (encrypted in storage)")}),l=256*1024;function d(n){return i(e(),r()).nullable().refine(c=>c===null||JSON.stringify(c).length<=l,{message:`${n} must serialize to at most ${l} bytes`})}const u=4096,p=o({id:e().describe("Unique identifier for the connection"),title:e().describe("Human-readable name for the connection"),created_at:e().describe("When the connection was created"),updated_at:e().describe("When the connection was last updated"),created_by:e().describe("User ID who created the connection"),updated_by:e().optional().describe("User ID who last updated the connection"),organization_id:e().describe("Organization ID this connection belongs to"),description:e().nullable().describe("Description of the connection"),icon:e().nullable().describe("Icon URL for the connection"),app_name:e().nullable().describe("Associated app name"),app_id:e().nullable().describe("Associated app ID"),slug:e().nullable().optional().describe("URL-safe slug derived from app_name, connection_url, or title"),url_slug:e().nullable().optional().describe("Name of the connection in Studio URLs, unique in the organization. Set it to rename the URL; the old one keeps redirecting."),connection_type:a(["HTTP","SSE","Websocket","STDIO","VIRTUAL"]).describe("Type of connection"),connection_url:e().nullable().describe("URL for HTTP/SSE/WebSocket connections. virtual://$id for VIRTUAL. Null for STDIO."),connection_token:e().nullable().optional().describe("Authentication token (for HTTP connections). Write-only: tool responses never include it."),has_connection_token:g().optional().describe("Whether a connection_token is stored. Set on tool responses."),connection_headers:_([y,T]).nullable().describe("Connection parameters. HTTP: { headers }. STDIO: { command, args, cwd, envVars }"),oauth_config:f.nullable().describe("OAuth configuration"),configuration_state:d("configuration_state").describe("Configuration state (decrypted)"),configuration_scopes:t(e()).nullable().optional().describe("Configuration scopes"),metadata:d("metadata").describe("Additional metadata (includes repository info)"),tools:t(S).nullable().describe("Discovered tools from MCP"),bindings:t(e()).nullable().describe("Detected bindings"),status:a(["active","inactive","error"]).describe("Current status")});p.omit({created_at:!0,updated_at:!0,created_by:!0,updated_by:!0,organization_id:!0,tools:!0,bindings:!0,status:!0,has_connection_token:!0}).partial({id:!0,description:!0,icon:!0,app_name:!0,app_id:!0,connection_url:!0,connection_token:!0,connection_headers:!0,oauth_config:!0,configuration_state:!0,configuration_scopes:!0,metadata:!0}).extend({icon:e().nullish(),connection_token:e().max(u).nullish()});p.omit({has_connection_token:!0}).partial().extend({url_slug:b.nullish(),connection_token:e().max(u).nullish()});function D(n){return n!=null&&"command"in n}function I(n){return!n||!n.startsWith("virtual://")?null:n.replace("virtual://","")}export{f as O,D as i,I as p};