@orchyn/mcp 1.12.1 → 1.12.2

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.
@@ -182,6 +182,7 @@ body{font-family:system-ui,-apple-system,'Segoe UI',sans-serif;background:var(--
182
182
  });
183
183
  }
184
184
 
185
+ var toolResultReceived=false;
185
186
  window.addEventListener("message",function(ev){
186
187
  var d=ev.data;if(!d||typeof d!=="object")return;
187
188
  if(d.id&&pending.has(d.id)){
@@ -190,7 +191,9 @@ body{font-family:system-ui,-apple-system,'Segoe UI',sans-serif;background:var(--
190
191
  else p.resolve(d.result);return;
191
192
  }
192
193
  if(d.method==="ui/notifications/tool-result"){
194
+ toolResultReceived=true;
193
195
  clearTimeout(loadingTimer);
196
+ clearTimeout(fallbackTimer);
194
197
  render(d.params);
195
198
  }
196
199
  if(d.method==="ui/notifications/tool-input-partial"){
@@ -204,6 +207,35 @@ body{font-family:system-ui,-apple-system,'Segoe UI',sans-serif;background:var(--
204
207
  if(app)app.innerHTML=renderSkeleton();
205
208
  },300);
206
209
 
210
+ // Fallback: if no tool-result arrives within 3s, check if data is embedded
211
+ // in the page (some hosts pass structuredContent via URL hash or postMessage)
212
+ var fallbackTimer=setTimeout(function(){
213
+ if(toolResultReceived)return;
214
+ // Try to extract data from URL hash (host may pass structuredContent here)
215
+ try{
216
+ var hash=window.location.hash.slice(1);
217
+ if(hash){
218
+ var decoded=JSON.parse(decodeURIComponent(hash));
219
+ if(decoded&&typeof decoded==="object"){render(decoded);return;}
220
+ }
221
+ }catch(e){}
222
+ // Try to extract from URL search params
223
+ try{
224
+ var params=new URLSearchParams(window.location.search);
225
+ var dataParam=params.get("data");
226
+ if(dataParam){
227
+ var decoded=JSON.parse(decodeURIComponent(dataParam));
228
+ if(decoded&&typeof decoded==="object"){render(decoded);return;}
229
+ }
230
+ }catch(e){}
231
+ // Last resort: show a minimal card indicating results are available
232
+ var app=document.getElementById("app");
233
+ if(app)app.innerHTML='<div class="card card-wide fade-in"><div class="card-body">'
234
+ +'<div style="font-size:14px;font-weight:600;margin-bottom:8px">✅ Results ready</div>'
235
+ +'<div style="font-size:13px;color:var(--muted)">Tool execution complete. See the full response in the chat.</div>'
236
+ +'</div></div>';
237
+ },3000);
238
+
207
239
  // MCP Apps handshake
208
240
  send("ui/initialize",{
209
241
  protocolVersion:"2026-01-26",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orchyn/mcp",
3
- "version": "1.12.1",
3
+ "version": "1.12.2",
4
4
  "description": "MCP server for orchyn - fetch, discover and understand TikTok/Instagram/YouTube/X posts with AI (media metadata, niche discovery, hook & viral analysis)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",