@llmindset/hf-mcp-server 0.2.32 → 0.2.34

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.
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Gradio Widget Dev</title>
7
- <script type="module" crossorigin src="/assets/gradioWidgetDev-DR9EW8U9.js"></script>
7
+ <script type="module" crossorigin src="/assets/gradioWidgetDev-CHFFzaiX.js"></script>
8
8
  <link rel="modulepreload" crossorigin href="/assets/index-DuDDhJyu.js">
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-BJ0b-DVy.css">
10
10
  </head>
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/assets/hf-logo-DbjPOSLw.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>HF MCP Server</title>
8
- <script type="module" crossorigin src="/assets/main-BNxKgQmr.js"></script>
8
+ <script type="module" crossorigin src="/assets/main-DqGg20mH.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/index-DuDDhJyu.js">
10
10
  <link rel="stylesheet" crossorigin href="/assets/index-BJ0b-DVy.css">
11
11
  </head>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llmindset/hf-mcp-server",
3
- "version": "0.2.32",
3
+ "version": "0.2.34",
4
4
  "description": "Official Hugging Face MCP Server",
5
5
  "type": "module",
6
6
  "main": "./dist/server/streamableHttp.js",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@huggingface/hub": "^2.1.0",
35
- "@mcp-ui/server": "^5.10.0",
35
+ "@mcp-ui/server": "^5.12.0",
36
36
  "@modelcontextprotocol/sdk": "^1.20.0",
37
37
  "@radix-ui/react-checkbox": "^1.2.3",
38
38
  "@radix-ui/react-dropdown-menu": "^2.1.15",
@@ -58,7 +58,7 @@
58
58
  "tailwind-merge": "^3.2.0",
59
59
  "tailwindcss": "^4.1.5",
60
60
  "zod": "^3.24.4",
