import{s as Et,o as Gt,n as gt}from"../chunks/scheduler.008aaf19.js";import{S as At,i as Zt,e as w,s as r,c as y,h as Nt,a as j,d as s,b as c,f as Bt,g as u,j as h,k as vt,l as St,m as e,n as I,t as U,o as f,p as b}from"../chunks/index.7c7f75b2.js";import{Y as Qt}from"../chunks/Youtube.79476af5.js";import{C as F}from"../chunks/CodeBlock.027569b9.js";import{H as z,E as kt}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.4f0ca956.js";import{H as xt,a as $t}from"../chunks/HfOption.b44a1114.js";function Rt(B){let p,T,i,m,n,M="Once you have your server implemented, you can start it by running the server script.",J,o,d;return p=new Qt({props:{id:"exzrb5QNUis"}}),i=new F({props:{code:"ZnJvbSUyMG1jcC5zZXJ2ZXIuZmFzdG1jcCUyMGltcG9ydCUyMEZhc3RNQ1AlMEElMEElMjMlMjBDcmVhdGUlMjBhbiUyME1DUCUyMHNlcnZlciUwQW1jcCUyMCUzRCUyMEZhc3RNQ1AoJTIyV2VhdGhlciUyMFNlcnZpY2UlMjIpJTBBJTBBJTIzJTIwVG9vbCUyMGltcGxlbWVudGF0aW9uJTBBJTQwbWNwLnRvb2woKSUwQWRlZiUyMGdldF93ZWF0aGVyKGxvY2F0aW9uJTNBJTIwc3RyKSUyMC0lM0UlMjBzdHIlM0ElMEElMjAlMjAlMjAlMjAlMjIlMjIlMjJHZXQlMjB0aGUlMjBjdXJyZW50JTIwd2VhdGhlciUyMGZvciUyMGElMjBzcGVjaWZpZWQlMjBsb2NhdGlvbi4lMjIlMjIlMjIlMEElMjAlMjAlMjAlMjByZXR1cm4lMjBmJTIyV2VhdGhlciUyMGluJTIwJTdCbG9jYXRpb24lN0QlM0ElMjBTdW5ueSUyQyUyMDcyJUMyJUIwRiUyMiUwQSUwQSUyMyUyMFJlc291cmNlJTIwaW1wbGVtZW50YXRpb24lMEElNDBtY3AucmVzb3VyY2UoJTIyd2VhdGhlciUzQSUyRiUyRiU3QmxvY2F0aW9uJTdEJTIyKSUwQWRlZiUyMHdlYXRoZXJfcmVzb3VyY2UobG9jYXRpb24lM0ElMjBzdHIpJTIwLSUzRSUyMHN0ciUzQSUwQSUyMCUyMCUyMCUyMCUyMiUyMiUyMlByb3ZpZGUlMjB3ZWF0aGVyJTIwZGF0YSUyMGFzJTIwYSUyMHJlc291cmNlLiUyMiUyMiUyMiUwQSUyMCUyMCUyMCUyMHJldHVybiUyMGYlMjJXZWF0aGVyJTIwZGF0YSUyMGZvciUyMCU3QmxvY2F0aW9uJTdEJTNBJTIwU3VubnklMkMlMjA3MiVDMiVCMEYlMjIlMEElMEElMjMlMjBQcm9tcHQlMjBpbXBsZW1lbnRhdGlvbiUwQSU0MG1jcC5wcm9tcHQoKSUwQWRlZiUyMHdlYXRoZXJfcmVwb3J0KGxvY2F0aW9uJTNBJTIwc3RyKSUyMC0lM0UlMjBzdHIlM0ElMEElMjAlMjAlMjAlMjAlMjIlMjIlMjJDcmVhdGUlMjBhJTIwd2VhdGhlciUyMHJlcG9ydCUyMHByb21wdC4lMjIlMjIlMjIlMEElMjAlMjAlMjAlMjByZXR1cm4lMjBmJTIyJTIyJTIyWW91JTIwYXJlJTIwYSUyMHdlYXRoZXIlMjByZXBvcnRlci4lMjBXZWF0aGVyJTIwcmVwb3J0JTIwZm9yJTIwJTdCbG9jYXRpb24lN0QlM0YlMjIlMjIlMjIlMEElMEElMEElMjMlMjBSdW4lMjB0aGUlMjBzZXJ2ZXIlMEFpZiUyMF9fbmFtZV9fJTIwJTNEJTNEJTIwJTIyX19tYWluX18lMjIlM0ElMEElMjAlMjAlMjAlMjBtY3AucnVuKCk=",highlighted:`<span class="hljs-keyword">from</span> mcp.server.fastmcp <span class="hljs-keyword">import</span> FastMCP

