@modeltoolsprotocol/mtpcli 1.3.0 → 1.3.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.
Files changed (2) hide show
  1. package/dist/index.js +64 -7
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -8843,7 +8843,7 @@ var init_mcp = __esm(() => {
8843
8843
  });
8844
8844
 
8845
8845
  // src/version.ts
8846
- var VERSION2 = "1.3.0";
8846
+ var VERSION2 = "1.3.2";
8847
8847
 
8848
8848
  // src/serve.ts
8849
8849
  var exports_serve = {};
@@ -9940,7 +9940,7 @@ function parseHeaders(raw) {
9940
9940
  }
9941
9941
  return headers;
9942
9942
  }
9943
- async function run2(serverCmd, serverUrl, describeMode, toolName, toolArgs = [], rawHeaders = [], clientId) {
9943
+ async function run2(serverCmd, serverUrl, toolName, toolArgs = [], rawHeaders = [], clientId, describe2) {
9944
9944
  let client;
9945
9945
  let serverName;
9946
9946
  if (serverUrl) {
@@ -9965,7 +9965,7 @@ async function run2(serverCmd, serverUrl, describeMode, toolName, toolArgs = [],
9965
9965
  description: `CLI wrapper for MCP server: ${serverName}`,
9966
9966
  commands
9967
9967
  };
9968
- if (describeMode || !toolName) {
9968
+ if (describe2 || !toolName) {
9969
9969
  console.log(JSON.stringify(schema, null, 2));
9970
9970
  return;
9971
9971
  }
@@ -10651,10 +10651,67 @@ function withDescribe(program2, options) {
10651
10651
  }
10652
10652
 
10653
10653
  // src/version.ts
10654
- var VERSION = "1.3.0";
10654
+ var VERSION = "1.3.2";
10655
10655
 
10656
10656
  // src/index.ts
10657
- var program2 = new Command().name("mtpcli").version(VERSION).description("Unified CLI for discovering, authenticating, and bridging --mtp-describe-compatible tools");
10657
+ var program2 = new Command().name("mtpcli").version(VERSION).description("Unified CLI for discovering, authenticating, and bridging --mtp-describe-compatible tools").addHelpText("after", `
10658
+ MTP: Using CLI Tools as an LLM Agent
10659
+
10660
+ Discovery
10661
+ Any tool supporting MTP responds to --mtp-describe with a JSON schema:
10662
+
10663
+ toolname --mtp-describe
10664
+
10665
+ This returns: tool name, commands, args (name, type, required, default),
10666
+ stdin/stdout descriptors, and examples.
10667
+
10668
+ Invoking Commands
10669
+ Schema maps directly to CLI invocation:
10670
+
10671
+ "name": "convert" -> toolname convert
10672
+ "name": "auth login" -> toolname auth login
10673
+ "name": "_root" -> toolname (no subcommand)
10674
+ Args with -- prefix are flags: --format json
10675
+ Args without prefix are positional: toolname convert myfile.csv
10676
+ "type": "boolean" flags take no value: --verbose
10677
+ "type": "array" flags repeat: --tag foo --tag bar
10678
+
10679
+ Stdin/Stdout
10680
+ When a command has stdin declared, pipe data in:
10681
+
10682
+ echo '{"name":"foo"}' | toolname process
10683
+ cat file.csv | toolname convert --format json
10684
+
10685
+ When stdout has contentType "application/json", output is parseable:
10686
+
10687
+ toolname convert data.csv --format json | jq '.results'
10688
+
10689
+ mtpcli Usage
10690
+
10691
+ Understand mtpcli by running: mtpcli --mtp-describe
10692
+
10693
+ Search for commands across tools:
10694
+
10695
+ mtpcli search "deploy to production"
10696
+ mtpcli search "convert csv" -- filetool mytool
10697
+ mtpcli search --scan-path "git commit"
10698
+
10699
+ Wrap an MCP server as a CLI:
10700
+
10701
+ mtpcli wrap --url "https://mcp.example.com/v1/mcp" --mtp-describe
10702
+ mtpcli wrap --url "https://mcp.example.com/v1/mcp" toolName -- --arg1 val1
10703
+ mtpcli wrap --server "npx @mcp/server" toolName -- --arg1 val1
10704
+
10705
+ Auth:
10706
+
10707
+ mtpcli auth login toolname # OAuth2 flow
10708
+ mtpcli auth login toolname --token sk-x # API key
10709
+ eval $(mtpcli auth env toolname) # Inject token into env
10710
+
10711
+ Composability
10712
+ Chain tools with pipes. No LLM round-trip needed for intermediate steps:
10713
+
10714
+ toolA export --format json | toolB import --stdin | jq '.summary'`);
10658
10715
  program2.command("search").description("Search across --mtp-describe-compatible tools").argument("<query>", "Search query").option("--json", "Output as JSON", false).option("--scan-path", "Scan PATH for --mtp-describe-compatible tools", false).option("--jobs <n>", "Number of parallel jobs for --scan-path", "16").argument("[tools...]", "Tool names to search (after --)").action(async (query, tools, opts) => {
10659
10716
  const { search: search2, loadSchemas: loadSchemas2, scanPath: scanPath2 } = await Promise.resolve().then(() => (init_search(), exports_search));
10660
10717
  const schemas = opts.scanPath ? await scanPath2(parseInt(opts.jobs, 10)) : await loadSchemas2(tools);
@@ -10802,7 +10859,7 @@ Multiple tools can be combined into a single MCP server:
10802
10859
  const { run: run5 } = await Promise.resolve().then(() => (init_serve(), exports_serve));
10803
10860
  await run5(opts.tool);
10804
10861
  });
10805
- program2.command("wrap").description("Wrap an MCP server as a CLI tool (mcp2cli bridge)").option("--server <cmd>", "MCP server command to run (stdio transport)").option("--url <url>", "MCP server URL (Streamable HTTP / SSE transport)").option("-H, --header <header...>", "HTTP header(s) for --url (e.g. 'Authorization: Bearer tok')").option("--client-id <id>", "Pre-registered OAuth client ID (for --url)").option("--mtp-describe", "Output --mtp-describe JSON instead of invoking", false).argument("[tool_name]", "Tool name to invoke").argument("[args...]", "Arguments for the tool (after --)").action(async (toolName, args, opts) => {
10862
+ program2.command("wrap").description("Wrap an MCP server as a CLI tool (mcp2cli bridge)").option("--server <cmd>", "MCP server command to run (stdio transport)").option("--url <url>", "MCP server URL (Streamable HTTP / SSE transport)").option("-H, --header <header...>", "HTTP header(s) for --url (e.g. 'Authorization: Bearer tok')").option("--client-id <id>", "Pre-registered OAuth client ID (for --url)").option("--mtp-describe", "Output MTP schema for the wrapped MCP server").argument("[tool_name]", "Tool name to invoke").argument("[args...]", "Arguments for the tool (after --)").action(async (toolName, args, opts) => {
10806
10863
  if (opts.server && opts.url) {
10807
10864
  process.stderr.write(`error: --server and --url are mutually exclusive
10808
10865
  `);
@@ -10824,7 +10881,7 @@ program2.command("wrap").description("Wrap an MCP server as a CLI tool (mcp2cli
10824
10881
  process.exit(1);
10825
10882
  }
10826
10883
  const { run: run5 } = await Promise.resolve().then(() => (init_wrap(), exports_wrap));
10827
- await run5(opts.server, opts.url, opts.mtpDescribe, toolName, args, opts.header ?? [], opts.clientId);
10884
+ await run5(opts.server, opts.url, toolName, args, opts.header ?? [], opts.clientId, opts.mtpDescribe);
10828
10885
  });
10829
10886
  program2.command("validate").description("Validate a tool's --mtp-describe output against the MTP spec").argument("[tool]", "Tool name to validate").option("--json", "Output as JSON", false).option("--stdin", "Read JSON from stdin", false).option("--skip-help", "Skip --help cross-reference", false).action(async (tool, opts) => {
10830
10887
  const { run: run5 } = await Promise.resolve().then(() => (init_validate(), exports_validate));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modeltoolsprotocol/mtpcli",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "bin": {
@@ -17,7 +17,7 @@
17
17
  "typecheck": "tsc --noEmit"
18
18
  },
19
19
  "dependencies": {
20
- "@modeltoolsprotocol/sdk": "^0.4.0",
20
+ "@modeltoolsprotocol/sdk": "^0.4.1",
21
21
  "commander": "^14.0.0",
22
22
  "jaro-winkler": "^0.2.8",
23
23
  "open": "^11.0.0",