@mcp-use/cli 4.0.1-canary.0 → 4.0.1-canary.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/dist/bin.js +1 -1
- package/dist/{chunk-HKE5UI5S.js → chunk-JAWUXU2E.js} +5 -5
- package/dist/chunk-STQ3SGCH.js +1 -0
- package/dist/commands/dev.js +1 -1
- package/dist/commands/start.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{start-PCNMGPDW.js → start-PIY244P7.js} +1 -1
- package/package.json +2 -2
- package/dist/chunk-USIKTT3N.js +0 -1
package/dist/bin.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as n}from"./chunk-
|
|
2
|
+
import{a as n}from"./chunk-JAWUXU2E.js";import"./chunk-STQ3SGCH.js";n(process.argv.slice(2),{frameworkVersion:"4.0.1-canary.2"}).then(e=>{process.exitCode=e},e=>{console.error(e instanceof Error?e.message:String(e)),process.exitCode=1});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as l}from"./chunk-
|
|
1
|
+
import{a as p,b as l}from"./chunk-STQ3SGCH.js";import{resolve as u}from"path";var c=Object.getOwnPropertyDescriptor(globalThis,"localStorage");c?.get!==void 0&&c.configurable&&Object.defineProperty(globalThis,"localStorage",{configurable:!0,enumerable:c.enumerable??!1,value:void 0,writable:!0});var s=`mcp-use \u2014 run MCP servers built with mcp-use
|
|
2
2
|
|
|
3
3
|
Usage: mcp-use <command> [options]
|
|
4
4
|
|
|
@@ -32,7 +32,7 @@ Options:
|
|
|
32
32
|
--no-open Do not auto-open the inspector in a browser (dev only)
|
|
33
33
|
--no-inspector Start dev without loading the optional Inspector
|
|
34
34
|
-h, --help Show this help
|
|
35
|
-
-v, --version Print the version`,
|
|
35
|
+
-v, --version Print the version`,m={dev:`Usage: mcp-use dev [options]
|
|
36
36
|
|
|
37
37
|
Start the development MCP server with view hot reload.
|
|
38
38
|
|
|
@@ -84,7 +84,7 @@ Options:
|
|
|
84
84
|
--tunnel Start a public tunnel
|
|
85
85
|
-h, --help Show this help
|
|
86
86
|
|
|
87
|
-
Exit codes: 0 started/help, 2 invalid arguments, 1 startup failure`};async function
|
|
87
|
+
Exit codes: 0 started/help, 2 invalid arguments, 1 startup failure`};async function h(t,e={frameworkVersion:"unknown"}){if(t.length===1&&["--version","-v"].includes(t[0]??""))return console.log(e.frameworkVersion),0;if(t.some(r=>r==="--help"||r==="-h")){let r=t[0];if(r===void 0||r==="--help"||r==="-h")return console.log(s),0;let a=m[r];if(a!==void 0)return console.log(a),0}let o=t[0],i=l(t.slice(1));if(o==="login"||o==="logout"||o==="whoami"){let{runIdentity:r}=await import("./commands/identity.js");return r(o,i)}if(o==="org"){let{runOrganizations:r}=await import("./commands/organizations.js");return r(i)}if(o==="servers"){let{runServers:r}=await import("./commands/servers.js");return r(i)}if(o==="deployments"){let{runDeployments:r}=await import("./commands/deployments.js");return r(i)}if(o==="deploy"){let{runDeploy:r}=await import("./commands/deploy.js");return r(i)}if(o==="client"){let{runClient:r}=await import("./commands/client.js");return r(i)}if(o==="screenshot"){let{runScreenshot:r}=await import("./commands/screenshot.js");return r(i)}let n;try{n=p(t)}catch(r){return console.error(r instanceof Error?r.message:String(r)),2}if(n.version)return console.log(e.frameworkVersion),0;if(n.help)return console.log(s),0;switch(n.command){case"start":return y(n);case"dev":case"build":return w(n.command,n);case"typecheck":return f(n);case void 0:return console.error(s),2;default:return console.error(`Unknown command: ${n.command}
|
|
88
88
|
|
|
89
|
-
${
|
|
90
|
-
`):
|
|
89
|
+
${s}`),2}}async function f(t){try{let{runTypecheck:e}=await import("./commands/typecheck.js");return await e({cwd:u(process.cwd(),t.path??"."),...t.entry!==void 0&&{entry:t.entry},...t.mcpDir!==void 0&&{mcpDir:t.mcpDir},...t.passthrough.length>0&&{tscArgs:t.passthrough}})}catch(e){return console.error(d(e)),1}}async function y(t){let e;try{let{runStart:n}=await import("./commands/start.js");e=await n({cwd:u(process.cwd(),t.path??"."),port:t.port,host:t.host,...t.inspector===!0&&{withInspector:!0},tunnel:t.tunnel})}catch(n){return console.error(n instanceof Error?n.message:String(n)),1}console.log(`mcp-use server running at ${e.url}`),t.inspector===!0&&console.log(`mcp-use inspector at ${e.url.replace(/\/$/,"")}/inspector`),e.tunnelUrl!==void 0&&console.log(`mcp-use public MCP URL: ${e.tunnelUrl}`);let o=!1,i=()=>{o||(o=!0,e.close().then(()=>process.exit(0),n=>{console.error(n instanceof Error?n.message:String(n)),process.exit(1)}))};return process.once("SIGINT",i),process.once("SIGTERM",i),0}async function w(t,e){let o={cwd:u(process.cwd(),e.path??"."),...e.entry!==void 0&&{entry:e.entry},...e.mcpDir!==void 0&&{mcpDir:e.mcpDir},...e.viewsDir!==void 0&&{viewsDir:e.viewsDir},...e.port!==void 0&&{port:e.port},...e.host!==void 0&&{host:e.host},...e.tunnel&&{tunnel:!0},...!e.open&&{open:!1},...e.inspector===!1&&{inspector:!1},...e.sourceMaps&&{sourceMaps:!0},...e.inline&&{inline:!0}};try{if(t==="dev"){let{runDev:i}=await import("./commands/dev.js");await i(o)}else{let{runBuild:i}=await import("./commands/build.js");await i(o)}return 0}catch(i){return console.error(d(i)),1}}function d(t){let e=t instanceof Error?t.message:String(t);return/tunnel|bore connection/i.test(e)?["[tunnel_connection_timeout] Public tunnel could not establish a connection.",`Cause: ${e}`,"","Retry:"," mcp-use dev --tunnel","","Verify outbound network access and tunnel service status:"," https://local.mcp-use.run"].join(`
|
|
90
|
+
`):e}export{h as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var f="127.0.0.1";function u(n,e,t=process.env){if(n!==void 0)return n;let r=t.HOST?.trim();return r!==void 0&&r!==""?r:e??f}function a(n,e,t=process.env){if(n!==void 0)return n;let r=c(t.PORT);return r!==void 0?r:e??3e3}function c(n){if(n===void 0||n.trim()==="")return;let e=Number(n);return Number.isInteger(e)&&e>=0&&e<=65535?e:void 0}function m(n){let e={command:void 0,port:void 0,entry:void 0,path:void 0,mcpDir:void 0,viewsDir:void 0,host:void 0,tunnel:!1,open:!0,inspector:void 0,sourceMaps:!1,inline:!1,help:!1,version:!1,passthrough:[]};for(let t=0;t<n.length;t++){let r=n[t];if(r===void 0)continue;if(r==="--"){if(e.command==="typecheck"){e.passthrough=n.slice(t+1);break}continue}let i=r,d;if(r.startsWith("--")){let s=r.indexOf("=");s!==-1&&(i=r.slice(0,s),d=r.slice(s+1))}let o=()=>{if(d!==void 0)return d;let s=n[++t];if(s===void 0||s.startsWith("-"))throw new Error(`Missing value for ${i}`);return s};switch(i){case"-h":case"--help":e.help=!0;break;case"-v":case"--version":e.version=!0;break;case"-p":case"--port":e.port=p(o());break;case"--entry":e.entry=o();break;case"--path":e.path=o();break;case"--mcp-dir":e.mcpDir=o();break;case"--views-dir":e.viewsDir=o();break;case"--host":e.host=o();break;case"--tunnel":e.tunnel=!0;break;case"--no-open":e.open=!1;break;case"--no-inspector":e.inspector=!1;break;case"--with-inspector":e.inspector=!0;break;case"--source-maps":e.sourceMaps=!0;break;case"--inline":e.inline=!0;break;default:if(i.startsWith("-"))throw new Error(`Unknown option: ${i}`);if(e.command!==void 0)throw new Error(`Unexpected argument: ${i}`);e.command=i}}return e}function h(n){let e=n.indexOf("--");return e===-1?n:[...n.slice(0,e),...n.slice(e+1)]}function k(n,e=process.env,t){return a(n,t,e)}function w(n,e=process.env,t){return u(n,t,e)}function p(n){let e=Number(n);if(!l(e))throw new Error(`Invalid port: ${n}`);return e}function l(n){return Number.isInteger(n)&&n>=0&&n<=65535}export{m as a,h as b,k as c,w as d};
|
package/dist/commands/dev.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as ne}from"../chunk-F5XPOFT7.js";import{a as Z,b as Q}from"../chunk-N7BU45K6.js";import{
|
|
1
|
+
import{b as ne}from"../chunk-F5XPOFT7.js";import{a as Z,b as Q}from"../chunk-N7BU45K6.js";import{c as J,d as K}from"../chunk-STQ3SGCH.js";import{a as re,b as oe,c as se,d as ie,e as T,g as x,h as ae,j as ce,k as le,l as de}from"../chunk-ICHICRCP.js";import{b as ee,c as te,d as A}from"../chunk-7G4TXPP4.js";import{a as L,b as Y}from"../chunk-FLGSKQGU.js";import{a as X}from"../chunk-LNASFQWW.js";import{existsSync as $e}from"fs";import{createServer as Le}from"http";import{networkInterfaces as Ae}from"os";import{join as Te,resolve as xe}from"path";import Ve from"@tailwindcss/vite";import Fe from"@vitejs/plugin-react";import{createServer as Be,createServerModuleRunner as Ne}from"vite";import{InMemoryServerEventBus as We,localhostAllowedHostnames as Ge,localhostAllowedOrigins as qe,validateHostHeader as ze,validateOriginHeader as Je}from"@modelcontextprotocol/server";import{connect as Se,createServer as _e}from"net";var ue=100,De=300,He=new Set(["127.0.0.1","localhost","::1"]);function Ee(e,r){return new Promise(s=>{let n=_e();n.unref(),n.once("error",()=>s(!1)),n.listen({port:e,host:r},()=>{n.close(()=>s(!0))})})}function pe(e,r){return new Promise(s=>{let n=Se({port:e,host:r});n.setTimeout(De),n.once("connect",()=>{n.destroy(),s(!0)}),n.once("timeout",()=>{n.destroy(),s(!1)}),n.once("error",()=>{n.destroy(),s(!1)})})}async function Ce(e){return await pe(e,"127.0.0.1")||await pe(e,"::1")}async function fe(e,r){for(let s=e;s<e+ue;s++)if(await Ee(s,r)&&!(He.has(r)&&await Ce(s)))return{port:s,requested:e};throw new Error(`No free port found between ${e} and ${e+ue-1} on ${r}.`)}function me(e,r){let s=()=>{let n=e.getBasePath(),{url:c}=e.tunnel.status();return{mcpUrl:c!==null?`${c.replace(/\/+$/,"")}${n}`:null,port:e.port,fromCli:!0,tunnelUrl:c}};return async n=>{let c=e.getBasePath(),d=`${c}/inspector/api/dev/info`,l=`${c}/inspector/api/dev/start-tunnel`,u=`${c}/inspector/api/dev/stop-tunnel`,g=new URL(n.url).pathname;if(n.method==="GET"&&g===d)return Response.json(s());if(n.method==="POST"&&g===l)try{return await e.tunnel.start(e.port),Response.json({ok:!0,restarting:!1})}catch(y){let D=y instanceof Error?y.message:"Failed to start tunnel";return Response.json({error:D},{status:500})}return n.method==="POST"&&g===u?(await e.tunnel.stop(),Response.json({ok:!0})):r(n)}}import{readFileSync as Oe}from"fs";import{createRequire as Ue}from"module";import{join as je}from"path";import{pathToFileURL as ke}from"url";async function we(e){let r=je(e,"package.json"),s=JSON.parse(Oe(r,"utf8"));if([s.dependencies,s.devDependencies,s.optionalDependencies].some(d=>d!==null&&typeof d=="object"&&"@mcp-use/inspector"in d)){let d=Ue(r);try{let l=d.resolve("@mcp-use/inspector");return ve(await import(ke(l).href))}catch(l){if(!he(l))throw l}}try{return ve(await import("@mcp-use/inspector"))}catch(d){if(he(d))return{installed:!1};throw d}}function ve(e){if(typeof e.mountInspector!="function")throw new Error("The installed @mcp-use/inspector is incompatible: its package entry does not export mountInspector(). Update the development dependency.");return{installed:!0,module:e}}function he(e){let r=e!==null&&typeof e=="object"&&"code"in e?String(e.code):void 0;return r==="ERR_MODULE_NOT_FOUND"||r==="MODULE_NOT_FOUND"}function Ke(e){X(e)}function Xe(){for(let e of Object.values(Ae()))for(let r of e??[])if(!r.internal&&r.family==="IPv4")return r.address}function Ye(e){if(e!==void 0)try{return new URL(`http://${e}`).hostname.replace(/^\[|\]$/g,"")}catch{return}}function Ze(e){let r=e.getHeader("Vary"),s=typeof r=="string"?r:Array.isArray(r)?r.join(", "):r!==void 0?String(r):"";s.split(",").map(n=>n.trim().toLowerCase()).includes("origin")||e.setHeader("Vary",s===""?"Origin":`${s}, Origin`)}function Qe(e,r,s){if(s.tunnelActive){r.setHeader("Access-Control-Allow-Origin","*");return}if(!s.localhostBind)return;let n=e.headers.origin;if(n==="null"){r.setHeader("Access-Control-Allow-Origin","null");return}if(typeof n!="string"||n==="")return;let c=Je(n,qe());!c.ok||c.origin===void 0||(r.setHeader("Access-Control-Allow-Origin",c.origin),Ze(r))}function et(e){let r=e.default;if(r===null||typeof r!="object")throw new Error("The server entry must default-export the MCPServer instance (`export default server`) and never call listen() itself \u2014 `mcp-use dev` owns the socket.");let s=r;if(typeof s.fetch!="function")throw new Error("The entry's default export has no fetch() \u2014 it must be the MCPServer instance (`export default server`).");return s}async function tt(e){process.env.MCP_USE_DEV_CLI="1";let r=se(e.cwd),s=new We(t=>{console.error("[mcp-use] notification delivery failed:",t)});te(e.cwd,"development");let n=K(e.host),c=["127.0.0.1","localhost","::1"].includes(n),d=n==="0.0.0.0"||n==="::",l=Le(),{port:u,requested:g}=await fe(J(e.port),n);u!==g&&console.log(`[mcp-use] port ${g} is taken, using ${u}`),process.env.PORT=String(u);let y=process.env.MCP_URL===void 0&&(n==="127.0.0.1"||n==="localhost"||n==="::1")?`http://localhost:${u}`:void 0,D=e.mcpDir===void 0?e.cwd:xe(e.cwd,e.mcpDir),V=e.entry===void 0?L(D):L(e.cwd,e.entry),H=await Y(e.cwd,V);(H==="created"||H==="updated")&&console.log(`[mcp-use] ${H} mcp-env.d.ts`);let R=e.viewsDir??(e.mcpDir===void 0?void 0:Te(e.mcpDir,"views"));$e(ie(e.cwd,R))||console.log("[mcp-use] views directory not configured.");let p=T(e.cwd,R),P=p.length>0,ge=re(e.cwd),E=["127.0.0.1","localhost","0.0.0.0","::","::1"].includes(n)?"localhost":n,b=`http://${E.includes(":")?`[${E}]`:E}:${u}`,f=await Be({root:e.cwd,configFile:P?ge:!1,envDir:!1,logLevel:"warn",cacheDir:r.cache,resolve:{tsconfigPaths:!0,alias:{tailwindcss:oe()},dedupe:ce},optimizeDeps:le,oxc:{jsx:{runtime:"automatic"}},plugins:P?[A(e.cwd),Ve(),de({getViews:()=>p,dev:{reactRefresh:!0}}),Fe()]:[A(e.cwd)],server:{middlewareMode:!0,...P&&{origin:b},cors:!1,hmr:P?{server:l}:!1,...!P&&{ws:!1}},ssr:{...ee(e.cwd)}}),C=f.environments.ssr,I=Ne(C,{hmr:!1,sourcemapInterceptor:"node"}),F=async()=>{let t=async()=>{let a=await I.import(V),i=et(a),v=ae(p);if(typeof i.__primeViews!="function")throw new Error("Loaded MCPServer instance does not support __primeViews.");return i.__primeViews(v,{dev:!0,projectRoot:e.cwd}),i};if(y===void 0)return t();let o=process.env.MCP_URL;try{return process.env.MCP_URL=y,await t()}finally{o===void 0?delete process.env.MCP_URL:process.env.MCP_URL=o}},O,m;try{let t=await F();t.__setEventBus(s),t.__mount(),O=async o=>t.fetch(o),m=t.basePath??"/mcp"}catch(t){throw await I.close(),await f.close(),t}let U,M,B,N=t=>{if(U===void 0||B===t)return;let o=U.mountInspector({basePath:t,autoConnectUrl:`${b}${t}`,oauthProxyAllowLoopback:c||d,devMode:!0,manufactChatUrl:process.env.MANUFACT_CHAT_URL});if(typeof o!="function")throw new Error("The installed @mcp-use/inspector is incompatible: mountInspector() did not return a Fetch handler.");M=o,B=t};try{if(e.inspector!==!1){let t=await we(e.cwd);t.installed&&(U=t.module,N(m))}}catch(t){throw await I.close(),await f.close(),t}let j=!1,k=!1,W=()=>{if(j){k=!0;return}j=!0,(async()=>{do{k=!1;try{I.evaluatedModules.clear();let t=await F();t.__setEventBus(s),t.__mount();let o=async i=>t.fetch(i),a=t.basePath??"/mcp";N(a),O=o,m=a,s.publish({kind:"tools_list_changed"}),s.publish({kind:"prompts_list_changed"}),s.publish({kind:"resources_list_changed"}),console.log("[mcp-use] reloaded server entry")}catch(t){console.error(`[mcp-use] reload failed \u2014 keeping the previous server:
|
|
2
2
|
`,t)}}while(k);j=!1})()},$=t=>{if(x(t,e.cwd,R))return;let o=C.moduleGraph.getModulesByFile(t);if(!(o===void 0||o.size===0)){for(let a of o)C.moduleGraph.invalidateModule(a);W()}},Pe=t=>{if(!x(t,e.cwd,R))return;let o=p;p=T(e.cwd,R),(o.length!==p.length||o.some((i,v)=>i.name!==p[v]?.name||i.entryPath!==p[v]?.entryPath))&&W()},S=t=>{Pe(t),$(t)};f.watcher.on("change",$),f.watcher.on("add",S),f.watcher.on("unlink",S);let h=ne(r.tunnel);l.prependListener("upgrade",t=>{let o=h.status().url;if(o===null)return;let a=new URL(o).hostname;t.headers.host?.split(":")[0]===a&&(t.headers.host=`localhost:${u}`)});let ye=(t,o)=>{let a=h.status().url,i=a!==null?new URL(a).hostname:null,v=i!==null?[i]:[],w=ze(t.headers.host,[...Ge(),...v]);return w.ok?!1:(o.writeHead(403,{"content-type":"application/json"}),o.end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:w.message},id:null})),!0)},G=async()=>{f.watcher.off("change",$),f.watcher.off("add",S),f.watcher.off("unlink",S),await h.stop();let t=new Promise((o,a)=>{l.close(i=>{i!==void 0?a(i):o()})});l.closeAllConnections(),await I.close(),await f.close(),await t},Re=me({getBasePath:()=>m,port:u,tunnel:h},t=>M!==void 0&&Z(t,m)?M(t):O(t)),{toNodeHandler:be}=await import("../node-bridge-WOT2W5YZ.js"),q=be({fetch:Re}),Ie=(t,o)=>{if(c&&ye(t,o))return;let a=t.url??"/",i=new URL(a,"http://127.0.0.1").pathname,v=h.status().url,w=v===null?null:new URL(v).hostname,_=Ye(t.headers.host);if((w!==null&&_===w||d&&_!==void 0&&!["localhost","127.0.0.1","::1"].includes(_))&&Q(i,m)){o.writeHead(404,{"content-type":"text/plain; charset=utf-8"}),o.end("Not Found");return}let z=P&&p.length>0,Me=t.method==="GET"&&(i.startsWith("/@")||i.startsWith("/node_modules/")||i.startsWith("/.mcp-use/")||z&&i.startsWith("/views/"));z&&Me?(Qe(t,o,{tunnelActive:h.status().url!==null,localhostBind:c}),w!==null&&_===w&&(t.headers.host=`localhost:${u}`),f.middlewares(t,o,()=>{q(t,o)})):q(t,o)};if(l.on("request",Ie),await new Promise((t,o)=>{l.once("error",o),l.listen(u,n,()=>t())}),console.log("[mcp-use] dev server ready"),p.length>0&&console.log(` \u279C Views: ${p.map(t=>t.name).join(", ")}`),console.log(` \u279C MCP endpoint: ${b}${m}`),M!==void 0?console.log(` \u279C Inspector: ${b}${m}/inspector`):e.inspector!==!1&&console.warn("[mcp-use] Built-in Inspector is unavailable; reinstall mcp-use to restore visual testing."),n==="0.0.0.0"||n==="::"){let t=Xe();t!==void 0&&console.log(` \u279C Network: http://${t}:${u}${m}`)}if(c||console.warn(`[mcp-use] --host ${n} serves beyond this machine without Host validation or authentication \u2014 anyone with network access can call the MCP endpoint and dev routes.`),e.tunnel===!0)try{let{url:t}=await h.start(u);console.log(` \u279C Tunnel: ${t}${m}`)}catch(t){throw await G(),t}M!==void 0&&e.open!==!1&&process.stdout.isTTY===!0&&Ke(`${b}${m}/inspector`),await new Promise((t,o)=>{let a=!1,i=()=>{a||(a=!0,(async()=>{try{await G(),t()}catch(v){o(v)}finally{process.off("SIGINT",i),process.off("SIGTERM",i)}})())};process.on("SIGINT",i),process.on("SIGTERM",i),e.signal!==void 0&&(e.signal.aborted?i():e.signal.addEventListener("abort",i,{once:!0}))})}export{tt as runDev};
|
package/dist/commands/start.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
async function e(t){return(await import("../start-
|
|
1
|
+
async function e(t){return(await import("../start-PIY244P7.js")).runStart(t)}export{e as runStart};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-JAWUXU2E.js";import"./chunk-STQ3SGCH.js";export{a as main};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as E}from"./chunk-N7BU45K6.js";import{
|
|
1
|
+
import{a as E}from"./chunk-N7BU45K6.js";import{c as g,d as v}from"./chunk-STQ3SGCH.js";import{c as I}from"./chunk-7G4TXPP4.js";import{readFile as M}from"fs/promises";import{join as d}from"path";import{pathToFileURL as R}from"url";var k=".mcp-use",L="build",N="manifest.json";async function H(t){let o=d(t.cwd,k,L),s=d(o,N),c;try{c=await M(s,"utf8")}catch{throw new Error(`No production build found (missing ${s}).
|
|
2
2
|
Run \`mcp-use build\` first, then \`mcp-use start\`.`)}let a;try{let n=JSON.parse(c);if(typeof n.entryPoint!="string"||n.entryPoint==="")throw new Error("missing entryPoint");a=n.entryPoint}catch(n){let r=n instanceof Error?n.message:String(n);throw new Error(`Invalid build manifest at ${s} (${r}).
|
|
3
3
|
Re-run \`mcp-use build\`.`)}process.env.NODE_ENV??="production",I(t.cwd,"production");let i=d(o,a),u=await import(R(i).href);if(!("default"in u)||u.default===void 0)throw new Error(`The built entry (${i}) has no default export.
|
|
4
4
|
The server entry must \`export default\` its MCPServer instance (see the mcp-use entry contract).`);let e=u.default;if(!A(e))throw new Error(`The default export of ${i} is not an MCPServer: it has no listen() method. Export the MCPServer instance as the default export.`);let S=typeof e.port=="number"?e.port:void 0,U=typeof e.host=="string"?e.host:void 0,h=g(t.port,process.env,S),y=v(t.host,process.env,U),l=await(t.withInspector===!0?_(e,h,y):e.listen(h,{host:y})),m=typeof l?.port=="number"?l.port:h,b=typeof l?.url=="string"?l.url:`http://localhost:${m}`,p,w;if(t.tunnel===!0)try{let{createTunnelManager:n}=await import("./tunnel-FOJUZGIJ.js");p=n(d(t.cwd,k,"state","tunnel.json"));let r=await p.start(m),P=new URL(b);w=new URL(`${P.pathname}${P.search}`,`${r.url}/`).toString()}catch(n){try{await p?.stop()}catch{}try{await e.close?.()}catch{}throw n}return{port:m,url:b,...w!==void 0&&{tunnelUrl:w},close:async()=>{let n;try{await p?.stop()}catch(r){n=r}try{await e.close?.()}catch(r){n??=r}if(n!==void 0)throw n}}}async function _(t,o,s){let{mountInspector:c}=await x(),a=typeof t.basePath=="string"?t.basePath:"/mcp",i=c({basePath:a,devMode:!1,oauthProxyAllowLoopback:!1,manufactChatUrl:process.env.MANUFACT_CHAT_URL});return t.app.use("*",async(f,u)=>{if(E(f.req.raw,a))return i(f.req.raw);await u()}),t.listen(o,{host:s})}async function x(){let t;try{t=await import("@mcp-use/inspector")}catch(o){throw O(o)?new Error("Built-in Inspector is unavailable; reinstall mcp-use to restore it."):o}if(typeof t.mountInspector!="function")throw new Error("The installed @mcp-use/inspector is incompatible: its package entry does not export mountInspector(). Reinstall mcp-use.");return{mountInspector:t.mountInspector}}function A(t){return typeof t=="object"&&t!==null&&typeof t.listen=="function"}function O(t){return t!==null&&typeof t=="object"&&"code"in t&&(t.code==="ERR_MODULE_NOT_FOUND"||t.code==="MODULE_NOT_FOUND")}export{H as runStart};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-use/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.1-canary.
|
|
4
|
+
"version": "4.0.1-canary.2",
|
|
5
5
|
"description": "Prebuilt CLI, development server, and build pipeline for mcp-use",
|
|
6
6
|
"author": "mcp-use, Inc.",
|
|
7
7
|
"license": "MIT",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"vite": "^8.0.16"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@mcp-use/client": "^2.0.0",
|
|
48
|
+
"@mcp-use/client": "^2.0.1-canary.0",
|
|
49
49
|
"@mcp-use/inspector": "^20.0.1-canary.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependenciesMeta": {
|
package/dist/chunk-USIKTT3N.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var f="127.0.0.1";function u(n,e,t=process.env){if(n!==void 0)return n;let r=t.HOST?.trim();return r!==void 0&&r!==""?r:e??f}function a(n,e,t=process.env){if(n!==void 0)return n;let r=c(t.PORT);return r!==void 0?r:e??3e3}function c(n){if(n===void 0||n.trim()==="")return;let e=Number(n);return Number.isInteger(e)&&e>=0&&e<=65535?e:void 0}function m(n){let e={command:void 0,port:void 0,entry:void 0,path:void 0,mcpDir:void 0,viewsDir:void 0,host:void 0,tunnel:!1,open:!0,inspector:void 0,sourceMaps:!1,inline:!1,help:!1,version:!1,passthrough:[]};for(let t=0;t<n.length;t++){let r=n[t];if(r===void 0)continue;if(r==="--"){if(e.command!=="typecheck")throw new Error("TypeScript argument forwarding is only available for typecheck");e.passthrough=n.slice(t+1);break}let i=r,d;if(r.startsWith("--")){let s=r.indexOf("=");s!==-1&&(i=r.slice(0,s),d=r.slice(s+1))}let o=()=>{if(d!==void 0)return d;let s=n[++t];if(s===void 0||s.startsWith("-"))throw new Error(`Missing value for ${i}`);return s};switch(i){case"-h":case"--help":e.help=!0;break;case"-v":case"--version":e.version=!0;break;case"-p":case"--port":e.port=p(o());break;case"--entry":e.entry=o();break;case"--path":e.path=o();break;case"--mcp-dir":e.mcpDir=o();break;case"--views-dir":e.viewsDir=o();break;case"--host":e.host=o();break;case"--tunnel":e.tunnel=!0;break;case"--no-open":e.open=!1;break;case"--no-inspector":e.inspector=!1;break;case"--with-inspector":e.inspector=!0;break;case"--source-maps":e.sourceMaps=!0;break;case"--inline":e.inline=!0;break;default:if(i.startsWith("-"))throw new Error(`Unknown option: ${i}`);if(e.command!==void 0)throw new Error(`Unexpected argument: ${i}`);e.command=i}}return e}function h(n,e=process.env,t){return a(n,t,e)}function k(n,e=process.env,t){return u(n,t,e)}function p(n){let e=Number(n);if(!l(e))throw new Error(`Invalid port: ${n}`);return e}function l(n){return Number.isInteger(n)&&n>=0&&n<=65535}export{m as a,h as b,k as c};
|