@mcp-use/cli 4.1.1-canary.1 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a as o}from"./chunk-2MSZIPV6.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.1-canary.1"}).then(e=>{process.exitCode=e},e=>{console.error(e instanceof Error?e.message:String(e)),process.exitCode=1});
2
+ import{a as o}from"./chunk-WLXA26EO.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.1"}).then(e=>{process.exitCode=e},e=>{console.error(e instanceof Error?e.message:String(e)),process.exitCode=1});
@@ -9,7 +9,7 @@ ${t.map(([o,r])=>` ${o.padEnd(n)} ${r}`).join(`
9
9
  `),0):(process.stderr.write(`${r.error}
10
10
  `),2)}let t=G(e),n=e.filter(r=>r!=="--json"),o=n[0];try{if(o==="connect")return await $e(n.slice(1),t);if(o==="list")return await Ae(n.slice(1),t);if(o==="remove")return await Re(n.slice(1),t);if(o===void 0)throw new a("Usage: mcp-use client <connect|list|remove|name>");return await Ee(o,n.slice(1),t)}catch(r){return K(r instanceof TypeError?new a(r.message):r,t)}}async function $e(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 m=Ue(n.protocol),u=ie(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:Le(n.header??[])},P={url:i.href,oauth:n["no-oauth"]!==!0,protocol:m},k=await N(r,P,p,u,se({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(j,c),await C(q(r),p),f({name:r,url:H(P.url),protocol:m,...y?{authorization:{...y,...y.resource?{resource:H(y.resource)}:{}}}:{}},t,y?.mode==="mixed"&&!y.authenticated?`Connected and saved ${r}.
11
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 Ae(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 Re(e,t){let{positionals:n}=x({args:[...e],allowPositionals:!0,strict:!0,options:{}}),o=E(n,"mcp-use client remove <name>"),r=await _();return delete r.servers[o],await C(j,r),await ne(B(o),{recursive:!0,force:!0}),f({removed:o},t,`Removed ${o}.`),0}async function Ee(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 ne(z(e),{recursive:!0,force:!0}),f({loggedOut:e},n,`Logged out ${e}.`)),0}}Te(e,s,i,t.slice(2));let m=await U(q(e),{}),u=await N(e,r,m,3e5,se({noOpen:!1,json:n}),n);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(`
12
+ `)||"No saved servers."),0}async function Re(e,t){let{positionals:n}=x({args:[...e],allowPositionals:!0,strict:!0,options:{}}),o=E(n,"mcp-use client remove <name>"),r=await _();return delete r.servers[o],await C(j,r),await ne(B(o),{recursive:!0,force:!0}),f({removed:o},t,`Removed ${o}.`),0}async function Ee(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 ne(z(e),{recursive:!0,force:!0}),f({loggedOut:e},n,`Logged out ${e}.`)),0}}Te(e,s,i,t.slice(2));let m=await U(q(e),{}),u=await N(e,r,m,3e5,se({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
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 xe(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 Te(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"){re(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 xe(e,t,n,o){let{tool:r,timeout:s,positionals:i}=re(t,n),m=await e.callTool(r,I(i),{timeout:s});if(m.isError===!0)throw new h("tool_error",`Tool ${r} returned an error.`,m);return f(m,o),0}function re(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=ie(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:m,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 m(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
15
  `);return}await _e(),V(v)}}):void 0,ce=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},...ce}}});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):Ie(Ne(v,t.protocol),t,n)}}async function ot(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 rt(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=JSON.parse(e[0]);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 m=n.slice(0,s).replace(/^--/,""),u=n.slice(s+i);t[m]=o>=0?JSON.parse(u):u}return t}function se(e){return e.json||e.noOpen||!process.stdin.isTTY?"never":"ask"}async function _e(){let e=Oe({input:process.stdin,output:process.stderr});try{await e.question("This server requires OAuth. Press Enter to open your browser.")}finally{e.close()}}function Le(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 Ue(e){if(e!=="auto"&&e!=="legacy"&&e!=="modern")throw new a("Invalid protocol. Expected auto, legacy, or modern.");return e}function ie(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(j,{servers:{}}),t={servers:{}},n=!1;for(let[o,r]of Object.entries(e.servers)){let s=je(r.protocol);t.servers[o]={...r,protocol:s},n||=s!==r.protocol}return n&&await C(j,t),t}function je(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 Ne(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 Ie(e,t,n){let o=De(t.url,n.headers);if(!(e instanceof Error)||o.size===0)return e;let r=ae(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 De(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"?ae(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 ae(e,t){let n=e;for(let o of t)n=n.replaceAll(o,"[REDACTED]");return n}function B(e){return T(oe,"credentials",ke("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{nt as a,ot as b,rt as c,I as d};
@@ -1 +1 @@
1
- import{a,b,c,d}from"../chunk-ZL5M4BMB.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
+ import{a,b,c,d}from"../chunk-YTNIFIL2.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 B,c as H,d as R}from"../chunk-ZL5M4BMB.js";import{a as c,b as s,d as T,e as _,f as M}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 W,resolve as z}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]
1
+ import{b as B,c as H,d as R}from"../chunk-YTNIFIL2.js";import{a as c,b as s,d as T,e as _,f as M}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 W,resolve as z}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/index.js CHANGED
@@ -1 +1 @@
1
- import{a}from"./chunk-2MSZIPV6.js";import"./chunk-RXKUVCL7.js";import"./chunk-WOT6VMZA.js";export{a as main};
1
+ import{a}from"./chunk-WLXA26EO.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.1-canary.1",
4
+ "version": "4.1.1",
5
5
  "description": "Prebuilt CLI, development server, and build pipeline for mcp-use",
6
6
  "author": "mcp-use, Inc.",
7
7
  "license": "MIT",
@@ -50,8 +50,8 @@
50
50
  "vite": "8.0.16"
51
51
  },
52
52
  "peerDependencies": {
53
- "@mcp-use/client": "^2.0.1 || ^2.1.0 || ^2.1.1-canary.0",
54
- "@mcp-use/inspector": "^20.0.1 || ^20.0.5 || ^20.1.0 || ^20.1.1-canary.0"
53
+ "@mcp-use/client": "^2.0.1 || ^2.1.0 || ^2.1.1",
54
+ "@mcp-use/inspector": "^20.0.1 || ^20.0.5 || ^20.1.0 || ^20.1.1"
55
55
  },
56
56
  "peerDependenciesMeta": {
57
57
  "@mcp-use/client": {
@@ -74,7 +74,7 @@
74
74
  "typescript": "^5.9.3",
75
75
  "vitest": "^4.1.9",
76
76
  "zod": "^4.4.3",
77
- "@mcp-use/client": "2.1.1-canary.1",
77
+ "@mcp-use/client": "2.1.1",
78
78
  "@mcp-use/tunnel": "0.2.0"
79
79
  },
80
80
  "publishConfig": {
File without changes