@modeltoolsprotocol/mtpcli 0.2.0 → 0.2.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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +33 -12
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -6,7 +6,7 @@ The command-line interface for the [Model Tools Protocol](https://github.com/mod
6
6
 
7
7
  LLM agents need to discover and use tools. Right now there are two worlds:
8
8
 
9
- **CLI tools** are the backbone of software development. They're composable (`|`), scriptable, version-controlled, and work everywhere. But LLMs can't discover what a CLI does -they have to parse `--help` text, guess at arguments, and hope for the best.
9
+ **CLI tools** are the backbone of software development. They're composable (`|`), scriptable, version-controlled, and work everywhere. But LLMs can't discover what a CLI does - they have to parse `--help` text, guess at arguments, and hope for the best.
10
10
 
11
11
  **MCP (Model Context Protocol)** solves discovery beautifully. Tools declare typed schemas, and LLM hosts discover them via a structured handshake. But MCP requires running a server process, speaking JSON-RPC over stdio/SSE, and building within the MCP ecosystem. Your existing CLI tools don't get any of this for free.
12
12
 
package/dist/index.js CHANGED
@@ -7917,17 +7917,38 @@ function sendNotification(writer, method, params) {
7917
7917
  writer.write(JSON.stringify(req) + `
7918
7918
  `);
7919
7919
  }
7920
- async function readResponse(rl) {
7921
- for await (const line of rl) {
7922
- const trimmed = line.trim();
7923
- if (!trimmed)
7924
- continue;
7925
- const msg = JSON.parse(trimmed);
7926
- if ("id" in msg && msg.id !== undefined) {
7927
- return JsonRpcResponseSchema2.parse(msg);
7928
- }
7929
- }
7930
- throw new Error("MCP server closed connection");
7920
+ function readResponse(rl) {
7921
+ return new Promise((resolve, reject) => {
7922
+ const onLine = (line) => {
7923
+ const trimmed = line.trim();
7924
+ if (!trimmed)
7925
+ return;
7926
+ let msg;
7927
+ try {
7928
+ msg = JSON.parse(trimmed);
7929
+ } catch (e) {
7930
+ rl.off("line", onLine);
7931
+ rl.off("close", onClose);
7932
+ reject(e);
7933
+ return;
7934
+ }
7935
+ if ("id" in msg && msg.id !== undefined) {
7936
+ rl.off("line", onLine);
7937
+ rl.off("close", onClose);
7938
+ try {
7939
+ resolve(JsonRpcResponseSchema2.parse(msg));
7940
+ } catch (e) {
7941
+ reject(e);
7942
+ }
7943
+ }
7944
+ };
7945
+ const onClose = () => {
7946
+ rl.off("line", onLine);
7947
+ reject(new Error("MCP server closed connection"));
7948
+ };
7949
+ rl.on("line", onLine);
7950
+ rl.on("close", onClose);
7951
+ });
7931
7952
  }
7932
7953
  var init_mcp = __esm(() => {
7933
7954
  init_models();
@@ -9187,7 +9208,7 @@ function cleanJson(obj) {
9187
9208
  }
9188
9209
 
9189
9210
  // src/index.ts
9190
- var VERSION3 = "0.2.0";
9211
+ var VERSION3 = "0.2.1";
9191
9212
  function selfDescribe() {
9192
9213
  const schema = {
9193
9214
  name: "mtpcli",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modeltoolsprotocol/mtpcli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "bin": {