@mcp-use/cli 4.1.12-canary.0 → 4.1.12-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-K5AVW4TV.js → chunk-IS5RROVD.js} +9 -9
- package/dist/commands/client.js +1 -1
- package/dist/commands/screenshot.js +1 -1
- package/dist/commands/servers.js +6 -6
- package/dist/index.js +1 -1
- package/package.json +3 -3
- /package/dist/{chunk-JPZVQE3D.js → chunk-2STFQEQ4.js} +0 -0
package/dist/bin.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as o}from"./chunk-
|
|
2
|
+
import{a as o}from"./chunk-2STFQEQ4.js";import"./chunk-RXKUVCL7.js";import"./chunk-WOT6VMZA.js";import{readFileSync as i}from"fs";import{createRequire as a}from"module";import{dirname as t,join as c,parse as m}from"path";function p(){try{let e=a(import.meta.url).resolve("mcp-use"),n=t(e),s=m(n).root;for(;n!==s;){try{let r=JSON.parse(i(c(n,"package.json"),"utf8"));if(r.name==="mcp-use"&&typeof r.version=="string")return r.version}catch{}n=t(n)}}catch{}}o(process.argv.slice(2),{frameworkVersion:p()??"4.1.12-canary.2"}).then(e=>{process.exitCode=e},e=>{console.error(e instanceof Error?e.message:String(e)),process.exitCode=1});
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import{a,b as h,d as G,e as f,f as K,g as W,h as V,i as O,j as U,k as C,m as j}from"./chunk-Q6AC7LJS.js";import{createHash as
|
|
1
|
+
import{a,b as h,d as G,e as f,f as K,g as W,h as V,i as O,j as U,k as C,m as j}from"./chunk-Q6AC7LJS.js";import{createHash as Oe}from"crypto";import{rm as oe}from"fs/promises";import{join as T}from"path";import{createInterface as $e}from"readline/promises";import{parseArgs as x}from"util";var d=["-h, --help","Show this help"],g=["--json","Emit machine-readable JSON (accepted anywhere after client)"],b=new Map;function m(e,t){b.set(e,t)}m("",{usage:"mcp-use client <command>",summary:"Connect to and invoke saved HTTP(S) MCP servers.",commands:[["connect <name> <url>","Connect and save a server"],["list","List saved servers"],["remove <name>","Remove a saved server"],["<name>","Invoke a saved server"]],options:[d]});m("connect",{usage:"mcp-use client connect <name> <url> [options]",summary:"Connect to and save an HTTP(S) MCP server.",options:[['-H, --header <"Key: Value">',"Static header (repeatable)"],["--no-oauth","Skip OAuth on authorization challenges"],["--auth-timeout <ms>","OAuth wait timeout (default: 300000)"],["--protocol <auto|legacy|modern>","Protocol mode (default: auto; modern is stateless/sessionless)"],["--no-open","Print the OAuth URL without opening a browser"],g,d],notes:["JSON mode never opens a browser or prints an OAuth URL/state. If new consent is required, it returns oauth_interaction_required with an interactive retry command."]});m("list",{usage:"mcp-use client list [options]",summary:"List saved MCP servers.",options:[g,d]});m("remove",{usage:"mcp-use client remove <name> [options]",summary:"Immediately remove a saved server and its credentials.",options:[g,d]});m("<name>",{usage:"mcp-use client <name> <command>",summary:"Invoke a saved MCP server.",commands:[["tools","List, describe, or call tools"],["resources","List or read resources"],["prompts","List or get prompts"],["auth","Authenticate or inspect saved OAuth state"]],options:[d]});m("<name> tools",{usage:"mcp-use client <name> tools <command>",summary:"Use tools on a saved MCP server.",commands:[["list","List tools"],["describe <tool>","Show a tool definition"],["call <tool> [args...]","Call a tool"]],options:[d]});m("<name> tools list",{usage:"mcp-use client <name> tools list [options]",summary:"List tools on a saved MCP server.",options:[g,d]});m("<name> tools describe",{usage:"mcp-use client <name> tools describe <tool> [options]",summary:"Show one tool definition.",options:[g,d]});m("<name> tools call",{usage:"mcp-use client <name> tools call <tool> [args...] [options]",summary:"Call a tool on a saved MCP server.",options:[["--timeout <ms>","Call timeout (default: 30000)"],g,d],notes:["Arguments are one JSON object or key=value/key:=<json> pairs; do not mix forms."]});m("<name> resources",{usage:"mcp-use client <name> resources <command>",summary:"Use resources on a saved MCP server.",commands:[["list","List resources"],["read <uri>","Read a resource"]],options:[d]});m("<name> resources list",{usage:"mcp-use client <name> resources list [options]",summary:"List resources on a saved MCP server.",options:[g,d]});m("<name> resources read",{usage:"mcp-use client <name> resources read <uri> [options]",summary:"Read one resource.",options:[g,d]});m("<name> prompts",{usage:"mcp-use client <name> prompts <command>",summary:"Use prompts on a saved MCP server.",commands:[["list","List prompts"],["get <prompt> [args...]","Get a prompt"]],options:[d]});m("<name> prompts list",{usage:"mcp-use client <name> prompts list [options]",summary:"List prompts on a saved MCP server.",options:[g,d]});m("<name> prompts get",{usage:"mcp-use client <name> prompts get <prompt> [args...] [options]",summary:"Get a prompt from a saved MCP server.",options:[g,d],notes:["Arguments are one JSON object or key=value/key:=<json> pairs; do not mix forms."]});m("<name> auth",{usage:"mcp-use client <name> auth <command>",summary:"Manage saved OAuth state.",commands:[["login","Authenticate this server"],["status","Show OAuth status"],["logout","Delete saved OAuth credentials"]],options:[d]});m("<name> auth login",{usage:"mcp-use client <name> auth login [options]",summary:"Authenticate a saved MCP server with OAuth.",options:[g,d]});m("<name> auth status",{usage:"mcp-use client <name> auth status [options]",summary:"Show saved OAuth status.",options:[g,d]});m("<name> auth logout",{usage:"mcp-use client <name> auth logout [options]",summary:"Delete saved OAuth credentials but keep the server.",options:[["--yes","Skip the confirmation prompt"],g,d]});function Z(e){let t=e.filter(u=>u!=="--help"&&u!=="-h"&&u!=="--json"),n=t[0];if(n===void 0)return{text:$(b.get(""))};if(n==="connect"||n==="list"||n==="remove")return{text:$(b.get(n))};let o=t[1];if(o===void 0)return{text:$(b.get("<name>"))};if(!["tools","resources","prompts","auth"].includes(o))return{error:`Unknown client command family: ${o}`};let r=t[2],s=`<name> ${o}`;if(r===void 0)return{text:$(b.get(s))};let i=`${s} ${r}`,l=b.get(i);return l===void 0?{error:`Unknown client ${o} command: ${r}`}:{text:$(l)}}function $(e){let t=[`Usage: ${e.usage}`,e.summary];return e.commands!==void 0&&t.push(Y("Commands",e.commands)),e.options!==void 0&&t.push(Y("Options",e.options)),e.notes!==void 0&&t.push(e.notes.join(`
|
|
2
2
|
`)),t.join(`
|
|
3
3
|
|
|
4
4
|
`)}function Y(e,t){let n=Math.max(...t.map(([o])=>o.length));return`${e}:
|
|
5
5
|
${t.map(([o,r])=>` ${o.padEnd(n)} ${r}`).join(`
|
|
6
|
-
`)}`}import{spawn as
|
|
7
|
-
`);async function
|
|
8
|
-
`),n!==void 0){let[s,i]=
|
|
6
|
+
`)}`}import{spawn as le}from"child_process";import{readFileSync as de}from"fs";import{chmod as me,mkdir as pe}from"fs/promises";import{dirname as fe,join as R,resolve as ge}from"path";import{pathToFileURL as ee}from"url";var A=R(j,"client-sdk"),w="@mcp-use/client",he="^2.0.0-alpha.0",we=[`[mcp-use] ${w} is not installed.`,"The `mcp-use client` and `mcp-use screenshot` commands require it.","Install it in your project:",""," npm install @mcp-use/client",""," pnpm add @mcp-use/client",""," bun add @mcp-use/client"].join(`
|
|
7
|
+
`);async function ve(e){let t=ge(e);for(;;){if(await O(R(t,"package.json")))return t;let n=fe(t);if(n===t)return;t=n}}async function te(e={}){try{return await Ce()}catch(t){if(!Q(t))throw t;if(e.allowInstall===!1)throw new h("client_install_required",`${w} is required for this command.`,{nextSteps:[{description:"Install the optional client SDK",command:`npm install ${w}`}]});let n=await ye();try{return n.location==="sandbox"?await ke():await be(n.projectRoot)}catch(o){throw Q(o)?new a(we):o}}}async function ye(){let e=Se(),t=`${w}@${e}`,n=await ve(process.cwd());if(process.stderr.write(`[mcp-use] installing ${w}\u2026
|
|
8
|
+
`),n!==void 0){let[s,i]=Pe(t);if(await X(s,i,n)!==0)throw new h("client_install_failed",`Failed to install ${w}.`);return{location:"project",projectRoot:n}}await pe(A,{recursive:!0,mode:448}),await me(A,448);let o=R(A,"package.json");if(await O(o)||await C(o,{private:!0,dependencies:{[w]:e}}),await X("npm",["install",t],A)!==0)throw new h("client_install_failed",`Failed to install ${w}.`);return{location:"sandbox"}}function Pe(e){let t=process.env.npm_config_user_agent??"";return t.startsWith("pnpm/")?["pnpm",["add",e]]:t.startsWith("bun/")?["bun",["add",e]]:["npm",["install",e]]}function Se(){for(let e of["../package.json","../../package.json"])try{let t=de(new URL(e,import.meta.url),"utf8"),n=JSON.parse(t);if(n.name!=="mcp-use")continue;let o=n.peerDependencies?.[w];if(typeof o=="string"&&o.length>0)return o}catch{}return he}async function Ce(){return D(),import("@mcp-use/client")}async function be(e){D();let t=ee(R(e,"package.json")).href;return import(await import.meta.resolve(w,t))}async function ke(){D();let e=R(A,"node_modules",w,"dist","index.js");return await import(ee(e).href)}function D(){let e=Object.getOwnPropertyDescriptor(globalThis,"localStorage");e?.get===void 0||e.configurable!==!0||Object.defineProperty(globalThis,"localStorage",{configurable:!0,enumerable:e.enumerable??!1,value:void 0,writable:!0})}function Q(e){if(!(e instanceof Error))return!1;let t=e.code;return t==="ERR_MODULE_NOT_FOUND"||t==="MODULE_NOT_FOUND"?e.message.includes(w)||e.message.includes("Cannot find package"):!1}function X(e,t,n){return new Promise((o,r)=>{let s=le(e,t,{cwd:n,stdio:"inherit",shell:process.platform==="win32"});s.once("error",r),s.once("exit",(i,l)=>{o(l==="SIGINT"?130:i??1)})})}var re=T(j,"client"),M=T(re,"servers.json");async function ot(e){if(e.includes("--help")||e.includes("-h")){let r=Z(e);return r.text!==void 0?(process.stdout.write(`${r.text}
|
|
9
9
|
`),0):(process.stderr.write(`${r.error}
|
|
10
|
-
`),2)}let t=G(e),n=e.filter(r=>r!=="--json"),o=n[0];try{if(o==="connect")return await
|
|
11
|
-
This server is using mixed auth. Public tools are available now; run \`mcp-use client ${r} auth login\` to authenticate.`:`Connected and saved ${r}.`),0}async function
|
|
12
|
-
`)||"No saved servers."),0}async function
|
|
13
|
-
`)),0}if(i==="describe"){let c=E(t.slice(2),`mcp-use client ${e} tools describe <tool>`),p=(await u.listTools()).find(P=>P.name===c);if(p===void 0)throw new a(`Tool not found: ${c}`);return f(p,n),0}if(i==="call")return await
|
|
10
|
+
`),2)}let t=G(e),n=e.filter(r=>r!=="--json"),o=n[0];try{if(o==="connect")return await Ae(n.slice(1),t);if(o==="list")return await Re(n.slice(1),t);if(o==="remove")return await Ee(n.slice(1),t);if(o===void 0)throw new a("Usage: mcp-use client <connect|list|remove|name>");return await Te(o,n.slice(1),t)}catch(r){return K(r instanceof TypeError?new a(r.message):r,t)}}async function Ae(e,t){let{values:n,positionals:o}=x({args:[...e],allowPositionals:!0,strict:!0,options:{header:{type:"string",short:"H",multiple:!0},"no-oauth":{type:"boolean"},"auth-timeout":{type:"string"},protocol:{type:"string",default:"auto"},"no-open":{type:"boolean"}}});if(o.length!==2)throw new a("Usage: mcp-use client connect <name> <url>");let[r,s]=o;Me(r);let i=new URL(s);if(!["http:","https:"].includes(i.protocol))throw new a("Client URLs must use http or https.");let l=je(n.protocol),u=ae(n["auth-timeout"]??"300000","--auth-timeout"),c=await _();if(c.servers[r]!==void 0)throw new a(`Saved server already exists: ${r}`);let p={headers:Ue(n.header??[])},P={url:i.href,oauth:n["no-oauth"]!==!0,protocol:l},k=await N(r,P,p,u,ie({noOpen:n["no-open"]===!0,json:t}),t,`mcp-use client connect ${r} <url> --no-open`);await k.discoverAuthorization();let y=k.authorization;return await k.disconnect(),c.servers[r]=P,await C(M,c),await C(q(r),p),f({name:r,url:H(P.url),protocol:l,...y?{authorization:{...y,...y.resource?{resource:H(y.resource)}:{}}}:{}},t,y?.mode==="mixed"&&!y.authenticated?`Connected and saved ${r}.
|
|
11
|
+
This server is using mixed auth. Public tools are available now; run \`mcp-use client ${r} auth login\` to authenticate.`:`Connected and saved ${r}.`),0}async function Re(e,t){S(e);let n=await _(),o=Object.entries(n.servers).map(([r,s])=>({name:r,...s,url:H(s.url)}));return f(o,t,o.map(r=>`${r.name} ${r.url}`).join(`
|
|
12
|
+
`)||"No saved servers."),0}async function Ee(e,t){let{positionals:n}=x({args:[...e],allowPositionals:!0,strict:!0,options:{}}),o=E(n,"mcp-use client remove <name>"),r=await _();if(!Object.hasOwn(r.servers,o))throw new a(`Unknown saved server: ${o}. Run \`mcp-use client list\` to see saved servers.`);return delete r.servers[o],await C(M,r),await oe(B(o),{recursive:!0,force:!0}),f({removed:o},t,`Removed ${o}.`),0}async function Te(e,t,n){let r=(await _()).servers[e];if(r===void 0)throw new a(`Unknown saved server: ${e}. Run \`mcp-use client connect ${e} <url>\`.`);let s=t[0],i=t[1];if(s==="auth"){if(i==="status"){S(t.slice(2));let c=await O(z(e));return f({name:e,oauth:r.oauth,authenticated:c},n,c?"Authenticated.":"No saved OAuth session."),0}if(i==="logout"){let{values:c,positionals:p}=x({args:[...t.slice(2)],allowPositionals:!0,strict:!0,options:{yes:{type:"boolean"}}});if(p.length!==0)throw new a(`Usage: mcp-use client ${e} auth logout`);return await W(`Delete OAuth credentials for ${e}?`,{yes:c.yes===!0,json:n})&&(await oe(z(e),{recursive:!0,force:!0}),f({loggedOut:e},n,`Logged out ${e}.`)),0}}xe(e,s,i,t.slice(2));let l=await U(q(e),{}),u=await N(e,r,l,3e5,ie({noOpen:!1,json:n}),n,s==="auth"&&i==="login"?`mcp-use client ${e} auth login`:void 0);try{if(s==="auth"&&i==="login")return S(t.slice(2)),await u.authenticate(),f({name:e,authenticated:!0},n,`Authenticated ${e}.`),0;if(s==="tools"){if(i==="list"){S(t.slice(2));let c=await u.listTools();return f(c,n,c.map(p=>p.description?`${p.name} - ${p.description}`:p.name).join(`
|
|
13
|
+
`)),0}if(i==="describe"){let c=E(t.slice(2),`mcp-use client ${e} tools describe <tool>`),p=(await u.listTools()).find(P=>P.name===c);if(p===void 0)throw new a(`Tool not found: ${c}`);return f(p,n),0}if(i==="call")return await _e(u,e,t.slice(2),n)}if(s==="resources"){if(i==="list"){S(t.slice(2));let c=await u.listResources();return f(c,n),0}if(i==="read"){let c=E(t.slice(2),`mcp-use client ${e} resources read <uri>`);return f(await u.readResource(c),n),0}}if(s==="prompts"){if(i==="list")return S(t.slice(2)),f(await u.listPrompts(),n),0;if(i==="get"){let c=t[2];if(c===void 0)throw new a(`Usage: mcp-use client ${e} prompts get <prompt> [args]`);return f(await u.getPrompt(c,I(t.slice(3))),n),0}}throw new a(`Usage: mcp-use client ${e} <tools|resources|prompts|auth> ...`)}finally{await u.disconnect()}}function xe(e,t,n,o){if(t==="tools"&&n==="list"||t==="resources"&&n==="list"||t==="prompts"&&n==="list"){S(o);return}if(t==="auth"&&n==="login"){S(o);return}if(t==="tools"&&n==="describe"){E(o,`mcp-use client ${e} tools describe <tool>`);return}if(t==="tools"&&n==="call"){se(e,o);return}if(t==="resources"&&n==="read"){E(o,`mcp-use client ${e} resources read <uri>`);return}if(t==="prompts"&&n==="get"){if(o[0]===void 0)throw new a(`Usage: mcp-use client ${e} prompts get <prompt> [args]`);I(o.slice(1));return}throw new a(`Usage: mcp-use client ${e} <tools|resources|prompts|auth> ...`)}async function _e(e,t,n,o){let{tool:r,timeout:s,positionals:i}=se(t,n),l=await e.callTool(r,I(i),{timeout:s});if(l.isError===!0)throw new h("tool_error",`Tool ${r} returned an error.`,l);return f(l,o),0}function se(e,t){let n=t[0];if(n===void 0)throw new a(`Usage: mcp-use client ${e} tools call <tool> [args]`);let{values:o,positionals:r}=x({args:[...t.slice(1)],allowPositionals:!0,strict:!0,options:{timeout:{type:"string",default:"30000"}}}),s=ae(o.timeout,"--timeout");return I(r),{tool:n,timeout:s,positionals:r}}async function N(e,t,n,o,r=process.stdin.isTTY?"ask":"never",s=!1,i=`mcp-use client ${e} tools list`){let{createOAuthProvider:l,MCPClient:u,logger:c}=await te({allowInstall:!s});s&&(c.level="silent");let p,P=s&&t.oauth?new Promise((v,L)=>{p=L}):void 0,k=z(e),y=t.oauth?await l(t.url,{baseDir:k,authTimeoutMs:o,storageKeyPrefix:`mcp-use-cli:${e}`,openBrowser:async v=>{if(s){let L=new h("oauth_interaction_required","OAuth interaction is required; retry this command without --json in a terminal.",{server:e,nextSteps:[{description:"Authenticate interactively in a terminal",command:i}]});throw p?.(L),L}if(r==="never"){process.stderr.write(`Open this URL to authenticate:
|
|
14
14
|
${v}
|
|
15
|
-
`);return}await
|
|
15
|
+
`);return}await Le(),V(v)}}):void 0,ue=t.protocol==="auto"?{protocolNegotiation:"auto"}:t.protocol==="modern"?{protocolNegotiation:{pin:"2026-07-28"}}:{protocolNegotiation:"legacy",clientOptions:{supportedProtocolVersions:["2025-11-25"]}},F=new u({mcpServers:{[e]:{url:t.url,...n.headers!==void 0?{headers:n.headers}:{},...y!==void 0?{authProvider:y}:{oauth:!1},...ue}}});try{let v=F.connect(e);return await(P===void 0?v:Promise.race([v,P]))}catch(v){throw v instanceof h&&v.code==="oauth_interaction_required"?(y?.dispose?.(),await F.closeSession?.(e),v):De(Ie(v,t.protocol),t,n)}}async function rt(e,t=3e5,n=!1){let r=(await _()).servers[e];if(r===void 0)throw new a(`Unknown saved server: ${e}`);let s=await U(q(e),{});return N(e,r,s,t,process.stdin.isTTY?"ask":"never",n)}async function st(e,t,n=!1){return N("screenshot",{url:e,oauth:!1,protocol:"auto"},{headers:t},3e5,"never",n)}function I(e){if(e.length===0)return{};if(e.length===1&&e[0]?.trimStart().startsWith("{")){let n=ne(e[0],"The JSON argument");if(n===null||Array.isArray(n)||typeof n!="object")throw new a("The JSON argument must be an object.");return n}let t={};for(let n of e){let o=n.indexOf(":="),r=n.indexOf("="),s=o>=0?o:r,i=o>=0?2:1;if(s<=0)throw new a(`Expected key=value or key:=<json>, received: ${n}`);let l=n.slice(0,s).replace(/^--/,""),u=n.slice(s+i);t[l]=o>=0?ne(u,`The value for "${l}"`):u}return t}function ne(e,t){try{return JSON.parse(e)}catch(n){throw new a(`${t} is not valid JSON: ${n instanceof Error?n.message:String(n)}`)}}function ie(e){return e.json||e.noOpen||!process.stdin.isTTY?"never":"ask"}async function Le(){let e=$e({input:process.stdin,output:process.stderr});try{await e.question("This server requires OAuth. Press Enter to open your browser.")}finally{e.close()}}function Ue(e){let t={};for(let n of e){let o=n.indexOf(":");if(o<=0)throw new a(`Invalid header: ${n}`);t[n.slice(0,o).trim()]=n.slice(o+1).trim()}return t}function je(e){if(e!=="auto"&&e!=="legacy"&&e!=="modern")throw new a("Invalid protocol. Expected auto, legacy, or modern.");return e}function ae(e,t){let n=Number(e);if(!Number.isInteger(n)||n<=0)throw new a(`${t} must be a positive integer.`);return n}function Me(e){if(!/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/.test(e))throw new a("Server names must be 1-64 filesystem-safe letters, numbers, dots, dashes, or underscores.")}function H(e){let t=new URL(e);(t.username!==""||t.password!=="")&&(t.username="[REDACTED]",t.password="");for(let n of[...t.searchParams.keys()])t.searchParams.set(n,"[REDACTED]");return t.hash!==""&&(t.hash="[REDACTED]"),t.href}async function _(){let e=await U(M,{servers:{}}),t={servers:{}},n=!1;for(let[o,r]of Object.entries(e.servers)){let s=Ne(r.protocol);t.servers[o]={...r,protocol:s},n||=s!==r.protocol}return n&&await C(M,t),t}function Ne(e){if(e==="auto"||e==="legacy"||e==="modern")return e;if(e===void 0)return"auto";if(e==="2025-11-25")return"legacy";if(e==="2026-07-28")return"modern";throw new a("Saved server has an invalid protocol setting. Remove and reconnect it.")}function Ie(e,t){return t==="auto"||!(e instanceof Error)||!e.message.includes("Unsupported protocol version")&&!e.message.includes("pinned protocol version")?e:t==="legacy"?new h("protocol_mismatch","Server does not support the requested legacy protocol."):new h("protocol_mismatch","Server does not support the requested modern protocol (stateless/sessionless, no fallback).")}function De(e,t,n){let o=He(t.url,n.headers);if(!(e instanceof Error)||o.size===0)return e;let r=ce(e.message,o);if(e instanceof h)return new h(e.code,r,J(e.details,o));let s=new Error(r);return s.name=e.name,s}function He(e,t){let n=new Set,o=new URL(e);for(let r of[o.username,o.password,...o.searchParams.values(),o.hash.slice(1)])r!==""&&n.add(r);for(let r of Object.values(t??{}))if(r!==""){n.add(r);let s=r.match(/^Bearer\s+(.+)$/i)?.[1];s!==void 0&&n.add(s)}return n}function J(e,t){return typeof e=="string"?ce(e,t):Array.isArray(e)?e.map(n=>J(n,t)):e===null||typeof e!="object"?e:Object.fromEntries(Object.entries(e).map(([n,o])=>[n,J(o,t)]))}function ce(e,t){let n=e;for(let o of t)n=n.replaceAll(o,"[REDACTED]");return n}function B(e){return T(re,"credentials",Oe("sha256").update(e).digest("hex"))}function q(e){return T(B(e),"credentials.json")}function z(e){return T(B(e),"oauth")}function S(e){x({args:[...e],allowPositionals:!1,strict:!0,options:{}})}function E(e,t){if(e.length!==1)throw new a(`Usage: ${t}`);return e[0]}export{ot as a,rt as b,st as c,I as d};
|
package/dist/commands/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d}from"../chunk-
|
|
1
|
+
import{a,b,c,d}from"../chunk-IS5RROVD.js";import"../chunk-Q6AC7LJS.js";import"../chunk-S3WHXP7I.js";import"../chunk-WOT6VMZA.js";export{c as openDirectConnection,b as openSavedConnection,d as parseMcpArguments,a as runClient};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as R,c as B,d as H}from"../chunk-
|
|
1
|
+
import{b as R,c as B,d as H}from"../chunk-IS5RROVD.js";import{a,b as s,d as x,e as M,f as T}from"../chunk-Q6AC7LJS.js";import"../chunk-S3WHXP7I.js";import"../chunk-WOT6VMZA.js";import{spawn as $}from"child_process";import{access as j,mkdtemp as F,rm as A,writeFile as G}from"fs/promises";import{createServer as V}from"net";import{tmpdir as J}from"os";import{basename as q,join as z,resolve as W}from"path";import{parseArgs as K}from"util";import{fileURLToPath as X}from"url";var Q=`Usage: mcp-use screenshot (--server <name> | --mcp <url>) --tool <name> [args...] [options]
|
|
2
2
|
|
|
3
3
|
Call a view-backed MCP tool and capture its rendered MCP App as PNG.
|
|
4
4
|
|
package/dist/commands/servers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as m}from"../chunk-2E4ZVDXN.js";import{a as u,b as
|
|
1
|
+
import{h as m}from"../chunk-2E4ZVDXN.js";import{a as u,b as $,d as E,e as p,f as A,g as w}from"../chunk-Q6AC7LJS.js";import"../chunk-S3WHXP7I.js";import"../chunk-WOT6VMZA.js";import{parseArgs as h}from"util";var I=`Usage: mcp-use servers <command> [options]
|
|
2
2
|
|
|
3
3
|
Manage cloud servers and environment variables.
|
|
4
4
|
|
|
@@ -74,7 +74,7 @@ Options:
|
|
|
74
74
|
Options:
|
|
75
75
|
--org <id-or-slug> Override the active organization
|
|
76
76
|
--branch <name> Set a preview value for a branch (default: production)
|
|
77
|
-
--secret
|
|
77
|
+
--secret Store the value as a write-only secret. Required on every write to keep it write-only.
|
|
78
78
|
--json Emit mutation metadata only; never the value
|
|
79
79
|
-h, --help Show this help`,"env unset":`Usage: mcp-use servers env unset <server> <key> [options]
|
|
80
80
|
|
|
@@ -84,7 +84,7 @@ Options:
|
|
|
84
84
|
--yes Confirm deletion without prompting
|
|
85
85
|
--json Emit the deletion result; never prompt
|
|
86
86
|
-h, --help Show this help`};async function W(n){if(n.some(e=>e==="--help"||e==="-h")){let e=n[0]==="env"&&n[1]!==void 0?`env ${n[1]}`:n[0]??"";return process.stdout.write(`${D[e]??I}
|
|
87
|
-
`),0}let t
|
|
88
|
-
`)||"No environment variables."),0}async function T(n,t){let{values:e,positionals:r}=h({args:[...n],allowPositionals:!0,strict:!0,options:{...f(),branch:{type:"string"},secret:{type:"boolean"}}});if(r.length!==2)throw new u("Usage: mcp-use servers env set <server> <KEY=VALUE>");let[s,o]=r,c=o.indexOf("=");if(c<=0)throw new u("Environment value must be KEY=VALUE.");let l=o.slice(0,c),i=o.slice(c+1),{api:d}=await m(e.org),b=(await U(d,s,e.branch)).find(S=>S.key===l&&(S.branch??void 0)===e.branch),k={key:l,value:i,branch:e.branch??null,environments:e.branch===void 0?["production"]:["preview"],sensitive:e.secret===!0};b===void 0?await d.request(`/servers/${encodeURIComponent(s)}/env-variables`,{method:"POST",body:JSON.stringify(k)}):await d.request(`/servers/${encodeURIComponent(s)}/env-variables/${encodeURIComponent(b.id)}`,{method:"PATCH",body:JSON.stringify(k)});let R={serverId:s,key:l,scope:e.branch===void 0?"production":"preview",branch:e.branch??null,secret:e.secret===!0,updated:b!==void 0};return p(R,t
|
|
89
|
-
`)}function
|
|
90
|
-
`)}function
|
|
87
|
+
`),0}let t=E(n);try{let e=n[0];if(e==="list")return await j(n.slice(1),t);if(e==="get")return await L(n.slice(1),t);if(e==="update")return await q(n.slice(1),t);if(e==="delete")return await N(n.slice(1),t);if(e==="env")return await x(n.slice(1),t);throw new u("Usage: mcp-use servers <list|get|update|delete|env>")}catch(e){return A(e instanceof TypeError?new u(e.message):e,t)}}async function j(n,t){let{values:e}=h({args:[...n],allowPositionals:!1,strict:!0,options:G()}),{api:r,organizationId:s}=await m(e.org),{limit:o,skip:c}=J(e.limit,e.skip),l=new URLSearchParams({organizationId:s,limit:String(o),skip:String(c)}),i=await r.request(`/servers?${l}`);return p(i,t,V(i)),0}async function L(n,t){let{values:e,positionals:r}=h({args:[...n],allowPositionals:!0,strict:!0,options:f()}),s=v(r,"mcp-use servers get <id-or-slug>"),{api:o}=await m(e.org),c=await o.request(`/servers/${encodeURIComponent(s)}`);return p(c,t,H(c)),0}async function q(n,t){let{values:e,positionals:r}=h({args:[...n],allowPositionals:!0,strict:!0,options:{...f(),name:{type:"string"},description:{type:"string"},branch:{type:"string"},"root-dir":{type:"string"},"build-command":{type:"string"},"start-command":{type:"string"},"watch-paths":{type:"string",multiple:!0},"deploy-branches":{type:"string",multiple:!0},"wait-for-ci":{type:"boolean"},"no-wait-for-ci":{type:"boolean"}}}),s=v(r,"mcp-use servers update <id-or-slug>"),o={...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}:{}};if(e["wait-for-ci"]===!0&&e["no-wait-for-ci"]===!0)throw new u("--wait-for-ci and --no-wait-for-ci cannot be used together.");let c={...e.name!==void 0?{name:e.name}:{},...e.description!==void 0?{description:e.description}:{},...e.branch!==void 0?{productionBranch:e.branch}:{},...e["watch-paths"]!==void 0?{watchPaths:O(e["watch-paths"],"--watch-paths",512)}:{},...e["deploy-branches"]!==void 0?{deployBranchPatterns:O(e["deploy-branches"],"--deploy-branches",255)}:{},...e["wait-for-ci"]===!0?{waitForCi:!0}:{},...e["no-wait-for-ci"]===!0?{waitForCi:!1}:{},...Object.keys(o).length>0?{config:o}:{}};if(Object.keys(c).length===0)throw new u("servers update requires at least one mutation option.");let{api:l}=await m(e.org),i=await l.request(`/servers/${encodeURIComponent(s)}`,{method:"PATCH",body:JSON.stringify(c)});return p(i,t,`Updated ${s}.`),0}async function N(n,t){let{values:e,positionals:r}=h({args:[...n],allowPositionals:!0,strict:!0,options:{...f(),yes:{type:"boolean"}}}),s=v(r,"mcp-use servers delete <id-or-slug>");if(!await w(`Delete server ${s}?`,{yes:e.yes===!0,json:t}))return 0;let{api:o}=await m(e.org);return await o.request(`/servers/${encodeURIComponent(s)}`,{method:"DELETE"}),p({deleted:s},t,`Deleted ${s}.`),0}async function x(n,t){let e=n[0];if(e==="list")return z(n.slice(1),t);if(e==="set")return T(n.slice(1),t);if(e==="unset")return F(n.slice(1),t);throw new u("Usage: mcp-use servers env <list|set|unset>")}async function z(n,t){let{values:e,positionals:r}=h({args:[...n],allowPositionals:!0,strict:!0,options:{...f(),branch:{type:"string"}}}),s=v(r,"mcp-use servers env list <server>"),{api:o}=await m(e.org),l=(await U(o,s,e.branch)).map(i=>({id:i.id,key:i.key,branch:i.branch??null,environments:i.environments??[],sensitive:i.sensitive===!0,createdAt:i.createdAt,updatedAt:i.updatedAt}));return p(l,t,l.map(i=>i.key).join(`
|
|
88
|
+
`)||"No environment variables."),0}async function T(n,t){let{values:e,positionals:r}=h({args:[...n],allowPositionals:!0,strict:!0,options:{...f(),branch:{type:"string"},secret:{type:"boolean"}}});if(r.length!==2)throw new u("Usage: mcp-use servers env set <server> <KEY=VALUE>");let[s,o]=r,c=o.indexOf("=");if(c<=0)throw new u("Environment value must be KEY=VALUE.");let l=o.slice(0,c),i=o.slice(c+1),{api:d}=await m(e.org),b=(await U(d,s,e.branch)).find(S=>S.key===l&&(S.branch??void 0)===e.branch),k={key:l,value:i,branch:e.branch??null,environments:e.branch===void 0?["production"]:["preview"],sensitive:e.secret===!0};b===void 0?await d.request(`/servers/${encodeURIComponent(s)}/env-variables`,{method:"POST",body:JSON.stringify(k)}):await d.request(`/servers/${encodeURIComponent(s)}/env-variables/${encodeURIComponent(b.id)}`,{method:"PATCH",body:JSON.stringify(k)});let R={serverId:s,key:l,scope:e.branch===void 0?"production":"preview",branch:e.branch??null,secret:e.secret===!0,updated:b!==void 0};return p(R,t,e.secret===!0?`Set ${l} (saved as write-only).`:`Set ${l}.`),0}async function F(n,t){let{values:e,positionals:r}=h({args:[...n],allowPositionals:!0,strict:!0,options:{...f(),branch:{type:"string"},yes:{type:"boolean"}}});if(r.length!==2)throw new u("Usage: mcp-use servers env unset <server> <key>");let[s,o]=r;if(!await w(`Delete environment variable ${o}?`,{yes:e.yes===!0,json:t}))return 0;let{api:c}=await m(e.org),i=(await U(c,s,e.branch)).find(d=>d.key===o&&(d.branch??void 0)===e.branch);if(i===void 0){let d=e.branch===void 0?"production":`branch ${e.branch}`;throw new $("env_variable_not_found",`Environment variable not found on ${s} (${d}): ${o}`)}return await c.request(`/servers/${encodeURIComponent(s)}/env-variables/${encodeURIComponent(i.id)}`,{method:"DELETE"}),p({deleted:o},t,`Deleted ${o}.`),0}async function U(n,t,e){let r=e===void 0?"":`?branch=${encodeURIComponent(e)}`;return n.request(`/servers/${encodeURIComponent(t)}/env-variables${r}`)}function f(){return{org:{type:"string"},json:{type:"boolean"}}}function V(n){let t=M(n,"items");return t.length===0?"No servers.":["NAME STATUS SOURCE REGION UPDATED",...t.map(r=>{let s=C(r,"connectedRepository"),o=y(s,"isManaged")===!0?"managed":s!==void 0?"github":a(r,"externalUrl")!==void 0?"external":"-";return[a(r,"name")??a(r,"slug")??"-",a(r,"status")??a(r,"latestDeploymentStatus")??"-",o,a(r,"region")??"AUTO",a(r,"updatedAt")??"-"].join(" ")})].join(`
|
|
89
|
+
`)}function H(n){if(!g(n))return String(n);let t=C(n,"connectedRepository"),e=y(t,"isManaged")===!0?"managed":t!==void 0?"github":a(n,"externalUrl")!==void 0?"external":"-",r=P(t,"watchPaths"),s=P(t,"deployBranchPatterns"),o=y(t,"waitForCi");return[`Name: ${a(n,"name")??"-"}`,`ID: ${a(n,"id")??"-"}`,`Slug: ${a(n,"slug")??"-"}`,`Status: ${a(n,"status")??a(n,"latestDeploymentStatus")??"-"}`,`Source: ${e}`,`Region: ${a(n,"region")??"AUTO"}`,`MCP URL: ${a(n,"mcpUrl")??"-"}`,...t!==void 0?[`Watch paths: ${r.length>0?r.join(", "):"all changes"}`,`Deploy branches: ${s.length>0?s.join(", "):"all branches"}`,`Wait for CI: ${o===!0?"yes":"no"}`]:[],`Updated: ${a(n,"updatedAt")??"-"}`].join(`
|
|
90
|
+
`)}function M(n,t){if(!g(n))return[];let e=n[t];return Array.isArray(e)?e.filter(g):[]}function C(n,t){if(!g(n))return;let e=n[t];return g(e)?e:void 0}function a(n,t){if(!g(n))return;let e=n[t];return typeof e=="string"&&e!==""?e:void 0}function y(n,t){if(!g(n))return;let e=n[t];return typeof e=="boolean"?e:void 0}function P(n,t){if(!g(n))return[];let e=n[t];return Array.isArray(e)?e.filter(r=>typeof r=="string"):[]}function O(n,t,e){if(n.length===1&&n[0]==="")return[];if(n.length>32)throw new u(`${t} accepts at most 32 patterns.`);if(n.some(r=>r===""))throw new u(`${t} accepts an empty value only by itself to clear all patterns.`);if(n.some(r=>r.length>e))throw new u(`${t} patterns may not exceed ${e} characters.`);return n}function g(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function G(){return{...f(),limit:{type:"string",default:"30"},skip:{type:"string",default:"0"}}}function v(n,t){if(n.length!==1)throw new u(`Usage: ${t}`);return n[0]}function J(n,t){let e=Number(n??"30"),r=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(r)||r<0)throw new u("--skip must be a non-negative integer.");return{limit:e,skip:r}}export{W as runServers};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-2STFQEQ4.js";import"./chunk-RXKUVCL7.js";import"./chunk-WOT6VMZA.js";export{a as main};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-use/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.1.12-canary.
|
|
4
|
+
"version": "4.1.12-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",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"typescript": "^5.9.3",
|
|
75
75
|
"vitest": "^4.1.9",
|
|
76
76
|
"zod": "^4.4.3",
|
|
77
|
-
"@mcp-use/client": "2.3.1-canary.
|
|
78
|
-
"@mcp-use/tunnel": "0.2.0"
|
|
77
|
+
"@mcp-use/client": "2.3.1-canary.1",
|
|
78
|
+
"@mcp-use/tunnel": "0.2.1-canary.0"
|
|
79
79
|
},
|
|
80
80
|
"publishConfig": {
|
|
81
81
|
"access": "public"
|
|
File without changes
|