import{s as Ge,n as ze,o as We}from"../chunks/scheduler.ea9963d4.js";import{S as Ke,i as Xe,e as s,s as i,c as o,q as et,h as tt,a as p,d as n,b as a,f as Ie,g as m,j as $,r as nt,k as Ne,l as ke,m as l,n as f,t as r,o as g,p as u}from"../chunks/index.2ecb6441.js";import{C as lt,H as d,E as it}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.b27212aa.js";import{C as z}from"../chunks/CodeBlock.5675cb3b.js";function at(je){let c,W,N,K,h,X,v,ee,C,He="Client for the Model Context Protocol (MCP).",te,x,Re="This package provides a client implementation for interacting with MCP servers, built on top of our InferenceClient, <code>@huggingface/inference</code>.",ne,w,Ue="It includes an example CLI smol Agent that can leverage MCP tools.",le,_,ie,T,qe="This package is part of the Hugging Face JS monorepo. To install dependencies for all packages, run from the root of the repository:",ae,b,se,M,pe,P,Ae="The package includes a command-line interface (CLI) agent that demonstrates how to use the MCP client.",oe,L,me,V,y,Y,Fe="Hugging Face API Token:",Ee,I,fe,k,re,E,Se="Navigate to the package directory and run the agent script:",ge,j,ue,H,Ze="Alternatively, run from the root of the monorepo:",$e,R,ce,U,Qe="The agent will load available MCP tools (by default, connecting to a filesystem server for your Desktop and a Playwright server) and prompt you for input (<code>&gt;</code>).",de,q,he,A,De="<li><code>HF_TOKEN</code> (Optional): Your Hugging Face API token. Required if you use an Inference Provider on HF.</li> <li><code>MODEL_ID</code> (Optional): The model ID to use for the agent’s inference. Defaults to <code>Qwen/Qwen2.5-72B-Instruct</code>.</li> <li><code>PROVIDER</code> (Optional): The inference provider. Defaults to <code>together</code>. See <code>@huggingface/inference</code> for available providers.</li> <li><code>ENDPOINT_URL</code> or <code>BASE_URL</code> (Optional): A custom base URL (local for instance) to call.</li>",ve,F,Je="Example with custom model:",Ce,S,xe,Z,we,Q,Oe="Common development tasks can be run using pnpm scripts:",_e,D,Be="<li><code>pnpm build</code>: Build the package.</li> <li><code>pnpm lint</code>: Lint and fix code style.</li> <li><code>pnpm format</code>: Format code using Prettier.</li> <li><code>pnpm test</code>: Run tests using Vitest.</li> <li><code>pnpm check</code>: Type-check the code using TypeScript.</li>",Te,J,be,O,Ve="MIT",Me,B,Pe,G,Le;return h=new lt({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),v=new d({props:{title:"@huggingface/mcp-client",local:"huggingfacemcp-client",headingTag:"h1"}}),_=new d({props:{title:"Installation",local:"installation",headingTag:"h2"}}),b=new z({props:{code:"cG5wbSUyMGluc3RhbGw=",highlighted:"pnpm install",wrap:!1}}),M=new d({props:{title:"Usage (CLI Agent)",local:"usage-cli-agent",headingTag:"h2"}}),L=new d({props:{title:"Prerequisites",local:"prerequisites",headingTag:"h3"}}),I=new z({props:{code:"ZXhwb3J0JTIwSEZfVE9LRU4lM0QlMjJoZl8uLi4lMjI=",highlighted:'<span class="hljs-built_in">export</span> HF_TOKEN=<span class="hljs-string">&quot;hf_...&quot;</span>',wrap:!1}}),k=new d({props:{title:"Running the Agent",local:"running-the-agent",headingTag:"h3"}}),j=new z({props:{code:"Y2QlMjBwYWNrYWdlcyUyRm1jcC1jbGllbnQlMEFwbnBtJTIwYWdlbnQ=",highlighted:`<span class="hljs-built_in">cd</span> packages/mcp-client
pnpm agent`,wrap:!1}}),R=new z({props:{code:"cG5wbSUyMC0tZmlsdGVyJTIwJTQwaHVnZ2luZ2ZhY2UlMkZtY3AtY2xpZW50JTIwYWdlbnQ=",highlighted:"pnpm --filter @huggingface/mcp-client agent",wrap:!1}}),q=new d({props:{title:"Configuration (Environment Variables)",local:"configuration-environment-variables",headingTag:"h3"}}),S=new z({props:{code:"ZXhwb3J0JTIwSEZfVE9LRU4lM0QlMjJoZl8uLi4lMjIlMEFleHBvcnQlMjBNT0RFTF9JRCUzRCUyMlF3ZW4lMkZRd2VuMi41LTcyQi1JbnN0cnVjdCUyMiUwQXBucG0lMjBhZ2VudA==",highlighted:`<span class="hljs-built_in">export</span> HF_TOKEN=<span class="hljs-string">&quot;hf_...&quot;</span>
<span class="hljs-built_in">export</span> MODEL_ID=<span class="hljs-string">&quot;Qwen/Qwen2.5-72B-Instruct&quot;</span>
pnpm agent`,wrap:!1}}),Z=new d({props:{title:"Development",local:"development",headingTag:"h2"}}),J=new d({props:{title:"License",local:"license",headingTag:"h2"}}),B=new it({props:{source:"https://github.com/huggingface/huggingface.js/blob/main/docs/mcp-client/README.md"}}),{c(){c=s("meta"),W=i(),N=s("p"),K=i(),o(h.$$.fragment),X=i(),o(v.$$.fragment),ee=i(),C=s("p"),C.textContent=He,te=i(),x=s("p"),x.innerHTML=Re,ne=i(),w=s("p"),w.textContent=Ue,le=i(),o(_.$$.fragment),ie=i(),T=s("p"),T.textContent=qe,ae=i(),o(b.$$.fragment),se=i(),o(M.$$.fragment),pe=i(),P=s("p"),P.textContent=Ae,oe=i(),o(L.$$.fragment),me=i(),V=s("ul"),y=s("li"),Y=s("strong"),Y.textContent=Fe,Ee=et(` You need a Hugging Face API token with appropriate permissions. Set it as an environment variable:
	`),o(I.$$.fragment),fe=i(),o(k.$$.fragment),re=i(),E=s("p"),E.textContent=Se,ge=i(),o(j.$$.fragment),ue=i(),H=s("p"),H.textContent=Ze,$e=i(),o(R.$$.fragment),ce=i(),U=s("p"),U.innerHTML=Qe,de=i(),o(q.$$.fragment),he=i(),A=s("ul"),A.innerHTML=De,ve=i(),F=s("p"),F.textContent=Je,Ce=i(),o(S.$$.fragment),xe=i(),o(Z.$$.fragment),we=i(),Q=s("p"),Q.textContent=Oe,_e=i(),D=s("ul"),D.innerHTML=Be,Te=i(),o(J.$$.fragment),be=i(),O=s("p"),O.textContent=Ve,Me=i(),o(B.$$.fragment),Pe=i(),G=s("p"),this.h()},l(e){const t=tt("svelte-u9bgzb",document.head);c=p(t,"META",{name:!0,content:!0}),t.forEach(n),W=a(e),N=p(e,"P",{}),Ie(N).forEach(n),K=a(e),m(h.$$.fragment,e),X=a(e),m(v.$$.fragment,e),ee=a(e),C=p(e,"P",{"data-svelte-h":!0}),$(C)!=="svelte-pzg0x2"&&(C.textContent=He),te=a(e),x=p(e,"P",{"data-svelte-h":!0}),$(x)!=="svelte-5w9ozd"&&(x.innerHTML=Re),ne=a(e),w=p(e,"P",{"data-svelte-h":!0}),$(w)!=="svelte-1a1ne1a"&&(w.textContent=Ue),le=a(e),m(_.$$.fragment,e),ie=a(e),T=p(e,"P",{"data-svelte-h":!0}),$(T)!=="svelte-h2s4id"&&(T.textContent=qe),ae=a(e),m(b.$$.fragment,e),se=a(e),m(M.$$.fragment,e),pe=a(e),P=p(e,"P",{"data-svelte-h":!0}),$(P)!=="svelte-11mwzj0"&&(P.textContent=Ae),oe=a(e),m(L.$$.fragment,e),me=a(e),V=p(e,"UL",{});var Ye=Ie(V);y=p(Ye,"LI",{});var ye=Ie(y);Y=p(ye,"STRONG",{"data-svelte-h":!0}),$(Y)!=="svelte-136n659"&&(Y.textContent=Fe),Ee=nt(ye,` You need a Hugging Face API token with appropriate permissions. Set it as an environment variable:
	`),m(I.$$.fragment,ye),ye.forEach(n),Ye.forEach(n),fe=a(e),m(k.$$.fragment,e),re=a(e),E=p(e,"P",{"data-svelte-h":!0}),$(E)!=="svelte-1y99kwd"&&(E.textContent=Se),ge=a(e),m(j.$$.fragment,e),ue=a(e),H=p(e,"P",{"data-svelte-h":!0}),$(H)!=="svelte-16ixoy9"&&(H.textContent=Ze),$e=a(e),m(R.$$.fragment,e),ce=a(e),U=p(e,"P",{"data-svelte-h":!0}),$(U)!=="svelte-165s8qm"&&(U.innerHTML=Qe),de=a(e),m(q.$$.fragment,e),he=a(e),A=p(e,"UL",{"data-svelte-h":!0}),$(A)!=="svelte-gtei5s"&&(A.innerHTML=De),ve=a(e),F=p(e,"P",{"data-svelte-h":!0}),$(F)!=="svelte-1djl5kq"&&(F.textContent=Je),Ce=a(e),m(S.$$.fragment,e),xe=a(e),m(Z.$$.fragment,e),we=a(e),Q=p(e,"P",{"data-svelte-h":!0}),$(Q)!=="svelte-1rnf6ih"&&(Q.textContent=Oe),_e=a(e),D=p(e,"UL",{"data-svelte-h":!0}),$(D)!=="svelte-4tr2g3"&&(D.innerHTML=Be),Te=a(e),m(J.$$.fragment,e),be=a(e),O=p(e,"P",{"data-svelte-h":!0}),$(O)!=="svelte-1ikb5q6"&&(O.textContent=Ve),Me=a(e),m(B.$$.fragment,e),Pe=a(e),G=p(e,"P",{}),Ie(G).forEach(n),this.h()},h(){Ne(c,"name","hf:doc:metadata"),Ne(c,"content",st)},m(e,t){ke(document.head,c),l(e,W,t),l(e,N,t),l(e,K,t),f(h,e,t),l(e,X,t),f(v,e,t),l(e,ee,t),l(e,C,t),l(e,te,t),l(e,x,t),l(e,ne,t),l(e,w,t),l(e,le,t),f(_,e,t),l(e,ie,t),l(e,T,t),l(e,ae,t),f(b,e,t),l(e,se,t),f(M,e,t),l(e,pe,t),l(e,P,t),l(e,oe,t),f(L,e,t),l(e,me,t),l(e,V,t),ke(V,y),ke(y,Y),ke(y,Ee),f(I,y,null),l(e,fe,t),f(k,e,t),l(e,re,t),l(e,E,t),l(e,ge,t),f(j,e,t),l(e,ue,t),l(e,H,t),l(e,$e,t),f(R,e,t),l(e,ce,t),l(e,U,t),l(e,de,t),f(q,e,t),l(e,he,t),l(e,A,t),l(e,ve,t),l(e,F,t),l(e,Ce,t),f(S,e,t),l(e,xe,t),f(Z,e,t),l(e,we,t),l(e,Q,t),l(e,_e,t),l(e,D,t),l(e,Te,t),f(J,e,t),l(e,be,t),l(e,O,t),l(e,Me,t),f(B,e,t),l(e,Pe,t),l(e,G,t),Le=!0},p:ze,i(e){Le||(r(h.$$.fragment,e),r(v.$$.fragment,e),r(_.$$.fragment,e),r(b.$$.fragment,e),r(M.$$.fragment,e),r(L.$$.fragment,e),r(I.$$.fragment,e),r(k.$$.fragment,e),r(j.$$.fragment,e),r(R.$$.fragment,e),r(q.$$.fragment,e),r(S.$$.fragment,e),r(Z.$$.fragment,e),r(J.$$.fragment,e),r(B.$$.fragment,e),Le=!0)},o(e){g(h.$$.fragment,e),g(v.$$.fragment,e),g(_.$$.fragment,e),g(b.$$.fragment,e),g(M.$$.fragment,e),g(L.$$.fragment,e),g(I.$$.fragment,e),g(k.$$.fragment,e),g(j.$$.fragment,e),g(R.$$.fragment,e),g(q.$$.fragment,e),g(S.$$.fragment,e),g(Z.$$.fragment,e),g(J.$$.fragment,e),g(B.$$.fragment,e),Le=!1},d(e){e&&(n(W),n(N),n(K),n(X),n(ee),n(C),n(te),n(x),n(ne),n(w),n(le),n(ie),n(T),n(ae),n(se),n(pe),n(P),n(oe),n(me),n(V),n(fe),n(re),n(E),n(ge),n(ue),n(H),n($e),n(ce),n(U),n(de),n(he),n(A),n(ve),n(F),n(Ce),n(xe),n(we),n(Q),n(_e),n(D),n(Te),n(be),n(O),n(Me),n(Pe),n(G)),n(c),u(h,e),u(v,e),u(_,e),u(b,e),u(M,e),u(L,e),u(I),u(k,e),u(j,e),u(R,e),u(q,e),u(S,e),u(Z,e),u(J,e),u(B,e)}}}const st='{"title":"@huggingface/mcp-client","local":"huggingfacemcp-client","sections":[{"title":"Installation","local":"installation","sections":[],"depth":2},{"title":"Usage (CLI Agent)","local":"usage-cli-agent","sections":[{"title":"Prerequisites","local":"prerequisites","sections":[],"depth":3},{"title":"Running the Agent","local":"running-the-agent","sections":[],"depth":3},{"title":"Configuration (Environment Variables)","local":"configuration-environment-variables","sections":[],"depth":3}],"depth":2},{"title":"Development","local":"development","sections":[],"depth":2},{"title":"License","local":"license","sections":[],"depth":2}],"depth":1}';function pt(je){return We(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class gt extends Ke{constructor(c){super(),Xe(this,c,pt,at,Ge,{})}}export{gt as component};