61
- "@llmindset/hf-mcp": "^0.2.32"
61
+ "@llmindset/hf-mcp": "^0.2.34"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@eslint/js": "^9.25.0",
@@ -1,34 +0,0 @@
1
- declare module '@mcp-ui/server' {
2
- interface HTMLTextContent {
3
- uri: string;
4
- mimeType: string;
5
- text: string;
6
- }
7
- interface Base64BlobContent {
8
- uri: string;
9
- mimeType: string;
10
- blob: string;
11
- }
12
- interface UIResource {
13
- type: 'resource';
14
- resource: HTMLTextContent | Base64BlobContent;
15
- }
16
- interface CreateUIResourceOptions {
17
- uri: string;
18
- encoding: 'text' | 'blob';
19
- content: {
20
- type: 'rawHtml';
21
- htmlString: string;
22
- } | {
23
- type: 'externalUrl';
24
- iframeUrl: string;
25
- } | {
26
- type: 'remoteDom';
27
- script: string;
28
- framework?: string;
29
- };
30
- }
31
- function createUIResource(options: CreateUIResourceOptions): UIResource;
32
- }
33
- export {};
34
- //# sourceMappingURL=mcp-ui-server-shim.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcp-ui-server-shim.d.ts","sourceRoot":"","sources":["../../../src/server/types/mcp-ui-server-shim.ts"],"names":[],"mappings":"AAGA,OAAO,QAAQ,gBAAgB,CAAC;IAC/B,UAAiB,eAAe;QAC/B,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;KACb;IAED,UAAiB,iBAAiB;QACjC,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;KACb;IAED,UAAiB,UAAU;QAC1B,IAAI,EAAE,UAAU,CAAC;QACjB,QAAQ,EAAE,eAAe,GAAG,iBAAiB,CAAC;KAC9C;IAED,UAAiB,uBAAuB;QACvC,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;QAC1B,OAAO,EACJ;YAAE,IAAI,EAAE,SAAS,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAE,GACvC;YAAE,IAAI,EAAE,aAAa,CAAC;YAAC,SAAS,EAAE,MAAM,CAAA;SAAE,GAC1C;YAAE,IAAI,EAAE,WAAW,CAAC;YAAC,MAAM,EAAE,MAAM,CAAC;YAAC,SAAS,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KAC7D;IAED,SAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,UAAU,CAAC;CAC/E"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=mcp-ui-server-shim.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcp-ui-server-shim.js","sourceRoot":"","sources":["../../../src/server/types/mcp-ui-server-shim.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- import{a as n,j as t,d as N}from"./index-DuDDhJyu.js";const j={url:"https://example.com/audio.wav"},O={lastPlayed:null};function E(){const p=n.useRef(null),[h,u]=n.useState(JSON.stringify(j,null,2)),[c,f]=n.useState(JSON.stringify(O,null,2)),[a,v]=n.useState("inline"),[s,w]=n.useState(800),[i,y]=n.useState("light"),[S,b]=n.useState(null);n.useEffect(()=>{const e=localStorage.getItem("gradio-widget-dev-state");if(e)try{const o=JSON.parse(e);o.toolOutputJson&&u(o.toolOutputJson),o.widgetStateJson&&f(o.widgetStateJson),o.displayMode&&v(o.displayMode),o.maxHeight&&w(o.maxHeight),o.theme&&y(o.theme)}catch(o){console.error("Failed to load saved state:",o)}},[]),n.useEffect(()=>{const e={toolOutputJson:h,widgetStateJson:c,displayMode:a,maxHeight:s,theme:i};localStorage.setItem("gradio-widget-dev-state",JSON.stringify(e))},[h,c,a,s,i]),n.useEffect(()=>{const e=p.current;if(!(e!=null&&e.contentWindow))return;const o=e.contentWindow;if(!o.openai)return;o.openai.displayMode=a,o.openai.maxHeight=s,o.openai.theme=i;const r=new CustomEvent("openai:set_globals",{detail:{globals:{displayMode:a,maxHeight:s,theme:i}}});o.dispatchEvent(r),console.log("[Shim] Auto-updated displayMode, maxHeight, theme")},[a,s,i]),n.useEffect(()=>{const e=p.current;if(!e)return;const o=()=>{const r=e.contentWindow;if(!r)return;const d=l=>{const g=new CustomEvent("openai:set_globals",{detail:{globals:l}});r.dispatchEvent(g)},m={theme:i,locale:"en-US",displayMode:a,maxHeight:s,toolInput:{},toolOutput:null,toolResponseMetadata:null,widgetState:null,userAgent:{device:{type:"desktop"},capabilities:{hover:!0,touch:!1}},safeArea:{insets:{top:0,bottom:0,left:0,right:0}},setWidgetState:async l=>{console.log("[Shim] setWidgetState called:",l),f(JSON.stringify(l,null,2)),m.widgetState=l,d({widgetState:l})},callTool:async(l,g)=>(console.log("[Shim] callTool called:",l,g),{result:"Mock tool response"}),sendFollowUpMessage:async l=>{console.log("[Shim] sendFollowUpMessage called:",l)},openExternal:l=>{console.log("[Shim] openExternal called:",l),window.open(l.href,"_blank")},requestDisplayMode:async l=>(console.log("[Shim] requestDisplayMode called:",l),v(l.mode),{mode:l.mode})};r.openai=m,console.log("[Shim] window.openai initialized in iframe"),setTimeout(()=>{try{const l=JSON.parse(h),g=c.trim()?JSON.parse(c):null;m.toolOutput=l,m.widgetState=g,d({toolOutput:l,widgetState:g,displayMode:a,maxHeight:s,theme:i}),console.log("[Shim] Initial data sent to widget")}catch(l){console.error("[Shim] Failed to send initial data:",l)}},100)};return e.addEventListener("load",o),()=>e.removeEventListener("load",o)},[]);const x=()=>{b(null);const e=p.current;if(!(e!=null&&e.contentWindow)){b("Iframe not loaded");return}try{const o=JSON.parse(h),r=c.trim()?JSON.parse(c):null,d=e.contentWindow;if(!d.openai){b("window.openai not initialized");return}d.openai.toolOutput=o,d.openai.widgetState=r,d.openai.displayMode=a,d.openai.maxHeight=s,d.openai.theme=i;const m=new CustomEvent("openai:set_globals",{detail:{globals:{toolOutput:o,widgetState:r,displayMode:a,maxHeight:s,theme:i}}});d.dispatchEvent(m),console.log("[Shim] Update sent to widget")}catch(o){b(`Invalid JSON: ${o instanceof Error?o.message:String(o)}`)}};return t.jsxs("div",{className:"flex h-screen bg-gray-100",children:[t.jsx("div",{className:"flex-1 p-4 overflow-hidden",children:t.jsx("div",{className:"h-full bg-white rounded-lg shadow-lg overflow-hidden",children:t.jsx("iframe",{ref:p,src:"/gradio-widget.html",className:"w-full h-full border-0",title:"Gradio Widget"})})}),t.jsxs("div",{className:"w-96 p-4 overflow-y-auto bg-white border-l border-gray-200",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[t.jsx("h1",{className:"text-2xl font-bold",children:"Widget Dev"}),t.jsx("span",{className:"px-2 py-1 text-xs font-semibold bg-blue-100 text-blue-800 rounded",children:"IFRAME"})]}),t.jsxs("div",{className:"mb-4 p-3 bg-blue-50 border border-blue-200 rounded-lg text-blue-700 text-sm",children:[t.jsx("strong",{children:"Iframe Mode:"})," Widget loads in isolated context. Check browser console for [Shim] logs."]}),S&&t.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-lg text-red-700 text-sm",children:S}),t.jsxs("div",{className:"mb-6",children:[t.jsx("label",{className:"block text-sm font-medium mb-2",children:"Tool Output (JSON)"}),t.jsx("textarea",{value:h,onChange:e=>u(e.target.value),className:"w-full h-32 p-2 border border-gray-300 rounded font-mono text-sm",spellCheck:!1})]}),t.jsxs("div",{className:"mb-6",children:[t.jsx("label",{className:"block text-sm font-medium mb-2",children:"Widget State (JSON)"}),t.jsx("textarea",{value:c,onChange:e=>f(e.target.value),className:"w-full h-32 p-2 border border-gray-300 rounded font-mono text-sm",spellCheck:!1})]}),t.jsxs("div",{className:"mb-6",children:[t.jsx("label",{className:"block text-sm font-medium mb-2",children:"Display Mode"}),t.jsx("div",{className:"flex gap-2",children:["inline","fullscreen","pip"].map(e=>t.jsx("button",{onClick:()=>v(e),className:`px-4 py-2 rounded font-medium ${a===e?"bg-blue-500 text-white":"bg-gray-200 text-gray-700 hover:bg-gray-300"}`,children:e},e))})]}),t.jsxs("div",{className:"mb-6",children:[t.jsxs("label",{className:"block text-sm font-medium mb-2",children:["Max Height: ",s,"px"]}),t.jsx("input",{type:"range",min:"400",max:"1200",step:"50",value:s,onChange:e=>w(Number(e.target.value)),className:"w-full"})]}),t.jsxs("div",{className:"mb-6",children:[t.jsx("label",{className:"block text-sm font-medium mb-2",children:"Theme"}),t.jsx("div",{className:"flex gap-2",children:["light","dark"].map(e=>t.jsx("button",{onClick:()=>y(e),className:`px-4 py-2 rounded font-medium ${i===e?"bg-blue-500 text-white":"bg-gray-200 text-gray-700 hover:bg-gray-300"}`,children:e},e))})]}),t.jsx("button",{onClick:x,className:"w-full py-3 bg-green-600 text-white rounded-lg font-semibold hover:bg-green-700 transition-colors",children:"Send Update"}),t.jsxs("div",{className:"mt-8 pt-6 border-t border-gray-200",children:[t.jsx("h2",{className:"text-lg font-semibold mb-3",children:"Quick Presets"}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("button",{onClick:()=>{u(JSON.stringify({url:"https://example.com/audio.wav"},null,2)),x()},className:"w-full px-3 py-2 text-sm bg-gray-100 hover:bg-gray-200 rounded text-left",children:"Audio WAV"}),t.jsx("button",{onClick:()=>{u(JSON.stringify({url:"https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.png"},null,2)),x()},className:"w-full px-3 py-2 text-sm bg-gray-100 hover:bg-gray-200 rounded text-left",children:"Image PNG"}),t.jsx("button",{onClick:()=>{u(JSON.stringify({url:"https://example.com/video.mp4"},null,2)),x()},className:"w-full px-3 py-2 text-sm bg-gray-100 hover:bg-gray-200 rounded text-left",children:"Video MP4"}),t.jsx("button",{onClick:()=>{u(JSON.stringify({},null,2)),x()},className:"w-full px-3 py-2 text-sm bg-gray-100 hover:bg-gray-200 rounded text-left",children:"Empty (no content)"}),t.jsx("button",{onClick:()=>{u("");const e=p.current;if(e!=null&&e.contentWindow){const o=e.contentWindow;if(o.openai){o.openai.toolOutput=null;const r=new CustomEvent("openai:set_globals",{detail:{globals:{toolOutput:null,widgetState:c.trim()?JSON.parse(c):null,displayMode:a,maxHeight:s,theme:i}}});o.dispatchEvent(r),console.log("[Shim] Loading state activated")}}},className:"w-full px-3 py-2 text-sm bg-purple-100 hover:bg-purple-200 rounded text-left",children:"Show Loading"})]})]})]})]})}N.createRoot(document.getElementById("root")).render(t.jsx(n.StrictMode,{children:t.jsx(E,{})}));