@kolbo/mcp 1.54.0 → 1.55.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -14
- package/package.json +5 -3
- package/skill/GENERATED.md +1 -1
- package/skill/SKILL.md +16 -28
- package/skill/VERSION +1 -1
- package/skill/references/models/music.md +1 -1
- package/skill/references/workflows/media-library.md +29 -1
- package/skill/references/workflows/troubleshooting.md +13 -0
- package/src/apps/widgets/upload.js +19 -2
- package/src/client.js +60 -6
- package/src/index.js +31 -2
- package/src/install.js +35 -3
- package/src/polling.js +7 -0
- package/src/progress.js +55 -0
- package/src/tools/_shared.js +137 -11
- package/src/tools/artifacts.js +23 -5
- package/src/tools/chat.js +3 -3
- package/src/tools/generate.js +21 -19
- package/src/tools/media.js +104 -12
- package/src/tools/models.js +55 -3
- package/src/tools/moodboards.js +1 -1
- package/src/tools/music_library.js +31 -4
- package/src/tools/presets.js +56 -17
- package/src/tools/projects.js +1 -1
- package/src/tools/stock_library.js +23 -3
- package/src/tools/visual_dna.js +9 -5
- package/src/tools/voices.js +10 -1
- package/skill/references/models/voice-tts.md +0 -85
- package/skill/references/workflows/app-builder.md +0 -160
- package/src/tools/app_builder.js +0 -253
- package/src/tools/shorts_creator.js +0 -404
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
# App Builder
|
|
2
|
-
|
|
3
|
-
Load this file when the user wants to **build, edit, or iterate on a full React app** with Kolbo's App Builder — "build me a todo app", "add dark mode to my app", "give me the GitHub repo", "I want my app to use Kolbo image generation from the user's browser". Do NOT load this for single-asset generation requests (use the regular `generate_*` tools).
|
|
4
|
-
|
|
5
|
-
## 🚦 Preview / not live to the public yet
|
|
6
|
-
|
|
7
|
-
App Builder is in **preview** as of this writing. The MCP tools (`app_builder_*`) are wired and the backend runs end-to-end — owners can create projects, generate apps, edit them, get GitHub repos + Supabase DBs + a live deployment URL. The user-facing launch (in-app promo, self-serve public onboarding) is still pending. So:
|
|
8
|
-
|
|
9
|
-
- **You CAN call these tools** for owners / opted-in users — the flow works.
|
|
10
|
-
- **Don't proactively advertise App Builder** to users who haven't asked for it (no marketing pitch about "build apps with AI").
|
|
11
|
-
- If the user pushes back ("is this ready?"), say it's a working preview and ask if they want to try it.
|
|
12
|
-
|
|
13
|
-
## 🧠 Mental model — 4 layers, easy to conflate
|
|
14
|
-
|
|
15
|
-
This is the single biggest source of confusion. App Builder is NOT a generation tool. It's a **complete app factory** with its own lifecycle, its own runtime, and its own end-user identity model. Lock this in once:
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
┌─────────────────────────────────────────────────────────────────────────┐
|
|
19
|
-
│ Layer 1 — KOLBO PROJECT (Kolbo account) │
|
|
20
|
-
│ The same project you use for generations/media/chat. │
|
|
21
|
-
│ `list_projects` returns these. `app_builder_list_projects` ALSO │
|
|
22
|
-
│ returns these (same data, different endpoint shape). A project can │
|
|
23
|
-
│ hold BOTH regular sessions AND app-builder sessions at the same time. │
|
|
24
|
-
└─────────────────────────────────────────────────────────────────────────┘
|
|
25
|
-
│
|
|
26
|
-
▼
|
|
27
|
-
┌─────────────────────────────────────────────────────────────────────────┐
|
|
28
|
-
│ Layer 2 — APP BUILDER SESSION (one session = one app being built) │
|
|
29
|
-
│ Created with `app_builder_create_session` against a Kolbo project. │
|
|
30
|
-
│ Has a `session_id` that is COMPLETELY DIFFERENT from the │
|
|
31
|
-
│ `session_id` returned by `chat_send_message` or any `generate_*` │
|
|
32
|
-
│ tool. Don't mix them. │
|
|
33
|
-
│ A session accumulates "generations" — each one is a build / edit. │
|
|
34
|
-
└─────────────────────────────────────────────────────────────────────────┘
|
|
35
|
-
│
|
|
36
|
-
▼
|
|
37
|
-
┌─────────────────────────────────────────────────────────────────────────┐
|
|
38
|
-
│ Layer 3 — THE APP ITSELF (a deployed React app) │
|
|
39
|
-
│ After the first successful generation the session has a real app: │
|
|
40
|
-
│ • `deployment_url` — the live, hosted URL (e.g. apps.kolbo.ai/…) │
|
|
41
|
-
│ • `github_repo_url` — auto-provisioned GitHub repo (clone, hack) │
|
|
42
|
-
│ • `supabase_url` + `supabase_anon_key` — auto-provisioned DB │
|
|
43
|
-
│ The app embeds `@kolbo/app-sdk` so it can call Kolbo AI directly │
|
|
44
|
-
│ from the user's browser — see Layer 4. │
|
|
45
|
-
└─────────────────────────────────────────────────────────────────────────┘
|
|
46
|
-
│
|
|
47
|
-
▼
|
|
48
|
-
┌─────────────────────────────────────────────────────────────────────────┐
|
|
49
|
-
│ Layer 4 — APP END-USERS (real humans visiting the deployed app) │
|
|
50
|
-
│ Each visitor authenticates with a PER-APP JWT — NOT a Kolbo user │
|
|
51
|
-
│ account, NOT an API key. They hit `/api/apps/:appId/ai/*` endpoints │
|
|
52
|
-
│ that proxy Kolbo AI. The OWNER of the app (the person who built it) │
|
|
53
|
-
│ is the one whose credits get billed for every generation. This is a │
|
|
54
|
-
│ completely different surface from the MCP — there are no MCP tools │
|
|
55
|
-
│ for app end-users; the SDK lives in the generated app's bundle. │
|
|
56
|
-
└─────────────────────────────────────────────────────────────────────────┘
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
**The five easy confusions** — re-read this before every App Builder turn:
|
|
60
|
-
|
|
61
|
-
1. `list_projects` and `app_builder_list_projects` return the **same Kolbo projects** — different endpoints, different shapes, but the same data. Use whichever the current flow needs.
|
|
62
|
-
2. `session_id` from `app_builder_create_session` is NOT the same as `session_id` from `chat_send_message`. Don't pass an App Builder session id to a `generate_*` tool or vice versa.
|
|
63
|
-
3. `app_builder_generate_app` is NOT a media-generation tool. It kicks off a full multi-minute app build that produces code + infra + a deployment URL. Never confuse it with `generate_image` / `generate_video`.
|
|
64
|
-
4. The deployed app is its OWN product. Visiting it is not "using Kolbo"; the visitor's identity is per-app, not Kolbo.
|
|
65
|
-
5. The OWNER pays. App end-users consume credits from the owner's account. Confirm the owner understands this before they share their app publicly.
|
|
66
|
-
|
|
67
|
-
## When to route here
|
|
68
|
-
|
|
69
|
-
The user wants to **build or modify a full app**, not generate a single asset:
|
|
70
|
-
|
|
71
|
-
- "Build me a [todo / landing page / dashboard / form / marketplace / internal tool / mobile-friendly site] app"
|
|
72
|
-
- "Make me a [SaaS / site / app] that does X"
|
|
73
|
-
- "I want an app where my users can [Y]" (the visitor-runtime question — usually means App Builder + Layer 4)
|
|
74
|
-
- "Add [dark mode / a contact form / a chart / auth / a settings page] to my app"
|
|
75
|
-
- "Show me the GitHub repo" / "I want to clone it" / "Connect my own Supabase"
|
|
76
|
-
- "Is my app deployed?" / "My build failed" / "Why is the deployment URL blank?"
|
|
77
|
-
- "What apps have I built?" / "Show me my App Builder sessions"
|
|
78
|
-
- "Delete this app" (always confirm — see Rules)
|
|
79
|
-
|
|
80
|
-
## When NOT to route here
|
|
81
|
-
|
|
82
|
-
The user wants a single asset or a Kolbo-internal workflow. Stay on the regular `generate_*` / media / doc / chat tools:
|
|
83
|
-
|
|
84
|
-
- "Generate an image / video / song / voice / 3D model" → regular tools (the output lives in Kolbo)
|
|
85
|
-
- "Edit this image" → `generate_image_edit`
|
|
86
|
-
- "Write me a [plan / brief / script]" → `create_doc` (AI Docs)
|
|
87
|
-
- "Build a presentation / landing page artifact" → `publish_html_artifact`
|
|
88
|
-
- "I want a campaign with 4 product shots" → `generate_creative_director`
|
|
89
|
-
- "Make me a Kolbo character consistent across images" → Visual DNA tools
|
|
90
|
-
|
|
91
|
-
**Heuristic:** if the deliverable is a single file (image / video / doc / page artifact), it's NOT App Builder. If the deliverable is "an app that does X" or "my users can do Y in it", it IS App Builder.
|
|
92
|
-
|
|
93
|
-
## Standard workflow (build + iterate)
|
|
94
|
-
|
|
95
|
-
```
|
|
96
|
-
1. app_builder_list_projects → pick a Kolbo project (or note "default bucket")
|
|
97
|
-
2. app_builder_create_session(project_id) → returns session_id
|
|
98
|
-
3. app_builder_generate_app(session_id,
|
|
99
|
-
prompt="...") → blocks until build_status="deployed"
|
|
100
|
-
(up to ~5 min — surface the deployment_url!)
|
|
101
|
-
4. (later) app_builder_list_generations(session_id)
|
|
102
|
-
→ app_builder_edit_app(session_id,
|
|
103
|
-
generation_id=<latest>,
|
|
104
|
-
edit_prompt="add dark mode")
|
|
105
|
-
→ blocks until redeployed
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
**Surface the deployment URL on success** — always show the user: "Your app is live at: `<deployment_url>`". That's the whole payoff. If `deployment_url` is null after a successful build, treat it as a build failure and call `app_builder_get_build_status` to investigate.
|
|
109
|
-
|
|
110
|
-
**No manual polling needed.** `generate_app` and `edit_app` block until the build completes (or throws). If a build times out, the user can resume by calling `app_builder_get_build_status(session_id)` — DO NOT auto-retry; wait for the user's call.
|
|
111
|
-
|
|
112
|
-
## Local dev + handoff
|
|
113
|
-
|
|
114
|
-
If the user wants to run the app locally or connect to the database directly:
|
|
115
|
-
|
|
116
|
-
```
|
|
117
|
-
app_builder_get_session(session_id) → returns:
|
|
118
|
-
github_repo_url → git clone <url> && npm install && npm run dev
|
|
119
|
-
supabase_url → paste into .env as NEXT_PUBLIC_SUPABASE_URL
|
|
120
|
-
supabase_anon_key → paste into .env as NEXT_PUBLIC_SUPABASE_ANON_KEY
|
|
121
|
-
deployment_url → the currently deployed URL
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
The repo is a standard Next.js + Tailwind + shadcn/ui + Supabase app. The bundled `@kolbo/app-sdk` (`kolbo.auth`, `kolbo.data`, `kolbo.storage`, `kolbo.ai`) is what lets the app call Kolbo AI without exposing a full-access API key.
|
|
125
|
-
|
|
126
|
-
## End-user runtime — when the user asks "can my visitors do X in the app?"
|
|
127
|
-
|
|
128
|
-
This is Layer 4 — the deployed app's AI proxy. The MCP doesn't have direct tools for it, but you should KNOW it exists so you can answer:
|
|
129
|
-
|
|
130
|
-
- **What end-users see:** the deployed React app at `deployment_url`. They authenticate with a per-app JWT (auto-issued; the SDK handles it).
|
|
131
|
-
- **What they can do:** anything the app is coded to do, including calling Kolbo AI (image / video / chat / etc.) via `@kolbo/app-sdk`. The SDK hits `/api/apps/:appId/ai/*` proxy endpoints server-side; the OWNER's account is billed for those calls.
|
|
132
|
-
- **Spend controls:** the owner can set a per-app spend policy and per-user rate limits on the AI proxy (see `appAI/spendPolicy.js`). If the user says "my app is burning credits" or "someone is abusing my app", route them to that dashboard.
|
|
133
|
-
- **What you CAN'T do from the MCP:** inspect an end-user's session inside the app, view their chat history, or read their app-scoped data. Those live in the Kolbo dashboard under the App's settings.
|
|
134
|
-
|
|
135
|
-
## Routing examples
|
|
136
|
-
|
|
137
|
-
| User says | Sequence |
|
|
138
|
-
|---|---|
|
|
139
|
-
| "Build me a todo app" / "Make me a SaaS landing page with waitlist" | `app_builder_list_projects` → `app_builder_create_session` → `app_builder_generate_app` → show `deployment_url` |
|
|
140
|
-
| "Add dark mode to my app" / "Add a contact form / chart / auth" | `app_builder_list_generations` → grab latest `generation_id` → `app_builder_edit_app` → show `deployment_url` |
|
|
141
|
-
| "Give me the GitHub repo" / "I want to clone it and run it locally" | `app_builder_get_session` → return `github_repo_url` (+ `supabase_url` + `supabase_anon_key` if they ask) |
|
|
142
|
-
| "Show me my apps" / "What apps have I built?" | `app_builder_list_projects` → for each, `app_builder_list_sessions` → surface session list |
|
|
143
|
-
| "Is my build still running?" / "My build timed out" | `app_builder_get_build_status(session_id)` → resume |
|
|
144
|
-
| "Delete this app" | **ALWAYS CONFIRM FIRST** — see Rules. Then `app_builder_delete_session` |
|
|
145
|
-
| "My app visitors are burning my credits" | Not an MCP action — point them at the App → Settings → Spend Policy dashboard |
|
|
146
|
-
| "I want my app users to be able to generate images inside the app" | Tell them the `@kolbo/app-sdk` `kolbo.ai.generateImage` namespace handles it server-side via `/api/apps/:appId/ai/generate/image` — the OWNER pays |
|
|
147
|
-
|
|
148
|
-
## Hard rules
|
|
149
|
-
|
|
150
|
-
- **ALWAYS confirm before `app_builder_delete_session`** — permanently deletes the GitHub repo, Supabase DB (unless user-connected their own), deployed files, generation history, messages, and form submissions. IRREVERSIBLE.
|
|
151
|
-
- **On build timeout / failure:** use `app_builder_get_build_status(session_id)` and report the actual status to the user. DO NOT auto-retry the build.
|
|
152
|
-
- **Never invent a `deployment_url` or `github_repo_url`** — they come back from the tool. If null, the build didn't finish.
|
|
153
|
-
- **The owner pays for every AI call made by an app visitor.** Make sure the user understands this before they share the app publicly. Direct them to spend-policy settings if they need a cap.
|
|
154
|
-
- **Whitelabel works automatically** — the MCP client routes App Builder calls through the whitelabel API endpoints when configured.
|
|
155
|
-
- **Don't conflate `project_id` types.** A Kolbo project holds App Builder sessions; the App Builder session is a CHILD of that project. The deployed app has its OWN `:appId` (visible in `app_builder_get_session`) which is what the app-runtime uses to route AI calls — that's a different id namespace from the Kolbo `project_id`.
|
|
156
|
-
|
|
157
|
-
## Versioning note (MCP)
|
|
158
|
-
|
|
159
|
-
- The App Builder MCP surface is **stable as of `@kolbo/mcp@1.37.0`**. No renames or removals planned. New optional args ship as `npm version minor` per the standard rules.
|
|
160
|
-
- The kolbo-code skill mirrors this doc (canonical source: `kolbo-code/packages/opencode/skills/kolbo/references/workflows/app-builder.md`); a `chore(skill)` bot keeps them in sync.
|
package/src/tools/app_builder.js
DELETED
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
/* ⛔ BACKWARD COMPATIBILITY: Tool names and arg names below are a PUBLIC
|
|
2
|
-
* CONTRACT. Never rename, remove, or break an existing tool/arg — old cached
|
|
3
|
-
* `npx @kolbo/mcp` installs in the wild will break silently. Add new tools or
|
|
4
|
-
* new OPTIONAL args only. Full rules: ../index.js top-of-file and CLAUDE.md. */
|
|
5
|
-
|
|
6
|
-
const { z } = require('zod');
|
|
7
|
-
const { PollingTimeoutError } = require('../polling');
|
|
8
|
-
|
|
9
|
-
// ─── Build-status polling (App Builder uses a different endpoint than /v1/generate) ──
|
|
10
|
-
async function pollBuildStatus(client, sessionId, options = {}) {
|
|
11
|
-
const {
|
|
12
|
-
interval = 5000,
|
|
13
|
-
timeout = 300000 // 5 minutes
|
|
14
|
-
} = options;
|
|
15
|
-
|
|
16
|
-
const startTime = Date.now();
|
|
17
|
-
const url = `/app-builder/${encodeURIComponent(sessionId)}/build-status`;
|
|
18
|
-
|
|
19
|
-
while (true) {
|
|
20
|
-
if (Date.now() - startTime > timeout) {
|
|
21
|
-
throw new PollingTimeoutError(sessionId, timeout);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const result = await client.get(url);
|
|
25
|
-
|
|
26
|
-
if (result.buildStatus === 'deployed') {
|
|
27
|
-
return result;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (result.buildStatus === 'failed') {
|
|
31
|
-
throw new Error(
|
|
32
|
-
`App build failed for session_id="${sessionId}". ` +
|
|
33
|
-
`Call app_builder_get_build_status to check the current state.`
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
await new Promise(resolve => setTimeout(resolve, interval));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function registerAppBuilderTools(server, client) {
|
|
42
|
-
// ─── app_builder_list_projects ─────────────────────────────────────────────
|
|
43
|
-
server.tool(
|
|
44
|
-
'app_builder_list_projects',
|
|
45
|
-
'List all Kolbo projects for the authenticated user. Use this to find the project_id required by app_builder_create_session and app_builder_list_sessions. Projects are the top-level containers — each project can hold multiple App Builder sessions.',
|
|
46
|
-
{},
|
|
47
|
-
async () => {
|
|
48
|
-
const res = await client.get('/project/lightweight');
|
|
49
|
-
const projects = (Array.isArray(res) ? res : (res.data || [])).map(p => ({
|
|
50
|
-
project_id: p._id,
|
|
51
|
-
name: p.name,
|
|
52
|
-
description: p.description || '',
|
|
53
|
-
created_at: p.createdAt
|
|
54
|
-
}));
|
|
55
|
-
return {
|
|
56
|
-
content: [{ type: 'text', text: JSON.stringify(projects, null, 2) }]
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
// ─── app_builder_create_session ────────────────────────────────────────────
|
|
62
|
-
server.tool(
|
|
63
|
-
'app_builder_create_session',
|
|
64
|
-
'Create a new App Builder session inside a Kolbo project. Returns a session_id to pass to app_builder_generate_app. Sessions hold the full app state across multiple generations and edits.',
|
|
65
|
-
{
|
|
66
|
-
project_id: z.string().describe('Kolbo project ID to scope this session. Use app_builder_list_projects to find your project_id.'),
|
|
67
|
-
name: z.string().optional().describe('Optional initial session name. The backend will auto-generate a name on first generation if omitted.')
|
|
68
|
-
},
|
|
69
|
-
async ({ project_id, name }) => {
|
|
70
|
-
const body = name ? { name } : {};
|
|
71
|
-
const res = await client.post(`/app-builder/session/${encodeURIComponent(project_id)}`, body);
|
|
72
|
-
const session = res.data || res;
|
|
73
|
-
return {
|
|
74
|
-
content: [{
|
|
75
|
-
type: 'text',
|
|
76
|
-
text: JSON.stringify({
|
|
77
|
-
session_id: session._id,
|
|
78
|
-
name: session.name,
|
|
79
|
-
build_status: session.buildStatus,
|
|
80
|
-
deployment_url: session.deploymentUrl || null
|
|
81
|
-
}, null, 2)
|
|
82
|
-
}]
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
// ─── app_builder_generate_app ──────────────────────────────────────────────
|
|
88
|
-
server.tool(
|
|
89
|
-
'app_builder_generate_app',
|
|
90
|
-
'Generate a React app from a text prompt inside an App Builder session. On the FIRST call the backend auto-generates a punchy app name, URL slug, GitHub repo, and (if needed) a Supabase database. The build runs in the background — this tool polls until the app is deployed (up to 5 minutes) then returns the live deployment_url. Always show the user the deployment_url when done.',
|
|
91
|
-
{
|
|
92
|
-
session_id: z.string().describe('Session ID from app_builder_create_session.'),
|
|
93
|
-
prompt: z.string().describe('Natural language description of the app to build (e.g. "a todo app with drag-and-drop and Supabase persistence").')
|
|
94
|
-
},
|
|
95
|
-
async ({ session_id, prompt }) => {
|
|
96
|
-
await client.post(`/app-builder/generation/${encodeURIComponent(session_id)}`, { userPrompt: prompt });
|
|
97
|
-
const status = await pollBuildStatus(client, session_id);
|
|
98
|
-
return {
|
|
99
|
-
content: [{
|
|
100
|
-
type: 'text',
|
|
101
|
-
text: JSON.stringify({
|
|
102
|
-
session_id,
|
|
103
|
-
build_status: status.buildStatus,
|
|
104
|
-
deployment_url: status.deploymentUrl || null,
|
|
105
|
-
app_name: status.appName || null
|
|
106
|
-
}, null, 2)
|
|
107
|
-
}]
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
// ─── app_builder_edit_app ──────────────────────────────────────────────────
|
|
113
|
-
server.tool(
|
|
114
|
-
'app_builder_edit_app',
|
|
115
|
-
'Edit an existing generated app with a natural language instruction — "add a dark mode toggle", "change the color scheme to blue", "add a contact form". Like app_builder_generate_app but for modifications. Use app_builder_list_generations to get the current generation_id before calling this.',
|
|
116
|
-
{
|
|
117
|
-
session_id: z.string().describe('Session ID of the app to edit.'),
|
|
118
|
-
generation_id: z.string().describe('The generation to edit. Use app_builder_list_generations to find the latest generation_id.'),
|
|
119
|
-
edit_prompt: z.string().describe('Natural language instruction describing the change to make.')
|
|
120
|
-
},
|
|
121
|
-
async ({ session_id, generation_id, edit_prompt }) => {
|
|
122
|
-
await client.put(
|
|
123
|
-
`/app-builder/generation/${encodeURIComponent(session_id)}/${encodeURIComponent(generation_id)}`,
|
|
124
|
-
{ editPrompt: edit_prompt }
|
|
125
|
-
);
|
|
126
|
-
const status = await pollBuildStatus(client, session_id);
|
|
127
|
-
return {
|
|
128
|
-
content: [{
|
|
129
|
-
type: 'text',
|
|
130
|
-
text: JSON.stringify({
|
|
131
|
-
session_id,
|
|
132
|
-
build_status: status.buildStatus,
|
|
133
|
-
deployment_url: status.deploymentUrl || null,
|
|
134
|
-
app_name: status.appName || null
|
|
135
|
-
}, null, 2)
|
|
136
|
-
}]
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
// ─── app_builder_get_build_status ──────────────────────────────────────────
|
|
142
|
-
server.tool(
|
|
143
|
-
'app_builder_get_build_status',
|
|
144
|
-
'Check the current build status of an App Builder session. Use this to manually poll after app_builder_generate_app or app_builder_edit_app, or to check on an app at any time. Returns "deployed" when the live URL is ready.',
|
|
145
|
-
{
|
|
146
|
-
session_id: z.string().describe('Session ID to check.')
|
|
147
|
-
},
|
|
148
|
-
async ({ session_id }) => {
|
|
149
|
-
const result = await client.get(`/app-builder/${encodeURIComponent(session_id)}/build-status`);
|
|
150
|
-
return {
|
|
151
|
-
content: [{
|
|
152
|
-
type: 'text',
|
|
153
|
-
text: JSON.stringify({
|
|
154
|
-
build_status: result.buildStatus,
|
|
155
|
-
deployment_url: result.deploymentUrl || null,
|
|
156
|
-
deployed_at: result.deployedAt || null
|
|
157
|
-
}, null, 2)
|
|
158
|
-
}]
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
);
|
|
162
|
-
|
|
163
|
-
// ─── app_builder_get_session ───────────────────────────────────────────────
|
|
164
|
-
server.tool(
|
|
165
|
-
'app_builder_get_session',
|
|
166
|
-
'Get full details of an App Builder session including metadata, build status, deployment URL, and GitHub/Supabase integration info. Use this when the user wants to clone the app locally — it returns the GitHub repo URL and Supabase connection details needed for local development.',
|
|
167
|
-
{
|
|
168
|
-
session_id: z.string().describe('Session ID to retrieve.')
|
|
169
|
-
},
|
|
170
|
-
async ({ session_id }) => {
|
|
171
|
-
const res = await client.get(`/app-builder/session/${encodeURIComponent(session_id)}`);
|
|
172
|
-
const session = res.data || res;
|
|
173
|
-
return {
|
|
174
|
-
content: [{
|
|
175
|
-
type: 'text',
|
|
176
|
-
text: JSON.stringify({
|
|
177
|
-
session_id: session._id,
|
|
178
|
-
name: session.name,
|
|
179
|
-
build_status: session.buildStatus,
|
|
180
|
-
deployment_url: session.deploymentUrl || null,
|
|
181
|
-
github_repo_url: session.githubRepoUrl || null,
|
|
182
|
-
supabase_url: session.supabaseUrl || null,
|
|
183
|
-
supabase_anon_key: session.supabaseAnonKey || null,
|
|
184
|
-
created_at: session.createdAt
|
|
185
|
-
}, null, 2)
|
|
186
|
-
}]
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
);
|
|
190
|
-
|
|
191
|
-
// ─── app_builder_list_sessions ─────────────────────────────────────────────
|
|
192
|
-
server.tool(
|
|
193
|
-
'app_builder_list_sessions',
|
|
194
|
-
'List all App Builder sessions in a project. Use this to find existing sessions before creating a new one, or to pick a session_id to continue working on.',
|
|
195
|
-
{
|
|
196
|
-
project_id: z.string().describe('Kolbo project ID. Use app_builder_list_projects to find it.')
|
|
197
|
-
},
|
|
198
|
-
async ({ project_id }) => {
|
|
199
|
-
const res = await client.get(`/app-builder/sessions/${encodeURIComponent(project_id)}`);
|
|
200
|
-
const sessions = (Array.isArray(res) ? res : (res.data || [])).map(s => ({
|
|
201
|
-
session_id: s._id,
|
|
202
|
-
name: s.name,
|
|
203
|
-
build_status: s.buildStatus,
|
|
204
|
-
deployment_url: s.deploymentUrl || null,
|
|
205
|
-
created_at: s.createdAt
|
|
206
|
-
}));
|
|
207
|
-
return {
|
|
208
|
-
content: [{ type: 'text', text: JSON.stringify(sessions, null, 2) }]
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
);
|
|
212
|
-
|
|
213
|
-
// ─── app_builder_list_generations ──────────────────────────────────────────
|
|
214
|
-
server.tool(
|
|
215
|
-
'app_builder_list_generations',
|
|
216
|
-
'List all generations for an App Builder session, newest first. Use this to find the current generation_id before calling app_builder_edit_app.',
|
|
217
|
-
{
|
|
218
|
-
session_id: z.string().describe('Session ID to list generations for.')
|
|
219
|
-
},
|
|
220
|
-
async ({ session_id }) => {
|
|
221
|
-
const res = await client.get(`/app-builder/generations/${encodeURIComponent(session_id)}`);
|
|
222
|
-
const generations = (Array.isArray(res) ? res : (res.data || [])).map(g => ({
|
|
223
|
-
generation_id: g._id,
|
|
224
|
-
user_prompt: g.userPrompt || g.editPrompt || '',
|
|
225
|
-
build_status: g.buildStatus,
|
|
226
|
-
created_at: g.createdAt
|
|
227
|
-
}));
|
|
228
|
-
return {
|
|
229
|
-
content: [{ type: 'text', text: JSON.stringify(generations, null, 2) }]
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
);
|
|
233
|
-
|
|
234
|
-
// ─── app_builder_delete_session ────────────────────────────────────────────
|
|
235
|
-
server.tool(
|
|
236
|
-
'app_builder_delete_session',
|
|
237
|
-
'Permanently delete an App Builder session and ALL associated resources: GitHub repo, Supabase database (unless user-connected), deployed files, generation history, messages, and form submissions. THIS IS IRREVERSIBLE — always confirm with the user before calling.',
|
|
238
|
-
{
|
|
239
|
-
session_id: z.string().describe('Session ID to permanently delete. This cannot be undone.')
|
|
240
|
-
},
|
|
241
|
-
async ({ session_id }) => {
|
|
242
|
-
await client.delete(`/app-builder/session/${encodeURIComponent(session_id)}`);
|
|
243
|
-
return {
|
|
244
|
-
content: [{
|
|
245
|
-
type: 'text',
|
|
246
|
-
text: JSON.stringify({ success: true }, null, 2)
|
|
247
|
-
}]
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
module.exports = { registerAppBuilderTools };
|