@happyvertical/smrt-app-cli 0.40.53 → 0.40.55
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.
|
@@ -3,9 +3,8 @@ import { chmod, mkdir, readFile, rename, unlink, writeFile } from "node:fs/promi
|
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
5
|
import { SMRT_MCP_RESULT_METADATA_KEY } from "@happyvertical/smrt-users/app-contract";
|
|
6
|
-
import { Server } from "@modelcontextprotocol/
|
|
7
|
-
import { StdioServerTransport } from "@modelcontextprotocol/
|
|
8
|
-
import { CallToolRequestSchema, ErrorCode, ListToolsRequestSchema, McpError } from "@modelcontextprotocol/sdk/types.js";
|
|
6
|
+
import { ProtocolError, ProtocolErrorCode, Server } from "@modelcontextprotocol/server";
|
|
7
|
+
import { StdioServerTransport, serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
9
8
|
//#region src/bridge.ts
|
|
10
9
|
/**
|
|
11
10
|
* Stdio MCP bridge — pipes a remote SMRT app's HTTP MCP surface
|
|
@@ -37,12 +36,12 @@ function createMcpStdioBridge(options) {
|
|
|
37
36
|
const toolsPath = options.toolsPath ?? "/api/mcp/tools";
|
|
38
37
|
const callPath = options.callPath ?? "/api/mcp/call";
|
|
39
38
|
const server = new Server(options.serverInfo, { capabilities: { tools: {} } });
|
|
40
|
-
server.setRequestHandler(
|
|
39
|
+
server.setRequestHandler("tools/list", async (_request) => {
|
|
41
40
|
const outcome = await requestJsonResult(options, toolsPath, { method: "GET" }, { fetch: options.fetch });
|
|
42
41
|
if (!outcome.ok) throw toMcpTransportError(outcome.error);
|
|
43
42
|
return withMcpMetadata(outcome.result, outcome.metadata);
|
|
44
43
|
});
|
|
45
|
-
server.setRequestHandler(
|
|
44
|
+
server.setRequestHandler("tools/call", async (request) => {
|
|
46
45
|
const { name, arguments: args = {} } = request.params;
|
|
47
46
|
return formatMcpCallResult(await requestJsonResult(options, callPath, {
|
|
48
47
|
body: JSON.stringify({
|
|
@@ -101,7 +100,7 @@ function sanitizeMetadata(metadata) {
|
|
|
101
100
|
/** Convert an HTTP transport failure into an MCP JSON-RPC error safely. */
|
|
102
101
|
function toMcpTransportError(metadata) {
|
|
103
102
|
const sanitized = sanitizeMetadata(metadata);
|
|
104
|
-
return new
|
|
103
|
+
return new ProtocolError(ProtocolErrorCode.InternalError, sanitized.message ?? sanitized.code, { [SMRT_MCP_RESULT_METADATA_KEY]: sanitized });
|
|
105
104
|
}
|
|
106
105
|
function isMcpErrorResult(result) {
|
|
107
106
|
return result.isError === true;
|
|
@@ -126,12 +125,11 @@ function isRecord$1(value) {
|
|
|
126
125
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
127
126
|
}
|
|
128
127
|
/**
|
|
129
|
-
* One-call entry point —
|
|
130
|
-
*
|
|
128
|
+
* One-call entry point — start the factory-owned stdio bridge. The returned
|
|
129
|
+
* promise resolves once the stdio listener is installed.
|
|
131
130
|
*/
|
|
132
131
|
async function runMcpStdioBridge(options) {
|
|
133
|
-
|
|
134
|
-
await connect();
|
|
132
|
+
serveStdio(() => createMcpStdioBridge(options).server);
|
|
135
133
|
}
|
|
136
134
|
//#endregion
|
|
137
135
|
//#region src/config.ts
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Server } from '@modelcontextprotocol/
|
|
1
|
+
import { Server } from '@modelcontextprotocol/server';
|
|
2
2
|
import { Writable } from 'node:stream';
|
|
3
3
|
|
|
4
4
|
declare type ApiHttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
@@ -512,8 +512,8 @@ declare interface ResourceListResponseBody {
|
|
|
512
512
|
}
|
|
513
513
|
|
|
514
514
|
/**
|
|
515
|
-
* One-call entry point —
|
|
516
|
-
*
|
|
515
|
+
* One-call entry point — start the factory-owned stdio bridge. The returned
|
|
516
|
+
* promise resolves once the stdio listener is installed.
|
|
517
517
|
*/
|
|
518
518
|
export declare function runMcpStdioBridge(options: McpStdioBridgeOptions): Promise<void>;
|
|
519
519
|
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as loadCliConfig, c as requestJsonResult, d as createMcpStdioBridge, i as getStoredToken, l as saveAuth, n as clearStoredToken, o as redactTransportValue, p as runMcpStdioBridge, r as getServerUrl, s as requestJson, t as AppCliRequestError, u as saveCliConfig } from "./config-
|
|
1
|
+
import { a as loadCliConfig, c as requestJsonResult, d as createMcpStdioBridge, i as getStoredToken, l as saveAuth, n as clearStoredToken, o as redactTransportValue, p as runMcpStdioBridge, r as getServerUrl, s as requestJson, t as AppCliRequestError, u as saveCliConfig } from "./config-BKGZTlBc.js";
|
|
2
2
|
import { SMRT_MCP_RESULT_METADATA_KEY, validateDiscoveryConformanceArtifact } from "@happyvertical/smrt-users/app-contract";
|
|
3
3
|
import { spawn, spawnSync } from "node:child_process";
|
|
4
4
|
//#region src/discovery.ts
|
|
@@ -873,7 +873,7 @@ function createAppCli(options) {
|
|
|
873
873
|
return {
|
|
874
874
|
run: (argv) => runCli(context, options, extraByName, argv),
|
|
875
875
|
startMcpBridge: async (serverInfo) => {
|
|
876
|
-
const { runMcpStdioBridge } = await import("./bridge-
|
|
876
|
+
const { runMcpStdioBridge } = await import("./bridge-DpPDVLGq.js");
|
|
877
877
|
await runMcpStdioBridge({
|
|
878
878
|
...context,
|
|
879
879
|
serverInfo: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-app-cli",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.55",
|
|
4
4
|
"description": "Reusable CLI factory for SMRT apps — branded `<name> <resource> <command>` CLI + stdio MCP bridge with decorator-driven resource discovery",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,16 +20,17 @@
|
|
|
20
20
|
"AGENTS.md"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@modelcontextprotocol/
|
|
24
|
-
"@happyvertical/smrt-users": "0.40.
|
|
23
|
+
"@modelcontextprotocol/server": "2.0.0",
|
|
24
|
+
"@happyvertical/smrt-users": "0.40.55"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
+
"@modelcontextprotocol/client": "2.0.0",
|
|
27
28
|
"@types/node": "24.13.2",
|
|
28
29
|
"typescript": "5.9.3",
|
|
29
30
|
"vite": "8.1.4",
|
|
30
31
|
"vite-plugin-dts": "4.5.4",
|
|
31
32
|
"vitest": "4.1.10",
|
|
32
|
-
"@happyvertical/smrt-core": "0.40.
|
|
33
|
+
"@happyvertical/smrt-core": "0.40.55"
|
|
33
34
|
},
|
|
34
35
|
"engines": {
|
|
35
36
|
"node": ">=24.18.0"
|
package/dist/bridge-BgtGXmYP.js
DELETED