@mistflow-ai/mcp 0.7.0 → 0.7.2-staging.0
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/{chunk-SXNAPWCC.js → chunk-EED3GL6G.js} +1 -1
- package/dist/chunk-RTKBAE4U.js +23 -0
- package/dist/cli.js +9 -1
- package/dist/index.js +59 -1456
- package/dist/self-heal-KDCW562K.js +1 -0
- package/dist/state-manager-NJPMKZCE.js +1 -0
- package/package.json +1 -1
- package/dist/chunk-VQPRSDSC.js +0 -23
- package/dist/self-heal-QQ53MP7L.js +0 -1
- package/dist/state-manager-26IE6Y5D.js +0 -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
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o,b as s,
|
|
1
|
+
import{a as o,b as s,f as i,g as a}from"./chunk-RTKBAE4U.js";import{existsSync as u,readFileSync as f,writeFileSync as d,mkdirSync as m}from"fs";import{join as l}from"path";function p(t){return l(t,".mistflow","state.json")}function P(t){let e=p(t);if(!u(e))return null;try{return JSON.parse(f(e,"utf-8"))}catch{return null}}function w(t,e){let r=l(t,".mistflow");u(r)||m(r,{recursive:!0}),d(p(t),JSON.stringify(e,null,2)+`
|
|
2
2
|
`)}function C(t,e){return{projectId:t,name:e,template:"",features:[],dbSchema:[],deployCount:0,decisions:[],provenance:[]}}async function x(t){let e;try{e=a()}catch{return null}try{let r=await fetch(`${i()}/api/projects/${encodeURIComponent(t)}/state`,{headers:{...e,"Content-Type":"application/json","X-Mistflow-MCP-Version":o()}});try{s(r.headers)}catch{}return r.ok?await r.json():null}catch{return null}}async function R(t,e){let r;try{r=a()}catch{return!1}try{let n=await fetch(`${i()}/api/projects/${encodeURIComponent(t)}/state`,{method:"PUT",headers:{...r,"Content-Type":"application/json","X-Mistflow-MCP-Version":o()},body:JSON.stringify(e)});try{s(n.headers)}catch{}return n.ok}catch{return!1}}function L(t,e){let r=t.toLowerCase(),n=e.toLowerCase();return n.includes(r)||r.includes(n)?!0:r.split(/\s+/).some(c=>c.length>=3&&n.includes(c))}export{p as a,P as b,w as c,C as d,x as e,R as f,L as g};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import{existsSync as y,readFileSync as k,writeFileSync as T,mkdirSync as $}from"fs";import{join as f,dirname as m}from"path";import{homedir as M}from"os";import{fileURLToPath as j}from"url";var p=null;function h(){if(p)return p;try{let t=j(import.meta.url),e=m(t);for(let n=0;n<6;n++){let o=f(e,"package.json");if(y(o)){let s=JSON.parse(k(o,"utf-8"));if(s.name==="@mistflow-ai/mcp"&&typeof s.version=="string")return p=s.version,s.version}let r=m(e);if(r===e)break;e=r}}catch{}return p="0.0.0","0.0.0"}function d(t){let e=/^(\d+)\.(\d+)\.(\d+)/.exec(t.trim());return e?[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3],10)]:null}function R(t,e){let n=d(t),o=d(e);if(!n||!o)return 0;for(let r=0;r<3;r++){if(n[r]<o[r])return-1;if(n[r]>o[r])return 1}return 0}function E(t,e,n){if(n&&R(t,n)<0)return"unsupported";if(!e||R(t,e)>=0)return"none";let r=d(t),s=d(e);return!r||!s?"none":r[0]<s[0]?"major":r[1]<s[1]?"minor":"patch"}var a=null;function C(t){let e=t.get("x-mistflow-mcp-latest")??"",n=t.get("x-mistflow-mcp-min-supported")??"",o=t.get("x-mistflow-mcp-changelog-url")??"";!e&&!n||(a={latest:e,minSupported:n,changelogUrl:o})}function b(){let t=process.env.MISTFLOW_STATE_DIR||f(M(),".mistflow");return f(t,"upgrade-state.json")}function A(){try{let t=b();return y(t)?JSON.parse(k(t,"utf-8")):{}}catch{return{}}}function O(t){try{let e=b(),n=m(e);y(n)||$(n,{recursive:!0}),T(e,JSON.stringify(t,null,2)+`
|
|
2
|
+
`,{mode:384})}catch{}}var x=!1;function F(t){return t==="patch"?7*864e5:t==="minor"?1*864e5:0}function ie(){if(process.env.MISTFLOW_NO_UPGRADE_CHECK==="1"||!a)return null;let t=h();if(t==="0.0.0")return null;let e=E(t,a.latest,a.minSupported);if(e==="none")return null;if(e==="unsupported")return S(e,t,a);if(x)return null;let n=A(),o=Date.now(),r=F(e);return n.dismissedForVersion===a.latest&&e!=="major"||n.lastLatestSeen===a.latest&&n.lastShownMs&&o-n.lastShownMs<r?null:(x=!0,O({...n,lastShownMs:o,lastLatestSeen:a.latest}),S(e,t,a))}function S(t,e,n){let o="npx -y mistflow-ai install",r=n.changelogUrl?`
|
|
3
|
+
What's new: ${n.changelogUrl}`:"";return t==="unsupported"?`
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
Mistflow ${e} is no longer supported.
|
|
7
|
+
You must upgrade to ${n.latest} or newer to continue:
|
|
8
|
+
|
|
9
|
+
${o}
|
|
10
|
+
|
|
11
|
+
After upgrading, restart your AI editor.${r}
|
|
12
|
+
---`:t==="major"?`
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
Mistflow ${n.latest} is available (you have ${e}).
|
|
16
|
+
This is a major update. Run \`${o}\` and restart your editor.${r}
|
|
17
|
+
---`:t==="minor"?`
|
|
18
|
+
|
|
19
|
+
--- Mistflow update available: ${e} -> ${n.latest} ---
|
|
20
|
+
Run \`${o}\` to upgrade, then restart your editor.${r}`:`
|
|
21
|
+
|
|
22
|
+
(Mistflow ${n.latest} is out, you have ${e}. Run \`${o}\` when convenient.)`}import{readFileSync as V,existsSync as P,writeFileSync as L,mkdirSync as N,renameSync as B,unlinkSync as q}from"fs";import{join as v,dirname as K}from"path";import{homedir as J}from"os";import{randomBytes as H}from"crypto";function D(){return v(J(),".mistflow","credentials.json")}function g(){return(process.env.MISTFLOW_API_URL||"https://api.mistflow.ai").replace(/\/+$/,"")}var W="https://api.mistflow.ai";function U(){let t=D();if(!P(t))return null;try{let e=JSON.parse(V(t,"utf-8"));return typeof e.apiKey=="string"?{[W]:e}:e}catch{return null}}function w(){let t=process.env.MISTFLOW_API_KEY;if(t)return{ok:!0,creds:{apiKey:t,orgId:"",orgSlug:"env"}};let e=U();if(!e)return{ok:!1,reason:"missing"};let n=g(),o=e[n];return o&&typeof o.apiKey=="string"&&o.apiKey&&typeof o.orgId=="string"?{ok:!0,creds:o}:{ok:!1,reason:"missing"}}function de(t){let e=D(),n=K(e);P(n)||N(n,{recursive:!0});let o=U()??{},r=g();o[r]=t;let s=v(n,`.credentials.tmp.${H(8).toString("hex")}`);try{L(s,JSON.stringify(o,null,2)+`
|
|
23
|
+
`,{mode:384}),B(s,e)}catch(c){try{q(s)}catch{}throw c}}function Q(){return w().ok}function z(){return g()}var i=class extends Error{constructor(n,o,r,s){super(o);this.code=n;this.statusCode=r;this.details=s;this.name="MistflowApiError"}get isAuth(){return this.code.startsWith("auth_")}get isTransient(){return this.code==="server_error"||this.code==="upstream_error"||this.code==="network_error"||this.code==="rate_limited"}};function G(){let t=w();if(!t.ok)throw new i("auth_missing","No Mistflow credentials found.",401);return X(t.creds)}function X(t){return{Authorization:`ApiKey ${t.apiKey}`,"Content-Type":"application/json","X-Mistflow-MCP-Version":h()}}function Y(t){try{C(t.headers)}catch{}}async function Z(t,e,n,o){for(let r=0;r<2;r++)try{return await fetch(t,{...e,signal:AbortSignal.timeout(n)})}catch(s){let c=s instanceof Error&&s.name==="TimeoutError",u=s instanceof TypeError;if(o&&r===0&&(c||u)){console.error(`[api] Retrying ${t} after ${c?"timeout":"network error"}`);continue}throw s}throw new Error("fetchWithRetry: exhausted retries")}async function ee(t){let e=null;try{e=await t.json()}catch{e=null}let n=e&&typeof e.code=="string"?e.code:void 0,o=e&&typeof e.message=="string"?e.message:e&&typeof e.detail=="string"?e.detail:t.statusText||"Request failed";if(n)return new i(n,o,t.status,e?.details);let r=t.status;return r===401?new i("auth_invalid",o,r):r===403?new i("permission_denied",o,r):r===404?new i("not_found",o,r):r===409?new i("conflict",o,r):r===422?new i("validation_error",o,r):r===429?new i("rate_limited",o,r):r>=500?new i("server_error",t.statusText||"Internal server error",r):new i("client_error",o,r)}async function te(t,e={}){let n=G(),{timeoutMs:o,idempotent:r,...s}=e,c=o??3e4,u=(s.method??"GET").toUpperCase(),I=r??(u==="GET"||u==="HEAD"),l;try{l=await Z(`${z()}${t}`,{...s,headers:{...n,...s.headers}},c,I)}catch(_){throw _ instanceof Error&&_.name==="TimeoutError"?new i("network_error","Request timed out. Try again in a moment."):new i("network_error","Cannot reach Mistflow servers. Check your network.")}if(Y(l),!l.ok)throw await ee(l);return l.json()}var ye=300*1e3;async function he(t,e,n="neon",o){return te("/api/projects",{method:"POST",body:JSON.stringify({name:t,template:e,db_provider:n,requested_subdomain:o})})}export{h as a,C as b,ie as c,de as d,Q as e,z as f,G as g,he as h};
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var n=process.argv[2];(n==="
|
|
2
|
+
import{readFileSync as s}from"fs";import{dirname as t,join as r}from"path";import{fileURLToPath as l}from"url";var n=process.argv[2];if(n==="--version"||n==="-v"){try{let o=t(l(import.meta.url)),e=r(o,"..","package.json"),i=JSON.parse(s(e,"utf-8"));console.log(i.version)}catch{console.log("unknown")}process.exit(0)}(n==="--help"||n==="-h")&&(console.log(`@mistflow-ai/mcp \u2014 Mistflow MCP server
|
|
3
|
+
|
|
4
|
+
Usage:
|
|
5
|
+
npx @mistflow-ai/mcp Start the MCP server on stdio (default; invoked by editors)
|
|
6
|
+
npx @mistflow-ai/mcp --version Print the installed version and exit
|
|
7
|
+
|
|
8
|
+
To install the server into your editor config, use the installer:
|
|
9
|
+
npx -y mistflow-ai install
|
|
10
|
+
`),process.exit(0));(n==="install"||n==="uninstall")&&(console.error(`'npx @mistflow-ai/mcp ${n}' is no longer supported.
|
|
3
11
|
Use the installer package instead:
|
|
4
12
|
|
|
5
13
|
npx -y mistflow-ai ${n}
|