@mistflow-ai/mcp 0.7.1 → 0.7.2
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 -6
- package/dist/index.js +53 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ The Mistflow MCP server — an app-building tool provider for AI coding editors
|
|
|
6
6
|
|
|
7
7
|
## What this is
|
|
8
8
|
|
|
9
|
-
A Model Context Protocol ([MCP](https://modelcontextprotocol.io)) server that exposes Mistflow's app-building capabilities as tools to your AI coding editor. Your editor's AI does the reasoning; this server
|
|
9
|
+
A Model Context Protocol ([MCP](https://modelcontextprotocol.io)) server that exposes Mistflow's app-building capabilities as tools to your AI coding editor. Your editor's AI does the reasoning; this server provides the short, structured control-plane flows, while the companion CLI handles planning, scaffolding, building, seeding, and deployment.
|
|
10
10
|
|
|
11
11
|
The server never calls an LLM itself. It's a tool orchestrator, not a brain.
|
|
12
12
|
|
|
@@ -15,12 +15,9 @@ The server never calls an LLM itself. It's a tool orchestrator, not a brain.
|
|
|
15
15
|
| Tool | Purpose |
|
|
16
16
|
|------|---------|
|
|
17
17
|
| `mist_setup` | Device-code auth flow — log in via browser, credentials stored in `~/.mistflow/credentials.json` |
|
|
18
|
-
| `
|
|
19
|
-
| `mist_build` | Scaffold projects, implement plan steps, run local builds, QA the live app, generate wireframes |
|
|
20
|
-
| `mist_deploy` | Deploy to cloud, preview via tunnel, redeploy/rollback, verify live site |
|
|
21
|
-
| `mist_project` | Read/update project state, browse presets, fetch runtime errors and deploy logs |
|
|
22
|
-
| `mist_config` | Manage env vars and custom domains |
|
|
18
|
+
| `mist_project` | Read/update project state so the host AI can reason about an existing Mistflow app |
|
|
23
19
|
| `mist_browser` | Browser automation for testing the live app |
|
|
20
|
+
| `mist_help` | Return the Mistflow CLI catalog so the host AI knows which `mist` commands to run next |
|
|
24
21
|
|
|
25
22
|
## Manual install (if the installer doesn't work for you)
|
|
26
23
|
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import{a as I,d as
|
|
1
|
+
import{a as I,d as j,e as k}from"./chunk-UNFTM4B3.js";import{c as R,d as C,f as _}from"./chunk-RTKBAE4U.js";import{Server as ie}from"@modelcontextprotocol/sdk/server/index.js";import{StdioServerTransport as re}from"@modelcontextprotocol/sdk/server/stdio.js";import{CallToolRequestSchema as ae,ListToolsRequestSchema as le}from"@modelcontextprotocol/sdk/types.js";import{zodToJsonSchema as ce}from"zod-to-json-schema";function r(n,e=!1){let t=n;try{let a=R();a&&(t=n+a)}catch{}return{content:[{type:"text",text:t}],isError:e}}function P(n){return r(`This is not a Mistflow project (no mistflow.json found at ${n}).
|
|
2
2
|
|
|
3
3
|
Mistflow creates new projects from scratch \u2014 it doesn't work inside existing codebases.
|
|
4
4
|
|
|
5
5
|
To get started:
|
|
6
|
-
1. Run
|
|
7
|
-
2. Run
|
|
8
|
-
3. Run
|
|
6
|
+
1. Run mist plan --describe "<your app idea>"
|
|
7
|
+
2. Run mist init --plan-id <planId> --path <absolute-path>
|
|
8
|
+
3. Run mist install <absolute-path>, then mist implement <absolute-path>
|
|
9
9
|
|
|
10
|
-
If you want to deploy an existing project, use your framework's deploy tools directly.`,!0)}import{z as
|
|
10
|
+
If you want to deploy an existing project, use your framework's deploy tools directly.`,!0)}import{z as x}from"zod";import{platform as W}from"os";import{execFile as M}from"child_process";var K=x.object({apiKey:x.string().optional().describe("API key (mist_...) for headless auth. Skips the device code flow entirely. Generate one at app.mistflow.ai/mcp-keys."),deviceCode:x.string().optional().describe("Resume polling for a pending device code. Returned by a previous mist_setup call with status 'pending'. Call mist_setup again with this value after ~15 seconds to check if the user approved.")});function B(n){return"error"in n}function L(n){return new Promise(e=>setTimeout(e,n))}function H(n){return new Promise(e=>{let t=W();t==="win32"?M("cmd.exe",["/c","start","",n],a=>{a&&console.error("Could not open browser:",a.message),e(!a)}):M(t==="darwin"?"open":"xdg-open",[n],o=>{o&&console.error("Could not open browser:",o.message),e(!o)}),setTimeout(()=>e(!1),5e3)})}var G={fetch:globalThis.fetch,openBrowser:H,sleep:L};async function q(n,e,t,a){let o=t,l=a.sleep??L;for(let i=0;i<e;i++){await l(o);let s;try{let p=await a.fetch(`${_()}/auth/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_code:n})});if(!p.ok)continue;s=await p.json()}catch{continue}if(B(s))switch(s.error){case"authorization_pending":continue;case"slow_down":o+=5e3;continue;case"expired_token":return r("The sign-in link expired. Run mist_setup again to get a new code.",!0);case"access_denied":return r("Sign-in was cancelled. Run mist_setup again to try again.",!0);case"already_exchanged":return r("This sign-in link was already used. Run mist_setup again to get a new code.",!0)}let d=s.email||s.org_name||s.org_slug;return C({apiKey:s.api_key,apiKeyId:s.api_key_id,apiKeyName:s.api_key_name,orgId:s.org_id,orgSlug:s.org_slug,email:s.email}),r(`Connected to Mistflow as ${d}. You are ready to build and deploy.`)}return null}async function Y(n,e=G){let t=n;if(t?.apiKey)try{let i=await e.fetch(`${_()}/api/org`,{headers:{Authorization:`ApiKey ${t.apiKey}`}});if(!i.ok)return r("Invalid API key. Check the key and try again.",!0);let s=await i.json();return C({apiKey:t.apiKey,orgId:s.id,orgSlug:s.slug}),r(`Connected to Mistflow as ${s.slug} via API key. You are ready to build and deploy.`)}catch{return r("Cannot reach Mistflow servers. Check your internet connection.",!0)}if(t?.deviceCode){let i=await q(t.deviceCode,6,5e3,e);return i||r(JSON.stringify({status:"pending",deviceCode:t.deviceCode,instruction:"The user hasn't approved yet. Wait ~15 seconds and call mist_setup again with the same deviceCode."}))}let a;try{let i=await e.fetch(`${_()}/auth/device`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!i.ok)return r("Cannot reach Mistflow servers. Check your internet connection.",!0);a=await i.json()}catch{return r("Cannot reach Mistflow servers. Check your internet connection.",!0)}let o=`${a.verification_uri}?code=${a.user_code}`;console.error(`
|
|
11
11
|
Sign in at: ${o}
|
|
12
12
|
Your code: ${a.user_code}
|
|
13
|
-
`);try{await e.openBrowser(o)}catch{}let l=await
|
|
14
|
-
`)){let o=a.trim();if(!o||o.startsWith("#"))continue;let l=o.indexOf("=");if(l>0){let i=o.slice(0,l).trim(),s=o.slice(l+1).trim();s&&s!=='""'&&s!=="''"&&e.add(i)}}return e}var oe=u.object({action:u.enum(["get","update"]).default("get").describe("'get' reads current project state. 'update' modifies it."),projectPath:u.string().optional().describe("Path to the project directory (default: current working directory)"),completedStep:u.number().optional().describe("(update only) Mark a plan step as completed by step number"),addEnvVar:u.object({key:u.string(),description:u.string().optional(),setupUrl:u.string().optional()}).optional().describe("(update only) Add a required env var to the project manifest")}),
|
|
13
|
+
`);try{await e.openBrowser(o)}catch{}let l=await q(a.device_code,6,5e3,e);return l||r(JSON.stringify({status:"pending",deviceCode:a.device_code,signInUrl:o,userCode:a.user_code,instruction:"The user hasn't approved yet. Wait ~15 seconds, then call mist_setup again with deviceCode='"+a.device_code+"' to check if they approved."}))}var E={name:"mist_setup",description:"Connect the user's Mistflow account. Call this ONLY when: (a) the user has literally never signed in, or (b) a previous tool call returned error code 'auth_missing' or 'auth_revoked'. DO NOT call this tool in response to 500 errors, 404 errors, network errors, or any generic failure \u2014 those are backend issues, not auth issues. Running mist_setup when not needed wastes the user's time and creates login fatigue. Once signed in, the MCP persists a long-lived API key and never asks again. Two-phase device code flow: (1) Call without deviceCode \u2014 opens browser, returns status 'pending' with deviceCode and userCode. Tell the user the verification code and that they need to approve in the browser. (2) Call again with deviceCode after ~15 seconds \u2014 polls for approval. Also accepts an apiKey for headless auth (skips device code entirely).",inputSchema:K,handler:n=>Y(n)};import{z as m}from"zod";import{z as u}from"zod";import{resolve as Z,join as U}from"path";import{existsSync as ee,readFileSync as A,writeFileSync as te}from"fs";import{existsSync as Q,readFileSync as X}from"fs";function O(n){let e=new Set;if(!Q(n))return e;let t=X(n,"utf-8");for(let a of t.split(`
|
|
14
|
+
`)){let o=a.trim();if(!o||o.startsWith("#"))continue;let l=o.indexOf("=");if(l>0){let i=o.slice(0,l).trim(),s=o.slice(l+1).trim();s&&s!=='""'&&s!=="''"&&e.add(i)}}return e}var oe=u.object({action:u.enum(["get","update"]).default("get").describe("'get' reads current project state. 'update' modifies it."),projectPath:u.string().optional().describe("Path to the project directory (default: current working directory)"),completedStep:u.number().optional().describe("(update only) Mark a plan step as completed by step number"),addEnvVar:u.object({key:u.string(),description:u.string().optional(),setupUrl:u.string().optional()}).optional().describe("(update only) Add a required env var to the project manifest")}),N={name:"mist_state",description:"Read or update project state in mistflow.json. Use action='get' to load plan progress, env var status, and deploy info. Use action='update' to mark plan steps complete or add required env vars. Use when the user says 'mist status', 'mist state', or 'mist update state'.",inputSchema:oe,handler:async n=>{let e=n,t=Z(e.projectPath??process.cwd()),a=U(t,"mistflow.json");if(!ee(a))return P(t);let o;try{o=JSON.parse(A(a,"utf-8"))}catch{return r("Failed to parse mistflow.json.",!0)}if(e.action==="get"){if(!o.projectId)try{let{ensureBackendRegistered:c}=await import("./self-heal-KDCW562K.js");await c(t)&&(o=JSON.parse(A(a,"utf-8")))}catch{}let s=o.plan,d=s?.steps?.filter(c=>c.status==="completed").length??0,p=s?.steps?.length??0,g=O(U(t,".env.local")),y=o.env?.required?Object.entries(o.env.required).map(([c,b])=>({name:c,description:b?.description,configured:g.has(c)})):[];o.projectId&&import("./state-manager-NJPMKZCE.js").then(({fetchRemoteState:c})=>c(o.projectId)).catch(()=>{});let f=[`Project: ${o.name}`];if(s){f.push(`Plan: ${s.summary??s.name??"unnamed"} \u2014 ${d}/${p} steps complete`);for(let c of s.steps){let b=c.status==="completed"?"\u2713":c.status==="in_progress"?"\u2192":" ";f.push(` [${b}] ${c.number}. ${c.name}`)}}let w=y.filter(c=>!c.configured);w.length>0&&f.push(`Missing env vars: ${w.map(c=>c.name).join(", ")}`),o.deploy?.url?f.push(`Deployed: ${o.deploy.url} (${o.deploy.count??0} deploys)`):f.push("Not deployed yet");let v=[],T=s?.steps?.find(c=>c.status!=="completed");return T?v.push(`NEXT: Run mist implement <absolute-path> to work on step ${T.number} (${T.name}).`):s&&d===p&&(o.deploy?.url||v.push("NEXT: All steps complete! Run mist deploy <absolute-path> to deploy the app now. Do NOT ask the user \u2014 just deploy.")),w.length>0&&v.push(`Missing env vars in .env.local: ${w.map(c=>c.name).join(", ")}`),r(JSON.stringify({name:o.name,projectId:o.projectId,planProgress:s?{name:s.name,summary:s.summary,totalSteps:p,completedSteps:d,steps:s.steps}:null,envStatus:y,deploy:o.deploy??null,contextMessage:f.join(`
|
|
15
15
|
`),nextSteps:v}))}let l=[];if(e.completedStep!==void 0){let s=o.plan;if(s?.steps){let d=s.steps.findIndex(p=>p.number===e.completedStep);if(d===-1)return r(`Step ${e.completedStep} not found in the plan.`,!0);s.steps[d].status="completed",l.push(`Step ${e.completedStep} marked as completed`)}}e.addEnvVar&&(o.env||(o.env={required:{}}),o.env.required||(o.env.required={}),o.env.required[e.addEnvVar.key]={description:e.addEnvVar.description,setupUrl:e.addEnvVar.setupUrl},l.push(`Added required env var: ${e.addEnvVar.key}`)),te(a,JSON.stringify(o,null,2)+`
|
|
16
|
-
`),o.projectId&&import("./state-manager-NJPMKZCE.js").then(async({readLocalState:s,syncRemoteState:d})=>{let p=s(t);p&&await d(o.projectId,p)}).catch(()=>{});let i=[];if(e.completedStep!==void 0){let d=o.plan?.steps?.find(p=>p.status!=="completed");d?i.push(`NEXT:
|
|
16
|
+
`),o.projectId&&import("./state-manager-NJPMKZCE.js").then(async({readLocalState:s,syncRemoteState:d})=>{let p=s(t);p&&await d(o.projectId,p)}).catch(()=>{});let i=[];if(e.completedStep!==void 0){let d=o.plan?.steps?.find(p=>p.status!=="completed");d?i.push(`NEXT: Run mist implement <absolute-path> to work on step ${d.number} (${d.name}). Do this now.`):i.push("NEXT: All steps complete! Run mist deploy <absolute-path> to deploy the app now. Do NOT suggest localhost.")}return e.addEnvVar&&(i.push(`Add ${e.addEnvVar.key} to your .env.local file`),e.addEnvVar.setupUrl&&i.push(`Get the value from: ${e.addEnvVar.setupUrl}`)),r(JSON.stringify({updated:!0,changes:l,message:l.length>0?`Project state saved. ${l.join(". ")}.`:"No changes made.",nextSteps:i.length>0?i:void 0}))}};var se=m.object({action:m.enum(["get","update"]).default("get").describe("'get' reads current project state (context oracle \u2014 call before making decisions in an existing project). 'update' marks steps complete or adds env vars. All other project queries moved to the CLI in MCP 0.6.0: `mist projects share`, `mist projects errors`, `mist projects logs`, `mist projects deployments`, `mist projects version`, `mist projects designs`, `mist projects app-styles`, `mist projects integrations`."),projectPath:m.string().optional().describe("Path to the project directory (default: cwd)"),completedStep:m.number().optional().describe("(update) Mark a plan step as completed by step number"),addEnvVar:m.object({key:m.string(),description:m.string().optional(),setupUrl:m.string().optional()}).optional().describe("(update) Add a required env var to the project manifest")}),$={name:"mist_project",description:"Read or update Mistflow project state. 'get' loads plan progress, env vars, and deploy info \u2014 call this at the start of an incremental change so you understand the current app before editing. 'update' marks plan steps complete or adds env vars (note: `mist implement` in the CLI auto-marks the previous step, so manual updates are rarely needed).",inputSchema:se,handler:async n=>{let e=n;return N.handler({action:e.action,projectPath:e.projectPath,completedStep:e.completedStep,addEnvVar:e.addEnvVar})}};import{z as h}from"zod";var ne=h.object({action:h.enum(["navigate","go_back","go_forward","click","type","fill","select_option","press_key","hover","screenshot","snapshot"]).describe("Action to perform. Navigation: navigate|go_back|go_forward. Interaction: click|type|fill|select_option|press_key|hover. Visual: screenshot (returns image) | snapshot (returns accessibility tree)."),url:h.string().optional().describe("URL to navigate to. Required for 'navigate'; optional for 'screenshot' (navigates before capturing)."),selector:h.string().optional().describe("CSS selector of the target element. Required for: click, type, fill, select_option, hover. Optional for screenshot (captures just that element)."),value:h.string().optional().describe("Text to type/fill, option to select, or key to press (e.g. 'Enter', 'Tab'). Required for: type, fill, select_option, press_key."),fullPage:h.boolean().default(!1).describe("For 'screenshot': capture the full scrollable page instead of just the viewport."),includeScreenshot:h.boolean().default(!1).describe("For navigate/interact actions: also return a screenshot alongside the accessibility snapshot.")}),D={name:"mist_browser",description:"Unified browser tool for navigating, interacting with, and capturing the app. Use 'navigate' to open a URL, interaction actions (click/type/fill/etc.) to test flows, 'snapshot' to inspect the accessibility tree, and 'screenshot' for a visual capture. Use after mist_preview to verify UI, test flows, and iterate on design.",inputSchema:ne,handler:async n=>{let e=n,t=await I();if(e.action==="navigate"){if(!e.url)return r("URL is required for 'navigate'.",!0);let l=[],i=p=>{p.type()==="error"&&l.push(p.text())};t.on("console",i),await t.goto(e.url,{waitUntil:"domcontentloaded",timeout:3e4}),await t.waitForLoadState("networkidle").catch(()=>{});let s=[],d=p=>s.push(p.message);if(t.on("pageerror",d),await t.waitForTimeout(500),t.removeListener("console",i),t.removeListener("pageerror",d),l.length>0||s.length>0){let p=await j(t),g=[{type:"text",text:JSON.stringify({url:t.url(),title:await t.title(),snapshot:p,consoleErrors:l,pageErrors:s,hasErrors:!0})}];if(e.includeScreenshot){let y=await k(t);g.push({type:"image",data:y.toString("base64"),mimeType:"image/png"})}return{content:g}}}else if(e.action==="go_back")await t.goBack({waitUntil:"domcontentloaded",timeout:1e4});else if(e.action==="go_forward")await t.goForward({waitUntil:"domcontentloaded",timeout:1e4});else if(e.action==="click"){if(!e.selector)return r("Selector is required for 'click'.",!0);await t.click(e.selector,{timeout:1e4}),await t.waitForLoadState("domcontentloaded").catch(()=>{}),await t.waitForTimeout(500)}else if(e.action==="type"){if(!e.selector)return r("Selector is required for 'type'.",!0);if(!e.value)return r("Value is required for 'type'.",!0);await t.type(e.selector,e.value,{delay:50})}else if(e.action==="fill"){if(!e.selector)return r("Selector is required for 'fill'.",!0);if(!e.value)return r("Value is required for 'fill'.",!0);await t.fill(e.selector,e.value)}else if(e.action==="select_option"){if(!e.selector)return r("Selector is required for 'select_option'.",!0);if(!e.value)return r("Value is required for 'select_option'.",!0);await t.selectOption(e.selector,e.value)}else if(e.action==="hover"){if(!e.selector)return r("Selector is required for 'hover'.",!0);await t.hover(e.selector,{timeout:1e4})}else if(e.action==="press_key"){if(!e.value)return r("Value is required for 'press_key' (e.g. 'Enter').",!0);await t.keyboard.press(e.value),await t.waitForLoadState("domcontentloaded").catch(()=>{}),await t.waitForTimeout(500)}else if(e.action==="screenshot"){e.url&&(await t.goto(e.url,{waitUntil:"domcontentloaded",timeout:3e4}),await t.waitForLoadState("networkidle").catch(()=>{}));let l;if(e.selector){let i=await t.$(e.selector);if(!i)return r(`Element not found: ${e.selector}`,!0);l=await i.screenshot({type:"png"})}else l=await k(t,e.fullPage);return{content:[{type:"text",text:JSON.stringify({url:t.url(),title:await t.title(),message:`Screenshot captured (${e.fullPage?"full page":"viewport"})`})},{type:"image",data:l.toString("base64"),mimeType:"image/png"}]}}else if(e.action==="snapshot"){let l=await j(t);return{content:[{type:"text",text:JSON.stringify({url:t.url(),title:await t.title(),snapshot:l})}]}}let a=await j(t),o=[{type:"text",text:JSON.stringify({url:t.url(),title:await t.title(),snapshot:a})}];if(e.includeScreenshot){let l=await k(t);o.push({type:"image",data:l.toString("base64"),mimeType:"image/png"})}return{content:o}}};import{z as F}from"zod";var V=`# Mistflow CLI reference
|
|
17
17
|
|
|
18
18
|
The Mistflow CLI handles local execution and long-running operations that
|
|
19
19
|
would hit the MCP 60s tool-call ceiling. Every command below is invokable
|
|
@@ -36,9 +36,8 @@ Start a new plan. Returns \`status: "clarify"\` with questions to relay to
|
|
|
36
36
|
the user, OR \`status: "ready"\` / \`status: "design_clarify_pending"\` if
|
|
37
37
|
the description was specific enough for the backend to skip discovery.
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
call takes >60s; this CLI has no ceiling.
|
|
39
|
+
The CLI caches ready plans locally and returns a \`planId\` for init /
|
|
40
|
+
mockup / future modifications.
|
|
42
41
|
|
|
43
42
|
### \`mist plan --token <conversationId> --answers-stdin [--json]\`
|
|
44
43
|
Submit the user's answers to a previous \`clarify\` round. Pipe the
|
|
@@ -49,6 +48,12 @@ answers object on stdin:
|
|
|
49
48
|
|
|
50
49
|
Returns \`status: "ready"\` or \`status: "design_clarify_pending"\`.
|
|
51
50
|
|
|
51
|
+
### \`mist plan --describe "<change request>" --existing-plan-id <planId> [--json]\`
|
|
52
|
+
Modify an existing saved plan for a feature addition or integration
|
|
53
|
+
addition. Reads the current plan from \`~/.mistflow/plans/<planId>.json\`
|
|
54
|
+
or, when run inside the matching project, from \`mistflow.json\`. Returns
|
|
55
|
+
\`status: "ready"\` with the modified plan and a diff summary.
|
|
56
|
+
|
|
52
57
|
### \`mist plan --cid <designConversationId> --pick-stdin [--json]\`
|
|
53
58
|
Finalize the plan by submitting the user's picked design direction.
|
|
54
59
|
|
|
@@ -60,15 +65,40 @@ Poll for asynchronously generated design directions. Without \`--wait\`,
|
|
|
60
65
|
returns the current status once. With \`--wait\`, polls every 2s (up to 2
|
|
61
66
|
min) until ready or failed.
|
|
62
67
|
|
|
68
|
+
### \`mist init --plan-id <planId> --path <absolute-path> [--json]\`
|
|
69
|
+
Scaffold a fresh Mistflow app from a cached plan. Fast and fully CLI-driven.
|
|
70
|
+
|
|
71
|
+
### \`mist mockup --plan-id <planId> [--json]\`
|
|
72
|
+
Generate or iterate on a grayscale HTML wireframe before scaffolding. Use
|
|
73
|
+
\`--feedback\` to revise and \`--approved\` to lock it in.
|
|
74
|
+
|
|
63
75
|
### \`mist install <projectPath> [--json]\`
|
|
64
76
|
Run npm install in a Mistflow project. Streams output live, no timeout.
|
|
65
|
-
|
|
77
|
+
|
|
78
|
+
### \`mist implement <absolute-path> [--json]\`
|
|
79
|
+
Return the next plan step for the host AI to implement. Call repeatedly
|
|
80
|
+
until all steps are complete.
|
|
81
|
+
|
|
82
|
+
### \`mist build <absolute-path> [--json]\`
|
|
83
|
+
Run the local production build.
|
|
84
|
+
|
|
85
|
+
### \`mist seed <absolute-path> [--reset] [--allow-remote] [--json]\`
|
|
86
|
+
Seed realistic sample rows from \`plan.dataModel[].sampleRows\` into the
|
|
87
|
+
project database. Defaults to local-only seeding against PGlite; pass
|
|
88
|
+
\`--allow-remote\` only when you intentionally want to seed a remote
|
|
89
|
+
environment. Use before QA when acceptance criteria depend on populated
|
|
90
|
+
tables or lists. This is for app/domain data, not admin/test account
|
|
91
|
+
bootstrap.
|
|
92
|
+
|
|
93
|
+
### \`mist qa [live-url] [--json]\`
|
|
94
|
+
Run browser QA against the live deployed app. If no URL is passed, Mistflow
|
|
95
|
+
reads \`deploy.url\` from the current project's \`mistflow.json\`.
|
|
66
96
|
|
|
67
97
|
### \`mist login\`, \`mist deploy\`, \`mist status <id>\`, \`mist logs <id>\`,
|
|
68
98
|
### \`mist projects [id]\`, \`mist env <subcommand>\`, \`mist domains <subcommand>\`,
|
|
69
99
|
### \`mist rollback <id>\`
|
|
70
|
-
Shell-native
|
|
71
|
-
|
|
100
|
+
Shell-native cloud/project coordination. Use \`mist env\` to set required
|
|
101
|
+
integration keys before deploying a feature that depends on them.
|
|
72
102
|
|
|
73
103
|
## MCP-vs-CLI rule
|
|
74
104
|
|
|
@@ -76,7 +106,7 @@ Stays MCP: \`mist_setup\`, \`mist_browser\`, \`mist_project\`, \`mist_help\`
|
|
|
76
106
|
(this tool). These return structured data the AI routes on and aren't
|
|
77
107
|
long-running.
|
|
78
108
|
|
|
79
|
-
Prefers CLI: planning, install, build, qa, mockup \u2014 anything that can
|
|
109
|
+
Prefers CLI: planning, install, build, seed, qa, mockup \u2014 anything that can
|
|
80
110
|
exceed 30s or streams useful progress.
|
|
81
111
|
|
|
82
112
|
## Chaining pattern
|
|
@@ -94,7 +124,13 @@ and decides the next command. Example end-to-end chain:
|
|
|
94
124
|
# AI shows picker, user picks, then:
|
|
95
125
|
echo '{...}' | mist plan --cid ... --pick-stdin --json
|
|
96
126
|
# \u2192 {"status":"ready","plan":{...}}
|
|
97
|
-
|
|
127
|
+
mist init --plan-id ... --path /Users/you/projects/habit-tracker --json
|
|
128
|
+
mist install /Users/you/projects/habit-tracker --json
|
|
129
|
+
mist implement /Users/you/projects/habit-tracker --json
|
|
130
|
+
mist build /Users/you/projects/habit-tracker --json
|
|
131
|
+
mist deploy /Users/you/projects/habit-tracker --json
|
|
132
|
+
mist seed /Users/you/projects/habit-tracker --json
|
|
133
|
+
mist qa https://your-app.mistflow.app --json
|
|
98
134
|
`,J={name:"mist_help",description:"Returns the Mistflow CLI command reference. Call this ONCE at session start (or whenever you're unsure which tool to use) to learn every `mist` CLI command, when to prefer it over an MCP tool, and how to chain calls. Results are static \u2014 no backend round-trip, safe to call frequently.",inputSchema:F.object({command:F.string().optional().describe("Optional: name of a specific command to get focused reference for. Omit to get the full catalog.")}),handler:async n=>{let{command:e}=n;if(!e)return r(V);let t=V.split(`
|
|
99
135
|
`),a=new RegExp(`^### \`mist ${e}`),o=-1,l=t.length;for(let i=0;i<t.length;i++)if(a.test(t[i]))o=i;else if(o>=0&&t[i].startsWith("### ")){l=i;break}else if(o>=0&&t[i].startsWith("## ")&&i>o){l=i;break}return o<0?r(`No command named '${e}' found. Call mist_help with no args to see the full catalog.`,!0):r(t.slice(o,l).join(`
|
|
100
|
-
`).trim())}};var
|
|
136
|
+
`).trim())}};var S=new ie({name:"mistflow",version:"0.3.0"},{capabilities:{tools:{}},instructions:"Mistflow is a full-stack app builder that creates and deploys web apps from natural language descriptions. When a user asks to build, create, or make a web app, website, landing page, dashboard, internal tool, marketplace, content site, or browser game, use Mistflow tools. Mistflow creates NEW apps from scratch. It does NOT modify existing non-Mistflow codebases.\n\nCall `mist_help` at any point for the full CLI command reference. The 4 MCP tools handle short, structured, AI-native flows (auth, project state, browser automation, CLI discovery). Everything else is the `mist` CLI \u2014 invoke via your shell/bash tool.\n\nNew app workflow (entirely CLI-driven):\n1. Plan: run `mist plan --describe \"<user's description>\" --json` via your shell/bash tool. Pass the user's description EXACTLY as written \u2014 do NOT expand, rephrase, or add features. Relay any returned questions to the user, then submit answers via `echo '<answers-json>' | mist plan --token <id> --answers-stdin --json`. When status becomes \"design_clarify_pending\", poll with `mist plan-directions --cid <id> --wait --json`. Present the directions picker, then finalize with `echo '<pick-json>' | mist plan --cid <id> --pick-stdin --json`. If the CLI returns status \"confirm_new_project\" (safety gate when inside an existing codebase), ask the user whether to scaffold a new Mistflow app or edit the existing code.\n2. Mockup (optional): run `mist mockup --plan-id <id>` via your shell/bash tool \u2014 generates a visual HTML wireframe for user preview. Iterative: pass --feedback to refine, --approved to lock in the design.\n3. Scaffold: run `mist init --plan-id <id> --path <absolute-path>` via your shell/bash tool. Writes the Next.js scaffold, contracts/, AGENTS.md, and registers the project with Mistflow. Returns fast; does NOT run npm install.\n4. Install dependencies: run `mist install <projectPath>` via your shell/bash tool (streams output).\n5. Implement: run `mist implement <absolute-path>` via your shell/bash tool \u2014 executes plan steps one at a time. Call repeatedly until all steps are done; it auto-marks the previous step as completed on each call.\n6. Deploy: run `mist deploy [path]` via your shell/bash tool \u2014 tars, uploads, polls status with live streaming. Subcommands: `mist deploy promote` (staging\u2192prod), `mist deploy preview` (local tunnel), `mist deploy rollback <id>`, `mist deploy verify <url>`, `mist deploy redeploy`.\n7. QA: run `mist qa <live-url>` via your shell/bash tool, or just `mist qa` from inside the project if mistflow.json already has deploy.url. Call AFTER deploy. Do NOT show the URL to the user until QA passes.\n8. Seed sample data (optional but recommended before QA when acceptance criteria depend on populated tables/lists): run `mist seed <absolute-path>` via your shell/bash tool. This defaults to local-only seeding against PGlite; use `--allow-remote` only when you intentionally want to seed a remote environment. Use `--reset` to clear the matched tables first.\n\nCompanion CLI (`@mistflow-ai/cli`, invoke as `mist` or via `npx -y @mistflow-ai/cli`) is the primary path for EVERYTHING except the 4 MCP tools below:\n- `mist plan` / `mist plan-directions` \u2014 plan an app.\n- `mist init` \u2014 scaffold a new project from a plan (fast, ~10s).\n- `mist install` / `mist build` / `mist mockup` / `mist implement` / `mist debug` / `mist seed` / `mist qa` \u2014 local project lifecycle.\n- `mist deploy` (+ promote/preview/rollback/verify/redeploy subcommands) \u2014 deploy orchestration.\n- `mist status` / `mist fix` \u2014 feature manifest viewer + iteration loop.\n- `mist contracts` \u2014 integration-contract layer management.\n- `mist doctor` \u2014 project health diagnostics.\n- `mist login` / `mist projects` / `mist logs` / `mist env` / `mist domains` / `mist rollback` \u2014 cloud-coordination commands.\n- Call mist_help for the full reference.\n\nIMPORTANT \u2014 chaining discipline: once the user approves the plan, the init \u2192 install \u2192 implement (repeat) \u2192 build \u2192 deploy \u2192 seed (when needed) \u2192 qa chain is expected. Do NOT pause between these calls to ask the user \"should I continue?\" or offer options like \"full build vs step-by-step.\" The tool itself will return a status requiring user input when it actually needs one (e.g. confirm_new_project, confirm_dark_theme, awaiting promotion). Otherwise, chain calls continuously. Brief one-line status updates are fine and encouraged; permission requests are not.\n\nDesign presets (optional, between steps 2 and 3): run `mist projects designs`, `mist projects app-styles`, `mist projects integrations` via your shell/bash tool to browse catalogs. After `mist plan` generates a plan, it may recommend designs and styles \u2014 present these to the user before calling `mist init`.\n\nUpdating an existing Mistflow app:\n- Cosmetic or single-file changes: edit files directly, then `mist deploy` to publish.\n- New page or feature (no new data model): mist_project action=get for context, build it, then `mist deploy`.\n- Feature needing new data model: ask product questions, call `mist_project action=get` for context, then run `mist plan --describe \"<change request>\" --existing-plan-id <id>`, then `mist implement`, then `mist deploy`.\n- Integration addition: ask product questions, call `mist_project action=get`, optionally browse `mist projects integrations`, run `mist plan --describe \"<change request>\" --existing-plan-id <id>`, then `mist implement`, then `mist env` to set required keys before deploy, then `mist deploy`, then `mist qa`.\n- Bug fix: run `mist debug <absolute-path>` to analyze, fix the code, then `mist deploy`.\n\nTemplate forking: use the Mistflow dashboard UI (app.mistflow.ai) to fork templates for now. CLI-side template-fork plumbing is in place but the API-client bridge lands in a follow-up release.\n\nThe 4 MCP tools:\n- mist_setup: authentication. Only call when user has never signed in or a tool returned 'auth_missing'/'auth_revoked'. Do NOT call for 500s, 404s, or network errors. Also accepts an apiKey parameter for headless auth.\n- mist_project: read/write project state (actions: 'get' / 'update'). Other project queries (errors, logs, deployments, share, version, catalog browsing) moved to `mist projects <subcommand>` in the CLI.\n- mist_browser: navigate, interact with, and screenshot the app during preview or after deploy. Returns screenshots inline in tool results \u2014 the one tool that genuinely needs the MCP transport.\n- mist_help: returns the full CLI command reference. Call once per session to learn the available `mist` commands."}),z=[E,$,D,J];S.setRequestHandler(le,async()=>({tools:z.map(n=>({name:n.name,description:n.description,inputSchema:ce(n.inputSchema)}))}));S.setRequestHandler(ae,async n=>{let e=z.find(t=>t.name===n.params.name);if(!e)return r(`Unknown tool: ${n.params.name}`,!0);try{let t=e.inputSchema.safeParse(n.params.arguments);if(!t.success){let l=t.error.issues.map(i=>`${i.path.join(".")}: ${i.message}`).join(", ");return r(`Invalid input: ${l}`,!0)}let a=n.params._meta?.progressToken,o={server:S,progressToken:a};try{return await e.handler(t.data,o)}finally{o.cleanup?.()}}catch(t){let a=t instanceof Error?t.message:"An unexpected error occurred";return console.error("Tool error:",t),r(a,!0)}});async function pe(){let n=process.argv.indexOf("--api-url");n!==-1&&process.argv[n+1]&&(process.env.MISTFLOW_API_URL=process.argv[n+1]),process.argv.includes("--local")&&!process.env.MISTFLOW_API_URL&&(process.env.MISTFLOW_API_URL="http://localhost:9100");let e=new re;await S.connect(e),console.error(`Mistflow MCP server running on stdio (API: ${process.env.MISTFLOW_API_URL||"https://api.mistflow.ai"})`)}pe().catch(n=>{console.error("Fatal error:",n),process.exit(1)});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mistflow-ai/mcp",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "Mistflow MCP server for AI coding editors. Installed into Claude Code, Cursor, Codex CLI, and VS Code Copilot by the mistflow-ai installer.",
|
|
5
5
|
"license": "Elastic-2.0",
|
|
6
6
|
"type": "module",
|