<span class="hljs-comment"># Create an MCP server</span>
mcp = FastMCP(<span class="hljs-string">&quot;Weather Service&quot;</span>)

<span class="hljs-comment"># Tool implementation</span>
<span class="hljs-meta">@mcp.tool()</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">get_weather</span>(<span class="hljs-params">location: <span class="hljs-built_in">str</span></span>) -&gt; <span class="hljs-built_in">str</span>:
    <span class="hljs-string">&quot;&quot;&quot;Get the current weather for a specified location.&quot;&quot;&quot;</span>
    <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;Weather in <span class="hljs-subst">{location}</span>: Sunny, 72°F&quot;</span>

<span class="hljs-comment"># Resource implementation</span>
<span class="hljs-meta">@mcp.resource(<span class="hljs-params"><span class="hljs-string">&quot;weather://{location}&quot;</span></span>)</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">weather_resource</span>(<span class="hljs-params">location: <span class="hljs-built_in">str</span></span>) -&gt; <span class="hljs-built_in">str</span>:
    <span class="hljs-string">&quot;&quot;&quot;Provide weather data as a resource.&quot;&quot;&quot;</span>
    <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;Weather data for <span class="hljs-subst">{location}</span>: Sunny, 72°F&quot;</span>

<span class="hljs-comment"># Prompt implementation</span>
<span class="hljs-meta">@mcp.prompt()</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">weather_report</span>(<span class="hljs-params">location: <span class="hljs-built_in">str</span></span>) -&gt; <span class="hljs-built_in">str</span>:
    <span class="hljs-string">&quot;&quot;&quot;Create a weather report prompt.&quot;&quot;&quot;</span>
    <span class="hljs-keyword">return</span> <span class="hljs-string">f&quot;&quot;&quot;You are a weather reporter. Weather report for <span class="hljs-subst">{location}</span>?&quot;&quot;&quot;</span>


<span class="hljs-comment"># Run the server</span>
<span class="hljs-keyword">if</span> __name__ == <span class="hljs-string">&quot;__main__&quot;</span>:
    mcp.run()`,wrap:!1}}),o=new F({props:{code:"bWNwJTIwZGV2JTIwc2VydmVyLnB5",highlighted:"mcp dev server.py",wrap:!1}}),{c(){y(p.$$.fragment),T=r(),y(i.$$.fragment),m=r(),n=w("p"),n.textContent=M,J=r(),y(o.$$.fragment)},l(a){u(p.$$.fragment,a),T=c(a),u(i.$$.fragment,a),m=c(a),n=j(a,"P",{"data-svelte-h":!0}),h(n)!=="svelte-o6gns3"&&(n.textContent=M),J=c(a),u(o.$$.fragment,a)},m(a,C){I(p,a,C),e(a,T,C),I(i,a,C),e(a,m,C),e(a,n,C),e(a,J,C),I(o,a,C),d=!0},p:gt,i(a){d||(U(p.$$.fragment,a),U(i.$$.fragment,a),U(o.$$.fragment,a),d=!0)},o(a){f(p.$$.fragment,a),f(i.$$.fragment,a),f(o.$$.fragment,a),d=!1},d(a){a&&(s(T),s(m),s(n),s(J)),b(p,a),b(i,a),b(o,a)}}}function Vt(B){let p,T,i,m="Once you have your server implemented, you can start it by running the server script.",n,M,J;return p=new F({props:{code:"JTJGJTJGJTIwaW5kZXgubWpzJTBBaW1wb3J0JTIwJTdCJTBBJTIwJTIwTWNwU2VydmVyJTJDJTBBJTIwJTIwUmVzb3VyY2VUZW1wbGF0ZSUyQyUwQSU3RCUyMGZyb20lMjAlMjIlNDBtb2RlbGNvbnRleHRwcm90b2NvbCUyRnNkayUyRnNlcnZlciUyRm1jcC5qcyUyMiUzQiUwQWltcG9ydCUyMCU3QiUyMFN0ZGlvU2VydmVyVHJhbnNwb3J0JTIwJTdEJTIwZnJvbSUyMCUyMiU0MG1vZGVsY29udGV4dHByb3RvY29sJTJGc2RrJTJGc2VydmVyJTJGc3RkaW8uanMlMjIlM0IlMEFpbXBvcnQlMjAlN0IlMjB6JTIwJTdEJTIwZnJvbSUyMCUyMnpvZCUyMiUzQiUwQSUwQSUyRiUyRiUyMENyZWF0ZSUyMGFuJTIwTUNQJTIwc2VydmVyJTBBY29uc3QlMjBzZXJ2ZXIlMjAlM0QlMjBuZXclMjBNY3BTZXJ2ZXIoJTdCJTBBJTIwJTIwbmFtZSUzQSUyMCUyMldlYXRoZXIlMjBTZXJ2aWNlJTIyJTJDJTBBJTIwJTIwdmVyc2lvbiUzQSUyMCUyMjEuMC4wJTIyJTJDJTBBJTdEKSUzQiUwQSUwQSUyRiUyRiUyMFRvb2wlMjBpbXBsZW1lbnRhdGlvbiUwQXNlcnZlci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JTIwJTIwJTIwJTIwJTIwdHlwZSUzQSUyMCUyMnRleHQlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB0ZXh0JTNBJTIwJTYwV2VhdGhlciUyMHJlcG9ydCUyMGZvciUyMCUyNCU3QmxvY2F0aW9uJTdEJTNGJTYwJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTVEJTJDJTBBJTIwJTIwJTdEKSUwQSklM0IlMEElMEElMkYlMkYlMjBSdW4lMjB0aGUlMjBzZXJ2ZXIlMEFjb25zdCUyMHRyYW5zcG9ydCUyMCUzRCUyMG5ldyUyMFN0ZGlvU2VydmVyVHJhbnNwb3J0KCklM0IlMEFhd2FpdCUyMHNlcnZlci5jb25uZWN0KHRyYW5zcG9ydCklM0I=",highlighted:`<span class="hljs-comment">// index.mjs</span>
<span class="hljs-keyword">import</span> {
  <span class="hljs-title class_">McpServer</span>,
  <span class="hljs-title class_">ResourceTemplate</span>,
} <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;@modelcontextprotocol/sdk/server/mcp.js&quot;</span>;
<span class="hljs-keyword">import</span> { <span class="hljs-title class_">StdioServerTransport</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;@modelcontextprotocol/sdk/server/stdio.js&quot;</span>;
<span class="hljs-keyword">import</span> { z } <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;zod&quot;</span>;

<span class="hljs-comment">// Create an MCP server</span>
<span class="hljs-keyword">const</span> server = <span class="hljs-keyword">new</span> <span class="hljs-title class_">McpServer</span>({
  <span class="hljs-attr">name</span>: <span class="hljs-string">&quot;Weather Service&quot;</span>,
  <span class="hljs-attr">version</span>: <span class="hljs-string">&quot;1.0.0&quot;</span>,
});

<span class="hljs-comment">// Tool implementation</span>
server.<span class="hljs-title function_">tool</span>(<span class="hljs-string">&quot;get_weather&quot;</span>, { <span class="hljs-attr">location</span>: z.<span class="hljs-title function_">string</span>() }, <span class="hljs-keyword">async</span> ({ location }) =&gt; ({
  <span class="hljs-attr">content</span>: [
    {
      <span class="hljs-attr">type</span>: <span class="hljs-string">&quot;text&quot;</span>,
      <span class="hljs-attr">text</span>: <span class="hljs-string">\`Weather in <span class="hljs-subst">\${location}</span>: Sunny, 72°F\`</span>,
    },
  ],
}));

<span class="hljs-comment">// Resource implementation</span>
server.<span class="hljs-title function_">resource</span>(
  <span class="hljs-string">&quot;weather&quot;</span>,
  <span class="hljs-keyword">new</span> <span class="hljs-title class_">ResourceTemplate</span>(<span class="hljs-string">&quot;weather://{location}&quot;</span>, { <span class="hljs-attr">list</span>: <span class="hljs-literal">undefined</span> }),
  <span class="hljs-keyword">async</span> (uri, { location }) =&gt; ({
    <span class="hljs-attr">contents</span>: [
      {
        <span class="hljs-attr">uri</span>: uri.<span class="hljs-property">href</span>,
        <span class="hljs-attr">text</span>: <span class="hljs-string">\`Weather data for <span class="hljs-subst">\${location}</span>: Sunny, 72°F\`</span>,
      },
    ],
  })
);

<span class="hljs-comment">// Prompt implementation</span>
server.<span class="hljs-title function_">prompt</span>(
  <span class="hljs-string">&quot;weather_report&quot;</span>,
  { <span class="hljs-attr">location</span>: z.<span class="hljs-title function_">string</span>() },
  <span class="hljs-keyword">async</span> ({ location }) =&gt; ({
    <span class="hljs-attr">messages</span>: [
      {
        <span class="hljs-attr">role</span>: <span class="hljs-string">&quot;assistant&quot;</span>,
        <span class="hljs-attr">content</span>: {
          <span class="hljs-attr">type</span>: <span class="hljs-string">&quot;text&quot;</span>,
          <span class="hljs-attr">text</span>: <span class="hljs-string">&quot;You are a weather reporter.&quot;</span>,
        },
      },
      {
        <span class="hljs-attr">role</span>: <span class="hljs-string">&quot;user&quot;</span>,
        <span class="hljs-attr">content</span>: {
          <span class="hljs-attr">type</span>: <span class="hljs-string">&quot;text&quot;</span>,
          <span class="hljs-attr">text</span>: <span class="hljs-string">\`Weather report for <span class="hljs-subst">\${location}</span>?\`</span>,
        },
      },
    ],
  })
);

<span class="hljs-comment">// Run the server</span>
<span class="hljs-keyword">const</span> transport = <span class="hljs-keyword">new</span> <span class="hljs-title class_">StdioServerTransport</span>();
<span class="hljs-keyword">await</span> server.<span class="hljs-title function_">connect</span>(transport);`,wrap:!1}}),M=new F({props:{code:"bnB4JTIwJTQwbW9kZWxjb250ZXh0cHJvdG9jb2wlMkZpbnNwZWN0b3IlMjBub2RlJTIwLiUyRmluZGV4Lm1qcw==",highlighted:"npx @modelcontextprotocol/inspector node ./index.mjs",wrap:!1}}),{c(){y(p.$$.fragment),T=r(),i=w("p"),i.textContent=m,n=r(),y(M.$$.fragment)},l(o){u(p.$$.fragment,o),T=c(o),i=j(o,"P",{"data-svelte-h":!0}),h(i)!=="svelte-o6gns3"&&(i.textContent=m),n=c(o),u(M.$$.fragment,o)},m(o,d){I(p,o,d),e(o,T,d),e(o,i,d),e(o,n,d),I(M,o,d),J=!0},p:gt,i(o){J||(U(p.$$.fragment,o),U(M.$$.fragment,o),J=!0)},o(o){f(p.$$.fragment,o),f(M.$$.fragment,o),J=!1},d(o){o&&(s(T),s(i),s(n)),b(p,o),b(M,o)}}}function Xt(B){let p,T,i,m;return p=new $t({props:{id:"server-implementation",option:"python",$$slots:{default:[Rt]},$$scope:{ctx:B}}}),i=new $t({props:{id:"server-implementation",option:"javascript",$$slots:{default:[Vt]},$$scope:{ctx:B}}}),{c(){y(p.$$.fragment),T=r(),y(i.$$.fragment)},l(n){u(p.$$.fragment,n),T=c(n),u(i.$$.fragment,n)},m(n,M){I(p,n,M),e(n,T,M),I(i,n,M),m=!0},p(n,M){const J={};M&2&&(J.$$scope={dirty:M,ctx:n}),p.$set(J);const o={};M&2&&(o.$$scope={dirty:M,ctx:n}),i.$set(o)},i(n){m||(U(p.$$.fragment,n),U(i.$$.fragment,n),m=!0)},o(n){f(p.$$.fragment,n),f(i.$$.fragment,n),m=!1},d(n){n&&s(T),b(p,n),b(i,n)}}}function _t(B){let p,T,i,m,n,M,J,o="The Model Context Protocol provides official SDKs for both JavaScript, Python and other languages. This makes it easy to implement MCP clients and servers in your applications. These SDKs handle the low-level protocol details, allowing you to focus on building your application’s capabilities.",d,a,C,$,Tt="Both SDKs provide similar core functionality, following the MCP protocol specification we discussed earlier. They handle:",H,g,wt="<li>Protocol-level communication</li> <li>Capability registration and discovery</li> <li>Message serialization/deserialization</li> <li>Connection management</li> <li>Error handling</li>",P,E,D,G,jt="Let’s explore how to implement each of the core primitives (Tools, Resources, and Prompts) using both SDKs.",K,v,L,A,mt="This will initialize a development server running the file <code>server.py</code>. And log the following output:",O,Z,tt,N,dt='You can then open the MCP Inspector at <a href="http://127.0.0.1:6274" rel="nofollow">http://127.0.0.1:6274</a> to see the server’s capabilities and interact with them.',lt,S,ht="You’ll see the server’s capabilities and the ability to call them via the UI.",st,Q,yt='<img src="https://huggingface.co/datasets/mcp-course/images/resolve/main/unit1/6.png" alt="MCP Inspector"/>',et,k,nt,x,ut="MCP is designed to be language-agnostic, and there are official SDKs available for several popular programming languages:",at,R,It='<thead><tr><th>Language</th> <th>Repository</th> <th>Maintainer(s)</th> <th>Status</th></tr></thead> <tbody><tr><td>TypeScript</td> <td><a href="https://github.com/modelcontextprotocol/typescript-sdk" rel="nofollow">github.com/modelcontextprotocol/typescript-sdk</a></td> <td>Anthropic</td> <td>Active</td></tr> <tr><td>Python</td> <td><a href="https://github.com/modelcontextprotocol/python-sdk" rel="nofollow">github.com/modelcontextprotocol/python-sdk</a></td> <td>Anthropic</td> <td>Active</td></tr> <tr><td>Java</td> <td><a href="https://github.com/modelcontextprotocol/java-sdk" rel="nofollow">github.com/modelcontextprotocol/java-sdk</a></td> <td>Spring AI (VMware)</td> <td>Active</td></tr> <tr><td>Kotlin</td> <td><a href="https://github.com/modelcontextprotocol/kotlin-sdk" rel="nofollow">github.com/modelcontextprotocol/kotlin-sdk</a></td> <td>JetBrains</td> <td>Active</td></tr> <tr><td>C#</td> <td><a href="https://github.com/modelcontextprotocol/csharp-sdk" rel="nofollow">github.com/modelcontextprotocol/csharp-sdk</a></td> <td>Microsoft</td> <td>Active (Preview)</td></tr> <tr><td>Swift</td> <td><a href="https://github.com/modelcontextprotocol/swift-sdk" rel="nofollow">github.com/modelcontextprotocol/swift-sdk</a></td> <td>loopwork-ai</td> <td>Active</td></tr> <tr><td>Rust</td> <td><a href="https://github.com/modelcontextprotocol/rust-sdk" rel="nofollow">github.com/modelcontextprotocol/rust-sdk</a></td> <td>Anthropic/Community</td> <td>Active</td></tr> <tr><td>Dart</td> <td><a href="https://github.com/leehack/mcp_dart" rel="nofollow">https://github.com/leehack/mcp_dart</a></td> <td>Flutter Community</td> <td>Active</td></tr></tbody>',ot,V,Ut="These SDKs provide language-specific abstractions that simplify working with the MCP protocol, allowing you to focus on implementing the core logic of your servers or clients rather than dealing with low-level protocol details.",pt,X,it,_,ft="We’ve only scratched the surface of what you can do with the MCP but you’ve already got a basic server running. In fact, you’ve also connected to it using the MCP Client in the browser.",rt,W,bt="In the next section, we’ll look at how to connect to your server from an LLM.",ct,Y,Mt,q,Jt;return n=new z({props:{title:"MCP SDK",local:"mcp-sdk",headingTag:"h1"}}),a=new z({props:{title:"SDK Overview",local:"sdk-overview",headingTag:"h2"}}),E=new z({props:{title:"Core Primitives Implementation",local:"core-primitives-implementation",headingTag:"h2"}}),v=new xt({props:{id:"server-implementation",options:["python","javascript"],$$slots:{default:[Xt]},$$scope:{ctx:B}}}),Z=new F({props:{code:"U3RhcnRpbmclMjBNQ1AlMjBpbnNwZWN0b3IuLi4lMEElRTIlOUElOTklRUYlQjglOEYlMjBQcm94eSUyMHNlcnZlciUyMGxpc3RlbmluZyUyMG9uJTIwcG9ydCUyMDYyNzclMEFTcGF3bmVkJTIwc3RkaW8lMjB0cmFuc3BvcnQlMEFDb25uZWN0ZWQlMjBNQ1AlMjBjbGllbnQlMjB0byUyMGJhY2tpbmclMjBzZXJ2ZXIlMjB0cmFuc3BvcnQlMEFDcmVhdGVkJTIwd2ViJTIwYXBwJTIwdHJhbnNwb3J0JTBBU2V0JTIwdXAlMjBNQ1AlMjBwcm94eSUwQSVGMCU5RiU5NCU4RCUyME1DUCUyMEluc3BlY3RvciUyMGlzJTIwdXAlMjBhbmQlMjBydW5uaW5nJTIwYXQlMjBodHRwJTNBJTJGJTJGMTI3LjAuMC4xJTNBNjI3NCUyMCVGMCU5RiU5QSU4MA==",highlighted:`Starting MCP inspector...
⚙️ Proxy server listening on port 6277
Spawned stdio transport
Connected MCP client to backing server transport
Created web app transport
Set up MCP proxy
🔍 MCP Inspector is up and running at http://127.0.0.1:6274 🚀`,wrap:!1}}),k=new z({props:{title:"MCP SDKs",local:"mcp-sdks",headingTag:"h2"}}),X=new z({props:{title:"Next Steps",local:"next-steps",headingTag:"h2"}}),Y=new kt({props:{source:"https://github.com/huggingface/mcp-course/blob/main/units/en/unit1/sdk.mdx"}}),{c(){p=w("meta"),T=r(),i=w("p"),m=r(),y(n.$$.fragment),M=r(),J=w("p"),J.textContent=o,d=r(),y(a.$$.fragment),C=r(),$=w("p"),$.textContent=Tt,H=r(),g=w("ul"),g.innerHTML=wt,P=r(),y(E.$$.fragment),D=r(),G=w("p"),G.textContent=jt,K=r(),y(v.$$.fragment),L=r(),A=w("p"),A.innerHTML=mt,O=r(),y(Z.$$.fragment),tt=r(),N=w("p"),N.innerHTML=dt,lt=r(),S=w("p"),S.textContent=ht,st=r(),Q=w("p"),Q.innerHTML=yt,et=r(),y(k.$$.fragment),nt=r(),x=w("p"),x.textContent=ut,at=r(),R=w("table"),R.innerHTML=It,ot=r(),V=w("p"),V.textContent=Ut,pt=r(),y(X.$$.fragment),it=r(),_=w("p"),_.textContent=ft,rt=r(),W=w("p"),W.textContent=bt,ct=r(),y(Y.$$.fragment),Mt=r(),q=w("p"),this.h()},l(t){const l=Nt("svelte-u9bgzb",document.head);p=j(l,"META",{name:!0,content:!0}),l.forEach(s),T=c(t),i=j(t,"P",{}),Bt(i).forEach(s),m=c(t),u(n.$$.fragment,t),M=c(t),J=j(t,"P",{"data-svelte-h":!0}),h(J)!=="svelte-d74ti7"&&(J.textContent=o),d=c(t),u(a.$$.fragment,t),C=c(t),$=j(t,"P",{"data-svelte-h":!0}),h($)!=="svelte-13pn39g"&&($.textContent=Tt),H=c(t),g=j(t,"UL",{"data-svelte-h":!0}),h(g)!=="svelte-68l2gn"&&(g.innerHTML=wt),P=c(t),u(E.$$.fragment,t),D=c(t),G=j(t,"P",{"data-svelte-h":!0}),h(G)!=="svelte-ttdup7"&&(G.textContent=jt),K=c(t),u(v.$$.fragment,t),L=c(t),A=j(t,"P",{"data-svelte-h":!0}),h(A)!=="svelte-o7d2nm"&&(A.innerHTML=mt),O=c(t),u(Z.$$.fragment,t),tt=c(t),N=j(t,"P",{"data-svelte-h":!0}),h(N)!=="svelte-1t493b1"&&(N.innerHTML=dt),lt=c(t),S=j(t,"P",{"data-svelte-h":!0}),h(S)!=="svelte-14xr1ub"&&(S.textContent=ht),st=c(t),Q=j(t,"P",{"data-svelte-h":!0}),h(Q)!=="svelte-1pax2up"&&(Q.innerHTML=yt),et=c(t),u(k.$$.fragment,t),nt=c(t),x=j(t,"P",{"data-svelte-h":!0}),h(x)!=="svelte-1jgjuju"&&(x.textContent=ut),at=c(t),R=j(t,"TABLE",{"data-svelte-h":!0}),h(R)!=="svelte-hr2s98"&&(R.innerHTML=It),ot=c(t),V=j(t,"P",{"data-svelte-h":!0}),h(V)!=="svelte-1b923fr"&&(V.textContent=Ut),pt=c(t),u(X.$$.fragment,t),it=c(t),_=j(t,"P",{"data-svelte-h":!0}),h(_)!=="svelte-1mzm78"&&(_.textContent=ft),rt=c(t),W=j(t,"P",{"data-svelte-h":!0}),h(W)!=="svelte-v6yatx"&&(W.textContent=bt),ct=c(t),u(Y.$$.fragment,t),Mt=c(t),q=j(t,"P",{}),Bt(q).forEach(s),this.h()},h(){vt(p,"name","hf:doc:metadata"),vt(p,"content",Wt)},m(t,l){St(document.head,p),e(t,T,l),e(t,i,l),e(t,m,l),I(n,t,l),e(t,M,l),e(t,J,l),e(t,d,l),I(a,t,l),e(t,C,l),e(t,$,l),e(t,H,l),e(t,g,l),e(t,P,l),I(E,t,l),e(t,D,l),e(t,G,l),e(t,K,l),I(v,t,l),e(t,L,l),e(t,A,l),e(t,O,l),I(Z,t,l),e(t,tt,l),e(t,N,l),e(t,lt,l),e(t,S,l),e(t,st,l),e(t,Q,l),e(t,et,l),I(k,t,l),e(t,nt,l),e(t,x,l),e(t,at,l),e(t,R,l),e(t,ot,l),e(t,V,l),e(t,pt,l),I(X,t,l),e(t,it,l),e(t,_,l),e(t,rt,l),e(t,W,l),e(t,ct,l),I(Y,t,l),e(t,Mt,l),e(t,q,l),Jt=!0},p(t,[l]){const Ct={};l&2&&(Ct.$$scope={dirty:l,ctx:t}),v.$set(Ct)},i(t){Jt||(U(n.$$.fragment,t),U(a.$$.fragment,t),U(E.$$.fragment,t),U(v.$$.fragment,t),U(Z.$$.fragment,t),U(k.$$.fragment,t),U(X.$$.fragment,t),U(Y.$$.fragment,t),Jt=!0)},o(t){f(n.$$.fragment,t),f(a.$$.fragment,t),f(E.$$.fragment,t),f(v.$$.fragment,t),f(Z.$$.fragment,t),f(k.$$.fragment,t),f(X.$$.fragment,t),f(Y.$$.fragment,t),Jt=!1},d(t){t&&(s(T),s(i),s(m),s(M),s(J),s(d),s(C),s($),s(H),s(g),s(P),s(D),s(G),s(K),s(L),s(A),s(O),s(tt),s(N),s(lt),s(S),s(st),s(Q),s(et),s(nt),s(x),s(at),s(R),s(ot),s(V),s(pt),s(it),s(_),s(rt),s(W),s(ct),s(Mt),s(q)),s(p),b(n,t),b(a,t),b(E,t),b(v,t),b(Z,t),b(k,t),b(X,t),b(Y,t)}}}const Wt='{"title":"MCP SDK","local":"mcp-sdk","sections":[{"title":"SDK Overview","local":"sdk-overview","sections":[],"depth":2},{"title":"Core Primitives Implementation","local":"core-primitives-implementation","sections":[],"depth":2},{"title":"MCP SDKs","local":"mcp-sdks","sections":[],"depth":2},{"title":"Next Steps","local":"next-steps","sections":[],"depth":2}],"depth":1}';function Yt(B){return Gt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Kt extends At{constructor(p){super(),Zt(this,p,Yt,_t,Et,{})}}export{Kt as component};
