@mastergo/magic-mcp 0.1.0 → 0.1.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/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
`,z_=Vr.encode(Da),U_=2,Ro=class{constructor(e,a){let{escapeName:s}=this.constructor,r=b.isString(a),n=`Content-Disposition: form-data; name="${s(e)}"${!r&&a.name?`; filename="${s(a.name)}"`:""}${Da}`;r?a=Vr.encode(String(a).replace(/\r?\n|\r\n?/g,Da)):n+=`Content-Type: ${a.type||"application/octet-stream"}${Da}`,this.headers=Vr.encode(n+Da),this.contentLength=r?a.byteLength:a.size,this.size=this.headers.byteLength+this.contentLength+U_,this.name=e,this.value=a}async*encode(){yield this.headers;let{value:e}=this;b.isTypedArray(e)?yield e:yield*gn(e),yield z_}static escapeName(e){return String(e).replace(/[\r\n"]/g,a=>({"\r":"%0D","\n":"%0A",'"':"%22"})[a])}},M_=(t,e,a)=>{let{tag:s="form-data-boundary",size:r=25,boundary:n=s+"-"+me.generateString(r,q_)}=a||{};if(!b.isFormData(t))throw TypeError("FormData instance required");if(n.length<1||n.length>70)throw Error("boundary must be 10-70 characters long");let i=Vr.encode("--"+n+Da),o=Vr.encode("--"+n+"--"+Da),l=o.byteLength,c=Array.from(t.entries()).map(([m,x])=>{let d=new Ro(m,x);return l+=d.size,d});l+=i.byteLength*c.length,l=b.toFiniteNumber(l);let p={"Content-Type":`multipart/form-data; boundary=${n}`};return Number.isFinite(l)&&(p["Content-Length"]=l),e&&e(p),ff.Readable.from(async function*(){for(let m of c)yield i,yield*m.encode();yield o}())},hf=M_;var vf=Be(require("stream"),1),ko=class extends vf.default.Transform{__transform(e,a,s){this.push(e),s()}_transform(e,a,s){if(e.length!==0&&(this._transform=this.__transform,e[0]!==120)){let r=Buffer.alloc(2);r[0]=120,r[1]=156,this.push(r,a)}this.__transform(e,a,s)}},gf=ko;var B_=(t,e)=>b.isAsyncFn(t)?function(...a){let s=a.pop();t.apply(this,a).then(r=>{try{e?s(null,...e(r)):s(null,r)}catch(n){s(n)}},s)}:t,xf=B_;function H_(t,e){t=t||10;let a=new Array(t),s=new Array(t),r=0,n=0,i;return e=e!==void 0?e:1e3,function(l){let c=Date.now(),p=s[n];i||(i=c),a[r]=l,s[r]=c;let m=n,x=0;for(;m!==r;)x+=a[m++],m=m%t;if(r=(r+1)%t,r===n&&(n=(n+1)%t),c-i<e)return;let d=p&&c-p;return d?Math.round(x*1e3/d):void 0}}var yf=H_;function V_(t,e){let a=0,s=1e3/e,r,n,i=(c,p=Date.now())=>{a=p,r=null,n&&(clearTimeout(n),n=null),t(...c)};return[(...c)=>{let p=Date.now(),m=p-a;m>=s?i(c,p):(r=c,n||(n=setTimeout(()=>{n=null,i(r)},s-m)))},()=>r&&i(r)]}var bf=V_;var Ut=(t,e,a=3)=>{let s=0,r=yf(50,250);return bf(n=>{let i=n.loaded,o=n.lengthComputable?n.total:void 0,l=i-s,c=r(l),p=i<=o;s=i;let m={loaded:i,total:o,progress:o?i/o:void 0,bytes:l,rate:c||void 0,estimated:c&&o&&p?(o-i)/c:void 0,event:n,lengthComputable:o!=null,[e?"download":"upload"]:!0};t(m)},a)},ur=(t,e)=>{let a=t!=null;return[s=>e[0]({lengthComputable:a,total:t,loaded:s}),e[1]]},dr=t=>(...e)=>b.asap(()=>t(...e));var _f={flush:Mt.default.constants.Z_SYNC_FLUSH,finishFlush:Mt.default.constants.Z_SYNC_FLUSH},Z_={flush:Mt.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:Mt.default.constants.BROTLI_OPERATION_FLUSH},wf=b.isFunction(Mt.default.createBrotliDecompress),{http:G_,https:J_}=Cf.default,K_=/https:?/,Ef=me.protocols.map(t=>t+":"),Sf=(t,[e,a])=>(t.on("end",a).on("error",a),e);function Q_(t,e){t.beforeRedirects.proxy&&t.beforeRedirects.proxy(t),t.beforeRedirects.config&&t.beforeRedirects.config(t,e)}function jf(t,e,a){let s=e;if(!s&&s!==!1){let r=Rf.default.getProxyForUrl(a);r&&(s=new URL(r))}if(s){if(s.username&&(s.auth=(s.username||"")+":"+(s.password||"")),s.auth){(s.auth.username||s.auth.password)&&(s.auth=(s.auth.username||"")+":"+(s.auth.password||""));let n=Buffer.from(s.auth,"utf8").toString("base64");t.headers["Proxy-Authorization"]="Basic "+n}t.headers.host=t.hostname+(t.port?":"+t.port:"");let r=s.hostname||s.host;t.hostname=r,t.host=r,t.port=s.port,t.path=a,s.protocol&&(t.protocol=s.protocol.includes(":")?s.protocol:`${s.protocol}:`)}t.beforeRedirects.proxy=function(n){jf(n,e,n.href)}}var W_=typeof process<"u"&&b.kindOf(process)==="process",X_=t=>new Promise((e,a)=>{let s,r,n=(l,c)=>{r||(r=!0,s&&s(l,c))},i=l=>{n(l),e(l)},o=l=>{n(l,!0),a(l)};t(i,o,l=>s=l).catch(o)}),Y_=({address:t,family:e})=>{if(!b.isString(t))throw TypeError("address must be a string");return{address:t,family:e||(t.indexOf(".")<0?6:4)}},Pf=(t,e)=>Y_(b.isObject(t)?t:{address:t,family:e}),If=W_&&function(e){return X_(async function(s,r,n){let{data:i,lookup:o,family:l}=e,{responseType:c,responseEncoding:p}=e,m=e.method.toUpperCase(),x,d=!1,f;if(o){let F=xf(o,L=>b.isArray(L)?L:[L]);o=(L,Q,K)=>{F(L,Q,(re,be,Ne)=>{if(re)return K(re);let Y=b.isArray(be)?be.map(pe=>Pf(pe)):[Pf(be,Ne)];Q.all?K(re,Y):K(re,Y[0].address,Y[0].family)})}}let g=new Of.EventEmitter,h=()=>{e.cancelToken&&e.cancelToken.unsubscribe(w),e.signal&&e.signal.removeEventListener("abort",w),g.removeAllListeners()};n((F,L)=>{x=!0,L&&(d=!0,h())});function w(F){g.emit("abort",!F||F.type?new st(null,e,f):F)}g.once("abort",r),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(w),e.signal&&(e.signal.aborted?w():e.signal.addEventListener("abort",w)));let R=Aa(e.baseURL,e.url,e.allowAbsoluteUrls),E=new URL(R,me.hasBrowserEnv?me.origin:void 0),k=E.protocol||Ef[0];if(k==="data:"){let F;if(m!=="GET")return At(s,r,{status:405,statusText:"method not allowed",headers:{},config:e});try{F=wo(e.url,c==="blob",{Blob:e.env&&e.env.Blob})}catch(L){throw q.from(L,q.ERR_BAD_REQUEST,e)}return c==="text"?(F=F.toString(p),(!p||p==="utf8")&&(F=b.stripBOM(F))):c==="stream"&&(F=Na.default.Readable.from(F)),At(s,r,{data:F,status:200,statusText:"OK",headers:new Re,config:e})}if(Ef.indexOf(k)===-1)return r(new q("Unsupported protocol "+k,q.ERR_BAD_REQUEST,e));let T=Re.from(e.headers).normalize();T.set("User-Agent","axios/"+Ia,!1);let{onUploadProgress:C,onDownloadProgress:B}=e,z=e.maxRate,I,Z;if(b.isSpecCompliantForm(i)){let F=T.getContentType(/boundary=([-_\w\d]{10,70})/i);i=hf(i,L=>{T.set(L)},{tag:`axios-${Ia}-boundary`,boundary:F&&F[1]||void 0})}else if(b.isFormData(i)&&b.isFunction(i.getHeaders)){if(T.set(i.getHeaders()),!T.hasContentLength())try{let F=await Af.default.promisify(i.getLength).call(i);Number.isFinite(F)&&F>=0&&T.setContentLength(F)}catch{}}else if(b.isBlob(i)||b.isFile(i))i.size&&T.setContentType(i.type||"application/octet-stream"),T.setContentLength(i.size||0),i=Na.default.Readable.from(gn(i));else if(i&&!b.isStream(i)){if(!Buffer.isBuffer(i))if(b.isArrayBuffer(i))i=Buffer.from(new Uint8Array(i));else if(b.isString(i))i=Buffer.from(i,"utf-8");else return r(new q("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",q.ERR_BAD_REQUEST,e));if(T.setContentLength(i.length,!1),e.maxBodyLength>-1&&i.length>e.maxBodyLength)return r(new q("Request body larger than maxBodyLength limit",q.ERR_BAD_REQUEST,e))}let G=b.toFiniteNumber(T.getContentLength());b.isArray(z)?(I=z[0],Z=z[1]):I=Z=z,i&&(C||I)&&(b.isStream(i)||(i=Na.default.Readable.from(i,{objectMode:!1})),i=Na.default.pipeline([i,new Po({maxRate:b.toFiniteNumber(I)})],b.noop),C&&i.on("progress",Sf(i,ur(G,Ut(dr(C),!1,3)))));let M;if(e.auth){let F=e.auth.username||"",L=e.auth.password||"";M=F+":"+L}if(!M&&E.username){let F=E.username,L=E.password;M=F+":"+L}M&&T.delete("authorization");let D;try{D=Ta(E.pathname+E.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(F){let L=new Error(F.message);return L.config=e,L.url=e.url,L.exists=!0,r(L)}T.set("Accept-Encoding","gzip, compress, deflate"+(wf?", br":""),!1);let O={path:D,method:m,headers:T.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:M,protocol:k,family:l,beforeRedirect:Q_,beforeRedirects:{}};!b.isUndefined(o)&&(O.lookup=o),e.socketPath?O.socketPath=e.socketPath:(O.hostname=E.hostname.startsWith("[")?E.hostname.slice(1,-1):E.hostname,O.port=E.port,jf(O,e.proxy,k+"//"+E.hostname+(E.port?":"+E.port:"")+O.path));let H,le=K_.test(O.protocol);if(O.agent=le?e.httpsAgent:e.httpAgent,e.transport?H=e.transport:e.maxRedirects===0?H=le?Tf.default:kf.default:(e.maxRedirects&&(O.maxRedirects=e.maxRedirects),e.beforeRedirect&&(O.beforeRedirects.config=e.beforeRedirect),H=le?J_:G_),e.maxBodyLength>-1?O.maxBodyLength=e.maxBodyLength:O.maxBodyLength=1/0,e.insecureHTTPParser&&(O.insecureHTTPParser=e.insecureHTTPParser),f=H.request(O,function(L){if(f.destroyed)return;let Q=[L],K=+L.headers["content-length"];if(B||Z){let pe=new Po({maxRate:b.toFiniteNumber(Z)});B&&pe.on("progress",Sf(pe,ur(K,Ut(dr(B),!0,3)))),Q.push(pe)}let re=L,be=L.req||f;if(e.decompress!==!1&&L.headers["content-encoding"])switch((m==="HEAD"||L.statusCode===204)&&delete L.headers["content-encoding"],(L.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":Q.push(Mt.default.createUnzip(_f)),delete L.headers["content-encoding"];break;case"deflate":Q.push(new gf),Q.push(Mt.default.createUnzip(_f)),delete L.headers["content-encoding"];break;case"br":wf&&(Q.push(Mt.default.createBrotliDecompress(Z_)),delete L.headers["content-encoding"])}re=Q.length>1?Na.default.pipeline(Q,b.noop):Q[0];let Ne=Na.default.finished(re,()=>{Ne(),h()}),Y={status:L.statusCode,statusText:L.statusMessage,headers:new Re(L.headers),config:e,request:be};if(c==="stream")Y.data=re,At(s,r,Y);else{let pe=[],Ce=0;re.on("data",function(_e){pe.push(_e),Ce+=_e.length,e.maxContentLength>-1&&Ce>e.maxContentLength&&(d=!0,re.destroy(),r(new q("maxContentLength size of "+e.maxContentLength+" exceeded",q.ERR_BAD_RESPONSE,e,be)))}),re.on("aborted",function(){if(d)return;let _e=new q("stream has been aborted",q.ERR_BAD_RESPONSE,e,be);re.destroy(_e),r(_e)}),re.on("error",function(_e){f.destroyed||r(q.from(_e,null,e,be))}),re.on("end",function(){try{let _e=pe.length===1?pe[0]:Buffer.concat(pe);c!=="arraybuffer"&&(_e=_e.toString(p),(!p||p==="utf8")&&(_e=b.stripBOM(_e))),Y.data=_e}catch(_e){return r(q.from(_e,null,e,Y.request,Y))}At(s,r,Y)})}g.once("abort",pe=>{re.destroyed||(re.emit("error",pe),re.destroy())})}),g.once("abort",F=>{r(F),f.destroy(F)}),f.on("error",function(L){r(q.from(L,null,e,f))}),f.on("socket",function(L){L.setKeepAlive(!0,1e3*60)}),e.timeout){let F=parseInt(e.timeout,10);if(Number.isNaN(F)){r(new q("error trying to parse `config.timeout` to int",q.ERR_BAD_OPTION_VALUE,e,f));return}f.setTimeout(F,function(){if(x)return;let Q=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",K=e.transitional||sr;e.timeoutErrorMessage&&(Q=e.timeoutErrorMessage),r(new q(Q,K.clarifyTimeoutError?q.ETIMEDOUT:q.ECONNABORTED,e,f)),w()})}if(b.isStream(i)){let F=!1,L=!1;i.on("end",()=>{F=!0}),i.once("error",Q=>{L=!0,f.destroy(Q)}),i.on("close",()=>{!F&&!L&&w(new st("Request stream has been aborted",e,f))}),i.pipe(f)}else f.end(i)})};var Df=me.hasStandardBrowserEnv?((t,e)=>a=>(a=new URL(a,me.origin),t.protocol===a.protocol&&t.host===a.host&&(e||t.port===a.port)))(new URL(me.origin),me.navigator&&/(msie|trident)/i.test(me.navigator.userAgent)):()=>!0;var Nf=me.hasStandardBrowserEnv?{write(t,e,a,s,r,n){let i=[t+"="+encodeURIComponent(e)];b.isNumber(a)&&i.push("expires="+new Date(a).toGMTString()),b.isString(s)&&i.push("path="+s),b.isString(r)&&i.push("domain="+r),n===!0&&i.push("secure"),document.cookie=i.join("; ")},read(t){let e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var Ff=t=>t instanceof Re?{...t}:t;function _t(t,e){e=e||{};let a={};function s(c,p,m,x){return b.isPlainObject(c)&&b.isPlainObject(p)?b.merge.call({caseless:x},c,p):b.isPlainObject(p)?b.merge({},p):b.isArray(p)?p.slice():p}function r(c,p,m,x){if(b.isUndefined(p)){if(!b.isUndefined(c))return s(void 0,c,m,x)}else return s(c,p,m,x)}function n(c,p){if(!b.isUndefined(p))return s(void 0,p)}function i(c,p){if(b.isUndefined(p)){if(!b.isUndefined(c))return s(void 0,c)}else return s(void 0,p)}function o(c,p,m){if(m in e)return s(c,p);if(m in t)return s(void 0,c)}let l={url:n,method:n,data:n,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:o,headers:(c,p,m)=>r(Ff(c),Ff(p),m,!0)};return b.forEach(Object.keys({...t,...e}),function(p){let m=l[p]||r,x=m(t[p],e[p],p);b.isUndefined(x)&&m!==o||(a[p]=x)}),a}var xn=t=>{let e=_t({},t),{data:a,withXSRFToken:s,xsrfHeaderName:r,xsrfCookieName:n,headers:i,auth:o}=e;e.headers=i=Re.from(i),e.url=Ta(Aa(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),o&&i.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):"")));let l;if(b.isFormData(a)){if(me.hasStandardBrowserEnv||me.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if((l=i.getContentType())!==!1){let[c,...p]=l?l.split(";").map(m=>m.trim()).filter(Boolean):[];i.setContentType([c||"multipart/form-data",...p].join("; "))}}if(me.hasStandardBrowserEnv&&(s&&b.isFunction(s)&&(s=s(e)),s||s!==!1&&Df(e.url))){let c=r&&n&&Nf.read(n);c&&i.set(r,c)}return e};var ew=typeof XMLHttpRequest<"u",Lf=ew&&function(t){return new Promise(function(a,s){let r=xn(t),n=r.data,i=Re.from(r.headers).normalize(),{responseType:o,onUploadProgress:l,onDownloadProgress:c}=r,p,m,x,d,f;function g(){d&&d(),f&&f(),r.cancelToken&&r.cancelToken.unsubscribe(p),r.signal&&r.signal.removeEventListener("abort",p)}let h=new XMLHttpRequest;h.open(r.method.toUpperCase(),r.url,!0),h.timeout=r.timeout;function w(){if(!h)return;let E=Re.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),T={data:!o||o==="text"||o==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:E,config:t,request:h};At(function(B){a(B),g()},function(B){s(B),g()},T),h=null}"onloadend"in h?h.onloadend=w:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(w)},h.onabort=function(){h&&(s(new q("Request aborted",q.ECONNABORTED,t,h)),h=null)},h.onerror=function(){s(new q("Network Error",q.ERR_NETWORK,t,h)),h=null},h.ontimeout=function(){let k=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded",T=r.transitional||sr;r.timeoutErrorMessage&&(k=r.timeoutErrorMessage),s(new q(k,T.clarifyTimeoutError?q.ETIMEDOUT:q.ECONNABORTED,t,h)),h=null},n===void 0&&i.setContentType(null),"setRequestHeader"in h&&b.forEach(i.toJSON(),function(k,T){h.setRequestHeader(T,k)}),b.isUndefined(r.withCredentials)||(h.withCredentials=!!r.withCredentials),o&&o!=="json"&&(h.responseType=r.responseType),c&&([x,f]=Ut(c,!0),h.addEventListener("progress",x)),l&&h.upload&&([m,d]=Ut(l),h.upload.addEventListener("progress",m),h.upload.addEventListener("loadend",d)),(r.cancelToken||r.signal)&&(p=E=>{h&&(s(!E||E.type?new st(null,t,h):E),h.abort(),h=null)},r.cancelToken&&r.cancelToken.subscribe(p),r.signal&&(r.signal.aborted?p():r.signal.addEventListener("abort",p)));let R=Hr(r.url);if(R&&me.protocols.indexOf(R)===-1){s(new q("Unsupported protocol "+R+":",q.ERR_BAD_REQUEST,t));return}h.send(n||null)})};var tw=(t,e)=>{let{length:a}=t=t?t.filter(Boolean):[];if(e||a){let s=new AbortController,r,n=function(c){if(!r){r=!0,o();let p=c instanceof Error?c:this.reason;s.abort(p instanceof q?p:new st(p instanceof Error?p.message:p))}},i=e&&setTimeout(()=>{i=null,n(new q(`timeout ${e} of ms exceeded`,q.ETIMEDOUT))},e),o=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(n):c.removeEventListener("abort",n)}),t=null)};t.forEach(c=>c.addEventListener("abort",n));let{signal:l}=s;return l.unsubscribe=()=>b.asap(o),l}},$f=tw;var aw=function*(t,e){let a=t.byteLength;if(!e||a<e){yield t;return}let s=0,r;for(;s<a;)r=s+e,yield t.slice(s,r),s=r},rw=async function*(t,e){for await(let a of sw(t))yield*aw(a,e)},sw=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}let e=t.getReader();try{for(;;){let{done:a,value:s}=await e.read();if(a)break;yield s}}finally{await e.cancel()}},To=(t,e,a,s)=>{let r=rw(t,e),n=0,i,o=l=>{i||(i=!0,s&&s(l))};return new ReadableStream({async pull(l){try{let{done:c,value:p}=await r.next();if(c){o(),l.close();return}let m=p.byteLength;if(a){let x=n+=m;a(x)}l.enqueue(new Uint8Array(p))}catch(c){throw o(c),c}},cancel(l){return o(l),r.return()}},{highWaterMark:2})};var bn=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",zf=bn&&typeof ReadableStream=="function",nw=bn&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),Uf=(t,...e)=>{try{return!!t(...e)}catch{return!1}},iw=zf&&Uf(()=>{let t=!1,e=new Request(me.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),qf=64*1024,Ao=zf&&Uf(()=>b.isReadableStream(new Response("").body)),yn={stream:Ao&&(t=>t.body)};bn&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!yn[e]&&(yn[e]=b.isFunction(t[e])?a=>a[e]():(a,s)=>{throw new q(`Response type '${e}' is not supported`,q.ERR_NOT_SUPPORT,s)})})})(new Response);var ow=async t=>{if(t==null)return 0;if(b.isBlob(t))return t.size;if(b.isSpecCompliantForm(t))return(await new Request(me.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(b.isArrayBufferView(t)||b.isArrayBuffer(t))return t.byteLength;if(b.isURLSearchParams(t)&&(t=t+""),b.isString(t))return(await nw(t)).byteLength},cw=async(t,e)=>{let a=b.toFiniteNumber(t.getContentLength());return a??ow(e)},Mf=bn&&(async t=>{let{url:e,method:a,data:s,signal:r,cancelToken:n,timeout:i,onDownloadProgress:o,onUploadProgress:l,responseType:c,headers:p,withCredentials:m="same-origin",fetchOptions:x}=xn(t);c=c?(c+"").toLowerCase():"text";let d=$f([r,n&&n.toAbortSignal()],i),f,g=d&&d.unsubscribe&&(()=>{d.unsubscribe()}),h;try{if(l&&iw&&a!=="get"&&a!=="head"&&(h=await cw(p,s))!==0){let T=new Request(e,{method:"POST",body:s,duplex:"half"}),C;if(b.isFormData(s)&&(C=T.headers.get("content-type"))&&p.setContentType(C),T.body){let[B,z]=ur(h,Ut(dr(l)));s=To(T.body,qf,B,z)}}b.isString(m)||(m=m?"include":"omit");let w="credentials"in Request.prototype;f=new Request(e,{...x,signal:d,method:a.toUpperCase(),headers:p.normalize().toJSON(),body:s,duplex:"half",credentials:w?m:void 0});let R=await fetch(f,x),E=Ao&&(c==="stream"||c==="response");if(Ao&&(o||E&&g)){let T={};["status","statusText","headers"].forEach(I=>{T[I]=R[I]});let C=b.toFiniteNumber(R.headers.get("content-length")),[B,z]=o&&ur(C,Ut(dr(o),!0))||[];R=new Response(To(R.body,qf,B,()=>{z&&z(),g&&g()}),T)}c=c||"text";let k=await yn[b.findKey(yn,c)||"text"](R,t);return!E&&g&&g(),await new Promise((T,C)=>{At(T,C,{data:k,headers:Re.from(R.headers),status:R.status,statusText:R.statusText,config:t,request:f})})}catch(w){throw g&&g(),w&&w.name==="TypeError"&&/Load failed|fetch/i.test(w.message)?Object.assign(new q("Network Error",q.ERR_NETWORK,t,f),{cause:w.cause||w}):q.from(w,w&&w.code,t,f)}});var Co={http:If,xhr:Lf,fetch:Mf};b.forEach(Co,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var Bf=t=>`- ${t}`,lw=t=>b.isFunction(t)||t===null||t===!1,_n={getAdapter:t=>{t=b.isArray(t)?t:[t];let{length:e}=t,a,s,r={};for(let n=0;n<e;n++){a=t[n];let i;if(s=a,!lw(a)&&(s=Co[(i=String(a)).toLowerCase()],s===void 0))throw new q(`Unknown adapter '${i}'`);if(s)break;r[i||"#"+n]=s}if(!s){let n=Object.entries(r).map(([o,l])=>`adapter ${o} `+(l===!1?"is not supported by the environment":"is not available in the build")),i=e?n.length>1?`since :
|
|
17
17
|
`+n.map(Bf).join(`
|
|
18
18
|
`):" "+Bf(n[0]):"as no adapter specified";throw new q("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return s},adapters:Co};function Oo(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new st(null,t)}function wn(t){return Oo(t),t.headers=Re.from(t.headers),t.data=$r.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),_n.getAdapter(t.adapter||nr.adapter)(t).then(function(s){return Oo(t),s.data=$r.call(t,t.transformResponse,s),s.headers=Re.from(s.headers),s},function(s){return qr(s)||(Oo(t),s&&s.response&&(s.response.data=$r.call(t,t.transformResponse,s.response),s.response.headers=Re.from(s.response.headers))),Promise.reject(s)})}var En={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{En[t]=function(s){return typeof s===t||"a"+(e<1?"n ":" ")+t}});var Hf={};En.transitional=function(e,a,s){function r(n,i){return"[Axios v"+Ia+"] Transitional option '"+n+"'"+i+(s?". "+s:"")}return(n,i,o)=>{if(e===!1)throw new q(r(i," has been removed"+(a?" in "+a:"")),q.ERR_DEPRECATED);return a&&!Hf[i]&&(Hf[i]=!0,console.warn(r(i," has been deprecated since v"+a+" and will be removed in the near future"))),e?e(n,i,o):!0}};En.spelling=function(e){return(a,s)=>(console.warn(`${s} is likely a misspelling of ${e}`),!0)};function pw(t,e,a){if(typeof t!="object")throw new q("options must be an object",q.ERR_BAD_OPTION_VALUE);let s=Object.keys(t),r=s.length;for(;r-- >0;){let n=s[r],i=e[n];if(i){let o=t[n],l=o===void 0||i(o,n,t);if(l!==!0)throw new q("option "+n+" must be "+l,q.ERR_BAD_OPTION_VALUE);continue}if(a!==!0)throw new q("Unknown option "+n,q.ERR_BAD_OPTION)}}var Zr={assertOptions:pw,validators:En};var Ct=Zr.validators,mr=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Ki,response:new Ki}}async request(e,a){try{return await this._request(e,a)}catch(s){if(s instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;let n=r.stack?r.stack.replace(/^.+\n/,""):"";try{s.stack?n&&!String(s.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(s.stack+=`
|
|
19
|
-
`+n):s.stack=n}catch{}}throw s}}_request(e,a){typeof e=="string"?(a=a||{},a.url=e):a=e||{},a=_t(this.defaults,a);let{transitional:s,paramsSerializer:r,headers:n}=a;s!==void 0&&Zr.assertOptions(s,{silentJSONParsing:Ct.transitional(Ct.boolean),forcedJSONParsing:Ct.transitional(Ct.boolean),clarifyTimeoutError:Ct.transitional(Ct.boolean)},!1),r!=null&&(b.isFunction(r)?a.paramsSerializer={serialize:r}:Zr.assertOptions(r,{encode:Ct.function,serialize:Ct.function},!0)),a.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?a.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:a.allowAbsoluteUrls=!0),Zr.assertOptions(a,{baseUrl:Ct.spelling("baseURL"),withXsrfToken:Ct.spelling("withXSRFToken")},!0),a.method=(a.method||this.defaults.method||"get").toLowerCase();let i=n&&b.merge(n.common,n[a.method]);n&&b.forEach(["delete","get","head","post","put","patch","common"],f=>{delete n[f]}),a.headers=Re.concat(i,n);let o=[],l=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(a)===!1||(l=l&&g.synchronous,o.unshift(g.fulfilled,g.rejected))});let c=[];this.interceptors.response.forEach(function(g){c.push(g.fulfilled,g.rejected)});let p,m=0,x;if(!l){let f=[wn.bind(this),void 0];for(f.unshift(...o),f.push(...c),x=f.length,p=Promise.resolve(a);m<x;)p=p.then(f[m++],f[m++]);return p}x=o.length;let d=a;for(m=0;m<x;){let f=o[m++],g=o[m++];try{d=f(d)}catch(h){g.call(this,h);break}}try{p=wn.call(this,d)}catch(f){return Promise.reject(f)}for(m=0,x=c.length;m<x;)p=p.then(c[m++],c[m++]);return p}getUri(e){e=_t(this.defaults,e);let a=Aa(e.baseURL,e.url,e.allowAbsoluteUrls);return Ta(a,e.params,e.paramsSerializer)}};b.forEach(["delete","get","head","options"],function(e){mr.prototype[e]=function(a,s){return this.request(_t(s||{},{method:e,url:a,data:(s||{}).data}))}});b.forEach(["post","put","patch"],function(e){function a(s){return function(n,i,o){return this.request(_t(o||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:n,data:i}))}}mr.prototype[e]=a(),mr.prototype[e+"Form"]=a(!0)});var Gr=mr;var jo=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let a;this.promise=new Promise(function(n){a=n});let s=this;this.promise.then(r=>{if(!s._listeners)return;let n=s._listeners.length;for(;n-- >0;)s._listeners[n](r);s._listeners=null}),this.promise.then=r=>{let n,i=new Promise(o=>{s.subscribe(o),n=o}).then(r);return i.cancel=function(){s.unsubscribe(n)},i},e(function(n,i,o){s.reason||(s.reason=new st(n,i,o),a(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let a=this._listeners.indexOf(e);a!==-1&&this._listeners.splice(a,1)}toAbortSignal(){let e=new AbortController,a=s=>{e.abort(s)};return this.subscribe(a),e.signal.unsubscribe=()=>this.unsubscribe(a),e.signal}static source(){let e;return{token:new t(function(r){e=r}),cancel:e}}},Vf=jo;function Io(t){return function(a){return t.apply(null,a)}}function Do(t){return b.isObject(t)&&t.isAxiosError===!0}var No={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(No).forEach(([t,e])=>{No[e]=t});var Zf=No;function Gf(t){let e=new Gr(t),a=Tr(Gr.prototype.request,e);return b.extend(a,Gr.prototype,e,{allOwnKeys:!0}),b.extend(a,e,null,{allOwnKeys:!0}),a.create=function(r){return Gf(_t(t,r))},a}var De=Gf(nr);De.Axios=Gr;De.CanceledError=st;De.CancelToken=Vf;De.isCancel=qr;De.VERSION=Ia;De.toFormData=Yt;De.AxiosError=q;De.Cancel=De.CanceledError;De.all=function(e){return Promise.all(e)};De.spread=Io;De.isAxiosError=Do;De.mergeConfig=_t;De.AxiosHeaders=Re;De.formToJSON=t=>un(b.isHTMLForm(t)?new FormData(t):t);De.getAdapter=_n.getAdapter;De.HttpStatusCode=Zf;De.default=De;var ta=De;var{Axios:sO,AxiosError:nO,CanceledError:iO,isCancel:oO,CancelToken:cO,VERSION:lO,all:pO,Cancel:uO,isAxiosError:dO,spread:mO,toFormData:fO,AxiosHeaders:hO,HttpStatusCode:vO,formToJSON:gO,getAdapter:xO,mergeConfig:yO}=ta;function Jr(){return process.argv.slice(2)}function Fo(){let t=Jr(),e="";for(let a=0;a<t.length;a++)if(t[a]==="--token"&&a+1<t.length){e=t[a+1];break}else if(t[a].startsWith("--token=")){e=t[a].split("=")[1];break}return e}function Lo(){let t=Jr(),e="";for(let a=0;a<t.length;a++)if(t[a]==="--url"&&a+1<t.length){e=t[a+1];break}else if(t[a].startsWith("--url=")){e=t[a].split("=")[1];break}return e}function $o(){let t=Jr(),e=[];for(let a=0;a<t.length;a++)t[a]==="--rule"&&a+1<t.length?e.push(t[a+1]):t[a].startsWith("--rule=")&&e.push(t[a].split("=")[1]);return e}function uw(){let t=Jr();for(let e of t)if(e==="--debug")return!0;return!1}function qo(){let t=Jr();for(let e of t)if(e==="--no-rule")return!0;return!1}function Jf(){let t=Fo(),e=Lo(),a=$o(),s=uw(),r=qo();return{token:t,baseUrl:e,rules:a,debug:s,noRule:r}}var Sn=()=>({"Content-Type":"application/json",Accept:"application/json","X-MG-UserAccessToken":process.env.MG_MCP_TOKEN||process.env.MASTERGO_API_TOKEN||Fo()}),zo=()=>process.env.API_BASE_URL||Lo(),dw=t=>{var s;let e=new Set,a=r=>{var n,i,o,l;(i=(n=r==null?void 0:r.componentInfo)==null?void 0:n.componentSetDocumentLink)!=null&&i[0]&&e.add(r.componentInfo.componentSetDocumentLink[0]),(l=(o=r.children)==null?void 0:o.forEach)==null||l.call(o,a)};return(s=t.nodes)==null||s.forEach(a),Array.from(e)},mw=()=>["token filed must be generated as a variable (colors, shadows, fonts, etc.) and the token field must be displayed in the comment",`componentDocumentLinks is a list of frontend component documentation links used in the DSL layer, designed to help you understand how to use the components.
|
|
19
|
+
`+n):s.stack=n}catch{}}throw s}}_request(e,a){typeof e=="string"?(a=a||{},a.url=e):a=e||{},a=_t(this.defaults,a);let{transitional:s,paramsSerializer:r,headers:n}=a;s!==void 0&&Zr.assertOptions(s,{silentJSONParsing:Ct.transitional(Ct.boolean),forcedJSONParsing:Ct.transitional(Ct.boolean),clarifyTimeoutError:Ct.transitional(Ct.boolean)},!1),r!=null&&(b.isFunction(r)?a.paramsSerializer={serialize:r}:Zr.assertOptions(r,{encode:Ct.function,serialize:Ct.function},!0)),a.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?a.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:a.allowAbsoluteUrls=!0),Zr.assertOptions(a,{baseUrl:Ct.spelling("baseURL"),withXsrfToken:Ct.spelling("withXSRFToken")},!0),a.method=(a.method||this.defaults.method||"get").toLowerCase();let i=n&&b.merge(n.common,n[a.method]);n&&b.forEach(["delete","get","head","post","put","patch","common"],f=>{delete n[f]}),a.headers=Re.concat(i,n);let o=[],l=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(a)===!1||(l=l&&g.synchronous,o.unshift(g.fulfilled,g.rejected))});let c=[];this.interceptors.response.forEach(function(g){c.push(g.fulfilled,g.rejected)});let p,m=0,x;if(!l){let f=[wn.bind(this),void 0];for(f.unshift(...o),f.push(...c),x=f.length,p=Promise.resolve(a);m<x;)p=p.then(f[m++],f[m++]);return p}x=o.length;let d=a;for(m=0;m<x;){let f=o[m++],g=o[m++];try{d=f(d)}catch(h){g.call(this,h);break}}try{p=wn.call(this,d)}catch(f){return Promise.reject(f)}for(m=0,x=c.length;m<x;)p=p.then(c[m++],c[m++]);return p}getUri(e){e=_t(this.defaults,e);let a=Aa(e.baseURL,e.url,e.allowAbsoluteUrls);return Ta(a,e.params,e.paramsSerializer)}};b.forEach(["delete","get","head","options"],function(e){mr.prototype[e]=function(a,s){return this.request(_t(s||{},{method:e,url:a,data:(s||{}).data}))}});b.forEach(["post","put","patch"],function(e){function a(s){return function(n,i,o){return this.request(_t(o||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:n,data:i}))}}mr.prototype[e]=a(),mr.prototype[e+"Form"]=a(!0)});var Gr=mr;var jo=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let a;this.promise=new Promise(function(n){a=n});let s=this;this.promise.then(r=>{if(!s._listeners)return;let n=s._listeners.length;for(;n-- >0;)s._listeners[n](r);s._listeners=null}),this.promise.then=r=>{let n,i=new Promise(o=>{s.subscribe(o),n=o}).then(r);return i.cancel=function(){s.unsubscribe(n)},i},e(function(n,i,o){s.reason||(s.reason=new st(n,i,o),a(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let a=this._listeners.indexOf(e);a!==-1&&this._listeners.splice(a,1)}toAbortSignal(){let e=new AbortController,a=s=>{e.abort(s)};return this.subscribe(a),e.signal.unsubscribe=()=>this.unsubscribe(a),e.signal}static source(){let e;return{token:new t(function(r){e=r}),cancel:e}}},Vf=jo;function Io(t){return function(a){return t.apply(null,a)}}function Do(t){return b.isObject(t)&&t.isAxiosError===!0}var No={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(No).forEach(([t,e])=>{No[e]=t});var Zf=No;function Gf(t){let e=new Gr(t),a=Tr(Gr.prototype.request,e);return b.extend(a,Gr.prototype,e,{allOwnKeys:!0}),b.extend(a,e,null,{allOwnKeys:!0}),a.create=function(r){return Gf(_t(t,r))},a}var De=Gf(nr);De.Axios=Gr;De.CanceledError=st;De.CancelToken=Vf;De.isCancel=qr;De.VERSION=Ia;De.toFormData=Yt;De.AxiosError=q;De.Cancel=De.CanceledError;De.all=function(e){return Promise.all(e)};De.spread=Io;De.isAxiosError=Do;De.mergeConfig=_t;De.AxiosHeaders=Re;De.formToJSON=t=>un(b.isHTMLForm(t)?new FormData(t):t);De.getAdapter=_n.getAdapter;De.HttpStatusCode=Zf;De.default=De;var ta=De;var{Axios:sO,AxiosError:nO,CanceledError:iO,isCancel:oO,CancelToken:cO,VERSION:lO,all:pO,Cancel:uO,isAxiosError:dO,spread:mO,toFormData:fO,AxiosHeaders:hO,HttpStatusCode:vO,formToJSON:gO,getAdapter:xO,mergeConfig:yO}=ta;function Jr(){return process.argv.slice(2)}function Fo(){let t=Jr(),e="";for(let a=0;a<t.length;a++)if(t[a]==="--token"&&a+1<t.length){e=t[a+1];break}else if(t[a].startsWith("--token=")){e=t[a].split("=")[1];break}return e}function Lo(){let t=Jr(),e="";for(let a=0;a<t.length;a++)if(t[a]==="--url"&&a+1<t.length){e=t[a+1];break}else if(t[a].startsWith("--url=")){e=t[a].split("=")[1];break}return e}function $o(){let t=Jr(),e=[];for(let a=0;a<t.length;a++)t[a]==="--rule"&&a+1<t.length?e.push(t[a+1]):t[a].startsWith("--rule=")&&e.push(t[a].split("=")[1]);return e}function uw(){let t=Jr();for(let e of t)if(e==="--debug")return!0;return!1}function qo(){let t=Jr();for(let e of t)if(e==="--no-rule")return!0;return!1}function Jf(){let t=Fo(),e=Lo(),a=$o(),s=uw(),r=qo();return{token:t,baseUrl:e,rules:a,debug:s,noRule:r}}var Sn=()=>({"Content-Type":"application/json",Accept:"application/json","X-MG-UserAccessToken":process.env.MG_MCP_TOKEN||process.env.MASTERGO_API_TOKEN||Fo()}),zo=()=>{let t=process.env.API_BASE_URL||Lo();try{let e=new URL(t),a=e.protocol,s=e.hostname,r=e.port,n=`${a}//${s}`;return r&&(n+=`:${r}`),n}catch{throw new Error(`\u65E0\u6548\u7684URL\u683C\u5F0F: ${t}\u3002\u8BF7\u63D0\u4F9B\u6B63\u786E\u7684URL\u683C\u5F0F\uFF0C\u4F8B\u5982: https://mastergo.com`)}},dw=t=>{var s;let e=new Set,a=r=>{var n,i,o,l;(i=(n=r==null?void 0:r.componentInfo)==null?void 0:n.componentSetDocumentLink)!=null&&i[0]&&e.add(r.componentInfo.componentSetDocumentLink[0]),(l=(o=r.children)==null?void 0:o.forEach)==null||l.call(o,a)};return(s=t.nodes)==null||s.forEach(a),Array.from(e)},mw=()=>["token filed must be generated as a variable (colors, shadows, fonts, etc.) and the token field must be displayed in the comment",`componentDocumentLinks is a list of frontend component documentation links used in the DSL layer, designed to help you understand how to use the components.
|
|
20
20
|
When it exists and is not empty, you need to use mcp__getComponentLink in a for loop to get the URL content of all components in the list, understand how to use the components, and generate code using the components.
|
|
21
21
|
For example:
|
|
22
22
|
\`\`\`js
|
|
@@ -442,7 +442,7 @@ This tool provides a structured workflow for component development following bes
|
|
|
442
442
|
You must provide an absolute rootPath of workspace to save workflow files.
|
|
443
443
|
`,Tn=class extends mt{constructor(){super();this.name=Ew;this.description=Sw;this.schema=u.object({rootPath:u.string().describe("The root path of the project, if the user does not provide, you can use the current directory as the root path"),fileId:u.string().describe("MasterGo design file ID (format: file/<fileId> in MasterGo URL)"),layerId:u.string().describe("Layer ID of the specific component or element to retrieve (format: ?layer_id=<layerId> / file=<fileId> in MasterGo URL)")})}async execute({rootPath:a,fileId:s,layerId:r}){var p;let n=`${a}/.mastergo/`;Ot.default.existsSync(n)||Ot.default.mkdirSync(n,{recursive:!0});let i=`${n}/component-workflow.md`,o=await Bt.getComponentStyleJson(s,r),l=`${n}/${o[0].name}.json`,c=m=>{if(m.path&&m.path.length>0){m.imageUrls=[];let x=m.id.replaceAll("/","&"),d=`${n}/images`;Ot.default.existsSync(d)||Ot.default.mkdirSync(d,{recursive:!0}),(m.path??[]).forEach((f,g)=>{let h=`${d}/${x}-${g}.svg`;Ot.default.existsSync(h)||Ot.default.writeFileSync(h,`<svg width="100%" height="100%" viewBox="0 0 16 16"xmlns="http://www.w3.org/2000/svg">
|
|
444
444
|
<path d="${f}" fill="currentColor"/>
|
|
445
|
-
</svg>`),m.imageUrls.push(h)}),delete m.path}m.children&&m.children.forEach(x=>{c(x)})};c(o[0]),Ot.default.existsSync(i)||Ot.default.writeFileSync(i,Qf),Ot.default.writeFileSync(l,JSON.stringify(o[0]));try{return{content:[{type:"text",text:JSON.stringify({files:{workflow:i,componentSpec:l},message:"Component development files successfully created",rules:[`Follow the component workflow process defined in file://${i} for structured development. This workflow contains a lot of content, you'll need to read it in multiple sessions.`,`Implement the component according to the specifications in file://${l}, ensuring all properties and states are properly handled.`]})}]}}catch(m){let x=((p=m.response)==null?void 0:p.data)??(m==null?void 0:m.message);return{isError:!0,content:[{type:"text",text:JSON.stringify(x)}]}}}};var An={name:"@mastergo/magic-mcp",version:"0.1.
|
|
445
|
+
</svg>`),m.imageUrls.push(h)}),delete m.path}m.children&&m.children.forEach(x=>{c(x)})};c(o[0]),Ot.default.existsSync(i)||Ot.default.writeFileSync(i,Qf),Ot.default.writeFileSync(l,JSON.stringify(o[0]));try{return{content:[{type:"text",text:JSON.stringify({files:{workflow:i,componentSpec:l},message:"Component development files successfully created",rules:[`Follow the component workflow process defined in file://${i} for structured development. This workflow contains a lot of content, you'll need to read it in multiple sessions.`,`Implement the component according to the specifications in file://${l}, ensuring all properties and states are properly handled.`]})}]}}catch(m){let x=((p=m.response)==null?void 0:p.data)??(m==null?void 0:m.message);return{isError:!0,content:[{type:"text",text:JSON.stringify(x)}]}}}};var An={name:"@mastergo/magic-mcp",version:"0.1.1",description:"MasterGo MCP standalone service",main:"dist/index.js",bin:{"mastergo-magic-mcp":"dist/index.js"},files:["dist/**/*","!**/*.map","!**/.DS_Store","!**/.idea","!**/.vscode"],engines:{node:">=18"},scripts:{build:"node build.js",start:"node dist/index.js --token=test --url=http://localhost:3000 --debug",prepublishOnly:"npm run build"},keywords:["mastergo","mcp","ai"],author:"",license:"ISC",private:!1,dependencies:{"@modelcontextprotocol/sdk":"^1.6.1",axios:"^1.6.0",zod:"^3.22.4"},devDependencies:{"@types/node":"^20.8.10","@typescript-eslint/eslint-plugin":"^6.9.1","@typescript-eslint/parser":"^6.9.1",esbuild:"^0.25.1","esbuild-plugin-tsc":"^0.5.0",eslint:"^8.52.0",pkg:"^5.8.1",prettier:"^3.0.3","ts-node":"^10.9.1",typescript:"^5.2.2"}};var Rw=`version_${An.version.replace(/\./g,"_")}`,kw=`the current version is ${An.version}`,Cn=class extends mt{constructor(){super();this.name=Rw;this.description=kw;this.schema=u.object({})}async execute({}){return{content:[{type:"text",text:JSON.stringify(An.version)}]}}};function Tw(){let{token:t,baseUrl:e,rules:a,debug:s,noRule:r}=Jf();s&&(process.env.DEBUG="true",console.log("Debug information:"),console.log(`Token: ${t?"set":"not set"}`),console.log(`API URL: ${e||"default"}`),console.log(`Rules: ${a.length>0?a.join(", "):"none"}`),console.log(`No Rule: ${r?"enabled":"disabled"}`),console.log("Debug mode: enabled"));let n=new Zs({name:"MasterGoMcpServer",version:"0.0.1"});new Cn().register(n),new Pn().register(n),new Rn().register(n),new kn().register(n),new Tn().register(n),n.connect(new Js)}Tw();
|
|
446
446
|
/*! Bundled license information:
|
|
447
447
|
|
|
448
448
|
uri-js/dist/es5/uri.all.js:
|