@casys/mcp-bridge 0.2.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/esm/_dnt.shims.d.ts +2 -0
- package/esm/_dnt.shims.d.ts.map +1 -0
- package/esm/_dnt.shims.js +57 -0
- package/esm/adapters/base-adapter.d.ts +25 -0
- package/esm/adapters/base-adapter.d.ts.map +1 -0
- package/esm/adapters/base-adapter.js +86 -0
- package/esm/adapters/line/adapter.d.ts +11 -0
- package/esm/adapters/line/adapter.d.ts.map +1 -0
- package/esm/adapters/line/adapter.js +10 -0
- package/esm/adapters/line/types.d.ts +25 -0
- package/esm/adapters/line/types.d.ts.map +1 -0
- package/esm/adapters/line/types.js +4 -0
- package/esm/adapters/telegram/adapter.d.ts +11 -0
- package/esm/adapters/telegram/adapter.d.ts.map +1 -0
- package/esm/adapters/telegram/adapter.js +10 -0
- package/esm/adapters/telegram/platform-adapter.d.ts +40 -0
- package/esm/adapters/telegram/platform-adapter.d.ts.map +1 -0
- package/esm/adapters/telegram/platform-adapter.js +214 -0
- package/esm/adapters/telegram/sdk-bridge.d.ts +8 -0
- package/esm/adapters/telegram/sdk-bridge.d.ts.map +1 -0
- package/esm/adapters/telegram/sdk-bridge.js +22 -0
- package/esm/adapters/telegram/types.d.ts +93 -0
- package/esm/adapters/telegram/types.d.ts.map +1 -0
- package/esm/adapters/telegram/types.js +6 -0
- package/esm/client/bridge.js +424 -0
- package/esm/core/adapter.d.ts +88 -0
- package/esm/core/adapter.d.ts.map +1 -0
- package/esm/core/adapter.js +10 -0
- package/esm/core/bridge-client.d.ts +77 -0
- package/esm/core/bridge-client.d.ts.map +1 -0
- package/esm/core/bridge-client.js +275 -0
- package/esm/core/message-router.d.ts +71 -0
- package/esm/core/message-router.d.ts.map +1 -0
- package/esm/core/message-router.js +187 -0
- package/esm/core/protocol.d.ts +116 -0
- package/esm/core/protocol.d.ts.map +1 -0
- package/esm/core/protocol.js +203 -0
- package/esm/core/resource-resolver.d.ts +27 -0
- package/esm/core/resource-resolver.d.ts.map +1 -0
- package/esm/core/resource-resolver.js +85 -0
- package/esm/core/transport.d.ts +46 -0
- package/esm/core/transport.d.ts.map +1 -0
- package/esm/core/transport.js +85 -0
- package/esm/core/types.d.ts +187 -0
- package/esm/core/types.d.ts.map +1 -0
- package/esm/core/types.js +35 -0
- package/esm/mod.d.ts +36 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/mod.js +33 -0
- package/esm/package.json +3 -0
- package/esm/resource-server/csp.d.ts +36 -0
- package/esm/resource-server/csp.d.ts.map +1 -0
- package/esm/resource-server/csp.js +36 -0
- package/esm/resource-server/injector.d.ts +18 -0
- package/esm/resource-server/injector.d.ts.map +1 -0
- package/esm/resource-server/injector.js +39 -0
- package/esm/resource-server/server.d.ts +107 -0
- package/esm/resource-server/server.d.ts.map +1 -0
- package/esm/resource-server/server.js +483 -0
- package/esm/resource-server/session.d.ts +60 -0
- package/esm/resource-server/session.d.ts.map +1 -0
- package/esm/resource-server/session.js +86 -0
- package/esm/resource-server/telegram-auth.d.ts +45 -0
- package/esm/resource-server/telegram-auth.d.ts.map +1 -0
- package/esm/resource-server/telegram-auth.js +161 -0
- package/package.json +31 -0
- package/script/_dnt.shims.d.ts +2 -0
- package/script/_dnt.shims.d.ts.map +1 -0
- package/script/_dnt.shims.js +60 -0
- package/script/adapters/base-adapter.d.ts +25 -0
- package/script/adapters/base-adapter.d.ts.map +1 -0
- package/script/adapters/base-adapter.js +113 -0
- package/script/adapters/line/adapter.d.ts +11 -0
- package/script/adapters/line/adapter.d.ts.map +1 -0
- package/script/adapters/line/adapter.js +14 -0
- package/script/adapters/line/types.d.ts +25 -0
- package/script/adapters/line/types.d.ts.map +1 -0
- package/script/adapters/line/types.js +5 -0
- package/script/adapters/telegram/adapter.d.ts +11 -0
- package/script/adapters/telegram/adapter.d.ts.map +1 -0
- package/script/adapters/telegram/adapter.js +14 -0
- package/script/adapters/telegram/platform-adapter.d.ts +40 -0
- package/script/adapters/telegram/platform-adapter.d.ts.map +1 -0
- package/script/adapters/telegram/platform-adapter.js +241 -0
- package/script/adapters/telegram/sdk-bridge.d.ts +8 -0
- package/script/adapters/telegram/sdk-bridge.d.ts.map +1 -0
- package/script/adapters/telegram/sdk-bridge.js +48 -0
- package/script/adapters/telegram/types.d.ts +93 -0
- package/script/adapters/telegram/types.d.ts.map +1 -0
- package/script/adapters/telegram/types.js +7 -0
- package/script/client/bridge.js +424 -0
- package/script/core/adapter.d.ts +88 -0
- package/script/core/adapter.d.ts.map +1 -0
- package/script/core/adapter.js +11 -0
- package/script/core/bridge-client.d.ts +77 -0
- package/script/core/bridge-client.d.ts.map +1 -0
- package/script/core/bridge-client.js +302 -0
- package/script/core/message-router.d.ts +71 -0
- package/script/core/message-router.d.ts.map +1 -0
- package/script/core/message-router.js +191 -0
- package/script/core/protocol.d.ts +116 -0
- package/script/core/protocol.d.ts.map +1 -0
- package/script/core/protocol.js +230 -0
- package/script/core/resource-resolver.d.ts +27 -0
- package/script/core/resource-resolver.d.ts.map +1 -0
- package/script/core/resource-resolver.js +89 -0
- package/script/core/transport.d.ts +46 -0
- package/script/core/transport.d.ts.map +1 -0
- package/script/core/transport.js +112 -0
- package/script/core/types.d.ts +187 -0
- package/script/core/types.d.ts.map +1 -0
- package/script/core/types.js +38 -0
- package/script/mod.d.ts +36 -0
- package/script/mod.d.ts.map +1 -0
- package/script/mod.js +76 -0
- package/script/package.json +3 -0
- package/script/resource-server/csp.d.ts +36 -0
- package/script/resource-server/csp.d.ts.map +1 -0
- package/script/resource-server/csp.js +39 -0
- package/script/resource-server/injector.d.ts +18 -0
- package/script/resource-server/injector.d.ts.map +1 -0
- package/script/resource-server/injector.js +42 -0
- package/script/resource-server/server.d.ts +107 -0
- package/script/resource-server/server.d.ts.map +1 -0
- package/script/resource-server/server.js +487 -0
- package/script/resource-server/session.d.ts +60 -0
- package/script/resource-server/session.d.ts.map +1 -0
- package/script/resource-server/session.js +90 -0
- package/script/resource-server/telegram-auth.d.ts +45 -0
- package/script/resource-server/telegram-auth.d.ts.map +1 -0
- package/script/resource-server/telegram-auth.js +164 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON-RPC 2.0 message builders and validators for the MCP Apps protocol.
|
|
3
|
+
*
|
|
4
|
+
* Provides type-safe construction of all MCP Apps messages and a
|
|
5
|
+
* message validator to guard incoming data at system boundaries.
|
|
6
|
+
*/
|
|
7
|
+
import { McpAppsMethod } from "./types.js";
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// ID generation
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
let _nextId = 1;
|
|
12
|
+
/** Generate a monotonically increasing request ID. */
|
|
13
|
+
export function nextRequestId() {
|
|
14
|
+
return _nextId++;
|
|
15
|
+
}
|
|
16
|
+
/** Reset the ID counter. @internal — exported for tests only. */
|
|
17
|
+
export function resetRequestIdCounter() {
|
|
18
|
+
_nextId = 1;
|
|
19
|
+
}
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// Message type guards
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
/** Check if a value is a valid JSON-RPC 2.0 message. */
|
|
24
|
+
export function isJsonRpcMessage(value) {
|
|
25
|
+
return (typeof value === "object" &&
|
|
26
|
+
value !== null &&
|
|
27
|
+
"jsonrpc" in value &&
|
|
28
|
+
value.jsonrpc === "2.0");
|
|
29
|
+
}
|
|
30
|
+
/** Check if a message is a JSON-RPC request (has `id` and `method`). */
|
|
31
|
+
export function isRequest(msg) {
|
|
32
|
+
return "method" in msg && "id" in msg;
|
|
33
|
+
}
|
|
34
|
+
/** Check if a message is a JSON-RPC notification (has `method`, no `id`). */
|
|
35
|
+
export function isNotification(msg) {
|
|
36
|
+
return "method" in msg && !("id" in msg);
|
|
37
|
+
}
|
|
38
|
+
/** Check if a message is a JSON-RPC success response. */
|
|
39
|
+
export function isResponse(msg) {
|
|
40
|
+
return "result" in msg && "id" in msg && !("method" in msg);
|
|
41
|
+
}
|
|
42
|
+
/** Check if a message is a JSON-RPC error response. */
|
|
43
|
+
export function isErrorResponse(msg) {
|
|
44
|
+
return "error" in msg && "id" in msg;
|
|
45
|
+
}
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
// Request builders (App -> Host)
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
/** Build a `ui/initialize` request. */
|
|
50
|
+
export function buildInitializeRequest(params) {
|
|
51
|
+
return {
|
|
52
|
+
jsonrpc: "2.0",
|
|
53
|
+
id: nextRequestId(),
|
|
54
|
+
method: McpAppsMethod.UI_INITIALIZE,
|
|
55
|
+
params,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/** Build a `tools/call` request. */
|
|
59
|
+
export function buildToolCallRequest(params) {
|
|
60
|
+
return {
|
|
61
|
+
jsonrpc: "2.0",
|
|
62
|
+
id: nextRequestId(),
|
|
63
|
+
method: McpAppsMethod.TOOLS_CALL,
|
|
64
|
+
params,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/** Build a `resources/read` request. */
|
|
68
|
+
export function buildResourceReadRequest(params) {
|
|
69
|
+
return {
|
|
70
|
+
jsonrpc: "2.0",
|
|
71
|
+
id: nextRequestId(),
|
|
72
|
+
method: McpAppsMethod.RESOURCES_READ,
|
|
73
|
+
params,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/** Build a `ui/open-link` request. */
|
|
77
|
+
export function buildOpenLinkRequest(params) {
|
|
78
|
+
return {
|
|
79
|
+
jsonrpc: "2.0",
|
|
80
|
+
id: nextRequestId(),
|
|
81
|
+
method: McpAppsMethod.UI_OPEN_LINK,
|
|
82
|
+
params,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/** Build a `ui/message` request. */
|
|
86
|
+
export function buildMessageRequest(params) {
|
|
87
|
+
return {
|
|
88
|
+
jsonrpc: "2.0",
|
|
89
|
+
id: nextRequestId(),
|
|
90
|
+
method: McpAppsMethod.UI_MESSAGE,
|
|
91
|
+
params,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/** Build a `ui/update-model-context` request. */
|
|
95
|
+
export function buildUpdateModelContextRequest(params) {
|
|
96
|
+
return {
|
|
97
|
+
jsonrpc: "2.0",
|
|
98
|
+
id: nextRequestId(),
|
|
99
|
+
method: McpAppsMethod.UI_UPDATE_MODEL_CONTEXT,
|
|
100
|
+
params,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/** Build a `ui/request-display-mode` request. */
|
|
104
|
+
export function buildDisplayModeRequest(params) {
|
|
105
|
+
return {
|
|
106
|
+
jsonrpc: "2.0",
|
|
107
|
+
id: nextRequestId(),
|
|
108
|
+
method: McpAppsMethod.UI_REQUEST_DISPLAY_MODE,
|
|
109
|
+
params,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
// ---------------------------------------------------------------------------
|
|
113
|
+
// Notification builders (Host -> App)
|
|
114
|
+
// ---------------------------------------------------------------------------
|
|
115
|
+
/** Build a `ui/notifications/initialized` notification (App -> Host). */
|
|
116
|
+
export function buildInitializedNotification() {
|
|
117
|
+
return {
|
|
118
|
+
jsonrpc: "2.0",
|
|
119
|
+
method: McpAppsMethod.UI_NOTIFICATIONS_INITIALIZED,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/** Build a `ui/notifications/tool-input` notification (Host -> App). */
|
|
123
|
+
export function buildToolInputNotification(params) {
|
|
124
|
+
return {
|
|
125
|
+
jsonrpc: "2.0",
|
|
126
|
+
method: McpAppsMethod.UI_TOOL_INPUT,
|
|
127
|
+
params,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/** Build a `ui/notifications/tool-result` notification (Host -> App). */
|
|
131
|
+
export function buildToolResultNotification(params) {
|
|
132
|
+
return {
|
|
133
|
+
jsonrpc: "2.0",
|
|
134
|
+
method: McpAppsMethod.UI_TOOL_RESULT,
|
|
135
|
+
params,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/** Build a `ui/notifications/tool-cancelled` notification (Host -> App). */
|
|
139
|
+
export function buildToolCancelledNotification(params) {
|
|
140
|
+
return {
|
|
141
|
+
jsonrpc: "2.0",
|
|
142
|
+
method: McpAppsMethod.UI_TOOL_CANCELLED,
|
|
143
|
+
params,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
/** Build a `ui/notifications/host-context-changed` notification. */
|
|
147
|
+
export function buildHostContextChangedNotification(params) {
|
|
148
|
+
return {
|
|
149
|
+
jsonrpc: "2.0",
|
|
150
|
+
method: McpAppsMethod.UI_HOST_CONTEXT_CHANGED,
|
|
151
|
+
params: params,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/** Build a `ui/resource-teardown` request (Host -> App). */
|
|
155
|
+
export function buildResourceTeardownRequest(params) {
|
|
156
|
+
return {
|
|
157
|
+
jsonrpc: "2.0",
|
|
158
|
+
id: nextRequestId(),
|
|
159
|
+
method: McpAppsMethod.UI_RESOURCE_TEARDOWN,
|
|
160
|
+
params,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/** Build a `notifications/message` notification (logging). */
|
|
164
|
+
export function buildLogNotification(params) {
|
|
165
|
+
return {
|
|
166
|
+
jsonrpc: "2.0",
|
|
167
|
+
method: McpAppsMethod.NOTIFICATIONS_MESSAGE,
|
|
168
|
+
params,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
// ---------------------------------------------------------------------------
|
|
172
|
+
// Response builders
|
|
173
|
+
// ---------------------------------------------------------------------------
|
|
174
|
+
/** Build a `ui/initialize` success response. */
|
|
175
|
+
export function buildInitializeResponse(id, params) {
|
|
176
|
+
return {
|
|
177
|
+
jsonrpc: "2.0",
|
|
178
|
+
id,
|
|
179
|
+
result: params,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/** Build a generic JSON-RPC success response. */
|
|
183
|
+
export function buildSuccessResponse(id, result) {
|
|
184
|
+
return { jsonrpc: "2.0", id, result };
|
|
185
|
+
}
|
|
186
|
+
/** Build a JSON-RPC error response. */
|
|
187
|
+
export function buildErrorResponse(id, code, message, data) {
|
|
188
|
+
return {
|
|
189
|
+
jsonrpc: "2.0",
|
|
190
|
+
id,
|
|
191
|
+
error: { code, message, ...(data !== undefined ? { data } : {}) },
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
// ---------------------------------------------------------------------------
|
|
195
|
+
// Standard JSON-RPC error codes
|
|
196
|
+
// ---------------------------------------------------------------------------
|
|
197
|
+
export const JsonRpcErrorCode = {
|
|
198
|
+
PARSE_ERROR: -32700,
|
|
199
|
+
INVALID_REQUEST: -32600,
|
|
200
|
+
METHOD_NOT_FOUND: -32601,
|
|
201
|
+
INVALID_PARAMS: -32602,
|
|
202
|
+
INTERNAL_ERROR: -32603,
|
|
203
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves `ui://` resource URIs to HTTP URLs served by the resource server.
|
|
3
|
+
*
|
|
4
|
+
* The `ui://` scheme is defined by the MCP Apps specification:
|
|
5
|
+
* `ui://<server>/<path>?<query>`
|
|
6
|
+
*
|
|
7
|
+
* The resolver rewrites these to the resource server's HTTP base URL so that
|
|
8
|
+
* platform WebViews can fetch the assets over plain HTTP(S).
|
|
9
|
+
*/
|
|
10
|
+
import type { ResourceUri } from "./types.js";
|
|
11
|
+
/**
|
|
12
|
+
* Parse a raw `ui://` URI string into its components.
|
|
13
|
+
*
|
|
14
|
+
* @throws {Error} if the URI does not start with `ui://`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseResourceUri(raw: string): ResourceUri;
|
|
17
|
+
/**
|
|
18
|
+
* Resolve a `ui://` URI to an HTTP URL using the given base URL.
|
|
19
|
+
*
|
|
20
|
+
* Example:
|
|
21
|
+
* ```
|
|
22
|
+
* resolveToHttp("ui://my-app/index.html", "https://resource.example.com")
|
|
23
|
+
* // => "https://resource.example.com/my-app/index.html"
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveToHttp(uriOrString: ResourceUri | string, httpBaseUrl: string): string;
|
|
27
|
+
//# sourceMappingURL=resource-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-resolver.d.ts","sourceRoot":"","sources":["../../src/core/resource-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAI9C;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAqDzD;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,WAAW,GAAG,MAAM,EACjC,WAAW,EAAE,MAAM,GAClB,MAAM,CAwBR"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves `ui://` resource URIs to HTTP URLs served by the resource server.
|
|
3
|
+
*
|
|
4
|
+
* The `ui://` scheme is defined by the MCP Apps specification:
|
|
5
|
+
* `ui://<server>/<path>?<query>`
|
|
6
|
+
*
|
|
7
|
+
* The resolver rewrites these to the resource server's HTTP base URL so that
|
|
8
|
+
* platform WebViews can fetch the assets over plain HTTP(S).
|
|
9
|
+
*/
|
|
10
|
+
const UI_SCHEME = "ui://";
|
|
11
|
+
/**
|
|
12
|
+
* Parse a raw `ui://` URI string into its components.
|
|
13
|
+
*
|
|
14
|
+
* @throws {Error} if the URI does not start with `ui://`.
|
|
15
|
+
*/
|
|
16
|
+
export function parseResourceUri(raw) {
|
|
17
|
+
if (!raw.startsWith(UI_SCHEME)) {
|
|
18
|
+
throw new Error(`[ResourceResolver] Invalid resource URI: expected "ui://" scheme, got "${raw}".`);
|
|
19
|
+
}
|
|
20
|
+
const withoutScheme = raw.slice(UI_SCHEME.length);
|
|
21
|
+
const queryIdx = withoutScheme.indexOf("?");
|
|
22
|
+
let serverAndPath;
|
|
23
|
+
let queryString = "";
|
|
24
|
+
if (queryIdx >= 0) {
|
|
25
|
+
serverAndPath = withoutScheme.slice(0, queryIdx);
|
|
26
|
+
queryString = withoutScheme.slice(queryIdx + 1);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
serverAndPath = withoutScheme;
|
|
30
|
+
}
|
|
31
|
+
const slashIdx = serverAndPath.indexOf("/");
|
|
32
|
+
let server;
|
|
33
|
+
let path;
|
|
34
|
+
if (slashIdx >= 0) {
|
|
35
|
+
server = serverAndPath.slice(0, slashIdx);
|
|
36
|
+
path = serverAndPath.slice(slashIdx);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
server = serverAndPath;
|
|
40
|
+
path = "/";
|
|
41
|
+
}
|
|
42
|
+
if (server.length === 0) {
|
|
43
|
+
throw new Error(`[ResourceResolver] Invalid resource URI: empty server in "${raw}".`);
|
|
44
|
+
}
|
|
45
|
+
const query = {};
|
|
46
|
+
if (queryString.length > 0) {
|
|
47
|
+
for (const pair of queryString.split("&")) {
|
|
48
|
+
const eqIdx = pair.indexOf("=");
|
|
49
|
+
if (eqIdx >= 0) {
|
|
50
|
+
query[decodeURIComponent(pair.slice(0, eqIdx))] = decodeURIComponent(pair.slice(eqIdx + 1));
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
query[decodeURIComponent(pair)] = "";
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return { raw, server, path, query };
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Resolve a `ui://` URI to an HTTP URL using the given base URL.
|
|
61
|
+
*
|
|
62
|
+
* Example:
|
|
63
|
+
* ```
|
|
64
|
+
* resolveToHttp("ui://my-app/index.html", "https://resource.example.com")
|
|
65
|
+
* // => "https://resource.example.com/my-app/index.html"
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export function resolveToHttp(uriOrString, httpBaseUrl) {
|
|
69
|
+
const uri = typeof uriOrString === "string"
|
|
70
|
+
? parseResourceUri(uriOrString)
|
|
71
|
+
: uriOrString;
|
|
72
|
+
const base = httpBaseUrl.endsWith("/")
|
|
73
|
+
? httpBaseUrl.slice(0, -1)
|
|
74
|
+
: httpBaseUrl;
|
|
75
|
+
const pathPart = uri.path.startsWith("/") ? uri.path : `/${uri.path}`;
|
|
76
|
+
const queryEntries = Object.entries(uri.query);
|
|
77
|
+
let url = `${base}/${uri.server}${pathPart}`;
|
|
78
|
+
if (queryEntries.length > 0) {
|
|
79
|
+
const qs = queryEntries
|
|
80
|
+
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)
|
|
81
|
+
.join("&");
|
|
82
|
+
url += `?${qs}`;
|
|
83
|
+
}
|
|
84
|
+
return url;
|
|
85
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { McpAppsMessage } from "./types.js";
|
|
2
|
+
/** Handler invoked when the transport receives a message. */
|
|
3
|
+
export type TransportMessageHandler = (message: McpAppsMessage) => void;
|
|
4
|
+
/** Handler invoked when the transport connection state changes. */
|
|
5
|
+
export type TransportStateHandler = (connected: boolean) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Transport layer for bidirectional JSON-RPC communication between
|
|
8
|
+
* the bridge adapter and the resource server.
|
|
9
|
+
*/
|
|
10
|
+
export interface BridgeTransport {
|
|
11
|
+
/** Send a JSON-RPC message to the resource server. */
|
|
12
|
+
send(message: McpAppsMessage): void;
|
|
13
|
+
/** Register a handler for incoming messages from the resource server. */
|
|
14
|
+
onMessage(handler: TransportMessageHandler): void;
|
|
15
|
+
/** Register a handler for connection state changes. */
|
|
16
|
+
onStateChange(handler: TransportStateHandler): void;
|
|
17
|
+
/** Connect to the resource server at the given URL. */
|
|
18
|
+
connect(url: string): Promise<void>;
|
|
19
|
+
/** Disconnect from the resource server. */
|
|
20
|
+
disconnect(): void;
|
|
21
|
+
/** Whether the transport is currently connected. */
|
|
22
|
+
readonly connected: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* WebSocket-based transport for the MCP Apps Bridge.
|
|
26
|
+
*
|
|
27
|
+
* This is the primary transport. It provides full-duplex communication
|
|
28
|
+
* so the resource server can push notifications (tool results, context
|
|
29
|
+
* changes) to the app without polling.
|
|
30
|
+
*
|
|
31
|
+
* NOTE: This class uses browser WebSocket APIs. It is designed to run
|
|
32
|
+
* inside a platform webview (Telegram, LINE), not on the server side.
|
|
33
|
+
*/
|
|
34
|
+
export declare class WebSocketTransport implements BridgeTransport {
|
|
35
|
+
private ws;
|
|
36
|
+
private messageHandlers;
|
|
37
|
+
private stateHandlers;
|
|
38
|
+
send(message: McpAppsMessage): void;
|
|
39
|
+
onMessage(handler: TransportMessageHandler): void;
|
|
40
|
+
onStateChange(handler: TransportStateHandler): void;
|
|
41
|
+
connect(url: string): Promise<void>;
|
|
42
|
+
disconnect(): void;
|
|
43
|
+
get connected(): boolean;
|
|
44
|
+
private notifyState;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/core/transport.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,6DAA6D;AAC7D,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;AAExE,mEAAmE;AACnE,MAAM,MAAM,qBAAqB,GAAG,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;AAEjE;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,sDAAsD;IACtD,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;IAEpC,yEAAyE;IACzE,SAAS,CAAC,OAAO,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAElD,uDAAuD;IACvD,aAAa,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAEpD,uDAAuD;IACvD,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpC,2CAA2C;IAC3C,UAAU,IAAI,IAAI,CAAC;IAEnB,oDAAoD;IACpD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;;GASG;AACH,qBAAa,kBAAmB,YAAW,eAAe;IAExD,OAAO,CAAC,EAAE,CAAa;IACvB,OAAO,CAAC,eAAe,CAAiC;IACxD,OAAO,CAAC,aAAa,CAA+B;IAEpD,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IASnC,SAAS,CAAC,OAAO,EAAE,uBAAuB,GAAG,IAAI;IAIjD,aAAa,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI;IAInD,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA8CnC,UAAU,IAAI,IAAI;IAOlB,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,OAAO,CAAC,WAAW;CAKpB"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transport abstraction for the MCP Apps Bridge.
|
|
3
|
+
*
|
|
4
|
+
* Defines how JSON-RPC messages travel between the bridge adapter
|
|
5
|
+
* (client-side, in the webview) and the resource server.
|
|
6
|
+
*
|
|
7
|
+
* The primary implementation is WebSocket, with HTTP POST as a fallback.
|
|
8
|
+
*/
|
|
9
|
+
import * as dntShim from "../_dnt.shims.js";
|
|
10
|
+
/**
|
|
11
|
+
* WebSocket-based transport for the MCP Apps Bridge.
|
|
12
|
+
*
|
|
13
|
+
* This is the primary transport. It provides full-duplex communication
|
|
14
|
+
* so the resource server can push notifications (tool results, context
|
|
15
|
+
* changes) to the app without polling.
|
|
16
|
+
*
|
|
17
|
+
* NOTE: This class uses browser WebSocket APIs. It is designed to run
|
|
18
|
+
* inside a platform webview (Telegram, LINE), not on the server side.
|
|
19
|
+
*/
|
|
20
|
+
export class WebSocketTransport {
|
|
21
|
+
// deno-lint-ignore no-explicit-any
|
|
22
|
+
ws = null; // WebSocket instance (browser API)
|
|
23
|
+
messageHandlers = [];
|
|
24
|
+
stateHandlers = [];
|
|
25
|
+
send(message) {
|
|
26
|
+
if (!this.ws || this.ws.readyState !== 1 /* WebSocket.OPEN */) {
|
|
27
|
+
throw new Error("[WebSocketTransport] Not connected. Call connect() first.");
|
|
28
|
+
}
|
|
29
|
+
this.ws.send(JSON.stringify(message));
|
|
30
|
+
}
|
|
31
|
+
onMessage(handler) {
|
|
32
|
+
this.messageHandlers.push(handler);
|
|
33
|
+
}
|
|
34
|
+
onStateChange(handler) {
|
|
35
|
+
this.stateHandlers.push(handler);
|
|
36
|
+
}
|
|
37
|
+
connect(url) {
|
|
38
|
+
// deno-lint-ignore no-explicit-any
|
|
39
|
+
const WS = dntShim.dntGlobalThis.WebSocket;
|
|
40
|
+
if (!WS) {
|
|
41
|
+
throw new Error("[WebSocketTransport] WebSocket API not available. " +
|
|
42
|
+
"This transport requires a browser environment.");
|
|
43
|
+
}
|
|
44
|
+
return new Promise((resolve, reject) => {
|
|
45
|
+
const ws = new WS(url);
|
|
46
|
+
ws.onopen = () => {
|
|
47
|
+
this.ws = ws;
|
|
48
|
+
this.notifyState(true);
|
|
49
|
+
resolve();
|
|
50
|
+
};
|
|
51
|
+
ws.onerror = () => {
|
|
52
|
+
reject(new Error(`[WebSocketTransport] Failed to connect to ${url}.`));
|
|
53
|
+
};
|
|
54
|
+
ws.onmessage = (event) => {
|
|
55
|
+
try {
|
|
56
|
+
const message = JSON.parse(event.data);
|
|
57
|
+
for (const handler of this.messageHandlers) {
|
|
58
|
+
handler(message);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
console.warn("[WebSocketTransport] Received non-JSON message, dropping:", err instanceof Error ? err.message : err);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
ws.onclose = () => {
|
|
66
|
+
this.ws = null;
|
|
67
|
+
this.notifyState(false);
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
disconnect() {
|
|
72
|
+
if (this.ws) {
|
|
73
|
+
this.ws.close();
|
|
74
|
+
this.ws = null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
get connected() {
|
|
78
|
+
return this.ws !== null && this.ws.readyState === 1; /* WebSocket.OPEN */
|
|
79
|
+
}
|
|
80
|
+
notifyState(connected) {
|
|
81
|
+
for (const handler of this.stateHandlers) {
|
|
82
|
+
handler(connected);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core types for the MCP Apps Bridge protocol.
|
|
3
|
+
*
|
|
4
|
+
* Defines the message envelope, resource URIs, adapter configuration,
|
|
5
|
+
* and tool declarations used throughout the bridge.
|
|
6
|
+
*/
|
|
7
|
+
/** A JSON-RPC 2.0 request sent between host and MCP App. */
|
|
8
|
+
export interface McpAppsRequest {
|
|
9
|
+
readonly jsonrpc: "2.0";
|
|
10
|
+
readonly id: string | number;
|
|
11
|
+
readonly method: string;
|
|
12
|
+
readonly params?: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
/** A JSON-RPC 2.0 success response. */
|
|
15
|
+
export interface McpAppsResponse {
|
|
16
|
+
readonly jsonrpc: "2.0";
|
|
17
|
+
readonly id: string | number;
|
|
18
|
+
readonly result: unknown;
|
|
19
|
+
}
|
|
20
|
+
/** A JSON-RPC 2.0 error response. */
|
|
21
|
+
export interface McpAppsErrorResponse {
|
|
22
|
+
readonly jsonrpc: "2.0";
|
|
23
|
+
readonly id: string | number | null;
|
|
24
|
+
readonly error: {
|
|
25
|
+
readonly code: number;
|
|
26
|
+
readonly message: string;
|
|
27
|
+
readonly data?: unknown;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** A JSON-RPC 2.0 notification (no id, no response expected). */
|
|
31
|
+
export interface McpAppsNotification {
|
|
32
|
+
readonly jsonrpc: "2.0";
|
|
33
|
+
readonly method: string;
|
|
34
|
+
readonly params?: Record<string, unknown>;
|
|
35
|
+
}
|
|
36
|
+
/** Union of all JSON-RPC message shapes. */
|
|
37
|
+
export type McpAppsMessage = McpAppsRequest | McpAppsResponse | McpAppsErrorResponse | McpAppsNotification;
|
|
38
|
+
/** Parsed representation of a `ui://` resource URI. */
|
|
39
|
+
export interface ResourceUri {
|
|
40
|
+
/** The raw URI string, e.g. `ui://my-app/index.html`. */
|
|
41
|
+
readonly raw: string;
|
|
42
|
+
/** Server / app identifier (host portion of the URI). */
|
|
43
|
+
readonly server: string;
|
|
44
|
+
/** Path within the app, e.g. `/index.html`. */
|
|
45
|
+
readonly path: string;
|
|
46
|
+
/** Optional query parameters. */
|
|
47
|
+
readonly query: Record<string, string>;
|
|
48
|
+
}
|
|
49
|
+
/** Platform-specific configuration supplied when initializing an adapter. */
|
|
50
|
+
export interface AdapterConfig {
|
|
51
|
+
/** Base URL where the resource server is reachable by the client. */
|
|
52
|
+
readonly resourceBaseUrl: string;
|
|
53
|
+
/** Optional platform-specific settings (e.g. Telegram bot token). */
|
|
54
|
+
readonly platformOptions?: Record<string, unknown>;
|
|
55
|
+
}
|
|
56
|
+
/** Global bridge options shared across all adapters. */
|
|
57
|
+
export interface BridgeOptions {
|
|
58
|
+
/** Port for the local resource server. Defaults to 0 (OS-assigned). */
|
|
59
|
+
readonly resourceServerPort?: number;
|
|
60
|
+
/** Origin allowlist for CORS. Defaults to `["*"]`. */
|
|
61
|
+
readonly allowedOrigins?: readonly string[];
|
|
62
|
+
/** Enable debug logging. */
|
|
63
|
+
readonly debug?: boolean;
|
|
64
|
+
}
|
|
65
|
+
/** UI metadata attached to an MCP tool via `_meta`. */
|
|
66
|
+
export interface McpToolUiMeta {
|
|
67
|
+
/** Resource URI pointing to the interactive UI for this tool. */
|
|
68
|
+
readonly resourceUri: string;
|
|
69
|
+
/** Optional human-readable label for the UI. */
|
|
70
|
+
readonly label?: string;
|
|
71
|
+
/** Optional width hint in pixels. */
|
|
72
|
+
readonly width?: number;
|
|
73
|
+
/** Optional height hint in pixels. */
|
|
74
|
+
readonly height?: number;
|
|
75
|
+
}
|
|
76
|
+
/** CSP (Content Security Policy) metadata for an MCP App resource. */
|
|
77
|
+
export interface McpToolUiCsp {
|
|
78
|
+
/** Allowed script-src origins. */
|
|
79
|
+
readonly scriptSources?: readonly string[];
|
|
80
|
+
/** Allowed connect-src origins. */
|
|
81
|
+
readonly connectSources?: readonly string[];
|
|
82
|
+
/** Allowed frame-ancestors origins. */
|
|
83
|
+
readonly frameAncestors?: readonly string[];
|
|
84
|
+
}
|
|
85
|
+
/** Iframe sandbox permission flags that an MCP App can request. */
|
|
86
|
+
export type McpAppPermission = "allow-downloads" | "allow-forms" | "allow-modals" | "allow-popups" | "allow-same-origin" | "allow-scripts" | "camera" | "microphone" | "geolocation" | "clipboard-read" | "clipboard-write";
|
|
87
|
+
/** An MCP tool declaration that carries `_meta.ui`. */
|
|
88
|
+
export interface McpToolDeclaration {
|
|
89
|
+
readonly name: string;
|
|
90
|
+
readonly description?: string;
|
|
91
|
+
readonly inputSchema: Record<string, unknown>;
|
|
92
|
+
readonly _meta?: {
|
|
93
|
+
readonly ui?: McpToolUiMeta & {
|
|
94
|
+
/** CSP directives for the UI resource. */
|
|
95
|
+
readonly csp?: McpToolUiCsp;
|
|
96
|
+
/** Additional sandbox permissions requested by the app. */
|
|
97
|
+
readonly permissions?: readonly McpAppPermission[];
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Well-known JSON-RPC method names used in the MCP Apps protocol (SEP-1865).
|
|
103
|
+
*
|
|
104
|
+
* App -> Host requests.
|
|
105
|
+
*/
|
|
106
|
+
export declare const McpAppsMethod: {
|
|
107
|
+
readonly UI_INITIALIZE: "ui/initialize";
|
|
108
|
+
readonly UI_NOTIFICATIONS_INITIALIZED: "ui/notifications/initialized";
|
|
109
|
+
readonly TOOLS_CALL: "tools/call";
|
|
110
|
+
readonly RESOURCES_READ: "resources/read";
|
|
111
|
+
readonly UI_OPEN_LINK: "ui/open-link";
|
|
112
|
+
readonly UI_MESSAGE: "ui/message";
|
|
113
|
+
readonly UI_UPDATE_MODEL_CONTEXT: "ui/update-model-context";
|
|
114
|
+
readonly UI_REQUEST_DISPLAY_MODE: "ui/request-display-mode";
|
|
115
|
+
readonly NOTIFICATIONS_MESSAGE: "notifications/message";
|
|
116
|
+
readonly UI_TOOL_INPUT: "ui/notifications/tool-input";
|
|
117
|
+
readonly UI_TOOL_INPUT_PARTIAL: "ui/notifications/tool-input-partial";
|
|
118
|
+
readonly UI_TOOL_RESULT: "ui/notifications/tool-result";
|
|
119
|
+
readonly UI_TOOL_CANCELLED: "ui/notifications/tool-cancelled";
|
|
120
|
+
readonly UI_HOST_CONTEXT_CHANGED: "ui/notifications/host-context-changed";
|
|
121
|
+
readonly UI_SIZE_CHANGED: "ui/notifications/size-changed";
|
|
122
|
+
readonly UI_RESOURCE_TEARDOWN: "ui/resource-teardown";
|
|
123
|
+
};
|
|
124
|
+
/** Dimensions of the container rendering the MCP App. */
|
|
125
|
+
export interface ContainerDimensions {
|
|
126
|
+
readonly width?: number;
|
|
127
|
+
readonly maxWidth?: number;
|
|
128
|
+
readonly height?: number;
|
|
129
|
+
readonly maxHeight?: number;
|
|
130
|
+
}
|
|
131
|
+
/** Safe area insets (e.g. notch, status bar) from the platform. */
|
|
132
|
+
export interface SafeAreaInsets {
|
|
133
|
+
readonly top: number;
|
|
134
|
+
readonly right: number;
|
|
135
|
+
readonly bottom: number;
|
|
136
|
+
readonly left: number;
|
|
137
|
+
}
|
|
138
|
+
/** Host theme and style information provided to the MCP App. */
|
|
139
|
+
export interface HostContextStyles {
|
|
140
|
+
/** CSS custom properties for theming (e.g. `--color-background-primary`). */
|
|
141
|
+
readonly variables?: Record<string, string>;
|
|
142
|
+
/** Optional CSS with font declarations. */
|
|
143
|
+
readonly css?: {
|
|
144
|
+
readonly fonts?: string;
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Host context provided to an MCP App during `ui/initialize`.
|
|
149
|
+
*
|
|
150
|
+
* Contains theme, dimensions, locale, and other environment info
|
|
151
|
+
* needed for the app to adapt to its container.
|
|
152
|
+
*/
|
|
153
|
+
export interface HostContext {
|
|
154
|
+
readonly theme: "light" | "dark";
|
|
155
|
+
readonly styles?: HostContextStyles;
|
|
156
|
+
readonly containerDimensions?: ContainerDimensions;
|
|
157
|
+
readonly platform?: "web" | "desktop" | "mobile";
|
|
158
|
+
readonly locale?: string;
|
|
159
|
+
readonly timeZone?: string;
|
|
160
|
+
readonly safeAreaInsets?: SafeAreaInsets;
|
|
161
|
+
}
|
|
162
|
+
/** Display mode an MCP App can request via `ui/request-display-mode`. */
|
|
163
|
+
export type DisplayMode = "inline" | "fullscreen" | "pip";
|
|
164
|
+
/**
|
|
165
|
+
* Capabilities the host exposes to the MCP App during `ui/initialize`.
|
|
166
|
+
*/
|
|
167
|
+
export interface HostCapabilities {
|
|
168
|
+
readonly serverTools?: {
|
|
169
|
+
readonly listChanged?: boolean;
|
|
170
|
+
};
|
|
171
|
+
readonly serverResources?: {
|
|
172
|
+
readonly listChanged?: boolean;
|
|
173
|
+
};
|
|
174
|
+
readonly logging?: Record<string, never>;
|
|
175
|
+
readonly openLinks?: Record<string, never>;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Lifecycle events generated by platform adapters.
|
|
179
|
+
*
|
|
180
|
+
* The bridge translates these into MCP Apps notifications
|
|
181
|
+
* (e.g. `ui/notifications/host-context-changed`).
|
|
182
|
+
*/
|
|
183
|
+
export interface LifecycleEvent {
|
|
184
|
+
readonly type: "theme-changed" | "viewport-changed" | "activated" | "deactivated" | "teardown";
|
|
185
|
+
readonly reason?: string;
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=types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