open-mcp-app 0.1.2 → 0.1.3

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.
@@ -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);
@@ -13774,6 +13774,8 @@ var App = class {
13774
13774
  singletonInstances = /* @__PURE__ */ new Map();
13775
13775
  /** Whether the connected host supports multiInstance. ChatGPT doesn't, Creature does. */
13776
13776
  hostSupportsMultiInstance = false;
13777
+ /** The connected client type for format-specific responses. */
13778
+ clientType = "unknown";
13777
13779
  /** OAuth discovery endpoint configuration. */
13778
13780
  oauthDiscoveryConfig = null;
13779
13781
  // ==========================================================================
@@ -14563,9 +14565,21 @@ var App = class {
14563
14565
  if (transportSessionId && this.transports.has(transportSessionId)) {
14564
14566
  transport = this.transports.get(transportSessionId);
14565
14567
  } else if (!transportSessionId && isInitializeRequest2(req.body)) {
14566
- const clientName = req.body?.params?.clientInfo?.name;
14567
- this.hostSupportsMultiInstance = clientName === "creature";
14568
- console.log(`[MCP] Client: ${clientName}, multiInstance support: ${this.hostSupportsMultiInstance}`);
14568
+ const clientName = req.body?.params?.clientInfo?.name?.toLowerCase() || "";
14569
+ if (clientName === "creature") {
14570
+ this.clientType = "creature";
14571
+ this.hostSupportsMultiInstance = true;
14572
+ } else if (clientName.includes("claude")) {
14573
+ this.clientType = "claude";
14574
+ this.hostSupportsMultiInstance = false;
14575
+ } else if (clientName.includes("chatgpt") || clientName.includes("openai")) {
14576
+ this.clientType = "chatgpt";
14577
+ this.hostSupportsMultiInstance = false;
14578
+ } else {
14579
+ this.clientType = "unknown";
14580
+ this.hostSupportsMultiInstance = false;
14581
+ }
14582
+ console.log(`[MCP] Client: ${clientName}, type: ${this.clientType}, multiInstance: ${this.hostSupportsMultiInstance}`);
14569
14583
  transport = this.createTransport();
14570
14584
  const server = this.createMcpServer();
14571
14585
  await server.connect(transport);
@@ -14701,6 +14715,30 @@ var App = class {
14701
14715
  const chatgptMeta = {
14702
14716
  "openai/widgetPrefersBorder": true
14703
14717
  };
14718
+ if (this.clientType === "claude" || this.clientType === "creature") {
14719
+ return {
14720
+ contents: [
14721
+ {
14722
+ uri,
14723
+ mimeType: MIME_TYPES.MCP_APPS,
14724
+ text: html,
14725
+ _meta: mcpAppsMeta
14726
+ }
14727
+ ]
14728
+ };
14729
+ }
14730
+ if (this.clientType === "chatgpt") {
14731
+ return {
14732
+ contents: [
14733
+ {
14734
+ uri,
14735
+ mimeType: MIME_TYPES.CHATGPT,
14736
+ text: html,
14737
+ _meta: chatgptMeta
14738
+ }
14739
+ ]
14740
+ };
14741
+ }
14704
14742
  return {
14705
14743
  contents: [
14706
14744
  {