@ggui-ai/mcp-server 0.3.0-rc.0 → 0.4.0-rc.0
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/build-mcp.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
12
12
|
import { type ZodRawShape } from 'zod';
|
|
13
|
-
import type
|
|
13
|
+
import { type HandlerContext, type SharedHandler } from '@ggui-ai/mcp-server-handlers';
|
|
14
14
|
import type { Logger } from './logger.js';
|
|
15
15
|
import { type GguiRenderResourceTemplateOptions } from './mcp-apps-outbound.js';
|
|
16
16
|
export interface ServerInfo {
|
package/dist/build-mcp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-mcp.d.ts","sourceRoot":"","sources":["../src/build-mcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE,OAAO,EAAK,KAAK,WAAW,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"build-mcp.d.ts","sourceRoot":"","sources":["../src/build-mcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE,OAAO,EAAK,KAAK,WAAW,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAEL,KAAK,iCAAiC,EACvC,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,iCAAiC,CAAC;IAC3D;;;;;;;;;OASG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;IAElE;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAE/B;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,aAAa,CAAC,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC,CAAC;CACtE;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,aAAa,CAAC,aAAa,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,EAChE,UAAU,EAAE,MAAM,cAAc,EAChC,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,qBAA0B,GAC/B,SAAS,CAiLX"}
|
package/dist/build-mcp.js
CHANGED
|
@@ -12,6 +12,7 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
|
12
12
|
import { registerAppTool } from '@modelcontextprotocol/ext-apps/server';
|
|
13
13
|
import { isRecord } from '@ggui-ai/protocol';
|
|
14
14
|
import { z } from 'zod';
|
|
15
|
+
import { isHandlerFailure, } from '@ggui-ai/mcp-server-handlers';
|
|
15
16
|
import { installMcpAppsOutbound, } from './mcp-apps-outbound.js';
|
|
16
17
|
/**
|
|
17
18
|
* Build a fresh MCP server with every handler registered.
|
|
@@ -87,6 +88,30 @@ export function buildMcpServer(info, handlers, getContext, logger, opts = {}) {
|
|
|
87
88
|
const start = Date.now();
|
|
88
89
|
try {
|
|
89
90
|
const data = await handler.handler(input, ctx);
|
|
91
|
+
// First-class in-result failure channel. A handler that
|
|
92
|
+
// returns the `HandlerFailure` marker gets an `isError: true`
|
|
93
|
+
// TOOL RESULT (never a thrown/JSON-RPC error): the marker's
|
|
94
|
+
// `errorText` is the model-visible content, and its `data` is
|
|
95
|
+
// validated against the SAME outputSchema as a success — MCP
|
|
96
|
+
// SDK clients validate structuredContent against outputSchema
|
|
97
|
+
// even when isError is set, so the envelope stays
|
|
98
|
+
// schema-conformant. NO `_meta` on failures: `resultMeta` is
|
|
99
|
+
// not invoked, so no mount affordance / bootstrap slice is
|
|
100
|
+
// emitted for a failed call.
|
|
101
|
+
if (isHandlerFailure(data)) {
|
|
102
|
+
const validated = z.object(handler.outputSchema).parse(data.data);
|
|
103
|
+
logger.warn('tool_invoked', {
|
|
104
|
+
tool: handler.name,
|
|
105
|
+
appId: ctx.appId,
|
|
106
|
+
outcome: 'tool_error',
|
|
107
|
+
elapsedMs: Date.now() - start,
|
|
108
|
+
});
|
|
109
|
+
return {
|
|
110
|
+
isError: true,
|
|
111
|
+
structuredContent: validated,
|
|
112
|
+
content: [{ type: 'text', text: data.errorText }],
|
|
113
|
+
};
|
|
114
|
+
}
|
|
90
115
|
const validated = z.object(handler.outputSchema).parse(data);
|
|
91
116
|
// Per-result `_meta` — NOT merged into structuredContent, so
|
|
92
117
|
// agents that typecheck against the tool signature never see
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
* the exact Lane-1 chat-page spec assertion (`/OSS agent
|
|
44
44
|
* generation/`) without a copy change.
|
|
45
45
|
*/
|
|
46
|
-
import type
|
|
46
|
+
import { type SharedHandler } from "@ggui-ai/mcp-server-handlers";
|
|
47
47
|
import type { Express } from "express";
|
|
48
48
|
import type { ZodRawShape } from "zod";
|
|
49
49
|
import type { Logger } from "./logger.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console-chat-routes.d.ts","sourceRoot":"","sources":["../src/console-chat-routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"console-chat-routes.d.ts","sourceRoot":"","sources":["../src/console-chat-routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,KAAK,CAAC;AAIvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,UAAU,YAAY;IACpB,iCAAiC;IACjC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACjE,+DAA+D;IAC/D,QAAQ,CAAC,gBAAgB,CAAC,EAAE,aAAa,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACpE;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE;QACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;KAC1B,CAAC;IACF,yBAAyB;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CA2K/D"}
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
* the exact Lane-1 chat-page spec assertion (`/OSS agent
|
|
44
44
|
* generation/`) without a copy change.
|
|
45
45
|
*/
|
|
46
|
+
import { isHandlerFailure, } from "@ggui-ai/mcp-server-handlers";
|
|
46
47
|
import { randomUUID } from "node:crypto";
|
|
47
48
|
import { DEFAULT_BUILDER_APP_ID } from "./auth.js";
|
|
48
49
|
import { mintDevtoolCookie } from "./console-auth.js";
|
|
@@ -101,6 +102,27 @@ export function mountConsoleChatRoutes(opts) {
|
|
|
101
102
|
});
|
|
102
103
|
const handshakeId = hsRaw.handshakeId;
|
|
103
104
|
const raw = await renderHandler.handler({ handshakeId, contract: {} }, { appId: DEFAULT_BUILDER_APP_ID, requestId });
|
|
105
|
+
if (isHandlerFailure(raw)) {
|
|
106
|
+
// In-result failure envelope (generation failed / rejected).
|
|
107
|
+
// The marker's errorText is the honest self-correction
|
|
108
|
+
// surface — reuse it verbatim; no ui payload (nothing
|
|
109
|
+
// mountable landed for this turn).
|
|
110
|
+
logger.warn?.("console_chat_render_failed", {
|
|
111
|
+
threadId,
|
|
112
|
+
error: raw.errorText,
|
|
113
|
+
});
|
|
114
|
+
res.status(200).json({
|
|
115
|
+
threadId,
|
|
116
|
+
userMessage,
|
|
117
|
+
agentMessage: {
|
|
118
|
+
id: `msg-${randomUUID()}`,
|
|
119
|
+
role: "agent",
|
|
120
|
+
text: raw.errorText,
|
|
121
|
+
createdAt: now + 1,
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
104
126
|
const result = raw;
|
|
105
127
|
ui = {
|
|
106
128
|
sessionId: result.sessionId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ggui-ai/mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0-rc.0",
|
|
4
4
|
"description": "Self-hosted MCP server for the ggui protocol. An HTTP/MCP binding layer over @ggui-ai/mcp-server-handlers and the reference adapters from @ggui-ai/mcp-server-core — run it via `ggui serve`.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ggui",
|
|
@@ -32,16 +32,16 @@
|
|
|
32
32
|
"resend": "^6.12.2",
|
|
33
33
|
"ws": "^8.20.1",
|
|
34
34
|
"zod": "^4.3.6",
|
|
35
|
-
"@ggui-ai/console": "0.
|
|
36
|
-
"@ggui-ai/iframe-runtime": "0.
|
|
37
|
-
"@ggui-ai/mcp-server-
|
|
38
|
-
"@ggui-ai/mcp-server-
|
|
39
|
-
"@ggui-ai/negotiator": "0.
|
|
40
|
-
"@ggui-ai/preview-a2ui": "0.
|
|
41
|
-
"@ggui-ai/project-config": "0.
|
|
42
|
-
"@ggui-ai/protocol": "0.
|
|
43
|
-
"@ggui-ai/ui-
|
|
44
|
-
"@ggui-ai/ui-
|
|
35
|
+
"@ggui-ai/console": "0.4.0-rc.0",
|
|
36
|
+
"@ggui-ai/iframe-runtime": "0.4.0-rc.0",
|
|
37
|
+
"@ggui-ai/mcp-server-core": "0.4.0-rc.0",
|
|
38
|
+
"@ggui-ai/mcp-server-handlers": "0.4.0-rc.0",
|
|
39
|
+
"@ggui-ai/negotiator": "0.4.0-rc.0",
|
|
40
|
+
"@ggui-ai/preview-a2ui": "0.4.0-rc.0",
|
|
41
|
+
"@ggui-ai/project-config": "0.4.0-rc.0",
|
|
42
|
+
"@ggui-ai/protocol": "0.4.0-rc.0",
|
|
43
|
+
"@ggui-ai/ui-registry": "0.4.0-rc.0",
|
|
44
|
+
"@ggui-ai/ui-gen": "0.4.0-rc.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/express": "^5.0.0",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"@types/nodemailer": "^8.0.0",
|
|
50
50
|
"@types/ws": "^8.5.10",
|
|
51
51
|
"typescript": "^5.0.0",
|
|
52
|
-
"vitest": "^3.
|
|
53
|
-
"@ggui-ai/protocol-conformance": "0.
|
|
52
|
+
"vitest": "^3.2.6",
|
|
53
|
+
"@ggui-ai/protocol-conformance": "0.4.0-rc.0"
|
|
54
54
|
},
|
|
55
55
|
"repository": {
|
|
56
56
|
"type": "git",
|