|
| 1 | +// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license. |
| 2 | + |
| 3 | +/** |
| 4 | + * "Connect an agent" Setup page — plugin-carried UI metadata (#2714 Phase 1, |
| 5 | + * objectui#2363). |
| 6 | + * |
| 7 | + * The page ships WITH the MCP capability (same principle as the marketplace |
| 8 | + * pages in `@objectstack/cloud-connection`, cloud ADR-0009: the nav lives and |
| 9 | + * dies with the capability — no MCP plugin, no entry). The page body is the |
| 10 | + * SDUI widget `mcp:connect-agent`, provided by objectui's console app-shell: |
| 11 | + * it reads `/discovery` for the environment's MCP URL, renders per-client |
| 12 | + * connect cards (claude.ai / Claude Desktop / Claude Code / Cursor / VS Code / |
| 13 | + * Codex), mints API keys for headless callers, and links the SKILL.md |
| 14 | + * download (`GET /api/v1/mcp/skill`). |
| 15 | + * |
| 16 | + * Registered by {@link MCPServerPlugin} on `kernel:ready`, gated on the same |
| 17 | + * default-on switch as the HTTP surface — an opted-out deployment |
| 18 | + * (`OS_MCP_SERVER_ENABLED=false`) gets no page and no nav entry. |
| 19 | + */ |
| 20 | + |
| 21 | +export const CONNECT_AGENT_PAGE = { |
| 22 | + name: 'connect_agent', |
| 23 | + label: 'Connect an Agent', |
| 24 | + type: 'app' as const, |
| 25 | + template: 'default', |
| 26 | + kind: 'full' as const, |
| 27 | + isDefault: false, |
| 28 | + regions: [ |
| 29 | + { |
| 30 | + name: 'header', |
| 31 | + width: 'full' as const, |
| 32 | + components: [ |
| 33 | + { |
| 34 | + type: 'page:header', |
| 35 | + properties: { |
| 36 | + title: 'Connect an Agent', |
| 37 | + subtitle: |
| 38 | + 'Give any MCP-capable AI client governed access to this environment — ' + |
| 39 | + 'every call runs under the caller\'s own permissions and row-level security.', |
| 40 | + icon: 'bot', |
| 41 | + }, |
| 42 | + }, |
| 43 | + ], |
| 44 | + }, |
| 45 | + { |
| 46 | + name: 'main', |
| 47 | + width: 'large' as const, |
| 48 | + components: [{ type: 'mcp:connect-agent', properties: {} }], |
| 49 | + }, |
| 50 | + ], |
| 51 | +}; |
| 52 | + |
| 53 | +export const CONNECT_AGENT_UI_BUNDLE = { |
| 54 | + id: 'com.objectstack.mcp.connect-agent-ui', |
| 55 | + namespace: 'sys', |
| 56 | + version: '0.1.0', |
| 57 | + type: 'plugin', |
| 58 | + scope: 'system', |
| 59 | + name: 'Connect an Agent UI', |
| 60 | + description: 'Setup page + navigation for connecting MCP clients to this environment.', |
| 61 | + pages: [CONNECT_AGENT_PAGE], |
| 62 | + navigationContributions: [ |
| 63 | + { |
| 64 | + app: 'setup', |
| 65 | + group: 'group_integrations', |
| 66 | + priority: 110, |
| 67 | + items: [ |
| 68 | + { |
| 69 | + id: 'nav_connect_agent', |
| 70 | + type: 'page', |
| 71 | + pageName: 'connect_agent', |
| 72 | + label: 'Connect an Agent', |
| 73 | + icon: 'bot', |
| 74 | + }, |
| 75 | + ], |
| 76 | + }, |
| 77 | + ], |
| 78 | +}; |
0 commit comments