open-mcp-app 0.1.2 → 0.1.4
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/core/index.d.ts +92 -53
- package/dist/core/index.js +95 -63
- package/dist/core/index.js.map +1 -1
- package/dist/react/index.d.ts +307 -30
- package/dist/react/index.js +360 -115
- package/dist/react/index.js.map +1 -1
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.js +44 -4
- package/dist/server/index.js.map +1 -1
- package/dist/vite/index.d.ts +0 -13
- package/dist/vite/index.js +3 -1
- package/dist/vite/index.js.map +1 -1
- package/package.json +6 -3
package/dist/server/index.d.ts
CHANGED
|
@@ -424,6 +424,8 @@ declare class App {
|
|
|
424
424
|
private singletonInstances;
|
|
425
425
|
/** Whether the connected host supports multiInstance. ChatGPT doesn't, Creature does. */
|
|
426
426
|
private hostSupportsMultiInstance;
|
|
427
|
+
/** The connected client type for format-specific responses. */
|
|
428
|
+
private clientType;
|
|
427
429
|
/** OAuth discovery endpoint configuration. */
|
|
428
430
|
private oauthDiscoveryConfig;
|
|
429
431
|
constructor(config: AppConfig, callerDir?: string);
|
package/dist/server/index.js
CHANGED
|
@@ -13399,6 +13399,7 @@ import { createHash } from "crypto";
|
|
|
13399
13399
|
import { spawnSync } from "child_process";
|
|
13400
13400
|
|
|
13401
13401
|
// src/vite/hmr-client.ts
|
|
13402
|
+
var HMR_RELOAD_NOTIFICATION = "ui/notifications/hmr-reload";
|
|
13402
13403
|
function generateHmrClientScript(port) {
|
|
13403
13404
|
return `
|
|
13404
13405
|
(function() {
|
|
@@ -13463,11 +13464,12 @@ function generateHmrClientScript(port) {
|
|
|
13463
13464
|
};
|
|
13464
13465
|
}
|
|
13465
13466
|
|
|
13467
|
+
// Note: Method name must match HMR_RELOAD_NOTIFICATION constant
|
|
13466
13468
|
function notifyParent() {
|
|
13467
13469
|
console.log('[Creature HMR] Sending hmr-reload to parent frame');
|
|
13468
13470
|
window.parent.postMessage({
|
|
13469
13471
|
jsonrpc: '2.0',
|
|
13470
|
-
method: '
|
|
13472
|
+
method: '${HMR_RELOAD_NOTIFICATION}',
|
|
13471
13473
|
params: {}
|
|
13472
13474
|
}, '*');
|
|
13473
13475
|
}
|
|
@@ -13774,6 +13776,8 @@ var App = class {
|
|
|
13774
13776
|
singletonInstances = /* @__PURE__ */ new Map();
|
|
13775
13777
|
/** Whether the connected host supports multiInstance. ChatGPT doesn't, Creature does. */
|
|
13776
13778
|
hostSupportsMultiInstance = false;
|
|
13779
|
+
/** The connected client type for format-specific responses. */
|
|
13780
|
+
clientType = "unknown";
|
|
13777
13781
|
/** OAuth discovery endpoint configuration. */
|
|
13778
13782
|
oauthDiscoveryConfig = null;
|
|
13779
13783
|
// ==========================================================================
|
|
@@ -14563,9 +14567,21 @@ var App = class {
|
|
|
14563
14567
|
if (transportSessionId && this.transports.has(transportSessionId)) {
|
|
14564
14568
|
transport = this.transports.get(transportSessionId);
|
|
14565
14569
|
} else if (!transportSessionId && isInitializeRequest2(req.body)) {
|
|
14566
|
-
const clientName = req.body?.params?.clientInfo?.name;
|
|
14567
|
-
|
|
14568
|
-
|
|
14570
|
+
const clientName = req.body?.params?.clientInfo?.name?.toLowerCase() || "";
|
|
14571
|
+
if (clientName === "creature") {
|
|
14572
|
+
this.clientType = "creature";
|
|
14573
|
+
this.hostSupportsMultiInstance = true;
|
|
14574
|
+
} else if (clientName.includes("claude")) {
|
|
14575
|
+
this.clientType = "claude";
|
|
14576
|
+
this.hostSupportsMultiInstance = false;
|
|
14577
|
+
} else if (clientName.includes("chatgpt") || clientName.includes("openai")) {
|
|
14578
|
+
this.clientType = "chatgpt";
|
|
14579
|
+
this.hostSupportsMultiInstance = false;
|
|
14580
|
+
} else {
|
|
14581
|
+
this.clientType = "unknown";
|
|
14582
|
+
this.hostSupportsMultiInstance = false;
|
|
14583
|
+
}
|
|
14584
|
+
console.log(`[MCP] Client: ${clientName}, type: ${this.clientType}, multiInstance: ${this.hostSupportsMultiInstance}`);
|
|
14569
14585
|
transport = this.createTransport();
|
|
14570
14586
|
const server = this.createMcpServer();
|
|
14571
14587
|
await server.connect(transport);
|
|
@@ -14701,6 +14717,30 @@ var App = class {
|
|
|
14701
14717
|
const chatgptMeta = {
|
|
14702
14718
|
"openai/widgetPrefersBorder": true
|
|
14703
14719
|
};
|
|
14720
|
+
if (this.clientType === "claude" || this.clientType === "creature") {
|
|
14721
|
+
return {
|
|
14722
|
+
contents: [
|
|
14723
|
+
{
|
|
14724
|
+
uri,
|
|
14725
|
+
mimeType: MIME_TYPES.MCP_APPS,
|
|
14726
|
+
text: html,
|
|
14727
|
+
_meta: mcpAppsMeta
|
|
14728
|
+
}
|
|
14729
|
+
]
|
|
14730
|
+
};
|
|
14731
|
+
}
|
|
14732
|
+
if (this.clientType === "chatgpt") {
|
|
14733
|
+
return {
|
|
14734
|
+
contents: [
|
|
14735
|
+
{
|
|
14736
|
+
uri,
|
|
14737
|
+
mimeType: MIME_TYPES.CHATGPT,
|
|
14738
|
+
text: html,
|
|
14739
|
+
_meta: chatgptMeta
|
|
14740
|
+
}
|
|
14741
|
+
]
|
|
14742
|
+
};
|
|
14743
|
+
}
|
|
14704
14744
|
return {
|
|
14705
14745
|
contents: [
|
|
14706
14746
|
{
|