@mcp-use/cli 4.0.0-beta.3 → 4.0.0-beta.5
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 +6 -4
- package/dist/chunk-ALPMVGHI.js +3 -0
- package/dist/chunk-DB3E6LBX.js +2 -0
- package/dist/chunk-USIKTT3N.js +1 -0
- package/dist/commands/build.js +5 -5
- package/dist/commands/client.js +1 -1
- package/dist/commands/deploy.js +1 -1
- package/dist/commands/deployments.js +1 -1
- package/dist/commands/dev.js +2 -2
- package/dist/commands/identity.js +1 -1
- package/dist/commands/organizations.js +1 -1
- package/dist/commands/screenshot.js +1 -1
- package/dist/commands/servers.js +1 -1
- package/dist/commands/skills.js +1 -1
- package/dist/commands/start.js +4 -4
- package/dist/commands/typecheck.js +1 -0
- package/dist/next-server-shims.js +1 -1
- package/dist/node-bridge-JJIA6K5P.js +1 -0
- package/package.json +6 -9
- package/dist/api-5C5J73XS.js +0 -23
- package/dist/build-BL3SCD2Q.js +0 -23
- package/dist/chunk-4Q7KWFEW.js +0 -65
- package/dist/chunk-4WKUTVLA.js +0 -1
- package/dist/chunk-7LRTFWC6.js +0 -205
- package/dist/chunk-AMCCKJH2.js +0 -1
- package/dist/chunk-HU2QUJ7M.js +0 -1
- package/dist/chunk-JAFV3QGS.js +0 -1
- package/dist/chunk-N7GIB7UG.js +0 -2
- package/dist/chunk-V2YAB5J5.js +0 -20
- package/dist/chunk-YAUVPOKC.js +0 -618
- package/dist/chunk-ZWRDP37E.js +0 -1
- package/dist/dist-ATUXZA3G.js +0 -1
- package/dist/dist-DSLOT2HN.js +0 -139
- package/dist/false-AWHO5BNV.js +0 -1
- package/dist/jiti-IZ2GHWFT.js +0 -1
- package/dist/lexer-DQCqS3nf-TWOGUR6Y.js +0 -3
- package/dist/main-25QSIQDF.js +0 -1
- package/dist/node-7FETFLWX.js +0 -1
- package/dist/node-bridge-P3XTCFXS.js +0 -1
- package/dist/postcss-YNTG32JE.js +0 -33
- package/dist/postcss-import-VHSC6LGV.js +0 -5
package/dist/bin.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as
|
|
2
|
+
import{a as s}from"./chunk-USIKTT3N.js";import{readFileSync as a}from"fs";import{resolve as i}from"path";var o=`mcp-use \u2014 run MCP servers built with mcp-use
|
|
3
3
|
|
|
4
4
|
Usage: mcp-use <command> [options]
|
|
5
5
|
|
|
6
6
|
Commands:
|
|
7
7
|
dev Start the dev server
|
|
8
8
|
build Build the server into .mcp-use/build
|
|
9
|
+
typecheck Refresh MCP types and run the project's TypeScript compiler
|
|
9
10
|
start Serve the production build from .mcp-use/build
|
|
10
11
|
login Authenticate the cloud CLI
|
|
11
12
|
logout Delete local cloud credentials
|
|
@@ -21,17 +22,18 @@ Commands:
|
|
|
21
22
|
Options:
|
|
22
23
|
-p, --port <n> Port to serve on (dev/start; default: $PORT or 3000)
|
|
23
24
|
--host <host> Host to bind (dev/start; default: $HOST or 127.0.0.1)
|
|
24
|
-
--entry <path> Server entry module (dev/build only)
|
|
25
|
+
--entry <path> Server entry module (dev/build/typecheck only)
|
|
25
26
|
--path <directory> Project root (default: current directory)
|
|
26
27
|
--mcp-dir <dir> Directory containing the MCP entry and views/
|
|
27
28
|
--views-dir <dir> Views directory (default: views/ or <mcp-dir>/views/)
|
|
28
29
|
--source-maps Emit source maps in build output (build only)
|
|
29
30
|
--inline Embed view JS and CSS in MCP resources (build only)
|
|
31
|
+
-- <tsc options> Forward remaining options to TypeScript (typecheck only)
|
|
30
32
|
--with-inspector Mount Inspector on the production listener (start only)
|
|
31
33
|
--tunnel Expose the dev server through a public tunnel (dev only)
|
|
32
34
|
--no-open Do not auto-open the inspector in a browser (dev only)
|
|
33
35
|
--no-inspector Start dev without loading the optional Inspector
|
|
34
36
|
-h, --help Show this help
|
|
35
|
-
-v, --version Print the version`;async function u(t){if(t.length===1&&["--version","-v"].includes(t[0]??""))return console.log(
|
|
37
|
+
-v, --version Print the version`;async function u(t){if(t.length===1&&["--version","-v"].includes(t[0]??""))return console.log(c()),0;if(t.some(e=>e==="--help"||e==="-h")){let e=t[0];if(e===void 0||e==="--help"||e==="-h")return console.log(o),0}let n=t[0];if(n==="login"||n==="logout"||n==="whoami"){let{runIdentity:e}=await import("./commands/identity.js");return e(n,t.slice(1))}if(n==="org"){let{runOrganizations:e}=await import("./commands/organizations.js");return e(t.slice(1))}if(n==="servers"){let{runServers:e}=await import("./commands/servers.js");return e(t.slice(1))}if(n==="deployments"){let{runDeployments:e}=await import("./commands/deployments.js");return e(t.slice(1))}if(n==="deploy"){let{runDeploy:e}=await import("./commands/deploy.js");return e(t.slice(1))}if(n==="client"){let{runClient:e}=await import("./commands/client.js");return e(t.slice(1))}if(n==="skills"){let{runSkills:e}=await import("./commands/skills.js");return e(t.slice(1))}if(n==="screenshot"){let{runScreenshot:e}=await import("./commands/screenshot.js");return e(t.slice(1))}let r;try{r=s(t)}catch(e){return console.error(e instanceof Error?e.message:String(e)),2}if(r.version)return console.log(c()),0;if(r.help)return console.log(o),0;switch(r.command){case"start":return p(r);case"dev":case"build":return d(r.command,r);case"typecheck":return l(r);case void 0:return console.error(o),2;default:return console.error(`Unknown command: ${r.command}
|
|
36
38
|
|
|
37
|
-
${
|
|
39
|
+
${o}`),2}}async function l(t){try{let{runTypecheck:n}=await import("./commands/typecheck.js");return await n({cwd:i(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(n){return console.error(n instanceof Error?n.message:String(n)),1}}async function p(t){let n;try{let{runStart:e}=await import("./commands/start.js");n=await e({cwd:i(process.cwd(),t.path??"."),port:t.port,host:t.host,...t.inspector===!0&&{withInspector:!0}})}catch(e){return console.error(e instanceof Error?e.message:String(e)),1}console.log(`mcp-use server running at ${n.url}`);let r=()=>{n.close().then(()=>process.exit(0),e=>{console.error(e instanceof Error?e.message:String(e)),process.exit(1)})};return process.once("SIGINT",r),process.once("SIGTERM",r),0}async function d(t,n){let r={cwd:i(process.cwd(),n.path??"."),...n.entry!==void 0&&{entry:n.entry},...n.mcpDir!==void 0&&{mcpDir:n.mcpDir},...n.viewsDir!==void 0&&{viewsDir:n.viewsDir},...n.port!==void 0&&{port:n.port},...n.host!==void 0&&{host:n.host},...n.tunnel&&{tunnel:!0},...!n.open&&{open:!1},...n.inspector===!1&&{inspector:!1},...n.sourceMaps&&{sourceMaps:!0},...n.inline&&{inline:!0}};try{if(t==="dev"){let{runDev:e}=await import("./commands/dev.js");await e(r)}else{let{runBuild:e}=await import("./commands/build.js");await e(r)}return 0}catch(e){return console.error(e instanceof Error?e.message:String(e)),1}}function c(){return"2.0.0-beta.28"}u(process.argv.slice(2)).then(t=>{process.exitCode=t},t=>{console.error(t instanceof Error?t.message:String(t)),process.exitCode=1});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as p,b as f,d as l}from"./chunk-7G4TXPP4.js";import{existsSync as v}from"fs";import{join as w}from"path";import{fileURLToPath as V}from"url";var h=["vite.config.ts","vite.config.js","vite.config.mts","vite.config.cjs"];function W(t){for(let e of h){let r=w(t,e);if(v(r))return r}return!1}function b(){return V(import.meta.resolve("tailwindcss/index.css"))}import{join as s}from"path";var I=".mcp-use",x="manifest.json";function U(t){let e=s(t,I),r=s(e,"build");return{projectRoot:t,workspace:e,build:r,generated:s(e,"generated"),cache:s(e,"cache"),state:s(e,"state"),cloud:s(e,"cloud"),buildManifest:s(r,x),tunnel:s(e,"state","tunnel.json")}}import{existsSync as m,readdirSync as D}from"fs";import{isAbsolute as _,join as y,resolve as E}from"path";var P="views",a="virtual:mcp-use/views/",c=`\0${a}`;function d(t,e){let r=e??P;return _(r)?r:E(t,r)}function C(t,e){let r=d(t,e);if(!m(r))return[];let n=[];for(let i of D(r,{withFileTypes:!0})){if(!i.isDirectory())continue;let o=y(r,i.name,"view.tsx");m(o)&&n.push({name:i.name,entryPath:o})}return n.sort((i,o)=>i.name.localeCompare(o.name)),n}function R(t){return`${a}${t}`}function S(t){return`/@id/__x00__${a}${t}`}function F(t,e,r){let n=d(e,r);return t===n||t.startsWith(`${n}/`)}function B(t){let e={};for(let r of t)e[r.name]={kind:"external",entry:S(r.name),css:[],scripts:["/@vite/client"]};return e}async function X(t,e,r){let{createServer:n}=await import("vite");return n({root:t,configFile:r,envDir:!1,logLevel:"warn",cacheDir:e,resolve:{tsconfigPaths:!0,alias:p(t)},plugins:[l(t)],server:{middlewareMode:!0,hmr:!1},ssr:{...f(t)}})}var u="virtual:mcp-use/tailwind.css",g=`\0${u}`;function K(t){return{name:"mcp-use-views",applyToEnvironment(e){return e.name==="client"},resolveId(e){if(e===u)return g;if(e.startsWith(a))return`\0${e}`},load(e){if(e===g)return['@import "tailwindcss";',"@custom-variant dark (&:where(.dark, .dark *, [data-theme=dark], [data-theme=dark] *));"].join(`
|
|
2
|
+
`);if(!e.startsWith(c))return;let r=e.slice(c.length),n=t.getViews().find(o=>o.name===r);if(n===void 0)return;let i=[];return t.dev?.reactRefresh===!0&&i.push('import "@vitejs/plugin-react/preamble";'),i.push(`import ${JSON.stringify(u)};`),i.push('import { bootstrapView } from "mcp-use/react";',`import * as viewModule from ${JSON.stringify(n.entryPath)};`,"bootstrapView(viewModule);"),t.dev!==void 0&&i.push("if (import.meta.hot) {"," import.meta.hot.accept();","}"),i.push(""),i.join(`
|
|
3
|
+
`)}}}export{W as a,b,U as c,C as d,R as e,F as f,B as g,X as h,K as i};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{existsSync as s}from"fs";import{isAbsolute as p,join as f,resolve as d}from"path";var i=["src/index.ts","src/index.tsx","src/server.ts","src/server.tsx","index.ts","index.tsx","server.ts","server.tsx"];function j(t,e){if(e!==void 0){let n=p(e)?e:d(t,e);if(!s(n))throw new Error(`Entry not found: ${n} (from --entry "${e}")`);return n}for(let n of i){let r=f(t,n);if(s(r))return r}throw new Error(`No server entry found in ${t}. Looked for: ${i.join(", ")}. Create one of these (default-exporting your MCPServer instance) or pass --entry <path>.`)}import{readFile as l,writeFile as a}from"fs/promises";import{extname as E,join as m,relative as g,sep as x}from"path";var h="mcp-env.d.ts",u="// Generated by mcp-use. Do not edit.",y=["// mcp-use generated env declaration","// mcp-use auto-generated typing"];function A(t,e){let n=g(t,e).split(x).join("/"),r=E(n),o=r===".mts"?".mjs":r===".cts"?".cjs":r===".ts"||r===".tsx"?".js":r;return r!==o&&(n=`${n.slice(0,-r.length)}${o}`),n.startsWith(".")?n:`./${n}`}function D(t,e){let n=A(t,e);return[u,'declare module "*.css";',"",'declare module "mcp-use/react" {'," interface Register {",` tools: typeof import(${JSON.stringify(n)});`," }","}","","export {};",""].join(`
|
|
2
|
+
`)}async function N(t,e){let n=m(t,h),r=D(t,e);try{let o=await l(n,"utf8");return o===r?"unchanged":v(o)?(await a(n,r,"utf8"),"updated"):"user-owned"}catch(o){if(!c(o,"ENOENT"))throw o}try{return await a(n,r,{encoding:"utf8",flag:"wx"}),"created"}catch(o){if(!c(o,"EEXIST"))throw o;return N(t,e)}}function v(t){return[u,...y].some(e=>t.startsWith(e))}function c(t,e){return t!==null&&typeof t=="object"&&"code"in t&&t.code===e}export{j as a,N as b};
|
|
@@ -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")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};
|
package/dist/commands/build.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
`)),n}function
|
|
3
|
-
`)}}return{kind:"external",entry:
|
|
4
|
-
`);let
|
|
5
|
-
`);let
|
|
1
|
+
import{a as U,b as V,c as P,d as C,e as L,h as N,i as j}from"../chunk-ALPMVGHI.js";import{a as x,b as R,c as B,d as S}from"../chunk-7G4TXPP4.js";import{a as $,b as _}from"../chunk-DB3E6LBX.js";import{randomBytes as H}from"crypto";import{existsSync as Z}from"fs";import{cp as ee,mkdir as v,rm as te,writeFile as E}from"fs/promises";import{join as f,relative as w,resolve as re}from"path";import ne from"@tailwindcss/vite";import ie from"@vitejs/plugin-react";import{build as D}from"vite";import{createServerModuleRunner as O}from"vite";var K="/mcp",Q="http://localhost:3000";async function F(e,t){let i=O(e,{hmr:!1,sourcemapInterceptor:"node"}),n=process.env.MCP_URL;try{n===void 0&&(process.env.MCP_URL=Q);let r=(await i.import(t)).default;if(r===null||typeof r!="object")throw new Error("The server entry must default-export the MCPServer instance.");return r.basePath??K}finally{n===void 0?delete process.env.MCP_URL:process.env.MCP_URL=n,await i.close()}}async function T(e,t,i){let n=O(e,{hmr:!1,sourcemapInterceptor:"node"});try{let r=(await n.import(t)).default;if(r===null||typeof r!="object")throw new Error("The server entry must default-export the MCPServer instance.");if(typeof r.__primeViews!="function")throw new Error("The entry's default export does not support __primeViews.");r.__primeViews(i),r.__mount()}finally{await n.close()}}function X(e){return e.replace(/\/+$/,"")}function k(e){return X(e)}import{hostHeaderValidationResponse as we,originValidationResponse as he}from"@modelcontextprotocol/server";function I(e,t){let i=t.replace(/^\/+/,"");return e==="/"?`/${i}`:`${e}/${i}`}function q(e,t){return`${I(e,`_mcp-use/views/${t}`)}/`}var p="index.js",se="entry-wrapper.ts",oe=100*1024*1024;async function W(e,t){let i=f(e,"public");Z(i)&&await ee(i,t,{recursive:!0})}async function ae(e,t,i){let n=f(e,se);await v(e,{recursive:!0});let s=JSON.stringify(i);return await E(n,[`import server from ${JSON.stringify(t)};`,'import { registerViews } from "mcp-use";',`server[registerViews](${s});`,"export default server;",""].join(`
|
|
2
|
+
`)),n}function ce(){let e=process.env.MCP_ASSETS_URL;if(!(e===void 0||e.trim()===""))try{return k(new URL(e).href.replace(/\/$/,""))}catch{return}}function A(e,t,i,n){let s=e.replace(/^\/+/,"");return`${i}${q(n,t)}${s}`}function ue(e,t,i,n){return e.kind!=="external"?e:{...e,entry:A(e.entry,t,i,n),css:e.css.map(s=>A(s,t,i,n)),...e.scripts!==void 0&&{scripts:e.scripts.map(s=>A(s,t,i,n))}}}async function le(e,t){let i=f(t.viewsOutDir,e.name),n=await D({root:t.cwd,configFile:t.userViteConfig,envDir:!1,publicDir:!1,logLevel:"warn",cacheDir:t.cacheDir,resolve:{tsconfigPaths:!0,alias:{tailwindcss:V()}},plugins:[ne(),ie(),j({getViews:()=>[e]})],build:{outDir:i,emptyOutDir:!0,write:!t.inline,target:"es2022",sourcemap:t.inline?!1:t.sourceMaps,minify:!0,cssCodeSplit:!1,chunkSizeWarningLimit:1e3,assetsInlineLimit:oe,rollupOptions:{input:{[e.name]:L(e.name)},output:{format:"es",codeSplitting:!t.inline,entryFileNames:"assets/[name]-[hash].js",chunkFileNames:"assets/[name]-[hash].js",assetFileNames:"assets/[name]-[hash][extname]"}}},base:"./"}),s=Array.isArray(n)?n[0]:n;if(s===void 0||!("output"in s))throw new Error(`Client build for view "${e.name}" produced no output.`);let r=s.output,b=Array.isArray(r)?r:Object.values(r),c,m,u,l=[];for(let a of b){if(typeof a!="object"||a===null||!("fileName"in a)||typeof a.fileName!="string")continue;let o=a;o.type==="chunk"&&o.isEntry===!0?(c=o.fileName,u=o.code):o.type==="asset"&&o.fileName.endsWith(".css")&&(m=o.fileName,typeof o.source=="string"?l.push(o.source):o.source instanceof Uint8Array&&l.push(new TextDecoder().decode(o.source)))}if(c===void 0)throw new Error(`Client build produced no entry chunk for view "${e.name}".`);if(t.inline){if(u===void 0)throw new Error(`Client build produced no entry source for view "${e.name}".`);return{kind:"inline",js:u,css:l.join(`
|
|
3
|
+
`)}}return{kind:"external",entry:c.replace(/^\/+/,""),css:m!==void 0?[m.replace(/^\/+/,"")]:[]}}async function de(e){let t=performance.now();B(e.cwd,"production");let i=e.mcpDir===void 0?e.cwd:re(e.cwd,e.mcpDir),n=e.entry===void 0?$(i):$(e.cwd,e.entry),s=await _(e.cwd,n);(s==="created"||s==="updated")&&console.log(`[mcp-use] ${s} mcp-env.d.ts`);let r=P(e.cwd),b=e.viewsDir??(e.mcpDir===void 0?void 0:f(e.mcpDir,"views")),c=C(e.cwd,b),m=U(e.cwd),u=e.sourceMaps===!0,l=e.inline===!0;if(c.length===0){await D({root:e.cwd,configFile:!1,envDir:!1,publicDir:!1,logLevel:"warn",cacheDir:r.cache,resolve:{tsconfigPaths:!0,alias:x(e.cwd)},plugins:[S(e.cwd)],build:{ssr:n,outDir:r.build,emptyOutDir:!0,target:"node22",sourcemap:u,minify:!1,rollupOptions:{output:{format:"es",entryFileNames:p}}},ssr:{...R(e.cwd),target:"node"}}),await W(e.cwd,f(r.build,"views/public"));let d={buildId:H(8).toString("hex"),entryPoint:p,createdAt:new Date().toISOString(),views:{}};await v(r.build,{recursive:!0}),await E(r.buildManifest,`${JSON.stringify(d,null,2)}
|
|
4
|
+
`);let g=Math.round(performance.now()-t);console.log(`[mcp-use] built ${w(e.cwd,n)} \u2192 ${w(e.cwd,r.build)}/${p} (${g}ms)`);return}await te(r.build,{recursive:!0,force:!0});let a=f(r.build,"views");await v(a,{recursive:!0});let h=await N(e.cwd,r.cache,!1),o,y={},M=ce();try{o=await F(h.environments.ssr,n);for(let d of c){let g=await le(d,{cwd:e.cwd,cacheDir:r.cache,viewsOutDir:a,userViteConfig:m,sourceMaps:u,inline:l});M!==void 0&&!l&&(g=ue(g,d.name,M,o)),y[d.name]=g}M!==void 0&&!l&&(console.log(`[mcp-use] MCP_ASSETS_URL set \u2014 manifest uses CDN URLs; upload ${w(e.cwd,a)}/ to your asset host.`),o!=="/mcp"&&console.log(`[mcp-use] CDN manifest uses basePath ${o} from server entry`)),await W(e.cwd,f(a,"public")),await T(h.environments.ssr,n,y)}finally{await h.close()}let J=await ae(r.cache,n,y);await D({root:e.cwd,configFile:!1,envDir:!1,publicDir:!1,logLevel:"warn",cacheDir:r.cache,resolve:{tsconfigPaths:!0,alias:x(e.cwd)},plugins:[S(e.cwd)],build:{ssr:J,outDir:r.build,emptyOutDir:!1,target:"node22",sourcemap:u,minify:!1,rollupOptions:{output:{format:"es",entryFileNames:p}}},ssr:{...R(e.cwd),target:"node"}});let z={buildId:H(8).toString("hex"),entryPoint:p,createdAt:new Date().toISOString(),views:y};await v(r.build,{recursive:!0}),await E(r.buildManifest,`${JSON.stringify(z,null,2)}
|
|
5
|
+
`);let Y=Math.round(performance.now()-t),G=c.map(d=>d.name).join(", ");console.log(`[mcp-use] built ${w(e.cwd,n)} + views (${G}) \u2192 ${w(e.cwd,r.build)}/${p} (${Y}ms)`)}export{de as runBuild};
|
package/dist/commands/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d}from"../chunk-N6R74JIF.js";import"../chunk-LHNHT6HO.js";
|
|
1
|
+
import{a,b,c,d}from"../chunk-N6R74JIF.js";import"../chunk-LHNHT6HO.js";export{c as openDirectConnection,b as openSavedConnection,d as parseMcpArguments,a as runClient};
|
package/dist/commands/deploy.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as O}from"../chunk-ZELLSKD2.js";import{a as c,b as d,c as k,d as R,e as _,f as E,g as U,h as j,i as A,j as L}from"../chunk-LHNHT6HO.js";import
|
|
1
|
+
import{g as O}from"../chunk-ZELLSKD2.js";import{a as c,b as d,c as k,d as R,e as _,f as E,g as U,h as j,i as A,j as L}from"../chunk-LHNHT6HO.js";import{execFile as N}from"child_process";import{readFile as D}from"fs/promises";import{basename as J,isAbsolute as S,join as F,relative as H,resolve as v}from"path";import{promisify as G,parseArgs as M}from"util";var W=G(N);async function nt(n){let e=k(n);try{let{values:t,positionals:o}=M({args:[...n],allowPositionals:!0,strict:!0,options:{org:{type:"string"},name:{type:"string"},branch:{type:"string"},"root-dir":{type:"string"},region:{type:"string"},env:{type:"string",multiple:!0},"env-file":{type:"string"},"build-command":{type:"string"},"start-command":{type:"string"},dockerfile:{type:"string"},new:{type:"boolean"},open:{type:"boolean"},yes:{type:"boolean"},json:{type:"boolean"}}});if(o.length>1)throw new c("Usage: mcp-use deploy [path] [options]");let r=v(o[0]??process.cwd()),a=await b(r,["rev-parse","--show-toplevel"]),i=await b(a,["remote","get-url","origin"]),s=B(i),g=t.branch??await b(a,["branch","--show-current"]);if(g==="")throw new d("detached_head","Cannot infer a branch from detached HEAD; pass --branch.");z(a,t["root-dir"],"--root-dir"),z(a,t.dockerfile,"--dockerfile");let{api:l,organizationId:f}=await O(t.org),I=F(r,".mcp-use","cloud","link.json"),p=await A(I,null),q=t.new===!0||p===null;if(t.new===!0&&!await E("Create a new cloud server for this project?",{yes:t.yes===!0,json:e}))return 0;let u,w,h;if(!q&&p!==null){if(p.organizationId!==f)throw new d("organization_mismatch","The linked server belongs to another organization. Pass --new to create one.");u=p.serverId,w=p.serverSlug,h=(await l.request("/deployments",{method:"POST",body:JSON.stringify({serverId:u,branch:g,trigger:"manual"})})).id}else{let y=await l.request(`/github/installations?organizationId=${encodeURIComponent(f)}`),$=await K(l,y.installations,s);if($===void 0)throw new d("github_access_required",`The mcp-use GitHub App cannot access ${s}. Configure repository access in the cloud dashboard and retry.`);let P=await Q(r,t["env-file"],t.env??[]),m=await l.request("/servers",{method:"POST",body:JSON.stringify({type:"github",organizationId:f,installationId:$.installationId,name:t.name??J(s),repoFullName:s,branch:g,...t["root-dir"]!==void 0?{rootDir:t["root-dir"]}:{},...t.region!==void 0?{region:t.region}:{},...t["build-command"]!==void 0?{buildCommand:t["build-command"]}:{},...t["start-command"]!==void 0?{startCommand:t["start-command"]}:{},...t.dockerfile!==void 0?{dockerfilePath:t.dockerfile}:{},...Object.keys(P).length>0?{env:P}:{}})});if(m.deploymentId===null)throw new d("deployment_not_created","Server was created but no deployment was started.",{serverId:m.server.id});u=m.server.id,w=m.server.slug,h=m.deploymentId,await L(I,{organizationId:f,serverId:u,serverSlug:w,repository:s})}let C=`${process.env.MCP_USE_CLOUD_WEB_URL??"https://manufact.com"}/${encodeURIComponent(w??u)}`,x={serverId:u,deploymentId:h,status:"pending",webUrl:C};return t.open===!0&&U(C),R(x,e,`Deployment ${h} started for ${s}.`),0}catch(t){return _(t instanceof TypeError?new c(t.message):t,e)}}async function b(n,e){try{let{stdout:t}=await W("git",e,{cwd:n});return t.trim()}catch{throw new d("git_required",`Could not run git ${e.join(" ")} in ${n}.`)}}function B(n){let e=n.match(/github\.com[/:]([^/\s]+)\/([^/\s]+?)(?:\.git)?$/);if(e?.[1]===void 0||e[2]===void 0)throw new d("unsupported_remote","The origin remote must be a GitHub repository.");return`${e[1]}/${e[2]}`}async function K(n,e,t){let[o,r]=t.split("/"),a=[...e].sort((i,s)=>{let g=i.account?.login?.toLowerCase()===o.toLowerCase(),l=s.account?.login?.toLowerCase()===o.toLowerCase();return Number(l)-Number(g)});for(let i of a)try{if((await n.request(`/github/installations/${encodeURIComponent(i.installationId)}/repos/${encodeURIComponent(o)}/${encodeURIComponent(r)}/access`)).hasAccess)return i}catch{}}function z(n,e,t){if(e===void 0)return;if(S(e))throw new c(`${t} must be repository-relative.`);let o=v(n,e),r=H(n,o);if(r.startsWith("..")||S(r))throw new c(`${t} must not escape the repository.`)}async function Q(n,e,t){let o={};if(e!==void 0){let r=v(n,e);if(!await j(r))throw new c(`Environment file not found: ${e}`);for(let a of(await D(r,"utf8")).split(/\r?\n/)){let i=a.trim();i===""||i.startsWith("#")||T(o,i)}}for(let r of t)T(o,r);return o}function T(n,e){let t=e.indexOf("=");if(t<=0)throw new c(`Invalid environment value: ${e}`);n[e.slice(0,t)]=e.slice(t+1)}export{nt as runDeploy};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as d}from"../chunk-ZELLSKD2.js";import{a,c as m,d as u,e as g,f as y}from"../chunk-LHNHT6HO.js";import
|
|
1
|
+
import{g as d}from"../chunk-ZELLSKD2.js";import{a,c as m,d as u,e as g,f as y}from"../chunk-LHNHT6HO.js";import{parseArgs as w}from"util";async function T(n){let t=m(n);try{let e=n[0];if(e==="list")return await I(n.slice(1),t);if(e==="get")return await P(n.slice(1),t);if(e==="logs")return await S(n.slice(1),t);if(e==="restart")return await v(n.slice(1),t);if(e==="stop")return await R(n.slice(1),t);if(e==="delete")return await E(n.slice(1),t);throw new a("Usage: mcp-use deployments <list|get|logs|restart|stop|delete>")}catch(e){return g(e instanceof TypeError?new a(e.message):e,t)}}async function I(n,t){let{values:e}=w({args:[...n],allowPositionals:!1,strict:!0,options:{org:{type:"string"},server:{type:"string"},limit:{type:"string",default:"30"},skip:{type:"string",default:"0"},json:{type:"boolean"}}}),i=f(e.limit,"--limit",1,100),s=f(e.skip,"--skip",0),o=new URLSearchParams({limit:String(i),skip:String(s),...e.server!==void 0?{serverId:e.server}:{}}),{api:r}=await d(e.org),l=await r.request(`/deployments?${o}`);return u(l,t),0}async function P(n,t){let{positionals:e}=p(n,{json:{type:"boolean"}}),i=c(e,"mcp-use deployments get <deployment-id>"),{api:s}=await d(),o=await s.request(`/deployments/${encodeURIComponent(i)}`);return u(o,t),0}async function S(n,t){let{values:e,positionals:i}=p(n,{build:{type:"boolean"},follow:{type:"boolean"},json:{type:"boolean"}}),s=c(i,"mcp-use deployments logs <deployment-id>"),{api:o}=await d();if(e.build===!0)await $(o,s,e.follow===!0,t);else{let r=await o.request(`/deployments/${encodeURIComponent(s)}/logs?lines=500`);t?u({deploymentId:s,logs:r.logs},!0):process.stdout.write(r.logs.endsWith(`
|
|
2
2
|
`)?r.logs:`${r.logs}
|
|
3
3
|
`)}return 0}async function v(n,t){let{values:e,positionals:i}=p(n,{branch:{type:"string"},follow:{type:"boolean"},json:{type:"boolean"}}),s=c(i,"mcp-use deployments restart <deployment-id>"),{api:o}=await d(),r=await o.request(`/deployments/${encodeURIComponent(s)}`);if(r.serverId===void 0||r.serverId===null)throw new a(`Deployment ${s} is not attached to a server.`);let l=await o.request("/deployments",{method:"POST",body:JSON.stringify({serverId:r.serverId,branch:e.branch??r.gitBranch??void 0,trigger:"redeploy"})});return e.follow===!0?await $(o,l.id,!0,t):u(l,t,`Restarted as deployment ${l.id}.`),0}async function R(n,t){return b(n,t,"stop")}async function E(n,t){return b(n,t,"delete")}async function b(n,t,e){let{values:i,positionals:s}=p(n,{yes:{type:"boolean"},json:{type:"boolean"}}),o=c(s,`mcp-use deployments ${e} <deployment-id>`);if(!await y(`${e==="stop"?"Stop":"Delete"} deployment ${o}?`,{yes:i.yes===!0,json:t}))return 0;let{api:r}=await d();return await r.request(`/deployments/${encodeURIComponent(o)}${e==="stop"?"/stop":""}`,{method:e==="stop"?"POST":"DELETE"}),u({[e==="stop"?"stopped":"deleted"]:o},t,`${e==="stop"?"Stopped":"Deleted"} ${o}.`),0}async function $(n,t,e,i){let s=0,o=new Set(["running","failed","stopped"]),r=!0;for(;r;){let l=await n.request(`/deployments/${encodeURIComponent(t)}/build-logs?offset=${s}`);l.logs!==""&&(i?process.stdout.write(`${JSON.stringify({deploymentId:t,offset:s,logs:l.logs,status:l.status})}
|
|
4
4
|
`):process.stdout.write(l.logs.endsWith(`
|
package/dist/commands/dev.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as Z,b as ee}from"../chunk-N7BU45K6.js";import{b as Y,c as Q}from"../chunk-JAFV3QGS.js";import{a as se,b as ie,c as W,d as ae,e as ce,f as le,g as ue,h as G,j as z,k as de,m as pe}from"../chunk-7LRTFWC6.js";import"../chunk-HU2QUJ7M.js";import{H as oe,v as re}from"../chunk-YAUVPOKC.js";import"../chunk-N7GIB7UG.js";import"../chunk-V2YAB5J5.js";import"../chunk-AMCCKJH2.js";import{b as ne,c as te,d as B}from"../chunk-7G4TXPP4.js";import"../chunk-ZWRDP37E.js";import{spawn as We}from"child_process";import{createServer as Ge}from"http";import{networkInterfaces as ze}from"os";import{join as qe,resolve as Je}from"path";import{InMemoryServerEventBus as Ke,localhostAllowedHostnames as Xe,localhostAllowedOrigins as Ye,validateHostHeader as Qe,validateOriginHeader as Ze}from"@modelcontextprotocol/server";import{connect as ke,createServer as Te}from"net";var fe=100,_e=300,Ee=new Set(["127.0.0.1","localhost","::1"]);function He(e,r){return new Promise(o=>{let t=Te();t.unref(),t.once("error",()=>o(!1)),t.listen({port:e,host:r},()=>{t.close(()=>o(!0))})})}function me(e,r){return new Promise(o=>{let t=ke({port:e,host:r});t.setTimeout(_e),t.once("connect",()=>{t.destroy(),o(!0)}),t.once("timeout",()=>{t.destroy(),o(!1)}),t.once("error",()=>{t.destroy(),o(!1)})})}async function $e(e){return await me(e,"127.0.0.1")||await me(e,"::1")}async function we(e,r){for(let o=e;o<e+fe;o++)if(await He(o,r)&&!(Ee.has(r)&&await $e(o)))return{port:o,requested:e};throw new Error(`No free port found between ${e} and ${e+fe-1} on ${r}.`)}function he(e,r){let o=()=>{let t=e.getBasePath(),{url:a}=e.tunnel.status();return{mcpUrl:a!==null?`${a.replace(/\/+$/,"")}${t}`:null,port:e.port,fromCli:!0,tunnelUrl:a}};return async t=>{let a=e.getBasePath(),u=`${a}/inspector/api/dev/info`,d=`${a}/inspector/api/dev/start-tunnel`,p=`${a}/inspector/api/dev/stop-tunnel`,T=new URL(t.url).pathname;if(t.method==="GET"&&T===u)return Response.json(o());if(t.method==="POST"&&T===d)try{return await e.tunnel.start(e.port),Response.json({ok:!0,restarting:!1})}catch(E){let H=E instanceof Error?E.message:"Failed to start tunnel";return Response.json({error:H},{status:500})}return t.method==="POST"&&T===p?(await e.tunnel.stop(),Response.json({ok:!0})):r(t)}}import{readFileSync as De}from"fs";import{createRequire as Oe}from"module";import{join as xe}from"path";import{pathToFileURL as Ae}from"url";async function Pe(e){let r=xe(e,"package.json"),o=JSON.parse(De(r,"utf8"));if([o.dependencies,o.devDependencies,o.optionalDependencies].some(u=>u!==null&&typeof u=="object"&&"@mcp-use/inspector"in u)){let u=Oe(r);try{let d=u.resolve("@mcp-use/inspector");return ge(await import(Ae(d).href))}catch(d){if(!ve(d))throw d}}try{return ge(await import("@mcp-use/inspector"))}catch(u){if(ve(u))return{installed:!1};throw u}}function ge(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 ve(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"}import{mkdir as Ce,readFile as Ue,writeFile as Le}from"fs/promises";import{spawn as Fe}from"child_process";import{dirname as je}from"path";var Ne="https://local.mcp-use.run";function Ve(){return process.env.MCP_USE_TUNNEL_API??Ne}var q=1e3,Be=3e4;function ye(e){let r,o=null,t,a,u=!1,d,p=q,T=c=>new Promise(i=>{setTimeout(i,c)}),E=()=>{r!==void 0&&"markShutdown"in r&&typeof r.markShutdown=="function"&&r.markShutdown()},H=async c=>{try{await fetch(`${Ve()}/api/tunnels/${c}`,{method:"DELETE",signal:AbortSignal.timeout(2e3)})}catch{}},O=async()=>{try{let c=await Ue(e,"utf8"),i=JSON.parse(c);return typeof i.subdomain=="string"?i.subdomain:void 0}catch{return}},$=async c=>{try{await Ce(je(e),{recursive:!0}),await Le(e,JSON.stringify({subdomain:c},null,2),"utf8")}catch(i){console.warn(`[mcp-use] failed to save tunnel subdomain: ${i instanceof Error?i.message:String(i)}`)}},w=()=>{},M=(c,i)=>new Promise((f,b)=>{console.log(`[mcp-use] starting tunnel for port ${c}\u2026`);let g=process.env.npm_config_user_agent??"",[x,_]=g.startsWith("pnpm/")?["pnpm",["--silent","dlx","@mcp-use/tunnel",String(c)]]:g.startsWith("bun/")?["bunx",["@mcp-use/tunnel",String(c)]]:["npx",["--yes","--prefer-offline","@mcp-use/tunnel",String(c)]];i!==void 0&&_.push("--subdomain",i);let S=Fe(x,_,{stdio:["ignore","pipe","pipe"],shell:process.platform==="win32"}),I=!1,h=!1,A=()=>{h=!0};S.markShutdown=A,S.stdout.on("data",P=>{let v=P.toString(),C=v.includes("Shutting down")||v.includes("\u{1F6D1}"),U=v.includes("\u2716")||v.includes("Error:");!h&&!C&&!U&&process.stdout.write(v);let D=v.match(/https?:\/\/([a-z0-9-]+\.[a-z0-9.-]+)/i);if(D!==null&&!I){let L=D[0],N=D[1]??"",y=N.match(/^([a-z0-9-]+)\./i)?.[1]??N.split(".")[0]??"";/^[a-z0-9-]+$/i.test(y)||(console.warn(`[mcp-use] warning: extracted subdomain "${y}" does not match expected format`),y=""),I=!0,clearTimeout(R),f({url:L,subdomain:y,process:S})}}),S.stderr.on("data",P=>{let v=P.toString();!h&&!v.includes("INFO")&&!v.includes("bore_cli")&&!v.includes("Shutting down")&&!/npm warn Unknown (?:env|project|user|builtin) config/.test(v)&&process.stderr.write(P)}),S.on("error",P=>{I||(clearTimeout(R),b(new Error(`Failed to start tunnel: ${P.message}`)))}),S.on("exit",P=>{P!==0&&P!==null&&!I&&(clearTimeout(R),b(new Error(`Tunnel process exited with code ${P}`))),r===S&&(r=void 0,o=null,u?t=void 0:w())});let R=setTimeout(()=>{I||(S.kill(),b(new Error("Tunnel setup timed out")))},3e4)});return w=()=>{u||a===void 0||o!==null||d===void 0&&(d=(async()=>{for(;!u&&a!==void 0&&o===null;){console.log("[mcp-use] tunnel disconnected, restarting\u2026");let c=t??await O();try{c!==void 0&&await H(c);let i;try{i=await M(a,c)}catch(f){if(c!==void 0)console.log(`[mcp-use] subdomain "${c}" unavailable, requesting a new one\u2026`),i=await M(a,void 0);else throw f}r=i.process,o=i.url,t=i.subdomain,await $(i.subdomain),p=q;return}catch(i){console.warn(`[mcp-use] tunnel restart failed: ${i instanceof Error?i.message:String(i)}`),await T(p),p=Math.min(p*2,Be)}}})().finally(()=>{d=void 0}))},{status(){return{url:o}},async start(c){if(u=!1,a=c,o!==null)return{url:o,subdomain:t??""};let i=await O();i!==void 0&&(console.log(`[mcp-use] found existing subdomain: ${i}`),await H(i));let f;try{f=await M(c,i)}catch(b){if(i!==void 0)console.log(`[mcp-use] subdomain "${i}" unavailable, requesting a new one\u2026`),f=await M(c,void 0);else throw b}return r=f.process,o=f.url,t=f.subdomain,await $(f.subdomain),{url:f.url,subdomain:f.subdomain}},async stop(){u=!0,E(),d!==void 0&&await d,t!==void 0&&await H(t),r!==void 0&&(r.kill("SIGINT"),r=void 0),a=void 0,o=null,t=void 0,p=q}}}function en(e){let[r,o]=process.platform==="darwin"?["open",[e]]:process.platform==="win32"?["cmd",["/c","start","",e]]:["xdg-open",[e]];try{let t=We(r,o,{stdio:"ignore",detached:!0});t.on("error",()=>{}),t.unref()}catch{}}function nn(){for(let e of Object.values(ze()))for(let r of e??[])if(!r.internal&&r.family==="IPv4")return r.address}function tn(e){if(e!==void 0)try{return new URL(`http://${e}`).hostname.replace(/^\[|\]$/g,"")}catch{return}}function rn(e){let r=e.getHeader("Vary"),o=typeof r=="string"?r:Array.isArray(r)?r.join(", "):r!==void 0?String(r):"";o.split(",").map(t=>t.trim().toLowerCase()).includes("origin")||e.setHeader("Vary",o===""?"Origin":`${o}, Origin`)}function on(e,r,o){if(o.tunnelActive){r.setHeader("Access-Control-Allow-Origin","*");return}if(!o.localhostBind)return;let t=e.headers.origin;if(t==="null"){r.setHeader("Access-Control-Allow-Origin","null");return}if(typeof t!="string"||t==="")return;let a=Ze(t,Ye());!a.ok||a.origin===void 0||(r.setHeader("Access-Control-Allow-Origin",a.origin),rn(r))}function sn(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 o=r;if(typeof o.getHandler!="function")throw new Error("The entry's default export has no getHandler() \u2014 it must be the MCPServer instance (`export default server`).");return o}async function an(e){process.env.MCP_USE_DEV_CLI="1";let r=ue(e.cwd),o=new Ke(n=>{console.error("[mcp-use] notification delivery failed:",n)});te(e.cwd,"development");let t=Q(e.host),a=["127.0.0.1","localhost","::1"].includes(t),u=t==="0.0.0.0"||t==="::",d=Ge(),{port:p,requested:T}=await we(Y(e.port),t);p!==T&&console.log(`[mcp-use] port ${T} is taken, using ${p}`),process.env.PORT=String(p);let E=process.env.MCP_URL===void 0&&(t==="127.0.0.1"||t==="localhost"||t==="::1")?`http://localhost:${p}`:void 0,H=e.mcpDir===void 0?e.cwd:Je(e.cwd,e.mcpDir),O=e.entry===void 0?W(H):W(e.cwd,e.entry);await le(e.cwd,O)&&console.log("[mcp-use] created mcp-env.d.ts");let $=e.viewsDir??(e.mcpDir===void 0?void 0:qe(e.mcpDir,"views")),w=G(e.cwd,$),M=w.length>0,c=ae(e.cwd),f=["127.0.0.1","localhost","0.0.0.0","::","::1"].includes(t)?"localhost":t,b=`http://${f.includes(":")?`[${f}]`:f}:${p}`,g=await oe({root:e.cwd,configFile:M?c:!1,envDir:!1,logLevel:"warn",cacheDir:r.cache,resolve:{tsconfigPaths:!0,alias:{tailwindcss:ce()}},plugins:M?[B(e.cwd),se(),pe({getViews:()=>w,dev:{reactRefresh:!0}}),ie()]:[B(e.cwd)],server:{middlewareMode:!0,...M&&{origin:b},cors:!1,hmr:M?{server:d}:!1},ssr:{...ne(e.cwd)}}),x=g.environments.ssr,_=re(x,{hmr:!1,sourcemapInterceptor:"node"}),S=async()=>{let n=async()=>{let l=await _.import(O),m=sn(l);if(w.length>0){let k=de(w);if(typeof m.__primeViews!="function")throw new Error("Loaded MCPServer instance does not support __primeViews.");m.__primeViews(k,{dev:!0,projectRoot:e.cwd})}return m};if(E===void 0)return n();let s=process.env.MCP_URL;try{return process.env.MCP_URL=E,await n()}finally{s===void 0?delete process.env.MCP_URL:process.env.MCP_URL=s}},I,h;try{let n=await S();I=n.getHandler({bus:o}),h=n.basePath??"/mcp"}catch(n){throw await _.close(),await g.close(),n}let A,R,P,v=n=>{if(A===void 0||P===n)return;let s=A.mountInspector({basePath:n,autoConnectUrl:`${b}${n}`,oauthProxyAllowLoopback:a||u,devMode:!0});if(typeof s!="function")throw new Error("The installed @mcp-use/inspector is incompatible: mountInspector() did not return a Fetch handler.");R=s,P=n};try{if(e.inspector!==!1){let n=await Pe(e.cwd);n.installed&&(A=n.module,v(h))}}catch(n){throw await _.close(),await g.close(),n}let C=!1,U=!1,D=()=>{if(C){U=!0;return}C=!0,(async()=>{do{U=!1;try{_.evaluatedModules.clear();let n=await S(),s=n.getHandler({bus:o}),l=n.basePath??"/mcp";v(l),I=s,h=l,o.publish({kind:"tools_list_changed"}),o.publish({kind:"prompts_list_changed"}),o.publish({kind:"resources_list_changed"}),console.log("[mcp-use] reloaded server entry")}catch(n){console.error(`[mcp-use] reload failed \u2014 keeping the previous server:
|
|
2
|
-
`,n)}}while(
|
|
1
|
+
import{a as ne,b as te}from"../chunk-N7BU45K6.js";import{b as Q,c as Z}from"../chunk-USIKTT3N.js";import{a as se,b as ie,c as ae,d as G,f as q,g as ce,i as le}from"../chunk-ALPMVGHI.js";import{b as re,c as oe,d as W}from"../chunk-7G4TXPP4.js";import{a as V,b as ee}from"../chunk-DB3E6LBX.js";import{spawn as Ne}from"child_process";import{createServer as Be}from"http";import{networkInterfaces as Ve}from"os";import{join as We,resolve as Ge}from"path";import qe from"@tailwindcss/vite";import ze from"@vitejs/plugin-react";import{createServer as Je,createServerModuleRunner as Ke}from"vite";import{InMemoryServerEventBus as Xe,localhostAllowedHostnames as Ye,localhostAllowedOrigins as Qe,validateHostHeader as Ze,validateOriginHeader as en}from"@modelcontextprotocol/server";import{connect as Me,createServer as Re}from"net";var ue=100,Ie=300,_e=new Set(["127.0.0.1","localhost","::1"]);function ke(e,r){return new Promise(o=>{let t=Re();t.unref(),t.once("error",()=>o(!1)),t.listen({port:e,host:r},()=>{t.close(()=>o(!0))})})}function de(e,r){return new Promise(o=>{let t=Me({port:e,host:r});t.setTimeout(Ie),t.once("connect",()=>{t.destroy(),o(!0)}),t.once("timeout",()=>{t.destroy(),o(!1)}),t.once("error",()=>{t.destroy(),o(!1)})})}async function Te(e){return await de(e,"127.0.0.1")||await de(e,"::1")}async function pe(e,r){for(let o=e;o<e+ue;o++)if(await ke(o,r)&&!(_e.has(r)&&await Te(o)))return{port:o,requested:e};throw new Error(`No free port found between ${e} and ${e+ue-1} on ${r}.`)}function fe(e,r){let o=()=>{let t=e.getBasePath(),{url:c}=e.tunnel.status();return{mcpUrl:c!==null?`${c.replace(/\/+$/,"")}${t}`:null,port:e.port,fromCli:!0,tunnelUrl:c}};return async t=>{let c=e.getBasePath(),u=`${c}/inspector/api/dev/info`,d=`${c}/inspector/api/dev/start-tunnel`,p=`${c}/inspector/api/dev/stop-tunnel`,R=new URL(t.url).pathname;if(t.method==="GET"&&R===u)return Response.json(o());if(t.method==="POST"&&R===d)try{return await e.tunnel.start(e.port),Response.json({ok:!0,restarting:!1})}catch(k){let T=k instanceof Error?k.message:"Failed to start tunnel";return Response.json({error:T},{status:500})}return t.method==="POST"&&R===p?(await e.tunnel.stop(),Response.json({ok:!0})):r(t)}}import{readFileSync as Ee}from"fs";import{createRequire as $e}from"module";import{join as De}from"path";import{pathToFileURL as Oe}from"url";async function he(e){let r=De(e,"package.json"),o=JSON.parse(Ee(r,"utf8"));if([o.dependencies,o.devDependencies,o.optionalDependencies].some(u=>u!==null&&typeof u=="object"&&"@mcp-use/inspector"in u)){let u=$e(r);try{let d=u.resolve("@mcp-use/inspector");return me(await import(Oe(d).href))}catch(d){if(!we(d))throw d}}try{return me(await import("@mcp-use/inspector"))}catch(u){if(we(u))return{installed:!1};throw u}}function me(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 we(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"}import{mkdir as xe,readFile as He,writeFile as Ae}from"fs/promises";import{spawn as Ce}from"child_process";import{dirname as Ue}from"path";var Le="https://local.mcp-use.run";function je(){return process.env.MCP_USE_TUNNEL_API??Le}var z=1e3,Fe=3e4;function ve(e){let r,o=null,t,c,u=!1,d,p=z,R=a=>new Promise(i=>{setTimeout(i,a)}),k=()=>{r!==void 0&&"markShutdown"in r&&typeof r.markShutdown=="function"&&r.markShutdown()},T=async a=>{try{await fetch(`${je()}/api/tunnels/${a}`,{method:"DELETE",signal:AbortSignal.timeout(2e3)})}catch{}},U=async()=>{try{let a=await He(e,"utf8"),i=JSON.parse(a);return typeof i.subdomain=="string"?i.subdomain:void 0}catch{return}},H=async a=>{try{await xe(Ue(e),{recursive:!0}),await Ae(e,JSON.stringify({subdomain:a},null,2),"utf8")}catch(i){console.warn(`[mcp-use] failed to save tunnel subdomain: ${i instanceof Error?i.message:String(i)}`)}},E=()=>{},m=(a,i)=>new Promise((g,b)=>{console.log(`[mcp-use] starting tunnel for port ${a}\u2026`);let I=process.env.npm_config_user_agent??"",[P,A]=I.startsWith("pnpm/")?["pnpm",["--silent","dlx","@mcp-use/tunnel",String(a)]]:I.startsWith("bun/")?["bunx",["@mcp-use/tunnel",String(a)]]:["npx",["--yes","--prefer-offline","@mcp-use/tunnel",String(a)]];i!==void 0&&A.push("--subdomain",i);let h=Ce(P,A,{stdio:["ignore","pipe","pipe"],shell:process.platform==="win32"}),_=!1,$=!1,y=()=>{$=!0};h.markShutdown=y,h.stdout.on("data",w=>{let v=w.toString(),F=v.includes("Shutting down")||v.includes("\u{1F6D1}"),L=v.includes("\u2716")||v.includes("Error:");!$&&!F&&!L&&process.stdout.write(v);let O=v.match(/https?:\/\/([a-z0-9-]+\.[a-z0-9.-]+)/i);if(O!==null&&!_){let N=O[0],C=O[1]??"",S=C.match(/^([a-z0-9-]+)\./i)?.[1]??C.split(".")[0]??"";/^[a-z0-9-]+$/i.test(S)||(console.warn(`[mcp-use] warning: extracted subdomain "${S}" does not match expected format`),S=""),_=!0,clearTimeout(D),g({url:N,subdomain:S,process:h})}}),h.stderr.on("data",w=>{let v=w.toString();!$&&!v.includes("INFO")&&!v.includes("bore_cli")&&!v.includes("Shutting down")&&!/npm warn Unknown (?:env|project|user|builtin) config/.test(v)&&process.stderr.write(w)}),h.on("error",w=>{_||(clearTimeout(D),b(new Error(`Failed to start tunnel: ${w.message}`)))}),h.on("exit",w=>{w!==0&&w!==null&&!_&&(clearTimeout(D),b(new Error(`Tunnel process exited with code ${w}`))),r===h&&(r=void 0,o=null,u?t=void 0:E())});let D=setTimeout(()=>{_||(h.kill(),b(new Error("Tunnel setup timed out")))},3e4)});return E=()=>{u||c===void 0||o!==null||d===void 0&&(d=(async()=>{for(;!u&&c!==void 0&&o===null;){console.log("[mcp-use] tunnel disconnected, restarting\u2026");let a=t??await U();try{a!==void 0&&await T(a);let i;try{i=await m(c,a)}catch(g){if(a!==void 0)console.log(`[mcp-use] subdomain "${a}" unavailable, requesting a new one\u2026`),i=await m(c,void 0);else throw g}r=i.process,o=i.url,t=i.subdomain,await H(i.subdomain),p=z;return}catch(i){console.warn(`[mcp-use] tunnel restart failed: ${i instanceof Error?i.message:String(i)}`),await R(p),p=Math.min(p*2,Fe)}}})().finally(()=>{d=void 0}))},{status(){return{url:o}},async start(a){if(u=!1,c=a,o!==null)return{url:o,subdomain:t??""};let i=await U();i!==void 0&&(console.log(`[mcp-use] found existing subdomain: ${i}`),await T(i));let g;try{g=await m(a,i)}catch(b){if(i!==void 0)console.log(`[mcp-use] subdomain "${i}" unavailable, requesting a new one\u2026`),g=await m(a,void 0);else throw b}return r=g.process,o=g.url,t=g.subdomain,await H(g.subdomain),{url:g.url,subdomain:g.subdomain}},async stop(){u=!0,k(),d!==void 0&&await d,t!==void 0&&await T(t),r!==void 0&&(r.kill("SIGINT"),r=void 0),c=void 0,o=null,t=void 0,p=z}}}function nn(e){let[r,o]=process.platform==="darwin"?["open",[e]]:process.platform==="win32"?["cmd",["/c","start","",e]]:["xdg-open",[e]];try{let t=Ne(r,o,{stdio:"ignore",detached:!0});t.on("error",()=>{}),t.unref()}catch{}}function tn(){for(let e of Object.values(Ve()))for(let r of e??[])if(!r.internal&&r.family==="IPv4")return r.address}function rn(e){if(e!==void 0)try{return new URL(`http://${e}`).hostname.replace(/^\[|\]$/g,"")}catch{return}}function on(e){let r=e.getHeader("Vary"),o=typeof r=="string"?r:Array.isArray(r)?r.join(", "):r!==void 0?String(r):"";o.split(",").map(t=>t.trim().toLowerCase()).includes("origin")||e.setHeader("Vary",o===""?"Origin":`${o}, Origin`)}function sn(e,r,o){if(o.tunnelActive){r.setHeader("Access-Control-Allow-Origin","*");return}if(!o.localhostBind)return;let t=e.headers.origin;if(t==="null"){r.setHeader("Access-Control-Allow-Origin","null");return}if(typeof t!="string"||t==="")return;let c=en(t,Qe());!c.ok||c.origin===void 0||(r.setHeader("Access-Control-Allow-Origin",c.origin),on(r))}function an(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 o=r;if(typeof o.fetch!="function")throw new Error("The entry's default export has no fetch() \u2014 it must be the MCPServer instance (`export default server`).");return o}async function cn(e){process.env.MCP_USE_DEV_CLI="1";let r=ae(e.cwd),o=new Xe(n=>{console.error("[mcp-use] notification delivery failed:",n)});oe(e.cwd,"development");let t=Z(e.host),c=["127.0.0.1","localhost","::1"].includes(t),u=t==="0.0.0.0"||t==="::",d=Be(),{port:p,requested:R}=await pe(Q(e.port),t);p!==R&&console.log(`[mcp-use] port ${R} is taken, using ${p}`),process.env.PORT=String(p);let k=process.env.MCP_URL===void 0&&(t==="127.0.0.1"||t==="localhost"||t==="::1")?`http://localhost:${p}`:void 0,T=e.mcpDir===void 0?e.cwd:Ge(e.cwd,e.mcpDir),U=e.entry===void 0?V(T):V(e.cwd,e.entry),H=await ee(e.cwd,U);(H==="created"||H==="updated")&&console.log(`[mcp-use] ${H} mcp-env.d.ts`);let E=e.viewsDir??(e.mcpDir===void 0?void 0:We(e.mcpDir,"views")),m=G(e.cwd,E),a=m.length>0,i=se(e.cwd),b=["127.0.0.1","localhost","0.0.0.0","::","::1"].includes(t)?"localhost":t,I=`http://${b.includes(":")?`[${b}]`:b}:${p}`,P=await Je({root:e.cwd,configFile:a?i:!1,envDir:!1,logLevel:"warn",cacheDir:r.cache,resolve:{tsconfigPaths:!0,alias:{tailwindcss:ie()}},plugins:a?[W(e.cwd),qe(),le({getViews:()=>m,dev:{reactRefresh:!0}}),ze()]:[W(e.cwd)],server:{middlewareMode:!0,...a&&{origin:I},cors:!1,hmr:a?{server:d}:!1},ssr:{...re(e.cwd)}}),A=P.environments.ssr,h=Ke(A,{hmr:!1,sourcemapInterceptor:"node"}),_=async()=>{let n=async()=>{let l=await h.import(U),f=an(l);if(m.length>0){let M=ce(m);if(typeof f.__primeViews!="function")throw new Error("Loaded MCPServer instance does not support __primeViews.");f.__primeViews(M,{dev:!0,projectRoot:e.cwd})}return f};if(k===void 0)return n();let s=process.env.MCP_URL;try{return process.env.MCP_URL=k,await n()}finally{s===void 0?delete process.env.MCP_URL:process.env.MCP_URL=s}},$,y;try{let n=await _();n.__setEventBus(o),n.__mount(),$=async s=>n.fetch(s),y=n.basePath??"/mcp"}catch(n){throw await h.close(),await P.close(),n}let D,w,v,F=n=>{if(D===void 0||v===n)return;let s=D.mountInspector({basePath:n,autoConnectUrl:`${I}${n}`,oauthProxyAllowLoopback:c||u,devMode:!0});if(typeof s!="function")throw new Error("The installed @mcp-use/inspector is incompatible: mountInspector() did not return a Fetch handler.");w=s,v=n};try{if(e.inspector!==!1){let n=await he(e.cwd);n.installed&&(D=n.module,F(y))}}catch(n){throw await h.close(),await P.close(),n}let L=!1,O=!1,N=()=>{if(L){O=!0;return}L=!0,(async()=>{do{O=!1;try{h.evaluatedModules.clear();let n=await _();n.__setEventBus(o),n.__mount();let s=async f=>n.fetch(f),l=n.basePath??"/mcp";F(l),$=s,y=l,o.publish({kind:"tools_list_changed"}),o.publish({kind:"prompts_list_changed"}),o.publish({kind:"resources_list_changed"}),console.log("[mcp-use] reloaded server entry")}catch(n){console.error(`[mcp-use] reload failed \u2014 keeping the previous server:
|
|
2
|
+
`,n)}}while(O);L=!1})()},C=n=>{if(q(n,e.cwd,E))return;let s=A.moduleGraph.getModulesByFile(n);if(!(s===void 0||s.size===0)){for(let l of s)A.moduleGraph.invalidateModule(l);N()}},J=n=>{if(!q(n,e.cwd,E))return;let s=m;m=G(e.cwd,E),(s.length!==m.length||s.some((f,M)=>f.name!==m[M]?.name||f.entryPath!==m[M]?.entryPath))&&N()},S=n=>{J(n),C(n)};P.watcher.on("change",C),P.watcher.on("add",S),P.watcher.on("unlink",S);let x=ve(r.tunnel);d.prependListener("upgrade",n=>{let s=x.status().url;if(s===null)return;let l=new URL(s).hostname;n.headers.host?.split(":")[0]===l&&(n.headers.host=`localhost:${p}`)});let ge=(n,s)=>{let l=x.status().url,f=l!==null?new URL(l).hostname:null,M=f!==null?[f]:[],j=Ze(n.headers.host,[...Ye(),...M]);return j.ok?!1:(s.writeHead(403,{"content-type":"application/json"}),s.end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:j.message},id:null})),!0)},K=async()=>{P.watcher.off("change",C),P.watcher.off("add",S),P.watcher.off("unlink",S),await x.stop(),await new Promise(n=>d.close(()=>n())),await h.close(),await P.close()},Pe=fe({getBasePath:()=>y,port:p,tunnel:x},n=>w!==void 0&&ne(n,y)?w(n):$(n)),{toNodeHandler:ye}=await import("../node-bridge-JJIA6K5P.js"),X=ye({fetch:Pe}),be=(n,s)=>{if(c&&ge(n,s))return;let l=n.url??"/",f=new URL(l,"http://127.0.0.1").pathname,M=x.status().url,j=M===null?null:new URL(M).hostname,B=rn(n.headers.host);if((j!==null&&B===j||u&&B!==void 0&&!["localhost","127.0.0.1","::1"].includes(B))&&te(f,y)){s.writeHead(404,{"content-type":"text/plain; charset=utf-8"}),s.end("Not Found");return}let Y=a&&m.length>0,Se=n.method==="GET"&&(f.startsWith("/@")||f.startsWith("/node_modules/")||f.startsWith("/.mcp-use/")||Y&&f.startsWith("/views/"));Y&&Se?(sn(n,s,{tunnelActive:x.status().url!==null,localhostBind:c}),P.middlewares(n,s,()=>{X(n,s)})):X(n,s)};if(d.on("request",be),await new Promise((n,s)=>{d.once("error",s),d.listen(p,t,()=>n())}),console.log("[mcp-use] dev server ready"),m.length>0&&console.log(` \u279C Views: ${m.map(n=>n.name).join(", ")}`),console.log(` \u279C MCP endpoint: ${I}${y}`),w!==void 0?console.log(` \u279C Inspector: ${I}${y}/inspector`):e.inspector!==!1&&console.warn("[mcp-use] Built-in Inspector is unavailable; reinstall mcp-use to restore visual testing."),t==="0.0.0.0"||t==="::"){let n=tn();n!==void 0&&console.log(` \u279C Network: http://${n}:${p}${y}`)}if(c||console.warn(`[mcp-use] --host ${t} 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:n}=await x.start(p);console.log(` \u279C Tunnel: ${n}${y}`)}catch(n){throw await K(),n}w!==void 0&&e.open!==!1&&process.stdout.isTTY===!0&&nn(`${I}${y}/inspector`),await new Promise(n=>{let s=!1,l=()=>{s||(s=!0,process.off("SIGINT",l),process.off("SIGTERM",l),(async()=>(await K(),n()))())};process.on("SIGINT",l),process.on("SIGTERM",l),e.signal!==void 0&&(e.signal.aborted?l():e.signal.addEventListener("abort",l,{once:!0}))})}export{cn as runDev};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as h,b as v,c as b,d as C,e as k,f as d}from"../chunk-ZELLSKD2.js";import{a as f,b as l,c as y,d as c,e as m,f as w,g as _}from"../chunk-LHNHT6HO.js";import
|
|
1
|
+
import{a as h,b as v,c as b,d as C,e as k,f as d}from"../chunk-ZELLSKD2.js";import{a as f,b as l,c as y,d as c,e as m,f as w,g as _}from"../chunk-LHNHT6HO.js";import{parseArgs as u}from"util";async function S(i,n){let o=y(n);try{return i==="login"?await P(n,o):i==="logout"?await $(n,o):await T(n,o)}catch(e){return m(e instanceof TypeError?new f(e.message):e,o)}}async function P(i,n){let{values:o}=u({args:[...i],allowPositionals:!1,strict:!0,options:{"api-key":{type:"string"},org:{type:"string"},"no-open":{type:"boolean"},json:{type:"boolean"}}}),e=o["api-key"]??process.env.MCP_USE_API_KEY;e===void 0&&(e=await I(o["no-open"]===!0||!process.stdout.isTTY));let t=await d.withApiKey(e).identity(),r=o.org!==void 0?k(t.organizations,o.org):t.organizations.find(a=>a.id===t.defaultOrganizationId);return await b({apiKey:e,...r!==void 0?{orgId:r.id,orgName:r.name,...r.slug!==null?{orgSlug:r.slug}:{}}:{}}),c({email:t.email,organization:r??null},n,`Logged in as ${t.email}${r!==void 0?` (${r.name})`:""}.`),0}async function $(i,n){let{values:o}=u({args:[...i],allowPositionals:!1,strict:!0,options:{yes:{type:"boolean"},json:{type:"boolean"}}});return await w("Delete local cloud credentials?",{yes:o.yes===!0,json:n})&&(await C(),c({loggedOut:!0},n,"Logged out.")),0}async function T(i,n){u({args:[...i],allowPositionals:!1,strict:!0,options:{json:{type:"boolean"}}});let o=await v(),e=await(await d.create()).identity(),t=e.organizations.find(a=>a.id===o.orgId)??null,r={userId:e.userId,email:e.email,organization:t};return c(r,n,`${e.email}${t!==null?` \u2014 ${t.name}`:""}`),0}async function I(i){let n=h(),o=await fetch(`${n}/api/auth/device/code`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:"mcp-use-cli",scope:"openid profile email"})});if(!o.ok)throw new l("login_failed",`Could not start device login (${o.status}).`);let e=await o.json(),t=e.verification_uri_complete??e.verification_uri;process.stderr.write(`Open ${t} and enter code ${e.user_code}.
|
|
2
2
|
`),i||_(t);let r=Date.now()+e.expires_in*1e3,a=Math.max(e.interval,1);for(;Date.now()<r;){await O(a*1e3);let s=await(await fetch(`${n}/api/auth/device/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:e.device_code,client_id:"mcp-use-cli"})})).json();if(s.access_token!==void 0){let p=await fetch(`${n}/api/auth/api-key/create`,{method:"POST",headers:{Authorization:`Bearer ${s.access_token}`,"Content-Type":"application/json"},body:JSON.stringify({name:"CLI",prefix:"mcp_"})});if(!p.ok)throw new l("login_failed","Could not create a CLI API key.");let g=await p.json();if(typeof g.key!="string")throw new l("login_failed","Cloud returned an invalid API key.");return g.key}if(s.error!=="authorization_pending"){if(s.error==="slow_down"){a+=5;continue}throw new l("login_failed",s.error_description??s.error??"Device login failed.")}}throw new l("login_timeout","Device login expired.")}function O(i){return new Promise(n=>setTimeout(n,i))}export{S as runIdentity};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as m,c as p,e as w,f as y}from"../chunk-ZELLSKD2.js";import{a as s,c as g,d as l,e as f}from"../chunk-LHNHT6HO.js";import
|
|
1
|
+
import{b as m,c as p,e as w,f as y}from"../chunk-ZELLSKD2.js";import{a as s,c as g,d as l,e as f}from"../chunk-LHNHT6HO.js";import{parseArgs as $}from"util";async function I(o){let a=g(o);try{let r=o[0];if(!["list","current","use"].includes(r??""))throw new s("Usage: mcp-use org <list|current|use>");let c=await y.create(),t=await c.identity(),u=await m();if(r==="list"){z(o.slice(1));let e=t.organizations.map(n=>({...n,active:n.id===(u.orgId??t.defaultOrganizationId??void 0)}));return l(e,a,e.map(n=>`${n.active?"* ":" "}${n.name} (${n.slug??n.id}) [${n.role}]`).join(`
|
|
2
2
|
`)||"No organizations."),0}if(r==="current"){z(o.slice(1));let e=t.organizations.find(n=>n.id===(u.orgId??t.defaultOrganizationId))??null;if(e===null)throw new s("No active organization. Run `mcp-use org use <id-or-slug>`.");return l(e,a,`${e.name} (${e.slug??e.id})`),0}let d=o[1];if(d===void 0||o.length!==2)throw new s("Usage: mcp-use org use <id-or-slug>");let i=w(t.organizations,d);await p({...u.apiKey!==void 0?{apiKey:u.apiKey}:{},orgId:i.id,orgName:i.name,...i.slug!==null?{orgSlug:i.slug}:{}});try{await c.setDefaultOrganization(i.id)}catch{}return l(i,a,`Using ${i.name} (${i.slug??i.id}).`),0}catch(r){return f(r instanceof TypeError?new s(r.message):r,a)}}function z(o){$({args:[...o],allowPositionals:!1,strict:!0,options:{json:{type:"boolean"}}})}export{I as runOrganizations};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as M,c as $,d as x}from"../chunk-N6R74JIF.js";import{a as c,b as s,c as _,d as k,e as R}from"../chunk-LHNHT6HO.js";import
|
|
1
|
+
import{b as M,c as $,d as x}from"../chunk-N6R74JIF.js";import{a as c,b as s,c as _,d as k,e as R}from"../chunk-LHNHT6HO.js";import{spawn as H}from"child_process";import{access as N,mkdtemp as j,rm as A,writeFile as F}from"fs/promises";import{createServer as G}from"net";import{tmpdir as J}from"os";import{basename as V,join as q,resolve as W}from"path";import{parseArgs as z}from"util";import{fileURLToPath as K}from"url";async function Pe(r){let n=_(r),e,t,i;try{let{values:o,positionals:a}=z({args:[...r],allowPositionals:!0,strict:!0,options:{server:{type:"string"},mcp:{type:"string"},tool:{type:"string"},header:{type:"string",short:"H",multiple:!0},output:{type:"string"},width:{type:"string",default:"1280"},height:{type:"string",default:"720"},"device-scale-factor":{type:"string",default:"1"},theme:{type:"string",default:"light"},inspector:{type:"string"},"cdp-url":{type:"string"},"wait-for":{type:"string"},delay:{type:"string",default:"0"},timeout:{type:"string",default:"30000"},json:{type:"boolean"}}});if(o.server===void 0==(o.mcp===void 0))throw new c("Exactly one of --server or --mcp is required.");if(o.tool===void 0)throw new c("--tool is required.");if(o.server!==void 0&&o.header!==void 0)throw new c("--header is valid only with --mcp.");if(o.theme!=="light"&&o.theme!=="dark")throw new c("--theme must be light or dark.");let w=h(o.width,"--width"),y=h(o.height,"--height"),u=Number(o["device-scale-factor"]);if(!Number.isFinite(u)||u<=0||u>4)throw new c("--device-scale-factor must be greater than 0 and at most 4.");let l=h(o.timeout,"--timeout"),b=de(o.delay,"--delay"),U=ce(o.header??[]);e=o.server!==void 0?await M(o.server):await $(new URL(o.mcp).href,U);let P=(await e.listTools()).find(O=>O.name===o.tool);if(P===void 0)throw new s("tool_not_found",`Tool not found: ${o.tool}`);let m=Z(P),C=x(a),f=await e.callTool(o.tool,C,{timeout:l});if(f.isError===!0)throw new s("tool_failed",`Tool ${o.tool} returned an error.`,f);let I=await e.readResource(m);ee(I),i=o.inspector===void 0?await X(l):void 0;let E=(o.inspector??i.origin).replace(/\/+$/,"");await B(E,l);let S=te(m),p=new URL(`${E}/inspector/preview/${encodeURIComponent(S)}`);p.searchParams.set("protocol","1"),p.searchParams.set("theme",o.theme),p.searchParams.set("width",String(w)),t=o["cdp-url"]!==void 0?await re(o["cdp-url"]):await ne(),await t.cdp.send("Emulation.setDeviceMetricsOverride",{width:w,height:y,deviceScaleFactor:u,mobile:!1},t.sessionId),await t.cdp.send("Page.enable",{},t.sessionId),await t.cdp.send("Runtime.enable",{},t.sessionId),await t.cdp.send("Page.addScriptToEvaluateOnNewDocument",{source:`globalThis.__mcpUsePreviewBundle = ${ue({resourceUri:m,resourceContents:I,toolInput:C,toolOutput:f})};`},t.sessionId),await t.cdp.send("Page.navigate",{url:p.href},t.sessionId),await oe(t,l),await ie(t,o["wait-for"],l),b>0&&await d(b);let T=await t.cdp.send("Page.captureScreenshot",{format:"png",captureBeyondViewport:!1},t.sessionId);if(typeof T.data!="string")throw new s("capture_failed","Chrome returned no screenshot data.");let g=W(o.output??`${S}-${new Date().toISOString().replace(/[:.]/g,"-")}.png`);return await F(g,Buffer.from(T.data,"base64")),k({path:g,width:w,height:y,deviceScaleFactor:u},n,g),0}catch(o){return R(o instanceof TypeError?new c(o.message):o,n)}finally{await t?.close().catch(()=>{}),await i?.close().catch(()=>{}),await e?.disconnect().catch(()=>{})}}async function X(r){let n=await D(),e=import.meta.resolve("@mcp-use/inspector"),t=K(new URL("../cli.js",e)),i=H(process.execPath,[t,"--port",String(n),"--no-open"],{stdio:"ignore"}),o=`http://127.0.0.1:${n}`;try{await Q(o,i,Math.min(r,1e4))}catch(a){throw i.kill("SIGTERM"),a}return{origin:o,async close(){await Y(i)}}}async function Q(r,n,e){let t=Date.now()+e;for(;Date.now()<t;){if(n.exitCode!==null)throw new s("inspector_start_failed",`Packaged Inspector exited before becoming ready (code ${n.exitCode}).`);try{await B(r,Math.min(1e3,e));return}catch{await d(100)}}throw new s("inspector_start_failed","Packaged Inspector did not start in time.")}async function Y(r){r.exitCode===null&&(r.kill("SIGTERM"),await Promise.race([new Promise(n=>r.once("exit",()=>n())),d(2e3)]),r.exitCode===null&&r.kill("SIGKILL"))}async function B(r,n){let e=await fetch(`${r}/inspector/health`,{signal:AbortSignal.timeout(n)});if(!e.ok)throw new s("incompatible_inspector",`Inspector health check failed (${e.status}).`);let t=await e.json();if(t.status!=="ok"||t.protocol!=="mcp-use-inspector-preview"||t.version!==1||!t.capabilities?.includes("view-preview"))throw new s("incompatible_inspector","Inspector does not support mcp-use-inspector-preview version 1.")}function Z(r){let n=r!==null&&typeof r=="object"?r._meta:void 0,t=(n?.ui!==null&&typeof n?.ui=="object"?n.ui.resourceUri:void 0)??n?.["ui/resourceUri"];if(typeof t!="string")throw new s("missing_view","Tool does not advertise an MCP Apps UI resource.");return t}function ee(r){let n=r!==null&&typeof r=="object"?r.contents:void 0;if(!Array.isArray(n))throw new s("invalid_view","View resource has no contents.");let e=n.find(t=>t!==null&&typeof t=="object"&&typeof t.text=="string");if(e===void 0)throw new s("invalid_view","View resource has no HTML document.");return e.text}function te(r){let n=new URL(r);return V(n.pathname).replace(/\.html$/,"")||n.hostname}async function ne(){let r=await se(),n=await D(),e=await j(q(J(),"mcp-use-chrome-")),t=H(r,[`--remote-debugging-port=${n}`,`--user-data-dir=${e}`,"--headless=new","--no-first-run","--no-default-browser-check","about:blank"],{stdio:"ignore"});try{let i=await ae(`http://127.0.0.1:${n}/json/version`,1e4),o=await L(i.webSocketDebuggerUrl);return{...o,async close(){await o.close(),t.kill("SIGTERM"),await A(e,{recursive:!0,force:!0})}}}catch(i){throw t.kill("SIGTERM"),await A(e,{recursive:!0,force:!0}),i}}async function re(r){return L(r)}async function L(r){let n=await v.connect(r),e=await n.send("Target.createTarget",{url:"about:blank"}),t=await n.send("Target.attachToTarget",{targetId:e.targetId,flatten:!0});return{cdp:n,sessionId:t.sessionId,async close(){await n.send("Target.closeTarget",{targetId:e.targetId}).catch(()=>{}),n.close()}}}async function oe(r,n){let e=Date.now()+n;for(;Date.now()<e;){if((await r.cdp.send("Runtime.evaluate",{expression:"document.readyState",returnByValue:!0},r.sessionId)).result?.value==="complete")return;await d(100)}throw new s("browser_timeout","Inspector page did not load in time.")}async function ie(r,n,e){let t=Date.now()+e;for(;Date.now()<t;){let i=`(() => ({
|
|
2
2
|
ready: document.body?.dataset.viewReady === "true",
|
|
3
3
|
error: document.body?.dataset.viewError || null,
|
|
4
4
|
selector: ${JSON.stringify(n)} === undefined || !!document.querySelector(${JSON.stringify(n??"")})
|
package/dist/commands/servers.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{g as d}from"../chunk-ZELLSKD2.js";import{a as u,c as k,d as l,e as P,f as y}from"../chunk-LHNHT6HO.js";import
|
|
1
|
+
import{g as d}from"../chunk-ZELLSKD2.js";import{a as u,c as k,d as l,e as P,f as y}from"../chunk-LHNHT6HO.js";import{parseArgs as m}from"util";async function x(n){let t=k(n);try{let e=n[0];if(e==="list")return await $(n.slice(1),t);if(e==="get")return await E(n.slice(1),t);if(e==="update")return await C(n.slice(1),t);if(e==="delete")return await A(n.slice(1),t);if(e==="env")return await I(n.slice(1),t);throw new u("Usage: mcp-use servers <list|get|update|delete|env>")}catch(e){return P(e instanceof TypeError?new u(e.message):e,t)}}async function $(n,t){let{values:e}=m({args:[...n],allowPositionals:!1,strict:!0,options:S()}),{api:s,organizationId:r}=await d(e.org),{limit:i,skip:a}=N(e.limit,e.skip),c=new URLSearchParams({organizationId:r,limit:String(i),skip:String(a)}),o=await s.request(`/servers?${c}`);return l(o,t),0}async function E(n,t){let{values:e,positionals:s}=m({args:[...n],allowPositionals:!0,strict:!0,options:p()}),r=b(s,"mcp-use servers get <id-or-slug>"),{api:i}=await d(e.org),a=await i.request(`/servers/${encodeURIComponent(r)}`);return l(a,t),0}async function C(n,t){let{values:e,positionals:s}=m({args:[...n],allowPositionals:!0,strict:!0,options:{...p(),name:{type:"string"},description:{type:"string"},branch:{type:"string"},"root-dir":{type:"string"},"build-command":{type:"string"},"start-command":{type:"string"}}}),r=b(s,"mcp-use servers update <id-or-slug>"),i={...e["root-dir"]!==void 0?{rootDir:e["root-dir"]||null}:{},...e["build-command"]!==void 0?{buildCommand:e["build-command"]||null}:{},...e["start-command"]!==void 0?{startCommand:e["start-command"]||null}:{}},a={...e.name!==void 0?{name:e.name}:{},...e.description!==void 0?{description:e.description}:{},...e.branch!==void 0?{productionBranch:e.branch}:{},...Object.keys(i).length>0?{config:i}:{}};if(Object.keys(a).length===0)throw new u("servers update requires at least one mutation option.");let{api:c}=await d(e.org),o=await c.request(`/servers/${encodeURIComponent(r)}`,{method:"PATCH",body:JSON.stringify(a)});return l(o,t,`Updated ${r}.`),0}async function A(n,t){let{values:e,positionals:s}=m({args:[...n],allowPositionals:!0,strict:!0,options:{...p(),yes:{type:"boolean"}}}),r=b(s,"mcp-use servers delete <id-or-slug>");if(!await y(`Delete server ${r}?`,{yes:e.yes===!0,json:t}))return 0;let{api:i}=await d(e.org);return await i.request(`/servers/${encodeURIComponent(r)}`,{method:"DELETE"}),l({deleted:r},t,`Deleted ${r}.`),0}async function I(n,t){let e=n[0];if(e==="list")return O(n.slice(1),t);if(e==="set")return R(n.slice(1),t);if(e==="unset")return q(n.slice(1),t);throw new u("Usage: mcp-use servers env <list|set|unset>")}async function O(n,t){let{values:e,positionals:s}=m({args:[...n],allowPositionals:!0,strict:!0,options:{...p(),branch:{type:"string"}}}),r=b(s,"mcp-use servers env list <server>"),{api:i}=await d(e.org),c=(await f(i,r,e.branch)).map(o=>({id:o.id,key:o.key,branch:o.branch??null,environments:o.environments??[],sensitive:o.sensitive===!0,createdAt:o.createdAt,updatedAt:o.updatedAt}));return l(c,t,c.map(o=>o.key).join(`
|
|
2
2
|
`)||"No environment variables."),0}async function R(n,t){let{values:e,positionals:s}=m({args:[...n],allowPositionals:!0,strict:!0,options:{...p(),branch:{type:"string"},secret:{type:"boolean"}}});if(s.length!==2)throw new u("Usage: mcp-use servers env set <server> <KEY=VALUE>");let[r,i]=s,a=i.indexOf("=");if(a<=0)throw new u("Environment value must be KEY=VALUE.");let c=i.slice(0,a),o=i.slice(a+1),{api:g}=await d(e.org),v=(await f(g,r,e.branch)).find(h=>h.key===c&&(h.branch??void 0)===e.branch),w={key:c,value:o,branch:e.branch??null,environments:e.branch===void 0?["production"]:["preview"],sensitive:e.secret===!0},U=v===void 0?await g.request(`/servers/${encodeURIComponent(r)}/env-variables`,{method:"POST",body:JSON.stringify(w)}):await g.request(`/servers/${encodeURIComponent(r)}/env-variables/${encodeURIComponent(v.id)}`,{method:"PATCH",body:JSON.stringify(w)});return l(U,t,`Set ${c}.`),0}async function q(n,t){let{values:e,positionals:s}=m({args:[...n],allowPositionals:!0,strict:!0,options:{...p(),branch:{type:"string"},yes:{type:"boolean"}}});if(s.length!==2)throw new u("Usage: mcp-use servers env unset <server> <key>");let[r,i]=s;if(!await y(`Delete environment variable ${i}?`,{yes:e.yes===!0,json:t}))return 0;let{api:a}=await d(e.org),o=(await f(a,r,e.branch)).find(g=>g.key===i&&(g.branch??void 0)===e.branch);return o!==void 0&&await a.request(`/servers/${encodeURIComponent(r)}/env-variables/${encodeURIComponent(o.id)}`,{method:"DELETE"}),l({deleted:i},t,`Deleted ${i}.`),0}async function f(n,t,e){let s=e===void 0?"":`?branch=${encodeURIComponent(e)}`;return n.request(`/servers/${encodeURIComponent(t)}/env-variables${s}`)}function p(){return{org:{type:"string"},json:{type:"boolean"}}}function S(){return{...p(),limit:{type:"string",default:"30"},skip:{type:"string",default:"0"}}}function b(n,t){if(n.length!==1)throw new u(`Usage: ${t}`);return n[0]}function N(n,t){let e=Number(n??"30"),s=Number(t??"0");if(!Number.isInteger(e)||e<1||e>100)throw new u("--limit must be an integer from 1 to 100.");if(!Number.isInteger(s)||s<0)throw new u("--skip must be a non-negative integer.");return{limit:e,skip:s}}export{x as runServers};
|
package/dist/commands/skills.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o,d,e as u,h as m}from"../chunk-LHNHT6HO.js";import
|
|
1
|
+
import{a as o,d,e as u,h as m}from"../chunk-LHNHT6HO.js";import{spawn as f}from"child_process";import{resolve as w}from"path";import{parseArgs as g}from"util";async function I(r){let i=r.includes("--json");try{if(r[0]!=="add")throw new o("Usage: mcp-use skills add [options]");let{values:s}=g({args:[...r.slice(1)],allowPositionals:!1,strict:!0,options:{path:{type:"string",short:"p",default:process.cwd()},agent:{type:"string",multiple:!0},skill:{type:"string",multiple:!0},json:{type:"boolean"}}}),e=w(s.path??process.cwd());if(!await m(e))throw new o(`Directory not found: ${e}`);let n=s.agent??["all"],l=new Set(["cursor","claude-code","codex","all"]);for(let t of n)if(!l.has(t))throw new o(`Invalid agent: ${t}`);let a=n.includes("all")?["cursor","claude-code","codex"]:[...new Set(n)],c=["--yes","skills","add","mcp-use/mcp-use","--yes",...a.flatMap(t=>["-a",t]),...(s.skill??[]).flatMap(t=>["--skill",t])],p=await h("npx",c,e);return p!==0?p:(d({installed:!0,path:e,agents:a,skills:s.skill??"maintained"},i,"Installed mcp-use skills."),0)}catch(s){return u(s instanceof TypeError?new o(s.message):s,i)}}function h(r,i,s){return new Promise((e,n)=>{let l=f(r,i,{cwd:s,stdio:"inherit",shell:process.platform==="win32"});l.once("error",n),l.once("exit",(a,c)=>{e(c==="SIGINT"?130:a??1)})})}export{I as runSkills};
|
package/dist/commands/start.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as b}from"../chunk-N7BU45K6.js";import{b as h,c as w}from"../chunk-
|
|
2
|
-
Run \`mcp-use build\` first, then \`mcp-use start\`.`)}let s;try{let o=JSON.parse(
|
|
3
|
-
Re-run \`mcp-use build\`.`)}process.env.NODE_ENV??="production",y(t.cwd,"production");let i=
|
|
4
|
-
The server entry must \`export default\` its MCPServer instance (see the mcp-use entry contract).`);let n=
|
|
1
|
+
import{a as b}from"../chunk-N7BU45K6.js";import{b as h,c as w}from"../chunk-USIKTT3N.js";import{c as y}from"../chunk-7G4TXPP4.js";import{readFile as E}from"fs/promises";import{join as d}from"path";import{pathToFileURL as I}from"url";var k=".mcp-use",x="build",M="manifest.json";async function N(t){let e=d(t.cwd,k,x),r=d(e,M),u;try{u=await E(r,"utf8")}catch{throw new Error(`No production build found (missing ${r}).
|
|
2
|
+
Run \`mcp-use build\` first, then \`mcp-use start\`.`)}let s;try{let o=JSON.parse(u);if(typeof o.entryPoint!="string"||o.entryPoint==="")throw new Error("missing entryPoint");s=o.entryPoint}catch(o){let v=o instanceof Error?o.message:String(o);throw new Error(`Invalid build manifest at ${r} (${v}).
|
|
3
|
+
Re-run \`mcp-use build\`.`)}process.env.NODE_ENV??="production",y(t.cwd,"production");let i=d(e,s),a=await import(I(i).href);if(!("default"in a)||a.default===void 0)throw new Error(`The built entry (${i}) has no default export.
|
|
4
|
+
The server entry must \`export default\` its MCPServer instance (see the mcp-use entry contract).`);let n=a.default;if(!O(n))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 P=typeof n.port=="number"?n.port:void 0,S=typeof n.host=="string"?n.host:void 0,l=h(t.port,process.env,P),f=w(t.host,process.env,S),c=await(t.withInspector===!0?R(n,l,f):n.listen(l,{host:f})),m=typeof c?.port=="number"?c.port:l,g=typeof c?.url=="string"?c.url:`http://localhost:${m}`;return{port:m,url:g,close:async()=>{await n.close?.()}}}async function R(t,e,r){let{mountInspector:u}=await L(),s=typeof t.basePath=="string"?t.basePath:"/mcp",i=u({basePath:s,devMode:!1,oauthProxyAllowLoopback:!1});return t.app.use("*",async(p,a)=>{if(b(p.req.raw,s))return i(p.req.raw);await a()}),t.listen(e,{host:r})}async function L(){let t;try{t=await import("@mcp-use/inspector")}catch(e){throw _(e)?new Error("Built-in Inspector is unavailable; reinstall mcp-use to restore it."):e}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 O(t){return typeof t=="object"&&t!==null&&typeof t.listen=="function"}function _(t){return t!==null&&typeof t=="object"&&"code"in t&&(t.code==="ERR_MODULE_NOT_FOUND"||t.code==="MODULE_NOT_FOUND")}export{N as runStart};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as i,b as o}from"../chunk-DB3E6LBX.js";import{spawn as d}from"child_process";import{createRequire as l}from"module";import{dirname as u,join as p,resolve as y}from"path";async function f(e){let c=e.mcpDir===void 0?e.cwd:y(e.cwd,e.mcpDir),n=e.entry===void 0?i(c):i(e.cwd,e.entry),r=await o(e.cwd,n);r==="created"||r==="updated"?console.log(`[mcp-use] ${r} mcp-env.d.ts`):r==="user-owned"&&console.warn("[mcp-use] mcp-env.d.ts is user-owned; leaving it unchanged");let t=g(e.cwd);return w(t,e.cwd,e.tscArgs??[])}function g(e){let c=l(p(e,"package.json"));try{let n=c.resolve("typescript/package.json");return p(u(n),"bin","tsc")}catch{throw new Error(`TypeScript is not installed in ${e}. Install it with npm install --save-dev typescript.`)}}function w(e,c,n){return new Promise((r,t)=>{let s=d(process.execPath,[e,...n,"--noEmit"],{cwd:c,stdio:"inherit"});s.once("error",t),s.once("close",(a,m)=>{r(a??(m==="SIGINT"?130:1))})})}export{f as runTypecheck};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a(){}function d(){}function u(){}function l(){}function p(){}function x(e){return e}async function f(){return new Headers}var i={get:()=>{},getAll:()=>[],has:()=>!1,set:()=>{},delete:()=>{}};async function g(){return i}async function R(){return{isEnabled:!1,enable(){},disable(){}}}function c(e){let n=new Error(`redirect(${String(e)}) called outside Next.js`);throw Object.assign(n,{digest:`NEXT_REDIRECT;${String(e)}`}),n}var w=c;function h(){let e=new Error("notFound() called outside Next.js");throw Object.assign(e,{digest:"NEXT_NOT_FOUND"}),e}var v={push:"push",replace:"replace"},o=class e extends Response{static json(n,t){let r=new Headers(t?.headers);return r.set("content-type","application/json"),new e(JSON.stringify(n),{...t,headers:r})}static redirect(n,t=302){return new e(null,{status:t,headers:{location:String(n)}})}static next(){return new e(null)}static rewrite(){return new e(null)}},s=class extends Request{nextUrl;cookies=i;constructor(n,t){super(n,t),this.nextUrl=new URL(typeof n=="string"?n:n instanceof URL?n.href:n.url)}};function y(){return{ua:"",browser:{},device:{},engine:{},os:{},cpu:{},isBot:!1}}export{s as NextRequest,o as NextResponse,v as RedirectType,g as cookies,R as draftMode,f as headers,h as notFound,w as permanentRedirect,c as redirect,a as revalidatePath,d as revalidateTag,x as unstable_cache,l as unstable_cacheLife,p as unstable_cacheTag,u as unstable_noStore,y as userAgent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function b(e,c){return async(a,i,d)=>{typeof d=="function"&&(d=void 0);let l=!1,t=new AbortController;i.on("close",()=>{l||t.abort()}),i.destroyed===!0&&t.abort();let s;try{let n=await w(a,d,{signal:t.signal});s=await e.fetch(n,{...a.auth!==void 0&&{authInfo:a.auth},...d!==void 0&&{parsedBody:d}})}catch(n){try{c?.onerror?.(n instanceof Error?n:new Error(String(n)))}catch{}s=y(m(d))}let r={};for(let[n,f]of s.headers)r[n]=f;if(i.writeHead(s.status,r),s.body===null){l=!0,i.end();return}let o,u=()=>{o?.(),o=void 0},h=()=>new Promise(n=>{o=n});i.on("drain",u);let p=new Promise(n=>{t.signal.addEventListener("abort",()=>n(),{once:!0})});try{for await(let n of s.body){if(t.signal.aborted)break;let f=n instanceof Uint8Array?n:new Uint8Array(n);i.write(f)===!1&&await Promise.race([h(),p])}}catch{}l=!0,i.end()}}async function w(e,c,a){let i=(e.method??"GET").toUpperCase(),l=`http://${g(e.headers.host)??g(e.headers[":authority"])??"localhost"}${e.url??"/"}`,t=new Headers;for(let[r,o]of Object.entries(e.headers))if(!(o===void 0||r.startsWith(":")))if(Array.isArray(o))for(let u of o)t.append(r,u);else t.set(r,o);let s;if(i!=="GET"&&i!=="HEAD")if(c===void 0){let r=new TextDecoder,o="";for await(let u of e)o+=typeof u=="string"?u:r.decode(u,{stream:!0});o+=r.decode(),o.length>0&&(s=o)}else{let r=JSON.stringify(c);t.delete("content-encoding"),t.delete("transfer-encoding"),r===void 0?t.delete("content-length"):(s=r,t.set("content-length",String(new TextEncoder().encode(r).byteLength)))}return new Request(l,{method:i,headers:t,...a?.signal!==void 0&&{signal:a.signal},...s!==void 0&&{body:s}})}function g(e){return Array.isArray(e)?e[0]:e}function m(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let{method:c,id:a}=e;return typeof c!="string"?null:typeof a=="string"||typeof a=="number"?a:null}function y(e){return Response.json({jsonrpc:"2.0",error:{code:-32603,message:"Internal server error"},id:e},{status:500})}export{b as toNodeHandler,w as toWebRequest};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-use/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.0-beta.
|
|
4
|
+
"version": "4.0.0-beta.5",
|
|
5
5
|
"description": "Prebuilt CLI, development server, and build pipeline for mcp-use",
|
|
6
6
|
"author": "mcp-use, Inc.",
|
|
7
7
|
"license": "MIT",
|
|
@@ -36,9 +36,10 @@
|
|
|
36
36
|
"node": ">=22.22.2"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@tailwindcss/
|
|
40
|
-
"
|
|
41
|
-
"
|
|
39
|
+
"@tailwindcss/vite": "^4.2.0",
|
|
40
|
+
"@vitejs/plugin-react": "^6.0.3",
|
|
41
|
+
"tailwindcss": "^4.2.0",
|
|
42
|
+
"vite": "^8.0.16"
|
|
42
43
|
},
|
|
43
44
|
"peerDependencies": {
|
|
44
45
|
"@mcp-use/client": "^2.0.0-alpha.0",
|
|
@@ -54,13 +55,9 @@
|
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
57
|
"@modelcontextprotocol/server": "https://pkg.pr.new/@modelcontextprotocol/server@f60b40179b0f090f6d64248be1312245a160b5ee",
|
|
57
|
-
"@tailwindcss/vite": "^4.2.0",
|
|
58
|
-
"@vitejs/plugin-react": "^6.0.3",
|
|
59
58
|
"rimraf": "^6.1.3",
|
|
60
|
-
"tailwindcss": "^4.2.0",
|
|
61
59
|
"tsup": "^8.5.1",
|
|
62
|
-
"typescript": "^5.9.3"
|
|
63
|
-
"vite": "^8.0.16"
|
|
60
|
+
"typescript": "^5.9.3"
|
|
64
61
|
},
|
|
65
62
|
"publishConfig": {
|
|
66
63
|
"access": "public"
|