<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>Enlighten with Amit</title><link>https://www.amitk.net/</link><description>Expert insights from a Solution Architect on enterprise digital strategy, microservices architecture, and modern headless solutions (Sitecore XM Cloud, Next.js). Focused on driving business impact through scalable technology.</description><image><url>https://www.amitk.net/images/amit-kumar.jpeg</url><title>Enlighten with Amit</title><link>https://www.amitk.net/</link></image><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>amit@amitk.net (Amit Kumar)</managingEditor><webMaster>amit@amitk.net (Amit Kumar)</webMaster><lastBuildDate>Fri, 05 Dec 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://www.amitk.net/index.xml" rel="self" type="application/rss+xml"/><item><title>Build Custom Sitecore MCP Tools in .NET C#: A Practical Guide for .NET Developers</title><link>https://www.amitk.net/blog/build-custom-mcp-server-dotnet-csharp/</link><pubDate>Tue, 24 Mar 2026 00:00:00 +0000</pubDate><author>amit@amitk.net (Amit Kumar)</author><guid>https://www.amitk.net/blog/build-custom-mcp-server-dotnet-csharp/</guid><media:content url="https://www.amitk.net/images/build-custom-mcp-server-dotnet-csharp/build-custom-mcp-server-dotnet-csharp.gif" medium="image" type="image/gif"/><description>
Build custom Sitecore MCP tools in .NET C#: step-by-step tutorial with code examples to extend ChatGPT, Claude &amp; GitHub Copilot using enterprise data integration.</description><content:encoded><![CDATA[







<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-introduction" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">📊 Introduction</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>What if your AI assistant could securely tap into your company&rsquo;s <strong>database</strong>, browse your <a href="https://www.amitk.net/tags/sitecore-ai/" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text">SitecoreAI (FKA XM Cloud)</span></a>
 content, query your <strong>CRM</strong>, or talk directly to your internal <strong>business systems</strong> - all without you lifting a finger?</p>
<p>That&rsquo;s exactly what <a href="https://www.amitk.net/blog/sitecore-marketer-mcp-vscode-integration" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text-aqua">Model Context Protocol (MCP)</span></a>
 makes possible. And if you&rsquo;re a <strong>.NET developer</strong>, building <strong>custom MCP tools in C#</strong> is the most practical way to get there.</p>
<p>In my <span class="dark:text-gray-300 font-semibold gradient-text">previous articles</span>, I explained:</p>
<ul>
<li><a href="https://www.amitk.net/blog/sitecore-marketer-mcp-vscode-integration/" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text-vital-ocean">How MCP works with Sitecore Marketer MCP</span></a>
</li>
<li><a href="https://www.amitk.net/blog/mcp-server-vs-copilot-genai-agentic-ai/" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text-sea-salt">Why MCP is needed compared to Copilot, GenAI, and Agentic AI</span></a>
</li>
</ul>
<p>Now the next step is understanding how to <span class="dark:text-gray-300 font-semibold gradient-text-vital-ocean">create your own MCP tool in .NET C# </span>using the official <a href="https://csharp.sdk.modelcontextprotocol.io" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text-par-four">MCP SDK</span></a>
.</p>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-why-create-custom-mcp-tools" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🛠️ Why Create Custom MCP Tools</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p><strong>Out-of-the-box MCP servers</strong> are useful, but <strong>enterprise projects</strong> often require custom tools.</p>


<p class="font-semibold text-xl  text-primary dark:text-gray-300">Examples:</p>
<ul>
<li>Internal APIs</li>
<li>Sitecore CMS operation / automation</li>
<li>DevOps utilities</li>
<li>Data services</li>
<li>Marketing workflows</li>
<li>Reporting tools</li>
</ul>
<p>Creating a <span class="dark:text-gray-300 font-semibold gradient-text-aqua">custom MCP tool</span> allows AI agents to interact with your system safely.</p>
<p>This becomes <strong>important</strong> when using:</p>
<ul>
<li>Copilot</li>
<li>AI Agents</li>
<li>Agentic AI</li>
<li>Claude / ChatGPT with MCP</li>
<li>VS Code MCP integration</li>
</ul>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-mcp-and-net-why-c-is-a-strong-fit" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧱 MCP and .NET: Why C# Is a Strong Fit</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p><strong>Microsoft</strong> and <strong>Anthropic</strong> jointly maintain the <a href="https://developer.microsoft.com/blog/microsoft-partners-with-anthropic-to-create-official-c-sdk-for-model-context-protocol" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text">official MCP C# SDK</span></a>
, making <strong>.NET a first‑class platform</strong> for <strong>MCP development</strong>.</p>
<p>With the <strong>C# SDK</strong>, you can:</p>
<ul>
<li><span class="dark:text-gray-300 font-semibold gradient-text-aqua">Build MCP servers as simple console apps or ASP.NET services</span></li>
<li><span class="dark:text-gray-300 font-semibold gradient-text-ooey-gooey">Expose tools using familiar .NET patterns</span></li>
<li><span class="dark:text-gray-300 font-semibold gradient-text-sea-salt">Integrate cleanly with dependency injection and hosting</span></li>
<li><span class="dark:text-gray-300 font-semibold gradient-text-vital-ocean">Run locally (stdio) or remotely (HTTP/SSE)</span></li>
</ul>
<div class="callout info">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" width="22" height="22"><path stroke-linecap="round" stroke-linejoin="round" d="m11.25 11.25.041-.02a.75.75.0 011.063.852l-.708 2.836a.75.75.0 001.063.853l.041-.021M21 12A9 9 0 113 12a9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"></path></svg><p>Official Repository</p>
    </div>
    <div class="callout-body">
        <p><strong>You can explore the <span class="dark:text-gray-300 font-semibold gradient-text-sea-salt">official implementation over at the MCP C# SDK</span> on <a href="https://github.com/modelcontextprotocol/csharp-sdk" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text">GitHub</span></a>
 - <span class="dark:text-gray-300 font-semibold gradient-text-sea-salt">it&rsquo;s the best starting point for .NET developers diving into Model Context Protocol.</span></strong></p>
    </div>
</div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h3 id="-nuget-package" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">📦 NuGet Package</h3>
  
  
</div>
<p>The <span class="dark:text-gray-300 font-semibold gradient-text-sea-salt">ModelContextProtocol</span> SDK provides:</p>
<ul>
<li>Core MCP protocol implementation (transport layer, message handling)</li>
<li>Attribute-based tool registration (<code>[McpServerTool]</code>, <code>[McpServerToolType]</code>)</li>
<li>Built-in dependency injection support</li>
<li>Async/await patterns for I/O operations</li>
<li>Type-safe parameter handling with validation</li>
</ul>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-starting-point-the-quickstart-weather-server" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🏁 Starting Point: The Quickstart Weather Server</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>The best place to start is the official <a href="https://github.com/modelcontextprotocol/csharp-sdk/tree/main/samples/QuickstartWeatherServer" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text">QuickstartWeatherServer</span></a>
 sample from the MCP C# SDK repository - <strong><em>a minimal, well-structured example that shows exactly how to build your first MCP server in .NET</em></strong>.</p>


<p class="font-semibold text-xl  text-success-color dark:text-gray-300">This sample demonstrates:</p>
<ul>
<li>Creating a minimal MCP server</li>
<li>Registering tools using attributes</li>
<li>Exposing those tools to MCP clients</li>
<li>Returning structured responses</li>
</ul>
<p><span class="dark:text-gray-300 font-semibold gradient-text">Simple by design</span> - but it <span class="dark:text-gray-300 font-semibold gradient-text-aqua">demonstrates the exact pattern you'll repeat for every custom MCP tool you build.</span></p>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-how-mcp-server-works-in-net-high-level" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🏗️ How MCP Server Works in .NET (High Level)</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>


<p class="font-semibold text-xl  text-example-color dark:text-gray-300">Basic flow:</p>
<ol>
<li>Create MCP server project</li>
<li>Define tools using SDK attributes</li>
<li>Register tools in server</li>
<li>Run MCP server</li>
<li>Connect from client (VS Code / Copilot / AI Agent)</li>
</ol>


<p class="font-semibold text-xl  text-success-color dark:text-gray-300">Example concept:</p>





















  
  
    
    <img
      title="The diagram above illustrates how a Model Context Protocol (MCP) request flows end-to-end - from the user&#39;s prompt, through the AI, down to the MCP client and server, all the way to tool execution, and back with a result."
      loading="lazy"
      decoding="async"
      src="https://www.amitk.net/images/build-custom-mcp-server-dotnet-csharp/creating-mcp-tools-dotnet.png"
      alt="The diagram above illustrates how a Model Context Protocol (MCP) request flows end-to-end - from the user&#39;s prompt, through the AI, down to the MCP client and server, all the way to tool execution, and back with a result."
      class="img justify-self-center  "
      width=""
      height="" />
  
  













<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-getting-started-with-mcp-in-net" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">📦 Getting Started with MCP in .NET</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>Below is a high-level overview of how to build a custom MCP server in .NET. For the complete implementation, full source code, and a real-world <span class="dark:text-gray-300 font-semibold gradient-text-ooey-gooey">SitecoreAI (FKA XM Cloud)</span> example, check out the <strong>GitHub repository</strong>: <a href="https://github.com/AmitKumar-AK/mcp-dotnet-tutorial" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text">MCP C# SDK Tutorial with SitecoreAI Example</span></a>
</p>
<h3 id="1-hahahugoshortcode11s32hbhb"><strong>1.</strong> <span class="dark:text-gray-300 font-semibold gradient-text-aqua">Create a new .NET project Start with a minimal ASP.NET Core or console host:</span> <br/></h3>
<p>Target .NET 8 or later, as most MCP examples assume current LTS or preview runtimes.</p>
<p>Add the following <strong>package references</strong> :</p>
<ul>
<li><strong><em>Microsoft.Data.Sqlite</em></strong></li>
<li><strong><em>Microsoft.Extensions.Hosting</em></strong></li>
<li><strong><em>ModelContextProtocol</em></strong></li>
</ul>
<h3 id="2-hahahugoshortcode11s33hbhb"><strong>2.</strong> <span class="dark:text-gray-300 font-semibold gradient-text-ooey-gooey">Register the MCP server and transport Using an approach similar to the examples, you configure MCP in Program.cs:</span> <br/></h3>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-csharp" data-lang="csharp"><span style="display:flex;"><span><span style="color:#ff79c6">using</span> Microsoft.Extensions.DependencyInjection;
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">using</span> Microsoft.Extensions.Hosting;
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">using</span> Microsoft.Extensions.Logging;
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">using</span> McpSitecoreAiExample;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#8be9fd">var</span> builder = Host.CreateApplicationBuilder(args);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>builder.Services.AddSingleton&lt;MonkeyService&gt;();
</span></span><span style="display:flex;"><span>builder.Services.AddSingleton&lt;SellingService&gt;();
</span></span><span style="display:flex;"><span>builder.Services.AddSingleton&lt;SitecoreAIService&gt;();
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>builder.Logging.AddConsole(consoleLogOptions =&gt;
</span></span><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>    <span style="color:#6272a4">// Configure all logs to go to stderr</span>
</span></span><span style="display:flex;"><span>    consoleLogOptions.LogToStandardErrorThreshold = LogLevel.Trace;
</span></span><span style="display:flex;"><span>});
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>builder.Services
</span></span><span style="display:flex;"><span>    .AddMcpServer()
</span></span><span style="display:flex;"><span>    .WithStdioServerTransport()
</span></span><span style="display:flex;"><span>    .WithToolsFromAssembly();
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">await</span> builder.Build().RunAsync();</span></span></code></pre></div>
<p><strong>📦 Service Registration</strong></p>
<ul>
<li><code>MonkeyService</code>, <code>SellingService</code>, <code>SitecoreAIService</code> registered as Singletons - one shared instance per app lifetime</li>
<li><strong>SitecoreAIService</strong> is the key bridge connecting your MCP server to <strong>SitecoreAI</strong></li>
</ul>
<p><strong>📋 Logging Configuration</strong></p>
<ul>
<li>All logs redirected to stderr from Trace level upward</li>
<li>Critical for Stdio transport - keeps stdout clean exclusively for MCP protocol messages</li>
</ul>
<p><strong>⚙️ MCP Server Wiring</strong></p>
<ul>
<li><code>AddMcpServer()</code> - registers MCP into the .NET DI pipeline; server name &amp; version auto-resolved via assembly reflection</li>
<li><code>WithStdioServerTransport()</code> - sets Stdio as the communication channel; swap with WithHttpTransport() for web-hosted scenarios</li>
<li><code>WithToolsFromAssembly()</code> - auto-discovers all MCP tools via reflection; no manual registration needed</li>
</ul>
<p><strong>🔐 Optional Authentication</strong></p>
<ul>
<li>Plug in <strong>API-key authentication</strong> via standard ASP.NET Core middleware for production-grade security</li>
</ul>
<p><strong>🚀 Host Execution</strong></p>
<ul>
<li><code>RunAsync()</code> keeps the process alive, listening for MCP messages from AI hosts like <strong>Claude Desktop</strong> or <strong>GitHub Copilot</strong></li>
</ul>
<h3 id="3-hahahugoshortcode11s35hbhb"><strong>3.</strong> <span class="dark:text-gray-300 font-semibold gradient-text-aqua">Create the tool class:</span></h3>
<p>This is where your MCP server comes to life. In C#, MCP tools are simply well-designed methods that your AI model can discover and call - think of them as structured entry points into your business logic.</p>
<p>A typical MCP tool class in .NET looks like this:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-csharp" data-lang="csharp"><span style="display:flex;"><span><span style="color:#50fa7b">[McpServerToolType]</span>
</span></span><span style="display:flex;"><span><span style="color:#8be9fd;font-style:italic">public</span> <span style="color:#8be9fd;font-style:italic">static</span> <span style="color:#ff79c6">class</span> <span style="color:#50fa7b">SitecoreAITool</span>
</span></span><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span><span style="color:#50fa7b">
</span></span></span><span style="display:flex;"><span><span style="color:#50fa7b">    [McpServerTool, Description(&#34;Retrieves child item details from Sitecore by specifying an item path or ID and language.&#34;)]</span>
</span></span><span style="display:flex;"><span>    <span style="color:#8be9fd;font-style:italic">public</span> <span style="color:#8be9fd;font-style:italic">static</span> <span style="color:#8be9fd;font-style:italic">async</span> Task&lt;<span style="color:#8be9fd">string</span>&gt; GetChildDetails(SitecoreAIService sitecoreAIService,
</span></span><span style="display:flex;"><span><span style="color:#50fa7b">            [Description(&#34;The item path (e.g., /sitecore/content/site-name/home) or item GUID (e.g., &#39;{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}&#39;)&#34;)]</span> <span style="color:#8be9fd">string</span> path,
</span></span><span style="display:flex;"><span><span style="color:#50fa7b">            [Description(&#34;Language code for the item (e.g., &#39;en&#39; for English, &#39;de&#39; for German). Default is &#39;en&#39;.&#34;)]</span> <span style="color:#8be9fd">string</span> language = <span style="color:#f1fa8c">&#34;en&#34;</span>,
</span></span><span style="display:flex;"><span>            CancellationToken cancellationToken = <span style="color:#ff79c6">default</span>)
</span></span><span style="display:flex;"><span>    {
</span></span><span style="display:flex;"><span>        <span style="color:#8be9fd">var</span> childDetails = <span style="color:#ff79c6">await</span> sitecoreAIService.GetChildDetails(path, language);
</span></span><span style="display:flex;"><span>        <span style="color:#ff79c6">return</span> JsonSerializer.Serialize(childDetails);
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>}</span></span></code></pre></div>
<ul>
<li>A class decorated with <code>[McpServerToolType]</code> - this tells the SDK it&rsquo;s a tool container</li>
<li>Individual methods marked with <code>[McpServerTool]</code>, each with a clear Description so the AI understands what the tool does and when to use it</li>
</ul>


<p class="font-semibold text-xl  text-example-color dark:text-gray-300">A few design principles worth following:
</p>
<ul>
<li><span class="dark:text-gray-300 font-semibold gradient-text">Be goal-oriented, not CRUD-driven - </span> instead of exposing a raw <code>GetSales()</code> method, name and describe it as <strong>&ldquo;Summarise daily sales by channel&rdquo;</strong> so the model can use it intelligently</li>
<li><span class="dark:text-gray-300 font-semibold gradient-text-aqua">Separate reads from writes - </span> mark read-only tools clearly and keep write operations minimal and auditable</li>
<li><span class="dark:text-gray-300 font-semibold gradient-text-vital-ocean">Fail gracefully - </span> validate inputs early and return descriptive error messages, this helps the AI model self-correct rather than stall</li>
</ul>
<div class="callout success">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" width="22" height="22"><path stroke-linecap="round" stroke-linejoin="round" d="m11.25 11.25.041-.02a.75.75.0 011.063.852l-.708 2.836a.75.75.0 001.063.853l.041-.021M21 12A9 9 0 113 12a9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"></path></svg><p>Explore More & Share Your Feedback</p>
    </div>
    <div class="callout-body">
        <p><p>I built the <span class="dark:text-gray-300 font-semibold gradient-text">SitecoreAI MCP tool</span> to fetch <strong>child item details</strong> from Sitecore directly via the <strong>configured</strong> SaaS <strong>Edge GraphQL endpoint</strong> - keeping everything clean, secure, and governed through the injected <strong>SitecoreAIService</strong>.<br/><br/></p>
<p>The tool accepts a required <strong>path</strong> parameter (either an item path like <code>/sitecore/content/sitename/home</code> or an item <code>GUID</code>) and an optional <strong>language</strong> code parameter for the item (e.g., &rsquo;en&rsquo; for English, &lsquo;de&rsquo; for German),defaults to &ldquo;en&rdquo;. It also supports graceful cancellation via CancellationToken.<br/><br/></p>
<p>Internally, it calls <code>sitecoreAIService.GetChildDetails(path, language)</code> and <strong>returns</strong> the result as a <strong>JSON string</strong> - typically containing the <strong>child item details</strong> along with its metadata.<br/><br/></p>
<p><span class="dark:text-gray-300 font-semibold gradient-text-sea-salt">This tool is ideal when your AI assistant needs to retrieve <strong>Sitecore child item information</strong> while ensuring the right governance, security controls, and auditable access boundaries are in place.</span> ⬇</p>
</p>
    </div>
</div>
<div class="github-card-wrapper">
    <a id="github-342ed376efcdbc40625ca89312dd979b" target="_blank" href="https://github.com/AmitKumar-AK/mcp-dotnet-tutorial" class="cursor-pointer">
      <div
        class="w-full md:w-auto p-0 m-0 border border-neutral-200 dark:border-neutral-700 border rounded-md shadow-2xl"><div class="w-full nozoom">
            <img
              src="https://opengraph.githubassets.com/0/AmitKumar-AK/mcp-dotnet-tutorial"
              alt="GitHub Repository Thumbnail"
              class="nozoom mt-0 mb-0 w-full h-full object-cover">
          </div><div class="w-full md:w-auto pt-3 p-5">
          <div class="flex items-center">
            <span class="text-2xl text-neutral-800 dark:text-gray-300 me-2"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="currentColor" viewBox="3 3 18 18">
  <path d="M12 3C7.0275 3 3 7.12937 3 12.2276C3 16.3109 5.57625 19.7597 9.15374 20.9824C9.60374 21.0631 9.77249 20.7863 9.77249 20.5441C9.77249 20.3249 9.76125 19.5982 9.76125 18.8254C7.5 19.2522 6.915 18.2602 6.735 17.7412C6.63375 17.4759 6.19499 16.6569 5.8125 16.4378C5.4975 16.2647 5.0475 15.838 5.80124 15.8264C6.51 15.8149 7.01625 16.4954 7.18499 16.7723C7.99499 18.1679 9.28875 17.7758 9.80625 17.5335C9.885 16.9337 10.1212 16.53 10.38 16.2993C8.3775 16.0687 6.285 15.2728 6.285 11.7432C6.285 10.7397 6.63375 9.9092 7.20749 9.26326C7.1175 9.03257 6.8025 8.08674 7.2975 6.81794C7.2975 6.81794 8.05125 6.57571 9.77249 7.76377C10.4925 7.55615 11.2575 7.45234 12.0225 7.45234C12.7875 7.45234 13.5525 7.55615 14.2725 7.76377C15.9937 6.56418 16.7475 6.81794 16.7475 6.81794C17.2424 8.08674 16.9275 9.03257 16.8375 9.26326C17.4113 9.9092 17.76 10.7281 17.76 11.7432C17.76 15.2843 15.6563 16.0687 13.6537 16.2993C13.98 16.5877 14.2613 17.1414 14.2613 18.0065C14.2613 19.2407 14.25 20.2326 14.25 20.5441C14.25 20.7863 14.4188 21.0746 14.8688 20.9824C16.6554 20.364 18.2079 19.1866 19.3078 17.6162C20.4077 16.0457 20.9995 14.1611 21 12.2276C21 7.12937 16.9725 3 12 3Z"></path>
</svg>
</span>
            <div
              id="github-342ed376efcdbc40625ca89312dd979b-full_name"
              class="m-0 font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-gray-300">
              AmitKumar-AK/mcp-dotnet-tutorial
            </div>
          </div>

          <p id="github-342ed376efcdbc40625ca89312dd979b-description" class="m-0 mt-2 text-md text-neutral-800 dark:text-gray-300">
            Complete tutorial and guide for building Model Context Protocol (MCP) tools using C# .NET SDK. Includes step-by-step instructions, code examples, and a practical SitecoreAI MCP tool implementation to integrate AI capabilities with Sitecore content management.
          </p>

          <div class="m-0 mt-2 flex items-center">
            <span class="mr-1 inline-block h-3 w-3 rounded-full language-dot" data-language="C#"></span>
            <div class="m-0 mr-5 text-md text-neutral-800 dark:text-gray-300">
              C#
            </div>

            <span class="text-md mr-1 text-neutral-800 dark:text-gray-300"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"/></svg></span>
            <div id="github-342ed376efcdbc40625ca89312dd979b-stargazers" class="m-0 mr-5 text-md text-neutral-800 dark:text-gray-300">
              0
            </div>

            <span class="text-md mr-1 text-neutral-800 dark:text-gray-300"><svg height=1.2em class="hx:inline-block hx:align-middle" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M7 5C7 3.89543 7.89543 3 9 3C10.1046 3 11 3.89543 11 5C11 5.74028 10.5978 6.38663 10 6.73244V14.0396H11.7915C12.8961 14.0396 13.7915 13.1441 13.7915 12.0396V10.7838C13.1823 10.4411 12.7708 9.78837 12.7708 9.03955C12.7708 7.93498 13.6662 7.03955 14.7708 7.03955C15.8753 7.03955 16.7708 7.93498 16.7708 9.03955C16.7708 9.77123 16.3778 10.4111 15.7915 10.7598V12.0396C15.7915 14.2487 14.0006 16.0396 11.7915 16.0396H10V17.2676C10.5978 17.6134 11 18.2597 11 19C11 20.1046 10.1046 21 9 21C7.89543 21 7 20.1046 7 19C7 18.2597 7.4022 17.6134 8 17.2676V6.73244C7.4022 6.38663 7 5.74028 7 5Z" fill="#000000"></path> </g></svg></span>
            <div id="github-342ed376efcdbc40625ca89312dd979b-forks" class="m-0 mr-5 text-md text-neutral-800 dark:text-gray-300">
              0
            </div>
          </div>
        </div>
      </div>
      
      
      <script
        async
        type="text/javascript"
        src="/js/fetch-repo.min.dc5533c50cefd50405344b235937142271f26229fe39cbee27fd4960e8bb897a0beebfad77a1091ca91cd0d1fb14e70fc37cc114dd9674fb2c32e0ab512ec8a4.js"
        integrity="sha512-3FUzxQzv1QQFNEsjWTcUInHyYin&#43;OcvuJ/1JYOi7iXoL7r&#43;td6EJHKkc0NH7FOcPw3zBFN2WdPssMuCrUS7IpA=="
        data-repo-url="https://api.github.com/repos/AmitKumar-AK/mcp-dotnet-tutorial"
        data-repo-id="github-342ed376efcdbc40625ca89312dd979b"></script>
    </a>
  </div>
<h3 id="4-hahahugoshortcode11s43hbhb"><strong>4.</strong> <span class="dark:text-gray-300 font-semibold gradient-text-vital-ocean">Run and connect from an AI host:</span></h3>
<p>Once the server is running locally or in a container:</p>
<ul>
<li>Configure an MCP‑aware host like Claude Desktop, Gemini CLI or VS Code Copilot to connect to your server via stdio or HTTP.</li>
<li>Point it at your executable or remote endpoint and provide any required API keys or environment variables.</li>
<li>Ask natural language queries like <strong>Use the .NET MCP server to list the latest orders and highlight any anomalies</strong> and watch the host call your tools.</li>
</ul>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-json" data-lang="json"><span style="display:flex;"><span><span style="color:#6272a4">// .vscode/mcp.json
</span></span></span><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>    <span style="color:#ff79c6">&#34;servers&#34;</span>: {
</span></span><span style="display:flex;"><span>        <span style="color:#ff79c6">&#34;mcp-sitecoreai&#34;</span>: {
</span></span><span style="display:flex;"><span>			<span style="color:#ff79c6">&#34;type&#34;</span>: <span style="color:#f1fa8c">&#34;stdio&#34;</span>,
</span></span><span style="display:flex;"><span>            <span style="color:#ff79c6">&#34;command&#34;</span>: <span style="color:#f1fa8c">&#34;dotnet&#34;</span>,
</span></span><span style="display:flex;"><span>            <span style="color:#ff79c6">&#34;args&#34;</span>: [
</span></span><span style="display:flex;"><span>                <span style="color:#f1fa8c">&#34;run&#34;</span>,
</span></span><span style="display:flex;"><span>                <span style="color:#f1fa8c">&#34;--project&#34;</span>,
</span></span><span style="display:flex;"><span>				<span style="color:#f1fa8c">&#34;McpSitecoreAiExample.csproj&#34;</span>,
</span></span><span style="display:flex;"><span>            ]
</span></span><span style="display:flex;"><span>        }
</span></span><span style="display:flex;"><span>    },
</span></span><span style="display:flex;"><span>	<span style="color:#ff79c6">&#34;inputs&#34;</span>: []
</span></span><span style="display:flex;"><span>}</span></span></code></pre></div>
<span class="dark:text-gray-300 font-semibold gradient-text">Once your foundation is set, start layering in custom MCP tools, sharpen your responses, and ship your MCP server as a reusable NuGet package for your team.</span>





















  
  
    
    <img
      title="Building a Custom MCP Server in .NET - Step-by-Step Overview"
      loading="lazy"
      decoding="async"
      src="https://www.amitk.net/images/build-custom-mcp-server-dotnet-csharp/how_to_build_a_custom_mcp_server_in_c-sharp-sitecore-mvp-amit-kumar.gif"
      alt="Building a Custom MCP Server in .NET - Step-by-Step Overview"
      class="img justify-self-center  "
      width=""
      height="" />
  
  













<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-mcp-tool-structure-the-three-fundamental-elements" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🔩 MCP Tool Structure: The Three Fundamental Elements</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>


<p class="font-semibold text-xl  text-todo-color dark:text-gray-300">Every MCP tool in .NET consists of three essential parts:</p>
<ol>
<li><strong>Tool Class with [McpServerToolType] Attribute</strong> </br>
This decorator tells the MCP server that this class contains tool definitions.</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-csharp" data-lang="csharp"><span style="display:flex;"><span><span style="color:#50fa7b">[McpServerToolType]</span> <span style="color:#8be9fd;font-style:italic">public</span> <span style="color:#ff79c6">class</span> <span style="color:#50fa7b">CustomerTools</span> { 
</span></span><span style="display:flex;"><span><span style="color:#6272a4">// Tool methods go here </span>
</span></span><span style="display:flex;"><span>}</span></span></code></pre></div>
<ol start="2">
<li><strong>Tool Methods with [McpServerTool] Attribute</strong> </br>
Each public method decorated with <code>[McpServerTool]</code> becomes an AI-accessible tool.</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-csharp" data-lang="csharp"><span style="display:flex;"><span><span style="color:#50fa7b">[McpServerTool]</span>
</span></span><span style="display:flex;"><span><span style="color:#50fa7b">[Description(&#34;Retrieves customer information by customer ID&#34;)]</span>
</span></span><span style="display:flex;"><span><span style="color:#8be9fd;font-style:italic">public</span> <span style="color:#8be9fd;font-style:italic">async</span> Task&lt;CustomerData&gt; GetCustomerById(
</span></span><span style="display:flex;"><span><span style="color:#50fa7b">    [Description(&#34;The unique customer identifier&#34;)]</span> <span style="color:#8be9fd">int</span> customerId,
</span></span><span style="display:flex;"><span>    CancellationToken cancellationToken = <span style="color:#ff79c6">default</span>)
</span></span><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>    <span style="color:#6272a4">// Implementation here</span>
</span></span><span style="display:flex;"><span>}</span></span></code></pre></div>
<ol start="3">
<li><strong>Method Descriptions Using [Description] Attribute</strong> </br>
<code>Descriptions</code> are critical - they tell the AI when and how to use your tool. Write them as if you&rsquo;re instructing a human colleague.</li>
</ol>


<p class="font-semibold text-xl  text-danger-color dark:text-gray-300">❌ Bad Description:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-csharp" data-lang="csharp"><span style="display:flex;"><span><span style="color:#50fa7b">[Description(&#34;Gets customer&#34;)]</span></span></span></code></pre></div>


<p class="font-semibold text-xl  text-success-color dark:text-gray-300">✅ Good Description:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-csharp" data-lang="csharp"><span style="display:flex;"><span><span style="color:#50fa7b">[Description(&#34;Retrieves complete customer profile including contact info, purchase history, and support tickets by customer ID. Use this when the user asks about a specific customer or needs detailed customer information.&#34;)]</span></span></span></code></pre></div>
<span class="dark:text-gray-300 font-semibold gradient-text-sea-salt">The AI uses these descriptions to decide which tool to call, so clarity is paramount.</span>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-why-this-matters-for-sitecore-enterprise-projects" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🔑 Why This Matters for Sitecore / Enterprise Projects</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>In earlier articles, we explored how <span class="dark:text-gray-300 font-semibold gradient-text-ooey-gooey">Model Context Protocol (MCP)</span> enables AI assistants to perform real, meaningful actions - not just generate text. The <span class="dark:text-gray-300 font-semibold gradient-text-vital-ocean">Sitecore Marketer MCP</span> server puts that theory into practice with a working, real-world implementation.</p>


<p class="font-semibold text-xl  text-example-color dark:text-gray-300">With custom MCP tools we can:
</p>
<ul>
<li><span class="dark:text-gray-300 font-semibold gradient-text">Extend Sitecore automation</span></li>
<li><span class="dark:text-gray-300 font-semibold gradient-text-aqua">Integrate internal services</span></li>
<li><span class="dark:text-gray-300 font-semibold gradient-text-vital-ocean">Build developer tools</span></li>
<li><span class="dark:text-gray-300 font-semibold gradient-text-par-four">Enable AI-driven operations</span></li>
</ul>
<p><strong><em>This makes MCP a key part of modern architecture.</em></strong></p>
<p><strong>Enjoyed this guide? Give it a ⭐ and show your support!</strong></p>
<div class="callout tip">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M18.364 5.636l-3.536 3.536m0 5.656l3.536 3.536M9.172 9.172L5.636 5.636m3.536 9.192l-3.536 3.536M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-5 0a4 4 0 11-8 0 4 4 0 018 0z"/></svg><p>Support</p>
    </div>
    <div class="callout-body">
        <p><strong>If you enjoy this content, consider <a href="https://www.youtube.com/@AmitKumar-Info?sub_confirmation=1" target="_blank" rel="noopener">subscribing</a>
 📰 for more updates and insights. Your engagement is very important to me and helps me keep providing valuable resources! 🌟</strong></p>
    </div>
</div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-conclusion-empowering-ai-with-net" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🏁 Conclusion: Empowering AI with .NET</h2>
  
  
</div>
<p>Building custom MCP tools in .NET C# transforms AI assistants from generic chatbots into powerful, context-aware agents that understand your business. With the official C# SDK, dependency injection support, and .NET&rsquo;s robust ecosystem, you can create production-ready MCP servers that securely bridge AI and enterprise systems.</p>


<p class="font-semibold text-xl  text-success-color dark:text-gray-300">Key Takeaways:</p>
<ol>
<li><span class="dark:text-gray-300 font-semibold gradient-text-aqua">MCP tools are simple - </span> Just C# classes with attributes</li>
<li><span class="dark:text-gray-300 font-semibold gradient-text-ooey-gooey">Descriptions matter - </span> They guide AI decision-making</li>
<li><span class="dark:text-gray-300 font-semibold gradient-text-sea-salt">Follow .NET patterns - </span> Async/await, DI, separation of concerns</li>
<li><span class="dark:text-gray-300 font-semibold gradient-text-vital-ocean">Start small, iterate - </span> Begin with 2-3 tools, expand based on usage</li>
<li><span class="dark:text-gray-300 font-semibold gradient-text-aqua">Security first - </span> Never expose credentials, validate inputs, audit access</li>
</ol>
<span class="dark:text-gray-300 font-semibold gradient-text">Whether you're building AI-powered customer service, intelligent data analytics, or autonomous business workflows, MCP tools in .NET give you the foundation to make it real.</span>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="creditreferences" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧾Credit/References</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>



<div class="table-wrapper">
<table class="style-table"><tbody><tr><td><a href="https://doc.sitecore.com/sai/en/users/sitecoreai/marketer-mcp.html" target="_blank" rel="noopener">Sitecore Marketer MCP Documentation</a></td><td><a href="https://www.amitk.net/blog/sitecore-marketer-mcp-vscode-integration/" target="_blank" rel="noopener">Sitecore Marketer MCP</a></td><td><a href="https://modelcontextprotocol.io" target="_blank" rel="noopener">Model Context Protocol</a></td></tr><tr><td><a href="https://github.com/modelcontextprotocol/csharp-sdk" target="_blank" rel="noopener">C# MCP SDK</a></td><td><a href="https://www.amitk.net/blog/mcp-server-vs-copilot-genai-agentic-ai/" target="_blank" rel="noopener">MCP vs Copilot vs GenAI Article</a></td><td><a href="https://github.com/modelcontextprotocol/csharp-sdk" target="_blank" rel="noopener">Official MCP C# SDK (GitHub)</a></td></tr><tr><td><a href="https://csharp.sdk.modelcontextprotocol.io" target="_blank" rel="noopener">MCP C# SDK Documentation</a></td><td><a href="https://github.com/iamgauravn/mcp_server/tree/main" target="_blank" rel="noopener">Gaurav Nandankar&rsquo;s GitHub Repo</a></td><td><a href="https://devblogs.microsoft.com/dotnet/build-a-model-context-protocol-mcp-server-in-csharp/" target="_blank" rel="noopener">Build a Model Context Protocol (MCP) server in C#</a></td></tr><tr><td><a href="https://www.anthropic.com/news/model-context-protocol" target="_blank" rel="noopener">Anthropic MCP Documentation</a></td><td><a href="https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection/overview" target="_blank" rel="noopener">Dependency Injection in .NET</a></td><td><a href="https://learn.microsoft.com/en-us/dotnet/csharp/asynchronous-programming/async-scenarios" target="_blank" rel="noopener">Asynchronous programming scenarios</a></td></tr></tbody>
  
</table>
</div>
]]></content:encoded></item><item><title>Why MCP Server Matters: Copilot vs GenAI vs Agentic AI vs AI Agents Explained</title><link>https://www.amitk.net/blog/mcp-server-vs-copilot-genai-agentic-ai/</link><pubDate>Thu, 26 Feb 2026 00:00:00 +0000</pubDate><author>amit@amitk.net (Amit Kumar)</author><guid>https://www.amitk.net/blog/mcp-server-vs-copilot-genai-agentic-ai/</guid><media:content url="https://www.amitk.net/images/mcp-server-vs-copilot-genai-agentic-ai/mcp-server-vs-agentic-ai-comparison.gif" medium="image" type="image/gif"/><description>
Understand the difference between Copilot, GenAI, Agentic AI, AI Agents, and MCP Server - and why MCP is becoming critical for secure, enterprise-grade AI automation.</description><content:encoded><![CDATA[







<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-mcp-server-turning-ai-thinking-into-real-action" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">📘 MCP Server: Turning AI Thinking into Real Action</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>Modern enterprises no longer want AI that only <strong><em>writes</em></strong> or <strong><em>suggests</em></strong> - they want AI that can <strong>act</strong>.</p>
<p>The <a href="https://www.amitk.net/blog/sitecore-marketer-mcp-vscode-integration" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text">Model Context Protocol (MCP) Server</span></a>
 is the missing infrastructure that makes this possible. It acts as a secure, standardized bridge that allows <strong>Copilot</strong>, <strong>Generative AI</strong>, and <strong>AI agents</strong> to interact with real enterprise systems, tools, and data - safely, audibly, and at scale.</p>
<p>By connecting AI models to real tools, MCP Servers enable <span class="dark:text-gray-300 font-semibold gradient-text">Agentic AI</span> and <span class="dark:text-gray-300 font-semibold gradient-text-aqua">autonomous AI agents</span> to perform <strong>real tasks</strong> such as <strong>creating content</strong>, <strong>validating changes</strong>, <strong>orchestrating workflows</strong>, and <strong>publishing results</strong> - all while enforcing <strong>permissions</strong>, <strong>audit trails</strong>, and <strong>enterprise governance</strong>.</p>
<p>This is why <strong>MCP Server</strong> is quickly becoming <span class="dark:text-gray-300 font-semibold gradient-text">foundational infrastructure</span> for modern AI architectures.</p>


<p class="font-semibold text-xl  text-todo-color dark:text-gray-300">In this article, we'll clarify:</p>
<ul>
<li><span class="dark:text-gray-300 font-semibold gradient-text">What MCP Server actually does</span></li>
<li><span class="dark:text-gray-300 font-semibold gradient-text-vital-ocean">How it differs from related AI concepts</span></li>
<li><span class="dark:text-gray-300 font-semibold gradient-text-ooey-gooey">Why it matters for enterprises</span></li>
<li><span class="dark:text-gray-300 font-semibold gradient-text-sea-salt">How it works in practice using Sitecore Marketer MCP examples</span></li>
</ul>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-the-core-problem-ai-can-think-but-it-cant-act" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🚧 The Core Problem: AI Can Think, But It Can&#39;t Act</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>Most AI systems - whether <strong>GenAI</strong>, <strong>Copilot</strong>, or even <strong>Agentic AI</strong> - can generate content or propose plans, but they <strong>cannot safely act on enterprise systems</strong> like Sitecore CMS, CRM, or business platforms on their own.</p>


<p class="font-semibold text-xl  text-primary dark:text-gray-300">Without additional infrastructure, AI cannot:</p>
<ul>
<li>Create or update CMS content</li>
<li>Trigger enterprise workflows</li>
<li>Access live business data</li>
<li>Execute multi‑step operations</li>
<li>Work with enterprise permissions and security</li>
</ul>
<p>This is where <strong><em>MCP Server (Model Context Protocol)</em></strong> fills the gap.</p>
<p>MCP Server allows AI systems to <span class="dark:text-gray-300 font-semibold gradient-text-aqua">discover, understand, and invoke tools</span> in a controlled way. It provides:</p>
<ul>
<li>Permission‑scoped execution</li>
<li>Typed schemas for predictable behavior</li>
<li>Tool discovery</li>
<li>Full auditability</li>
</ul>
<div class="callout warning">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" width="22" height="22"><path stroke-linecap="round" stroke-linejoin="round" d="m11.25 11.25.041-.02a.75.75.0 011.063.852l-.708 2.836a.75.75.0 001.063.853l.041-.021M21 12A9 9 0 113 12a9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"></path></svg><p>Information</p>
    </div>
    <div class="callout-body">
        <p>In short, MCP Server standardizes how AI applications move from <strong>text generation to real-world action</strong>.</p>
    </div>
</div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-understanding-the-key-components" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧠 Understanding the Key Components</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h3 id="generative-ai-genai-the-brain" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">Generative AI (GenAI): The Brain</h3>
  
  
</div>
<p>Generative AI models (such as GPT-4 or Claude) are the core intelligence layer / underlying engine. They excel at producing new content - text, code, summaries, and ideas - based on prompts.</p>


<p class="font-semibold text-xl  text-success-color dark:text-gray-300">Strengths</p>
<ul>
<li>Content creation</li>
<li>Summaries and ideation</li>
</ul>


<p class="font-semibold text-xl  text-danger-color dark:text-gray-300">Limitations</p>
<ul>
<li>No execution capability</li>
<li>No direct access to tools or systems</li>
<li>No planning beyond a single response</li>
</ul>


<p class="font-semibold text-xl  text-example-color dark:text-gray-300">Example</p>
<ul>
<li>Using ChatGPT to draft a blog post</li>
</ul>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h3 id="copilot-the-assistant" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">Copilot: The Assistant</h3>
  
  
</div>
<p>Copilots embed GenAI directly into tools like VS Code, Microsoft 365, or Cursor. They observe user context and provide suggestions in real time.</p>


<p class="font-semibold text-xl  text-success-color dark:text-gray-300">Strengths</p>
<ul>
<li>In‑context recommendations</li>
<li>Code completion and productivity boosts</li>
<li>Excellent user experience</li>
</ul>


<p class="font-semibold text-xl  text-danger-color dark:text-gray-300">Limitations</p>
<ul>
<li>Not autonomous</li>
<li>Limited to the host application</li>
<li>Cannot orchestrate workflows across systems</li>
</ul>


<p class="font-semibold text-xl  text-example-color dark:text-gray-300">Example</p>
<ul>
<li>GitHub Copilot recommending code snippets</li>
</ul>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h3 id="ai-agents-the-specialist" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">AI Agents: The Specialist</h3>
  
  
</div>
<p>AI Agents wrap GenAI with a specific goal and a set of tools. They can execute predefined tasks such as fetching data, find all broken links, filtering results, or performing simple operations.</p>


<p class="font-semibold text-xl  text-success-color dark:text-gray-300">Strengths</p>
<ul>
<li>Task execution</li>
<li>API-based automation</li>
<li>Goal‑oriented behavior</li>
</ul>


<p class="font-semibold text-xl  text-danger-color dark:text-gray-300">Limitations</p>
<ul>
<li>Dependent on available integrations</li>
<li>Often rely on custom or fragile API wrappers</li>
<li>Limited planning unless combined with Agentic AI</li>
</ul>


<p class="font-semibold text-xl  text-example-color dark:text-gray-300">Example</p>
<ul>
<li>An agent retrieving flight data from an API</li>
</ul>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h3 id="agentic-ai-the-manager" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">Agentic AI: The Manager</h3>
  
  
</div>
<p>Agentic AI introduces autonomy, reasoning, and planning. Instead of following a script, it breaks goals into steps, selects tools, retries failures, and evaluates outcomes.</p>


<p class="font-semibold text-xl  text-success-color dark:text-gray-300">Strengths</p>
<ul>
<li>Multi-step planning</li>
<li>Tool selection</li>
<li>Self-evaluation and retries</li>
</ul>


<p class="font-semibold text-xl  text-danger-color dark:text-gray-300">Limitations</p>
<ul>
<li>Still needs secure access to systems</li>
<li>Requires guardrails and validation</li>
<li>Cannot safely discover tools without MCP</li>
</ul>


<p class="font-semibold text-xl  text-example-color dark:text-gray-300">Example</p>
<ul>
<li>Planning a trip by checking weather, comparing flights, and booking within constraints</li>
</ul>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h3 id="mcp-server-model-context-protocol-the-hands-and-eyes" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">MCP Server (Model Context Protocol): The Hands and Eyes</h3>
  
  
</div>
<p>MCP Server is the <strong>execution and integration layer</strong> that allows AI systems to act safely.</p>


<p class="font-semibold text-xl  text-success-color dark:text-gray-300">What MCP Server Provides</p>
<ul>
<li>Standardized interface for AI-to-tool communication</li>
<li>Tool discovery and invocation</li>
<li>Secure, scoped permissions</li>
<li>Typed schemas for predictable behavior</li>
<li>Full audit logs and governance</li>
</ul>
<div class="callout info">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="none" viewBox="0 0 24 24" width="22" height="22" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875.0 112.652 2.652L6.832 19.82a4.5 4.5.0 01-1.897 1.13l-2.685.8.8-2.685a4.5 4.5.0 011.13-1.897L16.863 4.487zm0 0L19.5 7.125"></path></svg><p>In simple terms:</p>
    </div>
    <div class="callout-body">
        <p><strong>MCP Server is an API layer designed specifically for AI agents and LLMs.</strong></p>
    </div>
</div>


<p class="font-semibold text-xl  text-todo-color dark:text-gray-300">It tells the AI:</p>
<ul>
<li>What actions are allowed</li>
<li>Which tools can be used</li>
<li>How to call them</li>
<li>What inputs and outputs are expected</li>
</ul>
<p>Without <span class="dark:text-gray-300 font-semibold text-abstract-color">MCP Server</span>, <span class="dark:text-gray-300 font-semibold text-bug-color">Agentic AI cannot reliably interact with enterprise systems</span>.</p>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-simple-comparison" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">📊 Simple Comparison</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<h3 id="enterprise-execution-comparison-genai-copilot-agentic-ai-and-mcp-server">Enterprise Execution Comparison: GenAI, Copilot, Agentic AI, and MCP Server</h3>



<div class="table-wrapper">
<table class="style-table"><thead>
        <tr><th>Technology</th><th>Primary Role</th><th>Can Take Actions</th><th>Enterprise‑Safe</th><th>Best For</th></tr>
      </thead><tbody><tr><td><strong>GenAI</strong></td><td>Content generation</td><td>❌</td><td>❌</td><td>Ideation</td></tr><tr><td><strong>Copilot</strong></td><td>In‑tool assistance</td><td>⚠️ Limited</td><td>⚠️ Limited</td><td>Productivity</td></tr><tr><td><strong>AI Agent</strong></td><td>Task execution</td><td>✅</td><td>⚠️ Depends</td><td>Automation</td></tr><tr><td><strong>Agentic AI</strong></td><td>Plan + reason + act</td><td>✅</td><td>❌ (without MCP)</td><td>Complex goals</td></tr><tr><td><strong>MCP Server</strong></td><td>Enable secure actions</td><td>🔑 Enables all</td><td>✅</td><td>Integration</td></tr></tbody>
  
</table>
</div>
<h3 id="capability-comparison-across-ai-models-and-mcp-server">Capability Comparison Across AI Models and MCP Server</h3>



<div class="table-wrapper">
<table class="style-table"><thead>
        <tr><th>Capability</th><th>GenAI</th><th>Copilot</th><th>AI Agent</th><th>Agentic AI</th><th>MCP Server</th></tr>
      </thead><tbody><tr><td><strong>Generates Content</strong></td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>❌ (It&rsquo;s a Bridge)</td></tr><tr><td><strong>Operates Autonomously</strong></td><td>❌</td><td>❌</td><td>✅</td><td>✅</td><td>❌</td></tr><tr><td><strong>Reasons &amp; Plans</strong></td><td>❌</td><td>❌</td><td>❌</td><td>✅</td><td>❌</td></tr><tr><td><strong>Standardized Tool Access</strong></td><td>❌</td><td>❌</td><td>❌</td><td>❌</td><td>✅</td></tr></tbody>
  
</table>
</div>
<div class="callout success">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg><p>Key takeaway:</p>
    </div>
    <div class="callout-body">
        <p><span class="dark:text-gray-300 font-semibold gradient-text-sea-salt">MCP Server is not an AI model - it is the bridge that allows AI systems to operate safely in the real world.</span></p>
    </div>
</div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-how-agentic-ai-and-mcp-server-work-together" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">⚒️ How Agentic AI and MCP Server Work Together</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>





















  
  
    
    <img
      title="Agentic AI, AI Agents, Copilot and GenAI"
      loading="lazy"
      decoding="async"
      src="https://www.amitk.net/images/mcp-server-vs-copilot-genai-agentic-ai/MCP-vs-Agentic-AI.png"
      alt="The Role of MCP Servers in AI Evolution: Comparing GenAI, Copilots, Agents, and Agentic Systems"
      class="img justify-self-center  "
      width=""
      height="" />
  
  







<p class="font-semibold text-xl  text-primary dark:text-gray-300">What it shows (at a glance):</p>
<p><strong>Agentic AI and MCP Server play very different but complementary roles.</strong></p>
<p><strong>Agentic AI</strong> is responsible for <strong><em>thinking</em></strong>: understanding goals, reasoning, planning steps, choosing actions, and learning from outcomes. It behaves like a <strong>manager</strong>, deciding <strong><em>what should happen next.</em></strong></p>
<p><strong>MCP Server</strong>, on the other hand, is responsible for <strong><em>doing things safely</em></strong>. It acts as the <strong>execution and governance layer</strong>, exposing enterprise tools (CMS, CRM, APIs, databases) in a standardized, permission‑controlled way.</p>
<p>When Agentic AI decides to take action, it does not call enterprise systems directly. Instead, it invokes tools through the <strong>MCP Server</strong>, which:</p>
<ul>
<li>Validates permissions</li>
<li>Enforces schemas</li>
<li>Executes actions securely</li>
<li>Records audit logs</li>
</ul>
<p>This separation ensures that AI can act autonomously <strong>without bypassing enterprise security or governance.</strong></p>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-why-mcp-server-is-critical-for-enterprises-and-sitecore" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🏢 Why MCP Server Is Critical for Enterprises (and Sitecore)</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>MCP Server turns GenAI and Copilots into <strong>secure</strong>, <strong>action-capable digital teammates</strong>.</p>
<p>For Sitecore, the <strong>Marketer MCP</strong> enables AI to:</p>
<ul>
<li><span class="dark:text-gray-300 font-semibold gradient-text-aqua">Create and update pages</span></li>
<li><span class="dark:text-gray-300 font-semibold gradient-text-ooey-gooey">Add or modify components</span></li>
<li><span class="dark:text-gray-300 font-semibold gradient-text-sea-salt">Search and manage assets</span></li>
<li><span class="dark:text-gray-300 font-semibold gradient-text-vital-ocean">Update Fields</span></li>
</ul>
<p>Using natural language commands from tools like <strong>VS Code Copilot</strong>, the MCP Server:</p>
<ul>
<li>Authenticates securely</li>
<li>Maps intent to Sitecore Agent APIs</li>
<li>Executes actions with governance</li>
<li>Returns auditable results</li>
</ul>
<p>This removes fragile custom integrations and standardizes AI-to-CMS communication across teams.</p>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-practical-example-sitecore-marketer-mcp" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧩 Practical Example: Sitecore Marketer MCP</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>


<p class="font-semibold text-xl  text-todo-color dark:text-gray-300">With Sitecore Marketer MCP:</p>
<ul>
<li>Agentic AI plans the steps</li>
<li>MCP Server exposes the correct tools</li>
<li>Sitecore Agent API executes securely</li>
</ul>
<p>Developers can configure MCP in <code>.vscode/mcp.json</code>, turning the IDE into a <strong>Sitecore command center</strong>.</p>
<div class="callout info">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" width="22" height="22"><path stroke-linecap="round" stroke-linejoin="round" d="m11.25 11.25.041-.02a.75.75.0 011.063.852l-.708 2.836a.75.75.0 001.063.853l.041-.021M21 12A9 9 0 113 12a9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"></path></svg><p>Sitecore Marketer MCP & VS Code Integration</p>
    </div>
    <div class="callout-body">
        <p><strong>A detailed walkthrough is available here</strong> 🔗 <a href="https://www.amitk.net/blog/sitecore-marketer-mcp-vscode-integration/" target="_blank" rel="noopener">Unlocking the Power of Sitecore Marketer MCP with Visual Studio Code</a></p>
    </div>
</div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-when-to-use-what" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧑‍💻 When to Use What</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<ul>
<li><span class="dark:text-gray-300 font-semibold gradient-text">Use GenAI</span> for writing, summaries, ideation</li>
<li><span class="dark:text-gray-300 font-semibold gradient-text-aqua">Use Copilot</span> for productivity inside tools</li>
<li><span class="dark:text-gray-300 font-semibold gradient-text-vital-ocean">Use AI Agents</span> for predefined automation</li>
<li><span class="dark:text-gray-300 font-semibold gradient-text-par-four">Use Agentic AI</span> for reasoning and orchestration</li>
<li><span class="dark:text-gray-300 font-semibold gradient-text-sea-salt">Use MCP Server</span> when AI must securely interact with real enterprise systems</li>
</ul>
<div class="callout success">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" width="22" height="22"><path stroke-linecap="round" stroke-linejoin="round" d="M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.129.166 2.27.293 3.423.379.35.026.67.21.865.501L12 21l2.755-4.133a1.14 1.14.0 01.865-.501 48.172 48.172.0 003.423-.379c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394.0 0012 3c-2.392.0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018z"></path></svg><p>Final Thought</p>
    </div>
    <div class="callout-body">
        <p><strong>MCP Server doesn&rsquo;t replace GenAI, Copilot, or Agentic AI -</strong> <span class="dark:text-gray-300 font-semibold gradient-text">it empowers them</span>.
<br/><br/>
It is the connective layer that allows AI to move from <strong><em>thinking</em></strong> to <strong>doing</strong>, safely and at enterprise scale.</p>
    </div>
</div>
<p><strong>Enjoyed this guide? Give it a ⭐ and show your support!</strong></p>
<div class="callout tip">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M18.364 5.636l-3.536 3.536m0 5.656l3.536 3.536M9.172 9.172L5.636 5.636m3.536 9.192l-3.536 3.536M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-5 0a4 4 0 11-8 0 4 4 0 018 0z"/></svg><p>Support</p>
    </div>
    <div class="callout-body">
        <p><strong>If you enjoy this content, consider <a href="https://www.youtube.com/@AmitKumar-Info?sub_confirmation=1" target="_blank" rel="noopener">subscribing</a>
 📰 for more updates and insights. Your engagement is very important to me and helps me keep providing valuable resources! 🌟</strong></p>
    </div>
</div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="creditreferences" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧾Credit/References</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>



<div class="table-wrapper">
<table class="style-table"><tbody><tr><td><a href="https://doc.sitecore.com/sai/en/users/sitecoreai/marketer-mcp.html" target="_blank" rel="noopener">Sitecore Marketer MCP Documentation</a></td><td><a href="https://www.amitk.net/blog/sitecore-marketer-mcp-vscode-integration/" target="_blank" rel="noopener">Sitecore Marketer MCP</a></td><td><a href="https://modelcontextprotocol.io" target="_blank" rel="noopener">Official Model Context Protocol (MCP) Introduction</a></td></tr><tr><td><a href="https://code.visualstudio.com" target="_blank" rel="noopener">VS Code MCP Servers</a></td><td><a href="https://www.cloudflare.com/en-gb/learning/ai/what-is-model-context-protocol-mcp/" target="_blank" rel="noopener">Cloudflare: What Is MCP?</a></td><td><a href="https://www.flux-digital.com/blog/setting-up-sitecore-mcp-server-with-xp-vscode-copilot" target="_blank" rel="noopener">Setting up Sitecore MCP Server with XP &amp; VS Code</a></td></tr><tr><td><a href="https://www.geeksforgeeks.org/artificial-intelligence/what-is-agentic-ai/" target="_blank" rel="noopener">What is Agentic AI?</a></td><td><a href="https://www.descope.com/learn/post/mcp" target="_blank" rel="noopener">Descope&rsquo;s MCP Guide</a></td><td><a href="https://www.geeksforgeeks.org/artificial-intelligence/gen-ai-vs-ai-agents-vs-agentic-ai" target="_blank" rel="noopener">AI Comparisons</a></td></tr><tr><td><a href="https://www.ibm.com/think/topics/agentic-ai" target="_blank" rel="noopener">Agentic AI</a></td><td><a href="https://www.freshworks.com/freshdesk/ai-agent/vs-agentic-ai/" target="_blank" rel="noopener">Agentic AI vs AI agents: what’s the difference?</a></td><td><a href="https://www.moveworks.com/us/en/resources/blog/agentic-ai-vs-ai-agents-definitions-and-differences" target="_blank" rel="noopener">AI agent vs. agentic AI: definitions, comparison, and 5 key differences</a></td></tr></tbody>
  
</table>
</div>
]]></content:encoded></item><item><title>How to Fix the Sitecore Docker FSCTL_EXTEND_VOLUME Error on Windows</title><link>https://www.amitk.net/blog/sitecore-docker-fsctl-extend-volume-windows-fix/</link><pubDate>Tue, 10 Feb 2026 00:00:00 +0000</pubDate><author>amit@amitk.net (Amit Kumar)</author><guid>https://www.amitk.net/blog/sitecore-docker-fsctl-extend-volume-windows-fix/</guid><media:content url="https://www.amitk.net/images/docker-fsctl-extend-volume-windows-fix/docker-desktop-fsctl-volume-error-solutions.gif" medium="image" type="image/gif"/><description>
Fix Docker FSCTL_EXTEND_VOLUME error on Windows: solutions for WSL2 disk issues, storage driver errors, VHDX cleanup, memory tuning, and prevention tips.</description><content:encoded><![CDATA[







<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-overview" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">📊 Overview</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>Recently, I needed to work on a project and set up <strong>Sitecore 10.4.0</strong> on a <strong>Windows 11</strong> machine. The <a href="https://github.com/AmitKumar-AK/Sitecore-XM0-Topology" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text">Sitecore 10.4.0 XM0 topology setup</span></a>
 <span class="dark:text-gray-300 font-semibold text-bug-color">stopped working</span> and started showing the <strong>error</strong> <span class="dark:text-gray-300 font-semibold text-bug-color">COPY failed: failed to create rwlayer: FSCTL_EXTEND_VOLUME</span>. This error usually happens during image builds and highlights a conflict between Docker&rsquo;s operations and the Windows file system&rsquo;s space management.</p>
<p>This guide explains why the <strong>error</strong> happens, how to <strong>fix it quickly</strong>, and how to <strong>prevent it</strong> from <strong>happening again</strong>, even for <strong>large images</strong> and <strong>CI pipelines</strong>.</p>
<h3 id="error-message-variants">Error Message Variants</h3>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>COPY failed: failed to create rwlayer: FSCTL_EXTEND_VOLUME \\?\Volume{GUID}
</span></span><span style="display:flex;"><span>failed to create rwlayer: write \\?\Volume{GUID}: The volume for a file has been externally altered
</span></span><span style="display:flex;"><span>ERROR: failed to solve: failed to create rwlayer
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>FSCTL_EXTEND_VOLUME \\?\Volume{GUID}: The media is write protected.</span></span></code></pre></div>
<h3 id="error-screenshot">Error Screenshot</h3>





















  
  
    
    <img
      title=""
      loading="lazy"
      decoding="async"
      src="https://www.amitk.net/images/docker-fsctl-extend-volume-windows-fix/docker-FSCTL_EXTEND_VOLUME-error.png"
      alt="Struggling with Docker COPY failures on Windows and WSL2? This guide shows how to fix FSCTL_EXTEND_VOLUME errors, reclaim disk space, and stabilize your builds"
      class="img Struggling with Docker COPY failures on Windows and WSL2? This guide shows how to fix FSCTL_EXTEND_VOLUME errors, reclaim disk space, and stabilize your builds  "
      width=""
      height="" />
  
  







<p class="font-semibold text-xl  text-todo-color dark:text-gray-300">Impact</p>
<ul>
<li><span class="dark:text-gray-300 font-semibold gradient-text">Build Process:</span> Interrupts Docker image builds during COPY operations</li>
<li><span class="dark:text-gray-300 font-semibold gradient-text">Development Workflow:</span> Blocks containerized application development</li>
<li><span class="dark:text-gray-300 font-semibold gradient-text">CI/CD Pipelines:</span> Causes automated deployment failures</li>
<li><span class="dark:text-gray-300 font-semibold gradient-text">Time Loss:</span> Can result in hours of debugging and lost productivity</li>
</ul>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-understanding-the-error" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">❌ Understanding the Error</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<h3 id="what-is-fsctl_extend_volume">What is FSCTL_EXTEND_VOLUME?</h3>
<p>The <code>FSCTL_EXTEND_VOLUME</code> error in Docker on Windows occurs when Docker tries to expand storage for a container&rsquo;s writable layer but fails due to filesystem limitations. This issue often stems from resource exhaustion or configuration limits, preventing Windows from extending the storage volume. As a result, Docker cannot create the necessary read-write layer, halting the build process. Understanding and addressing these underlying resource constraints can help resolve the error efficiently.</p>


<p class="font-semibold text-xl  text-primary dark:text-gray-300">When You'll See It:</p>
<ul>
<li>When running a <code>docker build</code> command, especially at a <code>COPY</code> or <code>ADD</code> step.</li>
<li>When pulling or building images with lots of files.</li>
<li>The base image usually downloads without issues; the problem starts when Docker tries to add a writable layer for your changes.</li>
<li>After system updates or changes to your disk setup.</li>
</ul>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-primary-causes-and-diagnostic-steps" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🔍 Primary Causes and Diagnostic Steps</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>Before applying fixes, understanding the likely culprit can save time. The main causes are:</p>
<ul>
<li>
<p><strong>Low free disk space</strong> on the host machine</p>
</li>
<li>
<p><strong>Bloated WSL2 VHDX file</strong> after months of builds</p>
</li>
<li>
<p><strong>Uncontrolled growth of Docker images and cache</strong></p>
</li>
<li>
<p><strong>Large COPY commands</strong> in Dockerfiles</p>
</li>
<li>
<p><strong>Not enough memory allocated to WSL2</strong></p>
</li>
<li>
<p><strong>Antivirus interference with Docker files, like</strong> BitLocker</p>
</li>
<li>
<p><strong>Corrupted Docker Desktop storage</strong></p>
</li>
</ul>
<h3 id="quick-diagnostic-commands">Quick Diagnostic Commands:</h3>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-powershell" data-lang="powershell"><span style="display:flex;"><span><span style="color:#6272a4"># Check host disk space</span>
</span></span><span style="display:flex;"><span><span style="color:#8be9fd;font-style:italic">Get-PSDrive</span> C | <span style="color:#8be9fd;font-style:italic">Format-Table</span> Name, <span style="color:#8be9fd;font-style:italic">@</span>{n=<span style="color:#f1fa8c">&#39;Free(GB)&#39;</span>;e={[math]::Round(<span style="color:#8be9fd;font-style:italic">$_</span>.Free/<span style="color:#bd93f9">1</span>GB,<span style="color:#bd93f9">2</span>)}}
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#6272a4"># Check Docker disk usage</span>
</span></span><span style="display:flex;"><span>docker system df</span></span></code></pre></div>
<p><strong>Output:</strong></p>





















  
  
    
    <img
      title=""
      loading="lazy"
      decoding="async"
      src="https://www.amitk.net/images/docker-fsctl-extend-volume-windows-fix/resolve-docker-copy-failed.png"
      alt="Check host disk space"
      class="img Check host disk space  "
      width=""
      height="" />
  
  













<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-reliable-fixes-that-actually-work" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">⚙️ Reliable Fixes That Actually Work</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>Follow these solutions in order, starting with the simplest and most likely to succeed.</p>
<h3 id="solution-1-free-up-disk-space-quick-win">Solution 1: Free Up Disk Space (Quick Win)</h3>


<p class="font-semibold text-xl  text-todo-color dark:text-gray-300">Docker quietly accumulates:</p>
<ul>
<li>Old images</li>
<li>Dangling layers</li>
<li>Unused volumes</li>
<li>Build cache</li>
</ul>
<h4 id="script-clean-everything-safely">Script: Clean everything safely</h4>
<script src="https://gist.github.com/AmitKumar-AK/8cfcb0035aa8e3216a9543a9a0662d70.js"></script>
<p><strong>Why it works:</strong> Directly addresses the most common cause: lack of free space. 👉 Aim for <strong>at least 20–30 GB free space</strong> on your system drive.</p>
<h3 id="solution-2-reset-docker-desktop-to-factory-settings-or-clear-cache">Solution 2: Reset Docker Desktop to Factory Settings or Clear Cache</h3>
<p><strong>⚠️ Warning:</strong> This removes all images, containers, and volumes.<br>
<strong>Action:</strong> Use Docker Desktop&rsquo;s UI: <em>Troubleshoot &gt; Reset to factory defaults</em> or Clear / Purge data</p>





















  
  
    
    <img
      title=""
      loading="lazy"
      decoding="async"
      src="https://www.amitk.net/images/docker-fsctl-extend-volume-windows-fix/docker-desktop-troubleshoot.png"
      alt="Reset Docker Desktop"
      class="img Reset Docker Desktop  "
      width=""
      height="" />
  
  





<p><strong>Why it works:</strong> Eliminates corruption in Docker&rsquo;s internal data structures, offering a clean slate.</p>
<h3 id="solution-3-update-bitlocker-drive-encryption">Solution 3: Update BitLocker Drive Encryption</h3>
<p>The value of <strong>FDVDenyWriteAccess</strong> is set to <code>1</code> at the <code>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Policies\Microsoft\FVE</code> registry key. This key manages <strong>BitLocker Drive Encryption</strong> (FVE = Full Volume Encryption) policies, which control security settings for removable drives and device encryption behavior. It is often used to block writing to non-encrypted USB drives or to turn off automatic device encryption.</p>
<p><strong>Before Update</strong>





















  
  
    
    <img
      title=""
      loading="lazy"
      decoding="async"
      src="https://www.amitk.net/images/docker-fsctl-extend-volume-windows-fix/BitLocker-Drive-Encryption-before-update.png"
      alt="BitLocker-Drive-Encryption"
      class="img BitLocker-Drive-Encryption  "
      width=""
      height="" />
  
  




</p>
<p>To fix the <code>FSCTL\_EXTEND\_VOLUME</code> write protection error, you need <code>ADMIN</code> access to change the value of <strong>FDVDenyWriteAccess</strong> to <code>0</code>.</p>
<p><strong>After Update</strong>





















  
  
    
    <img
      title=""
      loading="lazy"
      decoding="async"
      src="https://www.amitk.net/images/docker-fsctl-extend-volume-windows-fix/BitLocker-Drive-Encryption-after-update.png"
      alt="BitLocker-Drive-Encryption"
      class="img BitLocker-Drive-Encryption  "
      width=""
      height="" />
  
  




</p>
<h3 id="solution-4-install-the-latest-version-of-docker-desktop">Solution 4: Install the Latest Version of Docker Desktop</h3>
<p>Install the latest version of Docker Desktop and before that <strong>clear the content present</strong> at <code>%ProgramData%\docker</code> on Windows Server.</p>





















  
  
    
    <img
      title=""
      loading="lazy"
      decoding="async"
      src="https://www.amitk.net/images/docker-fsctl-extend-volume-windows-fix/antivirus-software-and-docker.png"
      alt="Latest Version of Docker Desktop"
      class="img Latest Version of Docker Desktop  "
      width=""
      height="" />
  
  





<h3 id="solution-5-configure-antivirus-exclusions">Solution 5: Configure Antivirus Exclusions</h3>
<p><strong>Action:</strong> Add Docker and WSL2 paths to your antivirus software&rsquo;s exclusion list.</p>
<p><strong>Key Paths to Exclude:</strong> <code>C:\Program Files\Docker</code>, <code>%LOCALAPPDATA%\Docker</code>, <code>%LOCALAPPDATA%\Packages\*WSL*</code>, <code>\\wsl$</code>.<br>
<strong>Why it works:</strong> Prevents real-time scanning from interfering with Docker&rsquo;s rapid file system operations.</p>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-how-to-prevent-this-error-permanently" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🛡️ How to Prevent This Error Permanently</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<h3 id="regular-maintenance-schedule">Regular Maintenance Schedule</h3>
<p>Create a maintenance calendar:</p>



<div class="table-wrapper">
<table class="style-table"><thead>
        <tr><th>Frequency</th><th>Task</th><th>Command</th></tr>
      </thead><tbody><tr><td><strong>Daily</strong></td><td>Check disk space</td><td><code>Get-PSDrive C</code></td></tr><tr><td><strong>Weekly</strong></td><td>Prune containers</td><td><code>docker container prune -f</code></td></tr><tr><td><strong>Weekly</strong></td><td>Prune images</td><td><code>docker image prune -a -f</code>; <code>docker volume prune -f</code></td></tr><tr><td><strong>Bi-weekly</strong></td><td>Compact WSL VHDX</td><td><code>Optimize-VHD</code></td></tr><tr><td><strong>Monthly</strong></td><td>Full system cleanup</td><td><code>docker system prune -a --volumes -f</code></td></tr><tr><td><strong>Monthly</strong></td><td>Review Docker logs</td><td>Check <code>$env:LOCALAPPDATA\Docker</code></td></tr><tr><td><strong>Quarterly</strong></td><td>Update Docker Desktop</td><td><code>winget upgrade Docker.DockerDesktop</code></td></tr></tbody>
  
</table>
</div>
<h3 id="monitoring-dashboards">Monitoring Dashboards</h3>
<p>Monitors Docker Desktop health metrics including disk space, WSL2 VHDX size, and Docker resource usage. Provides warnings when disk space falls below thresholds.</p>
<h4 id="script-monitors-docker-desktop-health">Script: Monitors Docker Desktop health</h4>
<script src="https://gist.github.com/AmitKumar-AK/e4038cff2ddea32ea33ea08e288427ae.js"></script>
<p><strong>Output</strong>





















  
  
    
    <img
      title=""
      loading="lazy"
      decoding="async"
      src="https://www.amitk.net/images/docker-fsctl-extend-volume-windows-fix/docker-monitoring-dashboard.png"
      alt="Monitors Docker Desktop health"
      class="img Monitors Docker Desktop health  "
      width=""
      height="" />
  
  




</p>
<h3 id="event-viewer-analysis">Event Viewer Analysis</h3>
<p>Retrieves and analyzes Windows Event Logs for errors and warnings related to Docker Desktop, Hyper-V, and WSL2 (Windows Subsystem for Linux).</p>
<h4 id="script-retrieves-and-analyzes-windows-event">Script: Retrieves and analyzes Windows Event</h4>
<script src="https://gist.github.com/AmitKumar-AK/c796789d20be6719f73e12d85c66b35c.js"></script>
<p><strong>Output</strong>





















  
  
    
    <img
      title=""
      loading="lazy"
      decoding="async"
      src="https://www.amitk.net/images/docker-fsctl-extend-volume-windows-fix/event-viewer-analysis.png"
      alt="Retrieves and analyzes Windows Event"
      class="img Retrieves and analyzes Windows Event  "
      width=""
      height="" />
  
  




</p>
<h3 id="performance-monitoring">Performance Monitoring</h3>
<p>Real-time Docker Performance Monitor</p>
<h4 id="script-docker-performance-monitor">Script: Docker Performance Monitor</h4>
<script src="https://gist.github.com/AmitKumar-AK/8ffdc9973a3ed0a0950d8c2d30e83b53.js"></script>
<p><strong>Output</strong>





















  
  
    
    <img
      title=""
      loading="lazy"
      decoding="async"
      src="https://www.amitk.net/images/docker-fsctl-extend-volume-windows-fix/docker-Performance-Monitoring.png"
      alt="Real-time Docker Performance Monitor"
      class="img Real-time Docker Performance Monitor  "
      width=""
      height="" />
  
  




</p>
<p><strong>Enjoyed this guide? Give it a ⭐ and show your support!</strong></p>
<div class="callout tip">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M18.364 5.636l-3.536 3.536m0 5.656l3.536 3.536M9.172 9.172L5.636 5.636m3.536 9.192l-3.536 3.536M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-5 0a4 4 0 11-8 0 4 4 0 018 0z"/></svg><p>Support</p>
    </div>
    <div class="callout-body">
        <p><strong>If you enjoy this content, consider <a href="https://www.youtube.com/@AmitKumar-Info?sub_confirmation=1" target="_blank" rel="noopener">subscribing</a>
 📰 for more updates and insights. Your engagement is very important to me and helps me keep providing valuable resources! 🌟</strong></p>
    </div>
</div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-conclusion" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧭 Conclusion</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>To effectively tackle the Docker <code>FSCTL_EXTEND_VOLUME</code> error on Windows, focus on freeing disk space, compacting the WSL2 VHDX file, and optimizing resource limits. Regular maintenance and cleanup will prevent build failures, ensuring smooth and reliable Docker Desktop performance.</p>
<div class="callout success">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M8.684 13.342C8.886 12.938 9 12.482 9 12c0-.482-.114-.938-.316-1.342m0 2.684a3 3 0 110-2.684m0 2.684l6.632 3.316m-6.632-6l6.632-3.316m0 0a3 3 0 105.367-2.684 3 3 0 00-5.367 2.684zm0 9.316a3 3 0 105.368 2.684 3 3 0 00-5.368-2.684z"/></svg><p>Explore More & Share Your Feedback</p>
    </div>
    <div class="callout-body">
        <p><p>This repository provides <strong>ready-to-use Docker container images</strong> and <strong>configuration</strong> for the following Sitecore topologies, all supporting <strong>Headless SXA</strong>:</p>
<ul>
<li><strong>Sitecore <span class="dark:text-gray-300 font-semibold gradient-text">XM0</span> Topology</strong></li>
<li><strong>Sitecore <span class="dark:text-gray-300 font-semibold gradient-text">XM1</span> Topology</strong></li>
<li><strong>Sitecore <span class="dark:text-gray-300 font-semibold gradient-text">XP0</span> Topology</strong></li>
<li><strong>Sitecore <span class="dark:text-gray-300 font-semibold gradient-text">XP1</span> Topology</strong></li>
</ul>
<p><strong><em>Share your feedback or contribute to support the Sitecore developer community!</em></strong></p>
</p>
    </div>
</div>
<div class="github-card-wrapper">
    <a id="github-d9614db9627a10e94aa78afd18192c3a" target="_blank" href="https://github.com/AmitKumar-AK/Sitecore-XM0-Topology" class="cursor-pointer">
      <div
        class="w-full md:w-auto p-0 m-0 border border-neutral-200 dark:border-neutral-700 border rounded-md shadow-2xl"><div class="w-full nozoom">
            <img
              src="https://opengraph.githubassets.com/0/AmitKumar-AK/Sitecore-XM0-Topology"
              alt="GitHub Repository Thumbnail"
              class="nozoom mt-0 mb-0 w-full h-full object-cover">
          </div><div class="w-full md:w-auto pt-3 p-5">
          <div class="flex items-center">
            <span class="text-2xl text-neutral-800 dark:text-gray-300 me-2"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="currentColor" viewBox="3 3 18 18">
  <path d="M12 3C7.0275 3 3 7.12937 3 12.2276C3 16.3109 5.57625 19.7597 9.15374 20.9824C9.60374 21.0631 9.77249 20.7863 9.77249 20.5441C9.77249 20.3249 9.76125 19.5982 9.76125 18.8254C7.5 19.2522 6.915 18.2602 6.735 17.7412C6.63375 17.4759 6.19499 16.6569 5.8125 16.4378C5.4975 16.2647 5.0475 15.838 5.80124 15.8264C6.51 15.8149 7.01625 16.4954 7.18499 16.7723C7.99499 18.1679 9.28875 17.7758 9.80625 17.5335C9.885 16.9337 10.1212 16.53 10.38 16.2993C8.3775 16.0687 6.285 15.2728 6.285 11.7432C6.285 10.7397 6.63375 9.9092 7.20749 9.26326C7.1175 9.03257 6.8025 8.08674 7.2975 6.81794C7.2975 6.81794 8.05125 6.57571 9.77249 7.76377C10.4925 7.55615 11.2575 7.45234 12.0225 7.45234C12.7875 7.45234 13.5525 7.55615 14.2725 7.76377C15.9937 6.56418 16.7475 6.81794 16.7475 6.81794C17.2424 8.08674 16.9275 9.03257 16.8375 9.26326C17.4113 9.9092 17.76 10.7281 17.76 11.7432C17.76 15.2843 15.6563 16.0687 13.6537 16.2993C13.98 16.5877 14.2613 17.1414 14.2613 18.0065C14.2613 19.2407 14.25 20.2326 14.25 20.5441C14.25 20.7863 14.4188 21.0746 14.8688 20.9824C16.6554 20.364 18.2079 19.1866 19.3078 17.6162C20.4077 16.0457 20.9995 14.1611 21 12.2276C21 7.12937 16.9725 3 12 3Z"></path>
</svg>
</span>
            <div
              id="github-d9614db9627a10e94aa78afd18192c3a-full_name"
              class="m-0 font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-gray-300">
              AmitKumar-AK/Sitecore-XM0-Topology
            </div>
          </div>

          <p id="github-d9614db9627a10e94aa78afd18192c3a-description" class="m-0 mt-2 text-md text-neutral-800 dark:text-gray-300">
            This repo will provide Sitecore Container images for XP0, XP1, XM0 and XM1 topologies. With Sitecore XM0 Topology Container Images, you can encapsulate the entire Sitecore XM environment, including its dependencies, configurations, and code, into a lightweight, isolated container.
          </p>

          <div class="m-0 mt-2 flex items-center">
            <span class="mr-1 inline-block h-3 w-3 rounded-full language-dot" data-language="TypeScript"></span>
            <div class="m-0 mr-5 text-md text-neutral-800 dark:text-gray-300">
              TypeScript
            </div>

            <span class="text-md mr-1 text-neutral-800 dark:text-gray-300"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"/></svg></span>
            <div id="github-d9614db9627a10e94aa78afd18192c3a-stargazers" class="m-0 mr-5 text-md text-neutral-800 dark:text-gray-300">
              0
            </div>

            <span class="text-md mr-1 text-neutral-800 dark:text-gray-300"><svg height=1.2em class="hx:inline-block hx:align-middle" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M7 5C7 3.89543 7.89543 3 9 3C10.1046 3 11 3.89543 11 5C11 5.74028 10.5978 6.38663 10 6.73244V14.0396H11.7915C12.8961 14.0396 13.7915 13.1441 13.7915 12.0396V10.7838C13.1823 10.4411 12.7708 9.78837 12.7708 9.03955C12.7708 7.93498 13.6662 7.03955 14.7708 7.03955C15.8753 7.03955 16.7708 7.93498 16.7708 9.03955C16.7708 9.77123 16.3778 10.4111 15.7915 10.7598V12.0396C15.7915 14.2487 14.0006 16.0396 11.7915 16.0396H10V17.2676C10.5978 17.6134 11 18.2597 11 19C11 20.1046 10.1046 21 9 21C7.89543 21 7 20.1046 7 19C7 18.2597 7.4022 17.6134 8 17.2676V6.73244C7.4022 6.38663 7 5.74028 7 5Z" fill="#000000"></path> </g></svg></span>
            <div id="github-d9614db9627a10e94aa78afd18192c3a-forks" class="m-0 mr-5 text-md text-neutral-800 dark:text-gray-300">
              0
            </div>
          </div>
        </div>
      </div>
      
      
      <script
        async
        type="text/javascript"
        src="/js/fetch-repo.min.dc5533c50cefd50405344b235937142271f26229fe39cbee27fd4960e8bb897a0beebfad77a1091ca91cd0d1fb14e70fc37cc114dd9674fb2c32e0ab512ec8a4.js"
        integrity="sha512-3FUzxQzv1QQFNEsjWTcUInHyYin&#43;OcvuJ/1JYOi7iXoL7r&#43;td6EJHKkc0NH7FOcPw3zBFN2WdPssMuCrUS7IpA=="
        data-repo-url="https://api.github.com/repos/AmitKumar-AK/Sitecore-XM0-Topology"
        data-repo-id="github-d9614db9627a10e94aa78afd18192c3a"></script>
    </a>
  </div>
<br/>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="creditreferences" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧾Credit/References</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>



<div class="table-wrapper">
<table class="style-table"><tbody><tr><td><a href="https://docs.docker.com/desktop/troubleshoot-and-support/troubleshoot/topics/#docker-desktop-with-windows-containers-fails-with-the-media-is-write-protected" target="_blank" rel="noopener">Docker Desktop with Windows Containers fails with The media is write protected</a></td><td><a href="https://superuser.com/questions/1849118/new-volume-error-message-the-media-is-write-protected" target="_blank" rel="noopener">New volume error message: The media is write protected</a></td><td><a href="https://docs.docker.com/engine/security/antivirus/" target="_blank" rel="noopener">Antivirus software and Docker</a></td></tr><tr><td><a href="https://github.com/docker/for-win/issues/14569" target="_blank" rel="noopener">Windows containers won&rsquo;t start after upgrading to 4.38.0 #14569</a></td><td><a href="https://learn.microsoft.com/is-is/windows/win32/api/winioctl/ni-winioctl-fsctl_extend_volume" target="_blank" rel="noopener">FSCTL_EXTEND_VOLUME IOCTL</a></td><td><a href="https://dev-solve.com/posts/43a8d5c" target="_blank" rel="noopener">Docker WSL ext4.vhdx File Size Management</a></td></tr><tr><td><a href="https://github.com/microsoft/navcontainerhelper/issues/3848" target="_blank" rel="noopener">docker: Error response from daemon: FSCTL_EXTEND_VOLUME</a></td><td><a href="https://github.com/docker/for-win/issues/13356" target="_blank" rel="noopener">Fail to pull the docker image with an error &ldquo;failed to register layer</a></td><td><a href="https://forums.docker.com/t/docker-build-for-windows-containers-copy-failed-file-not-found-in-build-context-or-excluded-by-dockerignore/141122" target="_blank" rel="noopener">Docker build for Windows containers: “COPY failed: file not found</a></td></tr></tbody>
  
</table>
</div>
]]></content:encoded></item><item><title>Sitecore Technology MVP 2026: Amit Kumar's 8th Consecutive Award</title><link>https://www.amitk.net/blog/sitecore-mvp-2026-amit-kumar-8th-year-announcement/</link><pubDate>Tue, 03 Feb 2026 00:00:00 +0000</pubDate><author>amit@amitk.net (Amit Kumar)</author><guid>https://www.amitk.net/blog/sitecore-mvp-2026-amit-kumar-8th-year-announcement/</guid><media:content url="https://www.amitk.net/images/sitecore-technology-mvp-2026-amit-kumar-8th-year/Sitecore-MVP-2026-Sitecore-MVP-Amit.gif" medium="image" type="image/gif"/><description>
Amit Kumar is recognized as a Sitecore Technology MVP for the 8th year in a row. Learn what the MVP program represents, key requirements, and why this recognition matters.</description><content:encoded><![CDATA[<p>I&rsquo;m <strong>excited</strong> to share that I&rsquo;ve been named a <a href="https://mvp.sitecore.com/en/Directory/Profile?id=764c86d9cfe14cc4b5f708dabbc3b551" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text">Sitecore Technology MVP</span></a>
 for the <span class="dark:text-gray-300 font-semibold gradient-text-aqua">8th year</span> in a row. This year&rsquo;s MVP group includes over <a href="https://www.sitecore.com/company/newsroom/press-releases/2026/02/sitecore-announces-its-2026-most-valuable-professionals" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient--text">200 contributors worldwide</span></a>
 who <strong>improve the Sitecore ecosystem</strong> by <strong><em>sharing knowledge, working together, and providing real project insights that help teams create better digital experiences</em></strong>.</p>
<p>Being part of this community is <span class="dark:text-gray-300 font-semibold gradient-text">very rewarding</span>. The <span class="dark:text-gray-300 font-semibold gradient-text-aqua">MVP program</span> <strong>recognizes</strong> people who <strong><em>do more than just their daily work</em></strong> - by giving practical advice, sharing solutions, supporting others, and helping to speed up the use of new Sitecore features.</p>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-what-the-sitecore-mvp-program-represents" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🤔 What the Sitecore MVP Program Represents</h2>
  
  
</div>


<p class="font-semibold text-xl  text-todo-color dark:text-gray-300">The Sitecore MVP award honors professionals who:</p>
<ul>
<li>
<p><strong>Demonstrate</strong> <span class="dark:text-gray-300 font-semibold gradient-text"> deep, hands‑on expertise </span> with <span class="dark:text-gray-300 font-semibold gradient-text-aqua">Sitecore products</span></p>
</li>
<li>
<p><strong>Contribute</strong> consistently across <span class="dark:text-gray-300 font-semibold gradient-text">blogs, videos, webinars, open‑source work, community forums, and events</span></p>
</li>
<li>
<p><strong>Share learning</strong> from <span class="dark:text-gray-300 font-semibold gradient-text-aqua">real implementations</span> to <span class="dark:text-gray-300 font-semibold gradient-text">support developers, marketers, and strategists</span></p>
</li>
<li>
<p>Provide <strong>valuable</strong> <span class="dark:text-gray-300 font-semibold gradient-text-aqua">product feedback and participate in beta programs</span></p>
</li>
<li>
<p><strong>Engage actively</strong> in <span class="dark:text-gray-300 font-semibold gradient-text">local and global communities to uplift others</span></p>
<div class="callout success">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 92.35 122.88" style="enable-background:new 0 0 92.35 122.88" xml:space="preserve"><style type="text/css">.st0{fill-rule:evenodd;clip-rule:evenodd;}</style><g><path class="st0" d="M88.96,113.07L77.41,111l-5.73,10.26c-4.16,5.15-6.8-3.32-7.96-6.27L52.57,93.96 c2.57-0.89,5.67-3.46,8.85-6.35c6.35,0.13,12.27-0.97,16.62-6.51l12.81,24.75l1.11,2.38C92.84,111.32,92.38,113.36,88.96,113.07 L88.96,113.07z M46.18,0.01c2.17-0.09,3.88,0.66,5.61,1.76c2.19,1.39,4.66,4.14,7.71,5.88c4.29,2.45,12.23-0.93,16.29,5.11 c2.37,3.52,2.48,6.28,2.66,9.01c0.19,2.94,0.71,5.65,3.72,9.63c4.99,6.6,6.03,10.99,3.46,15.56c-1.75,3.12-5.44,4.85-6.29,6.83 c-1.82,4.2,0.19,7.37-2.29,12.27c-1.73,3.4-4.39,5.64-7.94,6.78c-2.99,0.96-5.99-0.43-8.39,0.58c-4.21,1.77-7.31,5.88-10.66,6.92 c-1.29,0.4-2.58,0.6-3.87,0.59c-1.29,0.01-2.58-0.19-3.87-0.59c-3.35-1.04-6.45-5.15-10.66-6.92c-2.4-1.01-5.4,0.39-8.39-0.58 c-3.55-1.14-6.21-3.38-7.94-6.78c-2.49-4.9-0.48-8.07-2.29-12.27c-0.85-1.98-4.54-3.71-6.29-6.83C4.16,42.39,5.2,38,10.19,31.41 c3.01-3.98,3.53-6.69,3.72-9.63c0.18-2.73,0.29-5.49,2.66-9.01c4.07-6.04,12.01-2.66,16.29-5.11c3.05-1.74,5.52-4.49,7.71-5.88 C42.29,0.67,44.01-0.09,46.18,0.01L46.18,0.01z M39.13,35.79l5.22,4.97l8.98-9.13c0.89-0.9,1.45-1.62,2.54-0.5l3.56,3.64 c1.17,1.16,1.11,1.83,0.01,2.91L46.38,50.52c-2.32,2.28-1.92,2.42-4.28,0.08l-8.97-8.92c-0.49-0.53-0.44-1.07,0.1-1.6l4.13-4.28 C37.99,35.14,38.49,35.18,39.13,35.79L39.13,35.79z M46.18,16.24c13.38,0,24.23,10.85,24.23,24.23c0,13.38-10.85,24.23-24.23,24.23 c-13.38,0-24.23-10.85-24.23-24.23C21.95,27.08,32.8,16.24,46.18,16.24L46.18,16.24z M3.39,113.07L14.95,111l5.73,10.26 c4.16,5.15,6.8-3.32,7.96-6.27l11.15-21.03c-2.57-0.89-5.67-3.46-8.85-6.35c-6.35,0.13-12.27-0.97-16.62-6.51L1.5,105.85 l-1.11,2.38C-0.49,111.32-0.03,113.36,3.39,113.07L3.39,113.07z"/></g></svg><p>Sitecore MVP Award</p>
    </div>
    <div class="callout-body">
        <p>It&rsquo;s more than a <strong>technical milestone</strong> - it&rsquo;s about giving back, creating impact, and helping the community grow.</p>
    </div>
</div>
</li>
</ul>







<div class="flex flex-col md:flex-row md:flex-row-reverse items-start md:gap-8 gap-0 my-8">
  <div class="w-full md:w-1/2 flex items-start">
    
      <img src="https://www.amitk.net/images/sitecore-technology-mvp-2026-amit-kumar-8th-year/sitecore-mvp-2026-amit-kumar.gif" alt="Sitecore MVP 2026" class="rounded-lg shadow-lg w-full h-auto object-cover block" />
    
  </div>
  <div class="w-full md:w-1/2 flex flex-col">
    
      <h2 class="text-2xl font-bold !m-0 !p-0 leading-snug gradient-text" style="margin: 0 !important; padding: 0 !important;">🙏 A Heartfelt Thank You</h2>
    
    <div class="m-0 p-0"><p>This achievement wouldn&rsquo;t be possible without the <strong>trust</strong>, <strong>support</strong>, and <strong>encouragement</strong> from <strong>my teams</strong>, <strong>colleagues</strong>, <strong>leadership</strong>, and the wider <strong>Sitecore community</strong>. Every <strong>discussion</strong>, <strong>collaboration</strong>, and <strong>opportunity has contributed to this journey</strong>.</p>
<p>I <strong>look forward</strong> to <strong>continuing</strong> to <strong>learn</strong>, <strong>share</strong>, and <strong>support others</strong> as we move into an exciting future shaped by <strong>Sitecore</strong> and <span class="dark:text-gray-300 font-semibold gradient-text">AI‑driven digital experiences</span>.</p>
<p><span class="dark:text-gray-300 font-semibold gradient-text">Thank you all once again for your support!</span></p>
</div>
  </div>
</div>







<div class="flex flex-col md:flex-row  items-start md:gap-8 gap-0 my-8">
  <div class="w-full md:w-1/2 flex items-start">
    
      <img src="https://www.amitk.net/images/sitecore-technology-mvp-2026-amit-kumar-8th-year/Sitecore-MVP-2026-Sitecore-MVP-Amit_.png" alt="Credly Badge: Sitecore Technology MVP 2026" class="rounded-lg shadow-lg w-full h-auto object-cover block" />
    
  </div>
  <div class="w-full md:w-1/2 flex flex-col">
    
      <h2 class="text-2xl font-bold !m-0 !p-0 leading-snug gradient-text" style="margin: 0 !important; padding: 0 !important;">Credly Badge</h2>
    
    <div class="m-0 p-0"><p><strong>Issued by</strong> <a href="https://www.credly.com/badges/d2a82bc1-0fd1-4b8e-9d20-58e4e5d0fba7" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient--text">Sitecore</span></a>
</p>
<p>A Sitecore MVP is an individual with expertise in Sitecore products who actively participates in online and offline communities to share their knowledge and expertise with other Sitecore partners and customers. These individuals have made significant contributions that drive forward the success of other members of the community.</p>
<p><a href="https://www.credly.com/badges/d2a82bc1-0fd1-4b8e-9d20-58e4e5d0fba7" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient--text">Sitecore Technology MVP 2026</span></a>
</p>
</div>
  </div>
</div>
]]></content:encoded></item><item><title>Sitecore Marketer MCP &amp; VS Code Integration</title><link>https://www.amitk.net/blog/sitecore-marketer-mcp-vscode-integration/</link><pubDate>Sat, 31 Jan 2026 00:00:00 +0000</pubDate><author>amit@amitk.net (Amit Kumar)</author><guid>https://www.amitk.net/blog/sitecore-marketer-mcp-vscode-integration/</guid><media:content url="https://www.amitk.net/images/sitecore-marketer-mcp-vscode-integration/sitecore-marketer-mcp-Sitecore.gif" medium="image" type="image/gif"/><description>
Discover how to integrate Sitecore Marketer MCP with Visual Studio Code for enhanced AI-driven content management, streamlining tasks and boosting productivity.</description><content:encoded><![CDATA[<p>This article explores how to connect <a href="https://doc.sitecore.com/sai/en/users/sitecoreai/marketer-mcp.html" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text">Sitecore Marketer MCP (Model Context Protocol)</span></a>
 with <strong>Visual Studio Code</strong> to improve <span class="dark:text-gray-300 font-semibold gradient-text-aqua">AI-driven content management</span>. It shows <strong>how Sitecore Marketer MCP</strong>, using the <a href="https://api-docs.sitecore.com/ai-capabilities/agent-api" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text">SitecoreAI Agent API</span></a>
, helps with <strong>creating</strong> and <strong>updating content</strong> including <strong>marketing tasks</strong>. The guide explains the <strong>benefits of Sitecore Marketer MCP</strong> compared to regular Copilot solutions and provides a step-by-step tutorial for easy <strong>integration</strong> with <span class="dark:text-gray-300 font-semibold gradient-text-aqua">Visual Studio Code</span>, boosting your <strong>content workflows</strong> with advanced <strong>AI technology</strong>.</p>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-what-is-mcp-model-context-protocol" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🤖 What is MCP (Model Context Protocol)?</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>The <a href="https://modelcontextprotocol.io" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text">Model Context Protocol (MCP)</span></a>
 is an <strong>open standard</strong> that changes how <strong>AI tools</strong> work by <strong>linking AI apps</strong> to <strong>outside systems</strong> like <strong>data sources</strong>, <strong>tools</strong>, and <strong>workflows</strong>. Instead of using fragile, custom connections, it <strong>offers</strong> a <strong>unified</strong>, <strong>neutral way</strong> for <strong>any AI</strong> that <strong>supports MCP</strong> to easily <strong>connect</strong> with <strong>MCP servers</strong>. With more than 17,000 servers, MCP works with many applications, from web browsing to <strong>managing enterprise content</strong>.</p>
<p>In <strong>enterprise projects</strong> like <a href="https://www.amitk.net/blog/nextjs-app-router-content-sdk-sitecore-wildcard-pages/" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text">Sitecore implementations</span></a>
, it&rsquo;s important to use curated, secure, and <strong>well-managed MCP servers</strong>. Created by <a href="https://www.anthropic.com/news/model-context-protocol" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text-aqua">Anthropic</span></a>
, <strong>MCP</strong> sets a standard for how AI models <strong>connect</strong> to <strong>outside systems</strong>, ensuring they work well with AI clients like <a href="https://claude.com/product/overview" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text">Claude</span></a>
, <a href="https://openai.com/index/chatgpt/" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text-aqua">ChatGPT</span></a>
, and <a href="https://code.visualstudio.com/docs/copilot/overview" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text">VS Code Copilot</span></a>
. <strong><em>This protocol allows AI models to safely access data, tools, and business workflows, improving flexibility and integration</em></strong>.</p>





















  
  
    
    <img
      title="Introduction to Model Context Protocol (MCP)"
      loading="lazy"
      decoding="async"
      src="https://www.amitk.net/images/sitecore-marketer-mcp-vscode-integration/what-is-mcp-Sitecore-Marketer-MCP-Sitecore-MVP-Amit-Kumar.png"
      alt="Unlocking the Power of Sitecore Marketer MCP with Visual Studio Code"
      class="img justify-self-center  "
      width=""
      height="" />
  
  







<p class="font-semibold text-xl  text-primary dark:text-gray-300">What it shows (at a glance):</p>
<ul>
<li>An AI app (host) uses an MCP client to connect to an MCP server.</li>
<li>Messages use JSON‑RPC over stdio (local) or Streamable HTTP (remote).</li>
<li>The server exposes three core capabilities: Tools, Resources, and Prompts.</li>
<li>Basic flow: discover → invoke tool → return results/context</li>
</ul>
<p>📹 <strong>Learn More About MCP</strong></p>
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
      <iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen" loading="lazy" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/agBbdiOPLQA?autoplay=0&amp;controls=1&amp;end=60&amp;loop=0&amp;mute=0&amp;start=30" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" title="YouTube video"></iframe>
    </div>

<br/>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-introduction-to-sitecore-marketer-mcp" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧠 Introduction to Sitecore Marketer MCP</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p><a href="https://doc.sitecore.com/sai/en/users/sitecoreai/marketer-mcp.html" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text">Sitecore Marketer MCP</span></a>
 is a <strong>powerful tool</strong> that changes <strong>content management</strong> by adding <strong>advanced AI features</strong> to the <strong>SitecoreAI</strong> platform. This <strong>server</strong> uses the <strong>SitecoreAI Agent API</strong> to allow smooth <strong>interactions between AI assistants</strong> and <a href="https://doc.sitecore.com/sai/en/users/sitecoreai/marketer-mcp.html#marketer-mcp-tools-reference" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text-aqua">Sitecore's marketing tools</span></a>
. It lets users manage <strong>content</strong>, <strong>assets</strong>, and <strong>data</strong> with <a href="https://www.nuance.com/products/help/dragon152/dragon-for-pc/enx/professionalindividual/Content/Commands/about_natural_language_commands.htm?srsltid=AfmBOoouRJD_TEQhM6jYLmnHq-dwMW2jWIlOQ73gmvvSu__5oAl5IWU6" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text">natural language commands</span></a>
, making workflows <strong>easier</strong> and <strong>boosting productivity</strong>. Unlike traditional APIs, it is user-friendly for both developers and marketers, providing a more flexible and secure content management experience.</p>
<p>Built on the <a href="https://github.com/modelcontextprotocol" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text-aqua">open-standard Model Context Protocol (MCP)</span></a>
, <strong>Sitecore Marketer MCP</strong> lets <strong>AI agents</strong> safely work with <strong>Sitecore&rsquo;s marketing tools</strong>. This <strong>integration allows AI</strong> to not only offer <strong>suggestions</strong> but also perform actions like <strong>creating</strong> or <strong>editing content</strong> and optimizing <strong>campaigns</strong>, without needing <strong>manual</strong> UI navigation or <strong>complex API</strong> calls. The protocol includes <strong>safeguards</strong> like scoped <strong>permissions</strong> and <strong>audit trails</strong> to ensure secure and <strong>efficient operations</strong>. By allowing <strong>faster</strong> experimentation with <strong>less risk</strong>, Sitecore Marketer MCP <strong>helps</strong> marketers <strong>innovate</strong> and adapt <strong>quickly</strong>, making it a <strong>key feature</strong> in <strong>Sitecore&rsquo;s</strong> latest updates and discussions.</p>





















  
  
    
    <img
      title="Sitecore Marketer MCP"
      loading="lazy"
      decoding="async"
      src="https://www.amitk.net/images/sitecore-marketer-mcp-vscode-integration/what-is-Sitecore-Marketer-MCP-Sitecore-MVP-Amit-Kumar.png"
      alt="Unlocking the Power of Sitecore Marketer MCP with Visual Studio Code"
      class="img justify-self-center  "
      width=""
      height="" />
  
  







<p class="font-semibold text-xl  text-todo-color dark:text-gray-300">Why these components?:</p>
<ul>
<li><span class="dark:text-gray-300 font-semibold gradient-text">Marketer MCP exposes "tools" that directly map to business‑level actions </span>(e.g., create page, add component, upload asset). Those tools proxy to <span class="dark:text-gray-300 font-semibold gradient-text-aqua">Agent API endpoints</span>, so AI assistants can perform actions from natural‑language prompts - no manual UI or raw API calls.</li>
<li><span class="dark:text-gray-300 font-semibold gradient-text">Security & governance:</span> operations run under your existing Sitecore roles with auditability and human‑in‑the‑loop approval rules where configured.</li>
<li><span class="dark:text-gray-300 font-semibold gradient-text">Transport & protocol:</span> Requests flow via <span class="dark:text-gray-300 font-semibold gradient-text-aqua">MCP (JSON‑RPC)</span> over <span class="dark:text-gray-300 font-semibold gradient-text-aqua">Streamable HTTP (remote)</span> or <span class="dark:text-gray-300 font-semibold gradient-text-aqua">stdio</span> (local), following the standard MCP architecture.</li>
</ul>
<h3 id="list-of-available-tools-from-sitecore-marketer-mcp">List of available tools from Sitecore Marketer MCP</h3>
<p>By default, all the <a href="https://doc.sitecore.com/sai/en/users/sitecoreai/marketer-mcp.html#marketer-mcp-tools-reference" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text">Marketer MCP tools</span></a>
 are enabled. To <strong>fully use</strong> the <strong>Marketer MCP</strong>, it&rsquo;s <strong>recommended</strong> to <strong>enable each tool</strong>. Each tool <strong>matches</strong> an <strong>endpoint</strong> of the <strong>Agent API</strong> used by the <strong>MCP</strong> to perform <strong>actions</strong> in <strong>Sitecore</strong>.</p>





















  
  
    
    <img
      title="Sitecore Marketer MCP tools"
      loading="lazy"
      decoding="async"
      src="https://www.amitk.net/images/sitecore-marketer-mcp-vscode-integration/Marketer-MCP-tools-reference-Sitecore-MVP-Amit-Kumar.png"
      alt="Marketer MCP tools"
      class="img justify-self-center  "
      width=""
      height="" />
  
  





<h4 id="-site-management">🗂️ Site Management</h4>



<div class="table-wrapper">
<table class="style-table"><thead>
        <tr><th>Tool</th><th>Description</th></tr>
      </thead><tbody><tr><td><strong>list_sites</strong></td><td>Lists all sites available in the tenant.</td></tr><tr><td><strong>get_site_information</strong></td><td>Retrieves detailed information for a specific site.</td></tr><tr><td><strong>get_site_id_from_item</strong></td><td>Retrieves the site ID that is linked to a specific item ID.</td></tr><tr><td><strong>get_all_pages_by_site</strong></td><td>Retrieves a list of pages for a specific site, including the ID and path of each page.</td></tr></tbody>
  
</table>
</div>
<h4 id="-page-management">📄 Page Management</h4>



<div class="table-wrapper">
<table class="style-table"><thead>
        <tr><th>Tool</th><th>Description</th></tr>
      </thead><tbody><tr><td><strong>create_content_item</strong></td><td>Creates a new content item using the specified template and field values.</td></tr><tr><td><strong>update_content</strong></td><td>Updates an existing content item.</td></tr><tr><td><strong>delete_content</strong></td><td>Deletes a specific content item.</td></tr><tr><td><strong>get_content_item_by_path</strong></td><td>Retrieves a published content item (Experience Edge) by path.</td></tr><tr><td><strong>get_content_item_by_id</strong></td><td>Retrieves a published content item (Experience Edge) by ID.</td></tr><tr><td><strong>list_available_insertoptions</strong></td><td>Retrieves a list of content templates that you can add as child items under a specific parent item.</td></tr></tbody>
  
</table>
</div>
<h4 id="-content-management">📃 Content Management</h4>



<div class="table-wrapper">
<table class="style-table"><thead>
        <tr><th>Tool</th><th>Description</th></tr>
      </thead><tbody><tr><td><strong>list_sites</strong></td><td>Lists all sites available in the tenant.</td></tr><tr><td><strong>get_site_information</strong></td><td>Retrieves detailed information for a specific site.</td></tr><tr><td><strong>get_site_id_from_item</strong></td><td>Retrieves the site ID that is linked to a specific item ID.</td></tr><tr><td><strong>get_all_pages_by_site</strong></td><td>Retrieves a list of pages for a specific site, including the ID and path of each page.</td></tr></tbody>
  
</table>
</div>
<h4 id="-component-tools">🛠️ Component Tools</h4>



<div class="table-wrapper">
<table class="style-table"><thead>
        <tr><th>Tool</th><th>Description</th></tr>
      </thead><tbody><tr><td><strong>list_components</strong></td><td>Retrieves a list of components available for a specific site.</td></tr><tr><td><strong>get_component</strong></td><td>Retrieves the details of a specific component, including its ID, name, and datasource.</td></tr><tr><td><strong>create_component_datasource</strong></td><td>Creates a new datasource item for a specific component using the given data field values.</td></tr><tr><td><strong>search_component_datasources</strong></td><td>Searches for available datasources that can be used with a specific component.</td></tr></tbody>
  
</table>
</div>
<h4 id="-asset-management">🖼️ Asset Management</h4>



<div class="table-wrapper">
<table class="style-table"><thead>
        <tr><th>Tool</th><th>Description</th></tr>
      </thead><tbody><tr><td><strong>search_assets</strong></td><td>Searches for digital assets like videos, images, and documents using query terms, file types, or tags.</td></tr><tr><td><strong>get_asset_information</strong></td><td>Retrieves details of a specific asset.</td></tr><tr><td><strong>update_asset</strong></td><td>Updates metadata for an existing asset.</td></tr><tr><td><strong>upload_asset</strong></td><td>Uploads a new digital asset to the system and saves it with the given metadata.</td></tr></tbody>
  
</table>
</div>
<h4 id="-personalization">👤 Personalization</h4>



<div class="table-wrapper">
<table class="style-table"><thead>
        <tr><th>Tool</th><th>Description</th></tr>
      </thead><tbody><tr><td><strong>get_personalization_versions_by_page</strong></td><td>Gets all the personalization versions set up for a specific page.</td></tr><tr><td><strong>create_personalization_version</strong></td><td>Creates a new version of a page for personalization, allowing you to set targeting rules for different audiences.</td></tr><tr><td><strong>get_personalization_condition_templates</strong></td><td>Retrieves all the condition templates available for personalization.</td></tr><tr><td><strong>get_personalization_condition_template_by_id</strong></td><td>Retrieves a condition template by ID, including its parameters, to create a personalized version of a page.</td></tr></tbody>
  
</table>
</div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-how-to-integrate-sitecore-marketer-mcp-with-visual-studio-code" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧑‍💻 How to Integrate Sitecore Marketer MCP with Visual Studio Code</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>


<p class="font-semibold text-xl  text-primary dark:text-gray-300">Integrating the Marketer MCP server with Visual Studio Code and GitHub Copilot:</p>
<ul>
<li>
<p>Transforms your development environment into a powerful Sitecore content assistant.</p>
</li>
<li>
<p>This integration enhances the developer experience by turning VS Code into a comprehensive content-orchestration hub, allowing seamless interaction with Sitecore&rsquo;s
AI-driven features.</p>
</li>
<li>
<p>With native support for MCP servers through GitHub Copilot and related extensions, users can query Sitecore content, generate code snippets aligned with Sitecore schemas,
and automate marketing tasks using natural language prompts.</p>
<div class="callout info">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" width="22" height="22"><path stroke-linecap="round" stroke-linejoin="round" d="m11.25 11.25.041-.02a.75.75.0 011.063.852l-.708 2.836a.75.75.0 001.063.853l.041-.021M21 12A9 9 0 113 12a9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"></path></svg><p>What is SitecoreAI (FKA XM Cloud)?</p>
    </div>
    <div class="callout-body">
        <p><p>To learn more about SitecoreAI (FKA XM Cloud), watch the video below for detailed information.</p>
<br/>
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
      <iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen" loading="lazy" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/igOJ21AfDtc?autoplay=0&amp;controls=1&amp;end=60&amp;loop=0&amp;mute=0&amp;start=30" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" title="YouTube video"></iframe>
    </div></p>
    </div>
</div>
</li>
</ul>
<h3 id="step-by-step-vs-code-configuration">Step-by-Step: VS Code Configuration</h3>
<p><strong>1. Prerequisites:</strong></p>
<ul>
<li>
<p>Visual Studio Code with the GitHub Copilot extension enabled.</p>
</li>
<li>
<p>Access to the Sitecore Marketer MCP server (typically provided via a specific URL <a href="https://edge-platform.sitecorecloud.io/mcp/marketer-mcp-prod" target="_blank" rel="noopener">https://edge-platform.sitecorecloud.io/mcp/marketer-mcp-prod</a>
 from your Sitecore setup).</p>
</li>
<li>
<p>Ensure your organization&rsquo;s Copilot administrator has enabled the necessary permissions.</p>
<div class="callout warning">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" width="22" height="22"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73.0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898.0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"></path></svg><p>Important</p>
    </div>
    <div class="callout-body">
        <p>A common hurdle: If the <strong>START MCP SERVER</strong> option doesn&rsquo;t appear later, your <strong>admin</strong> may need to <strong>re-enable</strong> MCP access in the <strong>Copilot admin UI</strong>, as noted in related VS Code issues <a href="https://github.com/microsoft/vscode/issues/255952" target="_blank" rel="noopener">here</a></p>
    </div>
</div>
</li>
</ul>
<p><strong>2. Configuration in VS Code:</strong></p>
<p>Create or edit a file at <code>.vscode/mcp.json</code> in your <span class="dark:text-gray-300 font-semibold gradient-text-aqua">project root</span> (or workspace) or a <span class="dark:text-gray-300 font-semibold gradient-text">user-level</span> <code>mcp.json</code> (<code>C:\Users\[UserName]\AppData\Roaming\Code\User</code>). Add your <strong>MCP server entry</strong>. Example for a <strong>hosted/remote server</strong> (adapt URL to your Sitecore Marketer MCP endpoint):</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-json" data-lang="json"><span style="display:flex;"><span><span style="color:#6272a4">// Sitecore Marketer MCP Server configuration for AI-driven content management in Visual Studio Code.
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// Enables integration with SitecoreAI, and Copilot for advanced marketing automation, 
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// content orchestration, and secure API access.
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// For more details, visit: https://doc.sitecore.com/sai/en/users/sitecoreai/marketer-mcp.html
</span></span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  {
</span></span><span style="display:flex;"><span>    <span style="color:#ff79c6">&#34;servers&#34;</span>: {
</span></span><span style="display:flex;"><span>          <span style="color:#ff79c6">&#34;sitecore-marketer-mcp&#34;</span>: {
</span></span><span style="display:flex;"><span>        <span style="color:#ff79c6">&#34;url&#34;</span>: <span style="color:#f1fa8c">&#34;https://edge-platform.sitecorecloud.io/mcp/marketer-mcp-prod&#34;</span>,
</span></span><span style="display:flex;"><span>        <span style="color:#ff79c6">&#34;auth&#34;</span>: {
</span></span><span style="display:flex;"><span>          <span style="color:#ff79c6">&#34;type&#34;</span>: <span style="color:#f1fa8c">&#34;external&#34;</span>
</span></span><span style="display:flex;"><span>        },
</span></span><span style="display:flex;"><span>        <span style="color:#ff79c6">&#34;type&#34;</span>: <span style="color:#f1fa8c">&#34;http&#34;</span>
</span></span><span style="display:flex;"><span>      }
</span></span><span style="display:flex;"><span>      }
</span></span><span style="display:flex;"><span>  }</span></span></code></pre></div>
<p><strong>3. Restart and Use:</strong></p>
<p><span class="dark:text-gray-300 font-semibold gradient-text">i)</span> Save the <code>mcp.json</code> file.</p>
<p><span class="dark:text-gray-300 font-semibold gradient-text">ii)</span> Fully restart VS Code and ensure you are signed into Copilot.</p>
<p><span class="dark:text-gray-300 font-semibold gradient-text">iii)</span> Once configured correctly, VS Code should detect it. Look for options like <strong>START MCP server</strong> or <strong>MCP-related commands</strong> in the <strong>Command Palette (Ctrl+Shift+P)</strong> or Copilot Chat.</p>
<p><span class="dark:text-gray-300 font-semibold gradient-text">iv)</span> Visual Studio Code will expose the <strong>START MCP server</strong> option, allowing Copilot and other AI extensions to interact with the MCP server.</p>
<p>

<p class="font-semibold text-xl  text-primary dark:text-gray-300">Getting Started with the Sitecore Marketer MCP Demo:</p>





















  
  
    
    <img
      title="Marketer MCP and Agent API overview"
      loading="lazy"
      decoding="async"
      src="https://www.amitk.net/images/sitecore-marketer-mcp-vscode-integration/ai-capabilities-in-SitecoreAI.gif"
      alt="Marketer MCP and Agent API overview"
      class="img justify-self-center  "
      width=""
      height="" />
  
  




</p>
<p><span class="dark:text-gray-300 font-semibold gradient-text">v)</span> The AI in your editor (e.g., Copilot Chat) will now have access to the tools provided by the Sitecore Marketer MCP server.</p>
<p><strong>4. Troubleshooting:</strong></p>
<p>If the <strong>START MCP server</strong> option does not appear:</p>
<ul>
<li>
<p>Verify that <strong>GitHub Copilot</strong> is enabled for your account</p>
</li>
<li>
<p>Ensure your organization has not disabled MCP access</p>
</li>
</ul>

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
   
   
     
     <img
       title="GitHub Copilot Access"
       loading="lazy"
       decoding="async"
       src="https://www.amitk.net/images/sitecore-marketer-mcp-vscode-integration/GitHubCopilot-MCP-tools-Sitecore-MVP-Amit-Kumar.png"
       alt="GitHub Copilot Access"
       class="img justify-self-center  "
       width=""
       height="" />
   
   
 
 
 
 

<ul>
<li>
<p>Contact your <strong>organization admin</strong> to re-enable MCP in the Copilot Admin UI</p>
</li>
<li>
<p>For official Marketer MCP, confirm your Sitecore account has required permissions and the endpoint is correctly provisioned.</p>
</li>
</ul>
<p><strong>5. Utilization: Once connected:</strong></p>
<ul>
<li>
<p>In GitHub Copilot Chat , use natural language prompts tied to Sitecore, e.g., <span class="dark:text-gray-300 font-semibold gradient-text">Create a Sitecore content item for a new blog post</span> or <span class="dark:text-gray-300 font-semibold gradient-text-aqua">Generate JSS component code for a personalized banner from Sitecore data</span>.</p>
</li>
<li>
<p>Combine with VS Code&rsquo;s AI features for code generation.</p>
</li>
<li>
<p>Safely experiment with AI-driven Sitecore content changes and marketing tasks</p>
</li>
<li>
<p>Extend to web chatbots or other tools by referencing the same MCP server.</p>
</li>
<li>
<p>When you use a prompt like <span class="dark:text-gray-300 font-semibold gradient-text">Create item with name [Item Name] based on template [template name]</span>, followed by <span class="dark:text-gray-300 font-semibold gradient-text-aqua">Update field on Content Item</span>, the <code>update_fields_on_content_item</code> tool is triggered. It will <strong>automatically</strong> use the <strong>newly created Item ID</strong> to update the content item with your specified values. The required <strong>JSON payload</strong> will look like this:</p>
</li>
</ul>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-json" data-lang="json"><span style="display:flex;"><span><span style="color:#6272a4">// Example: Update Sitecore content item fields using Marketer MCP tool in VS Code.
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// Automate headless CMS workflows, AI-powered content updates, and marketing operations with SitecoreAI, 
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// Copilot, and Experience Edge.
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// Ideal for scalable, secure, and efficient Sitecore content management.
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// More info: https://doc.sitecore.com/sai/en/users/sitecoreai/marketer-mcp.html
</span></span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    {
</span></span><span style="display:flex;"><span>      <span style="color:#ff79c6">&#34;fields&#34;</span>: {
</span></span><span style="display:flex;"><span>        <span style="color:#ff79c6">&#34;image&#34;</span>: <span style="color:#f1fa8c">&#34;&lt;image mediaid=\&#34;\&#34; alt=\&#34;Contoso Logo\&#34; width=\&#34;904\&#34; height=\&#34;460\&#34; /&gt;&#34;</span>,
</span></span><span style="display:flex;"><span>        <span style="color:#ff79c6">&#34;paragraph1&#34;</span>: <span style="color:#f1fa8c">&#34;Lorem ipsum dolor sit amet, consectetur adipiscing elit&#34;</span>,
</span></span><span style="display:flex;"><span>        <span style="color:#ff79c6">&#34;title&#34;</span>: <span style="color:#f1fa8c">&#34;Lorem ipsum dolor&#34;</span>
</span></span><span style="display:flex;"><span>      },
</span></span><span style="display:flex;"><span>      <span style="color:#ff79c6">&#34;itemId&#34;</span>: <span style="color:#f1fa8c">&#34;dd8c3d91-b57b-4f0b-a574-e4c02b683b48&#34;</span>
</span></span><span style="display:flex;"><span>    }</span></span></code></pre></div>
<ul>
<li>When you use a prompt such as <span class="dark:text-gray-300 font-semibold gradient-text">Add Component [Component Name] inside placeholder [Placeholder Name] on Page [Page Name]</span>, the <code>add_component_on_page</code> tool is triggered. It will generate a <strong>JSON payload</strong> similar to the following:</li>
</ul>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-json" data-lang="json"><span style="display:flex;"><span><span style="color:#6272a4">// Example: Add a component to a Sitecore page using the add_component_on_page tool.
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// Streamline headless CMS personalization, automate component placement, and enhance marketing workflows with 
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// SitecoreAI and Copilot.
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// Supports scalable, AI-driven content management in Experience Edge and JSS environments.
</span></span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>   {
</span></span><span style="display:flex;"><span>      <span style="color:#ff79c6">&#34;componentItemName&#34;</span>: <span style="color:#f1fa8c">&#34;Hero Banner&#34;</span>,
</span></span><span style="display:flex;"><span>      <span style="color:#ff79c6">&#34;componentRenderingId&#34;</span>: <span style="color:#f1fa8c">&#34;ccd1c539-a271-4fc0-ae04-0e78fa722b9b&#34;</span>,
</span></span><span style="display:flex;"><span>      <span style="color:#ff79c6">&#34;fields&#34;</span>: {},
</span></span><span style="display:flex;"><span>      <span style="color:#ff79c6">&#34;language&#34;</span>: <span style="color:#f1fa8c">&#34;en&#34;</span>,
</span></span><span style="display:flex;"><span>      <span style="color:#ff79c6">&#34;pageId&#34;</span>: <span style="color:#f1fa8c">&#34;82932c57-15b6-4720-9603-a2c1a397ba5b&#34;</span>,
</span></span><span style="display:flex;"><span>      <span style="color:#ff79c6">&#34;placeholderPath&#34;</span>: <span style="color:#f1fa8c">&#34;headless-main&#34;</span>
</span></span><span style="display:flex;"><span>    }</span></span></code></pre></div>
<p><strong>Enjoyed this guide? Give it a ⭐ and show your support!</strong></p>
<div class="callout tip">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M18.364 5.636l-3.536 3.536m0 5.656l3.536 3.536M9.172 9.172L5.636 5.636m3.536 9.192l-3.536 3.536M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-5 0a4 4 0 11-8 0 4 4 0 018 0z"/></svg><p>Support</p>
    </div>
    <div class="callout-body">
        <p><strong>If you enjoy this content, consider <a href="https://www.youtube.com/@AmitKumar-Info?sub_confirmation=1" target="_blank" rel="noopener">subscribing</a>
 📰 for more updates and insights. Your engagement is very important to me and helps me keep providing valuable resources! 🌟</strong></p>
    </div>
</div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-conclusion-the-future-is-integrated" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧭 Conclusion: The Future is Integrated</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>The <strong><em>Sitecore Marketer MCP revolutionizes content management</em></strong> by <strong>integrating AI capabilities</strong> through the <strong>open Model Context Protocol (MCP)</strong> and the <strong>safety-focused Agent API</strong>. This <strong>integration</strong> with <strong>Visual Studio Code</strong> enhances flexibility, safety, and scalability, empowering organizations to <strong>innovate</strong> rapidly while maintaining <strong>control</strong> over their Sitecore ecosystem. By <strong>adopting</strong> Sitecore Marketer MCP early, businesses <strong>position</strong> themselves at the <strong>forefront</strong> of <strong>AI-driven digital experiences</strong>, streamlining <strong>content management</strong> and <strong>bridging</strong> code with <strong>marketing tasks</strong>. For the latest setup, refer to Sitecore&rsquo;s documentation on <a href="https://doc.sitecore.com/sai/en/users/sitecoreai/marketer-mcp.html#marketer-mcp-tools-reference" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text">Marketer MCP</span></a>
.</p>
<div class="callout success">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M8.684 13.342C8.886 12.938 9 12.482 9 12c0-.482-.114-.938-.316-1.342m0 2.684a3 3 0 110-2.684m0 2.684l6.632 3.316m-6.632-6l6.632-3.316m0 0a3 3 0 105.367-2.684 3 3 0 00-5.367 2.684zm0 9.316a3 3 0 105.368 2.684 3 3 0 00-5.368-2.684z"/></svg><p>Explore More & Share Your Feedback</p>
    </div>
    <div class="callout-body">
        <p>Find <strong>setup guides</strong> and <strong>ready-to-use</strong> <span class="dark:text-gray-300 font-semibold gradient-text">Sitecore Marketer MCP prompts</span> in the <a href="https://github.com/AmitKumar-AK/sitecore-marketer-mcp-prompts" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text-aqua">Sitecore Marketer MCP Prompts &amp; VS Code Integration</span></a>
 GitHub repo. <strong>Prompts</strong> for SitecoreAI sites, pages, and components are organized in <a href="https://github.com/AmitKumar-AK/sitecore-marketer-mcp-prompts/blob/main/docs/prompts/README.md" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text">docs/prompts</span></a>
.
<br/><br/>
<strong><em>Share your feedback or contribute to support the Sitecore developer community!</em></strong></p>
    </div>
</div>
<div class="github-card-wrapper">
    <a id="github-0b8cd2bfc8fbcb75a2913df72fab2c1f" target="_blank" href="https://github.com/AmitKumar-AK/sitecore-marketer-mcp-prompts" class="cursor-pointer">
      <div
        class="w-full md:w-auto p-0 m-0 border border-neutral-200 dark:border-neutral-700 border rounded-md shadow-2xl"><div class="w-full nozoom">
            <img
              src="https://opengraph.githubassets.com/0/AmitKumar-AK/sitecore-marketer-mcp-prompts"
              alt="GitHub Repository Thumbnail"
              class="nozoom mt-0 mb-0 w-full h-full object-cover">
          </div><div class="w-full md:w-auto pt-3 p-5">
          <div class="flex items-center">
            <span class="text-2xl text-neutral-800 dark:text-gray-300 me-2"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="currentColor" viewBox="3 3 18 18">
  <path d="M12 3C7.0275 3 3 7.12937 3 12.2276C3 16.3109 5.57625 19.7597 9.15374 20.9824C9.60374 21.0631 9.77249 20.7863 9.77249 20.5441C9.77249 20.3249 9.76125 19.5982 9.76125 18.8254C7.5 19.2522 6.915 18.2602 6.735 17.7412C6.63375 17.4759 6.19499 16.6569 5.8125 16.4378C5.4975 16.2647 5.0475 15.838 5.80124 15.8264C6.51 15.8149 7.01625 16.4954 7.18499 16.7723C7.99499 18.1679 9.28875 17.7758 9.80625 17.5335C9.885 16.9337 10.1212 16.53 10.38 16.2993C8.3775 16.0687 6.285 15.2728 6.285 11.7432C6.285 10.7397 6.63375 9.9092 7.20749 9.26326C7.1175 9.03257 6.8025 8.08674 7.2975 6.81794C7.2975 6.81794 8.05125 6.57571 9.77249 7.76377C10.4925 7.55615 11.2575 7.45234 12.0225 7.45234C12.7875 7.45234 13.5525 7.55615 14.2725 7.76377C15.9937 6.56418 16.7475 6.81794 16.7475 6.81794C17.2424 8.08674 16.9275 9.03257 16.8375 9.26326C17.4113 9.9092 17.76 10.7281 17.76 11.7432C17.76 15.2843 15.6563 16.0687 13.6537 16.2993C13.98 16.5877 14.2613 17.1414 14.2613 18.0065C14.2613 19.2407 14.25 20.2326 14.25 20.5441C14.25 20.7863 14.4188 21.0746 14.8688 20.9824C16.6554 20.364 18.2079 19.1866 19.3078 17.6162C20.4077 16.0457 20.9995 14.1611 21 12.2276C21 7.12937 16.9725 3 12 3Z"></path>
</svg>
</span>
            <div
              id="github-0b8cd2bfc8fbcb75a2913df72fab2c1f-full_name"
              class="m-0 font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-gray-300">
              AmitKumar-AK/sitecore-marketer-mcp-prompts
            </div>
          </div>

          <p id="github-0b8cd2bfc8fbcb75a2913df72fab2c1f-description" class="m-0 mt-2 text-md text-neutral-800 dark:text-gray-300">
            This repository provides ready-to-use <code>mcp.json</code> configuration and a collection of practical prompts for integrating Sitecore Marketer MCP with Visual Studio Code and GitHub Copilot. Use these resources to automate content management, marketing workflows, and personalization in Sitecore Headless, SitecoreAI and Experience Edge environments.
          </p>

          <div class="m-0 mt-2 flex items-center">
            <span class="mr-1 inline-block h-3 w-3 rounded-full language-dot" data-language="default"></span>
            <div class="m-0 mr-5 text-md text-neutral-800 dark:text-gray-300">
              null
            </div>

            <span class="text-md mr-1 text-neutral-800 dark:text-gray-300"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"/></svg></span>
            <div id="github-0b8cd2bfc8fbcb75a2913df72fab2c1f-stargazers" class="m-0 mr-5 text-md text-neutral-800 dark:text-gray-300">
              0
            </div>

            <span class="text-md mr-1 text-neutral-800 dark:text-gray-300"><svg height=1.2em class="hx:inline-block hx:align-middle" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M7 5C7 3.89543 7.89543 3 9 3C10.1046 3 11 3.89543 11 5C11 5.74028 10.5978 6.38663 10 6.73244V14.0396H11.7915C12.8961 14.0396 13.7915 13.1441 13.7915 12.0396V10.7838C13.1823 10.4411 12.7708 9.78837 12.7708 9.03955C12.7708 7.93498 13.6662 7.03955 14.7708 7.03955C15.8753 7.03955 16.7708 7.93498 16.7708 9.03955C16.7708 9.77123 16.3778 10.4111 15.7915 10.7598V12.0396C15.7915 14.2487 14.0006 16.0396 11.7915 16.0396H10V17.2676C10.5978 17.6134 11 18.2597 11 19C11 20.1046 10.1046 21 9 21C7.89543 21 7 20.1046 7 19C7 18.2597 7.4022 17.6134 8 17.2676V6.73244C7.4022 6.38663 7 5.74028 7 5Z" fill="#000000"></path> </g></svg></span>
            <div id="github-0b8cd2bfc8fbcb75a2913df72fab2c1f-forks" class="m-0 mr-5 text-md text-neutral-800 dark:text-gray-300">
              0
            </div>
          </div>
        </div>
      </div>
      
      
      <script
        async
        type="text/javascript"
        src="/js/fetch-repo.min.dc5533c50cefd50405344b235937142271f26229fe39cbee27fd4960e8bb897a0beebfad77a1091ca91cd0d1fb14e70fc37cc114dd9674fb2c32e0ab512ec8a4.js"
        integrity="sha512-3FUzxQzv1QQFNEsjWTcUInHyYin&#43;OcvuJ/1JYOi7iXoL7r&#43;td6EJHKkc0NH7FOcPw3zBFN2WdPssMuCrUS7IpA=="
        data-repo-url="https://api.github.com/repos/AmitKumar-AK/sitecore-marketer-mcp-prompts"
        data-repo-id="github-0b8cd2bfc8fbcb75a2913df72fab2c1f"></script>
    </a>
  </div>
<br/>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="creditreferences" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧾Credit/References</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>



<div class="table-wrapper">
<table class="style-table"><tbody><tr><td><a href="https://code.visualstudio.com/docs/copilot/customization/mcp-servers" target="_blank" rel="noopener">Use MCP servers in VS Code</a></td><td><a href="https://doc.sitecore.com/sai/en/users/sitecoreai/marketer-mcp-and-agent-api-overview.html" target="_blank" rel="noopener">Marketer MCP and Agent API overview</a></td><td><a href="https://doc.sitecore.com/sai/en/users/sitecoreai/marketer-mcp.html" target="_blank" rel="noopener">Marketer MCP</a></td></tr><tr><td><a href="https://modelcontextprotocol.io/docs/getting-started/intro" target="_blank" rel="noopener">What is the Model Context Protocol (MCP)?</a></td><td><a href="https://www.youtube.com/watch?v=VfZlglOWWZw" target="_blank" rel="noopener">Full Course (Lessons 1-11) MCP for Beginners</a></td><td><a href="https://github.com/punkpeye/awesome-mcp-servers" target="_blank" rel="noopener">Awesome MCP Servers</a></td></tr><tr><td><a href="https://www.amitk.net/blog/sitecore-headless-services-get-system-fields/" target="_blank" rel="noopener">Access Sitecore System Fields in GraphQL for Sitecore XP/XM 10.4 Headless SXA</a></td><td><a href="https://doc.sitecore.com/sai/en/users/sitecoreai/marketer-mcp-and-agent-api-overview.html" target="_blank" rel="noopener">Marketer MCP and Agent API overview</a></td><td><a href="https://doc.sitecore.com/sai/en/users/sitecoreai/integrating-sitecore-with-agentic-platforms.html" target="_blank" rel="noopener">Integrating Sitecore with agentic platforms</a></td></tr></tbody>
  
</table>
</div>
]]></content:encoded></item><item><title>How to Get System Fields in Sitecore GraphQL Query</title><link>https://www.amitk.net/blog/sitecore-headless-services-get-system-fields/</link><pubDate>Sun, 18 Jan 2026 00:00:00 +0000</pubDate><author>amit@amitk.net (Amit Kumar)</author><guid>https://www.amitk.net/blog/sitecore-headless-services-get-system-fields/</guid><media:content url="https://www.amitk.net/images/how-to-get-sitecore-created-updated-date-headless/access-sitecore-system-fields-headless-graphql.gif" medium="image" type="image/gif"/><description>
Learn how to access Sitecore system fields (__Created, __Updated) like Created and Updated dates in Sitecore Headless Service using Edge GraphQL / Layout Service endpoint.</description><content:encoded><![CDATA[







<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-introduction" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🏁 Introduction</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>When you migrate from a traditional Sitecore CMS to Sitecore Headless and Sitecore’s Composable DXP, and there may be business logic in Sitecore MVC which might be accessing the system fields (<span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">__Created</span>, <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">__Updated</span>) and you also need these system fields in <a href="https://amitkumarmca04.blogspot.com/2023/01/sitecore-experience-edge-graphql-queries.html" target="_blank" rel="noopener">GraphQL queries</a>
 for rendering in JSS components or Next.js applications. This article explains how to configure your setup to make these Sitecore standard fields (<strong>Created Date</strong>, <strong>Updated Date</strong>) available and how to query them correctly.</p>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-why-the-sitecoreai-patch-doesnt-work-on-104-xp-or-xm" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🔍 Why the SitecoreAI patch doesn’t work on 10.4 XP or XM?</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>The official Sitecore documentation Making fields from the <a href="https://doc.sitecore.com/sai/en/developers/sitecoreai/making-fields-from-the-standard-template-publishable.html" target="_blank" rel="noopener"><strong>standard template publishable</strong></a>
 suggests adding a <span class="dark:text-gray-300 font-semibold text-primary-color">patch configuration</span> to include system fields in GraphQL queries. However, this approach is designed for <a href="https://www.amitk.net/tags/sitecore-ai/" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text">SitecoreAI</span></a>
 (formerly <span class="dark:text-gray-300 font-semibold gradient-text-aqua">XM Cloud</span>) and <span class="dark:text-gray-300 font-semibold text-bug-color">does not work</span> for <span class="dark:text-gray-300 font-semibold text-bug-color">Sitecore XP/XM Headless Services</span>.</p>
<p>Here’s the patch configuration that fails in Sitecore XP or Sitecore XM Headless setups:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-xml" data-lang="xml"><span style="display:flex;"><span><span style="color:#6272a4">&lt;!-- Sitecore GraphQL/Experience Edge: This patch makes standard template fields (such as __Created, __Updated, __Owner) available for querying and publishing via the Experience Edge API. Enables access to system fields in headless and composable SitecoreAI solutions for enhanced content auditing, metadata, and integration scenarios. See Sitecore docs: Making fields from the standard template publishable. https://doc.sitecore.com/sai/en/developers/sitecoreai/making-fields-from-the-standard-template-publishable.html --&gt;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">&lt;configuration</span> <span style="color:#50fa7b">xmlns:patch=</span><span style="color:#f1fa8c">&#34;http://www.sitecore.net/xmlconfig/&#34;</span><span style="color:#ff79c6">&gt;</span>
</span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">&lt;sitecore&gt;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#ff79c6">&lt;api&gt;</span>
</span></span><span style="display:flex;"><span>      <span style="color:#ff79c6">&lt;GraphQL&gt;</span>
</span></span><span style="display:flex;"><span>        <span style="color:#ff79c6">&lt;defaults&gt;</span>
</span></span><span style="display:flex;"><span>          <span style="color:#ff79c6">&lt;standardFieldsResolver&gt;</span>
</span></span><span style="display:flex;"><span>            <span style="color:#ff79c6">&lt;supportedStandardFields&gt;</span>
</span></span><span style="display:flex;"><span>              <span style="color:#ff79c6">&lt;field</span> <span style="color:#50fa7b">name=</span><span style="color:#f1fa8c">&#34;__Owner&#34;</span> <span style="color:#ff79c6">/&gt;</span>
</span></span><span style="display:flex;"><span>              <span style="color:#ff79c6">&lt;field</span> <span style="color:#50fa7b">name=</span><span style="color:#f1fa8c">&#34;__Updated&#34;</span> <span style="color:#ff79c6">/&gt;</span>
</span></span><span style="display:flex;"><span>              <span style="color:#ff79c6">&lt;field</span> <span style="color:#50fa7b">name=</span><span style="color:#f1fa8c">&#34;__Created&#34;</span> <span style="color:#ff79c6">/&gt;</span>
</span></span><span style="display:flex;"><span>            <span style="color:#ff79c6">&lt;/supportedStandardFields&gt;</span>
</span></span><span style="display:flex;"><span>          <span style="color:#ff79c6">&lt;/standardFieldsResolver&gt;</span>
</span></span><span style="display:flex;"><span>        <span style="color:#ff79c6">&lt;/defaults&gt;</span>
</span></span><span style="display:flex;"><span>      <span style="color:#ff79c6">&lt;/GraphQL&gt;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#ff79c6">&lt;/api&gt;</span>
</span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">&lt;/sitecore&gt;</span>
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">&lt;/configuration&gt;</span></span></span></code></pre></div>
<p>Sitecore system fields, such as <strong>Created</strong> and <strong>Updated date</strong>, are typically <strong>excluded</strong> from <strong>GraphQL schemas</strong> in <strong>Sitecore Headless setups</strong> to <strong>reduce data exposure</strong>. While <span class="dark:text-gray-300 font-semibold gradient-text">SitecoreAI</span> (formerly <span class="dark:text-gray-300 font-semibold gradient-text-aqua">XM Cloud</span>) offers patches for Experience Edge, these <span class="dark:text-gray-300 font-semibold text-bug-color">do not work</span> for <span class="dark:text-gray-300 font-semibold gradient-text">Sitecore XP</span> or <span class="dark:text-gray-300 font-semibold gradient-text-aqua">Sitecore XM</span> <strong>10.4</strong> due to <strong>differences</strong> in <strong>GraphQL runtime configurations</strong>. Attempts to <strong>modify</strong> the schema using <strong>patches</strong> like <span class="dark:text-gray-300 font-semibold text-primary-color">&lt;supportedStandardFields&gt;</span> are <span class="dark:text-gray-300 font-semibold text-bug-color">ineffective</span> for <strong>Sitecore XP</strong> or <strong>Sitcore XM</strong> setups. <span class="dark:text-gray-300 font-semibold text-bug-color">As a result, queries for these system fields don't work because they aren't part of the default Edge provider schema.</span></p>


<p class="font-semibold text-xl  text-primary dark:text-gray-300">Output:</p>





















  
  
    
    <img
      title="Learn how to access Sitecore system fields (__Created, __Updated) in GraphQL for Headless SXA on Sitecore 10.4 using Experience Edge Preview endpoint."
      loading="lazy"
      decoding="async"
      src="https://www.amitk.net/images/how-to-get-sitecore-created-updated-date-headless/sitecore-headless-system-fields-configuration-sitecore-mvp-amit-kumar.png"
      alt="Accessing Sitecore System Fields in GraphQL for XP 10.4 Headless SXA"
      class="img justify-self-center  "
      width=""
      height="" />
  
  













<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-making-system-fields-available-in-edge-graphql-schema" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧱 Making system fields available in Edge GraphQL schema</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>To make <strong>Sitecore system fields</strong> available in the <span class="dark:text-gray-300 font-semibold gradient-text">Edge schema (Edge GraphQL endpoint)</span> for <strong>Sitecore XP</strong> or <strong>Sitecore XM</strong> implementation, you need to <span class="dark:text-gray-300 font-semibold text-bug-color">remove</span> the <strong>default exclusion rule</strong> that <strong>filters out fields</strong> starting with <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 font-extrabold bg-primary text-white">__</span>. This <span class="dark:text-gray-300 font-semibold text-abstract-color">adjustment</span> ensures <strong>system fields</strong> like <span class="dark:text-gray-300 font-semibold text-todo-color">Created</span> and <span class="dark:text-gray-300 font-semibold text-example-color">Updated</span> <strong>dates</strong> are <span class="dark:text-gray-300 font-semibold text-note-color">included</span> when <strong>generating the Edge schema for templates</strong>.</p>
<div class="callout warning">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" width="22" height="22"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73.0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898.0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"></path></svg><p>Important</p>
    </div>
    <div class="callout-body">
        <p>This only affects the <strong>Edge schema</strong> (<em><strong>On-prem</strong></em>), <strong>not</strong> the <strong>Sitecore Experience Edge (SaaS)</strong> endpoint.</p>
    </div>
</div>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-xml" data-lang="xml"><span style="display:flex;"><span><span style="color:#6272a4">&lt;!-- To include access Sitecore system fields (in Sitecore Layout Service or Sitecore Headless Services) like Created and Updated dates in the Edge GraphQL schema for Sitecore XP or Sitecore XM, remove the default exclusion rule for fields starting with “__”. This adjustment allows these fields to be part of the Edge schema, enhancing data accessibility for templates. Sitecore get system fields in Sitecore headless --&gt;</span>
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">&lt;configuration&gt;</span>
</span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">&lt;sitecore</span> <span style="color:#50fa7b">xmlns:patch=</span><span style="color:#f1fa8c">&#34;http://www.sitecore.net/xmlconfig/&#34;</span> <span style="color:#50fa7b">xmlns:role=</span><span style="color:#f1fa8c">&#34;http://www.sitecore.net/xmlconfig/role/&#34;</span><span style="color:#ff79c6">&gt;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#ff79c6">&lt;api&gt;</span>
</span></span><span style="display:flex;"><span>      <span style="color:#ff79c6">&lt;GraphQL&gt;</span>
</span></span><span style="display:flex;"><span>        <span style="color:#ff79c6">&lt;defaults&gt;</span>
</span></span><span style="display:flex;"><span>          <span style="color:#ff79c6">&lt;content&gt;</span>
</span></span><span style="display:flex;"><span>            <span style="color:#ff79c6">&lt;schemaProviders&gt;</span>
</span></span><span style="display:flex;"><span>              <span style="color:#ff79c6">&lt;edgeContent&gt;</span>
</span></span><span style="display:flex;"><span>                <span style="color:#ff79c6">&lt;templates&gt;</span>
</span></span><span style="display:flex;"><span>                  <span style="color:#ff79c6">&lt;fieldFilter&gt;</span>
</span></span><span style="display:flex;"><span>                    <span style="color:#ff79c6">&lt;exclusions</span> <span style="color:#50fa7b">hint=</span><span style="color:#f1fa8c">&#34;raw:AddFilter&#34;</span><span style="color:#ff79c6">&gt;</span>
</span></span><span style="display:flex;"><span>                      <span style="color:#ff79c6">&lt;exclude</span> <span style="color:#50fa7b">name=</span><span style="color:#f1fa8c">&#34;__*&#34;</span><span style="color:#ff79c6">&gt;</span>
</span></span><span style="display:flex;"><span>                        <span style="color:#ff79c6">&lt;patch:delete/&gt;</span>
</span></span><span style="display:flex;"><span>                      <span style="color:#ff79c6">&lt;/exclude&gt;</span>
</span></span><span style="display:flex;"><span>                    <span style="color:#ff79c6">&lt;/exclusions&gt;</span>
</span></span><span style="display:flex;"><span>                  <span style="color:#ff79c6">&lt;/fieldFilter&gt;</span>
</span></span><span style="display:flex;"><span>                <span style="color:#ff79c6">&lt;/templates&gt;</span>
</span></span><span style="display:flex;"><span>              <span style="color:#ff79c6">&lt;/edgeContent&gt;</span>
</span></span><span style="display:flex;"><span>            <span style="color:#ff79c6">&lt;/schemaProviders&gt;</span>
</span></span><span style="display:flex;"><span>          <span style="color:#ff79c6">&lt;/content&gt;</span>
</span></span><span style="display:flex;"><span>        <span style="color:#ff79c6">&lt;/defaults&gt;</span>
</span></span><span style="display:flex;"><span>      <span style="color:#ff79c6">&lt;/GraphQL&gt;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#ff79c6">&lt;/api&gt;</span>
</span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">&lt;/sitecore&gt;</span>
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">&lt;/configuration&gt;</span></span></span></code></pre></div>
<div class="callout tip">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"/></svg><p>Important</p>
    </div>
    <div class="callout-body">
        <p>This configuration is essential for developers working with <a href="https://amitkumarmca04.blogspot.com/2023/07/configure-sitecore-headless-sxa-next-js-multi-site-app.html" target="_blank" rel="noopener">Sitecore Headless Services</a>
 and <strong>JSS</strong> to <strong>access metadata</strong> such as <strong>system fields</strong> (<em><strong>Created Date</strong></em>, <em><strong>Updated Date</strong></em>).</p>
    </div>
</div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-querying-system-fields-on-template-type-not-field" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧬 Querying system fields on template type (not field())</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>Initially, your query looked like this:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-json" data-lang="json"><span style="display:flex;"><span>    query GetItemSystemFields( $contextItem: String!) {
</span></span><span style="display:flex;"><span>      #---- Retrieve Sitecore system fields by using field(name:<span style="color:#ff79c6">&#34;__Created&#34;</span>) directly on the Sitecore item.
</span></span><span style="display:flex;"><span>          layout(site: <span style="color:#f1fa8c">&#34;Services&#34;</span>,routePath: $contextItem, language:<span style="color:#ff79c6">&#34;en&#34;</span>){
</span></span><span style="display:flex;"><span>               item
</span></span><span style="display:flex;"><span>                  {
</span></span><span style="display:flex;"><span>                    created: field(name:<span style="color:#ff79c6">&#34;__Created&#34;</span>) {
</span></span><span style="display:flex;"><span>                      value
</span></span><span style="display:flex;"><span>                      jsonValue
</span></span><span style="display:flex;"><span>                    }
</span></span><span style="display:flex;"><span>                    updated: field(name:<span style="color:#f1fa8c">&#34;__Updated&#34;</span>) {
</span></span><span style="display:flex;"><span>                      value
</span></span><span style="display:flex;"><span>                      jsonValue
</span></span><span style="display:flex;"><span>                    }
</span></span><span style="display:flex;"><span>					rendered
</span></span><span style="display:flex;"><span>                  }
</span></span><span style="display:flex;"><span>              }
</span></span><span style="display:flex;"><span>            }
</span></span><span style="display:flex;"><span>            
</span></span><span style="display:flex;"><span># Query Variables:
</span></span><span style="display:flex;"><span># {<span style="color:#ff79c6">&#34;contextItem&#34;</span> :<span style="color:#f1fa8c">&#34;/insights/achieving-work-life-balance&#34;</span>}</span></span></code></pre></div>
<p>When querying these fields in <strong>GraphQL</strong>, you need a <strong>different approach</strong>. Instead of <strong>using</strong> <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">field(name:"__Created")</span>, <strong>query</strong> them <strong>directly</strong> at the <span class="dark:text-gray-300 font-semibold gradient-text">template</span> level.</p>
<div class="callout todo">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg><p>Important</p>
    </div>
    <div class="callout-body">
        <p>This <strong>adjustment only works</strong> for the <strong>Edge schema (Edge GraphQL endpoint)</strong> for <strong>Sitecore XP</strong> or <strong>Sitecore XM</strong> implementation - it <strong>won’t affect</strong> the <strong>Sitecore Experience Edge (SaaS)</strong> endpoint.</p>
    </div>
</div>
<p>On <strong>Sitecore 10.4 XP</strong> or <strong>Sitecore 10.4 XM</strong> <strong><em>Edge GraphQL</em></strong>, the usual pattern <strong>fails</strong> because <strong>standard fields</strong> aren’t exposed through the <strong>generic field()</strong> selector, even after you <strong>remove</strong> the <strong>field filter</strong>. Instead, these <strong>fields</strong> become <strong>strongly typed properties</strong> on the <strong>template</strong>. To access them, <strong>cast</strong> the <strong>item</strong> to its <strong>template</strong> and <strong>read</strong> the <strong>fields directly</strong>.</p>
<p>A working pattern is:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-json" data-lang="json"><span style="display:flex;"><span>        query GetItemSystemFields( $contextItem: String!) {
</span></span><span style="display:flex;"><span>      #---- Access Sitecore system fields by using field(name:<span style="color:#ff79c6">&#34;__Created&#34;</span>) directly at the template level referenced by the Sitecore item.
</span></span><span style="display:flex;"><span>          layout(site: <span style="color:#f1fa8c">&#34;Services&#34;</span>,routePath: $contextItem, language:<span style="color:#ff79c6">&#34;en&#34;</span>){
</span></span><span style="display:flex;"><span>               item
</span></span><span style="display:flex;"><span>                  {
</span></span><span style="display:flex;"><span>                    ... on BlogPost
</span></span><span style="display:flex;"><span>                    {
</span></span><span style="display:flex;"><span>                     blog_created: field(name:<span style="color:#ff79c6">&#34;__Created&#34;</span>) {
</span></span><span style="display:flex;"><span>                        jsonValue
</span></span><span style="display:flex;"><span>                      }
</span></span><span style="display:flex;"><span>                      blog_updated: field(name:<span style="color:#f1fa8c">&#34;__Updated&#34;</span>) {
</span></span><span style="display:flex;"><span>                        jsonValue
</span></span><span style="display:flex;"><span>                      }                      
</span></span><span style="display:flex;"><span>                    }                    
</span></span><span style="display:flex;"><span>					rendered
</span></span><span style="display:flex;"><span>                  }
</span></span><span style="display:flex;"><span>              }
</span></span><span style="display:flex;"><span>            }
</span></span><span style="display:flex;"><span>            
</span></span><span style="display:flex;"><span># Query Variables:
</span></span><span style="display:flex;"><span># {<span style="color:#ff79c6">&#34;contextItem&#34;</span> :<span style="color:#f1fa8c">&#34;/insights/achieving-work-life-balance&#34;</span>}</span></span></code></pre></div>
<p>The <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">jsonValue</span> returns the field in a format that works with JSS field helpers, including DateField rendering in Next.js apps. This method aligns with all Sitecore JSS types and how to use them, offering typed access similar to custom fields.</p>


<p class="font-semibold text-xl  text-primary dark:text-gray-300">Output:</p>





















  
  
    
    <img
      title="Sitecore Headless Services: Getting Created and Updated Dates from Experience Edge"
      loading="lazy"
      decoding="async"
      src="https://www.amitk.net/images/how-to-get-sitecore-created-updated-date-headless/sitecore-headless-services-graphql-get-system-fields-Sitecore-MVP-Amit-Kumar.png"
      alt="How to Access Sitecore System Fields"
      class="img justify-self-center  "
      width=""
      height="" />
  
  







<p class="font-semibold text-xl  text-primary dark:text-gray-300">This approach solves common questions like:</p>
<ul>
<li>How to get the Sitecore field updated date instead of item updated date?</li>
<li>How to get the modified date and created date of a Sitecore item?</li>
<li>How can we get Sitecore field type with GraphQL query?</li>
</ul>
<p><strong>Enjoyed this guide? Give it a ⭐ and show your support!</strong></p>
<div class="callout tip">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M18.364 5.636l-3.536 3.536m0 5.656l3.536 3.536M9.172 9.172L5.636 5.636m3.536 9.192l-3.536 3.536M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-5 0a4 4 0 11-8 0 4 4 0 018 0z"/></svg><p>Support</p>
    </div>
    <div class="callout-body">
        <p><strong>If you enjoy this content, consider <a href="https://www.youtube.com/@AmitKumar-Info?sub_confirmation=1" target="_blank" rel="noopener">subscribing</a>
 📰 for more updates and insights. Your engagement is very important to me and helps me keep providing valuable resources! 🌟</strong></p>
    </div>
</div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-conclusion" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧭 Conclusion</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>Accessing system fields in Sitecore 10.4 Headless SXA with Edge GraphQL involves knowing the schema limits. Using the Sitecore Patch Config for Edge GraphQL schema mentioned above, you can access created or modified dates system fields.</p>
<p>This approach keeps your headless project efficient while working within platform constraints. If you are migrating to <a href="https://www.amitk.net/tags/headless-cms/" target="_blank" rel="noopener"><span class="dark:text-gray-300 font-semibold gradient-text">SitecoreAI</span></a>
 (formerly <span class="dark:text-gray-300 font-semibold gradient-text-aqua">XM Cloud</span>), review the SitecoreAI-specific configurations for better support.</p>
<div class="callout success">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M8.684 13.342C8.886 12.938 9 12.482 9 12c0-.482-.114-.938-.316-1.342m0 2.684a3 3 0 110-2.684m0 2.684l6.632 3.316m-6.632-6l6.632-3.316m0 0a3 3 0 105.367-2.684 3 3 0 00-5.367 2.684zm0 9.316a3 3 0 105.368 2.684 3 3 0 00-5.368-2.684z"/></svg><p>Share Your Experience</p>
    </div>
    <div class="callout-body">
        <p>For complete setup details and code examples, check the <strong>src/platform/App_Config/Include/z.Contoso.Project.Sitecore.XA.JSS.StandardFields.config</strong> file in the  <a href="https://github.com/AmitKumar-AK/Sitecore-XM0-Topology/tree/feature/enable-system-fields-for-edge-graphql" target="_blank" rel="noopener">feature/enable-system-fields-for-edge-graphql</a>
 branch. Access the full GitHub repository below 👇 and don’t forget to share your feedback.
<br/><br/>
<strong><em>Deploy the patch configuration on both Sitecore CM and CD servers to enable access to Sitecore System Fields in Sitecore XP or Sitecore XM Edge GraphQL.</em></strong></p>
    </div>
</div>
<div class="github-card-wrapper">
    <a id="github-686008473fea0db783dbc48f7bfc8224" target="_blank" href="https://github.com/AmitKumar-AK/Sitecore-XM0-Topology" class="cursor-pointer">
      <div
        class="w-full md:w-auto p-0 m-0 border border-neutral-200 dark:border-neutral-700 border rounded-md shadow-2xl"><div class="w-full nozoom">
            <img
              src="https://opengraph.githubassets.com/0/AmitKumar-AK/Sitecore-XM0-Topology"
              alt="GitHub Repository Thumbnail"
              class="nozoom mt-0 mb-0 w-full h-full object-cover">
          </div><div class="w-full md:w-auto pt-3 p-5">
          <div class="flex items-center">
            <span class="text-2xl text-neutral-800 dark:text-gray-300 me-2"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="currentColor" viewBox="3 3 18 18">
  <path d="M12 3C7.0275 3 3 7.12937 3 12.2276C3 16.3109 5.57625 19.7597 9.15374 20.9824C9.60374 21.0631 9.77249 20.7863 9.77249 20.5441C9.77249 20.3249 9.76125 19.5982 9.76125 18.8254C7.5 19.2522 6.915 18.2602 6.735 17.7412C6.63375 17.4759 6.19499 16.6569 5.8125 16.4378C5.4975 16.2647 5.0475 15.838 5.80124 15.8264C6.51 15.8149 7.01625 16.4954 7.18499 16.7723C7.99499 18.1679 9.28875 17.7758 9.80625 17.5335C9.885 16.9337 10.1212 16.53 10.38 16.2993C8.3775 16.0687 6.285 15.2728 6.285 11.7432C6.285 10.7397 6.63375 9.9092 7.20749 9.26326C7.1175 9.03257 6.8025 8.08674 7.2975 6.81794C7.2975 6.81794 8.05125 6.57571 9.77249 7.76377C10.4925 7.55615 11.2575 7.45234 12.0225 7.45234C12.7875 7.45234 13.5525 7.55615 14.2725 7.76377C15.9937 6.56418 16.7475 6.81794 16.7475 6.81794C17.2424 8.08674 16.9275 9.03257 16.8375 9.26326C17.4113 9.9092 17.76 10.7281 17.76 11.7432C17.76 15.2843 15.6563 16.0687 13.6537 16.2993C13.98 16.5877 14.2613 17.1414 14.2613 18.0065C14.2613 19.2407 14.25 20.2326 14.25 20.5441C14.25 20.7863 14.4188 21.0746 14.8688 20.9824C16.6554 20.364 18.2079 19.1866 19.3078 17.6162C20.4077 16.0457 20.9995 14.1611 21 12.2276C21 7.12937 16.9725 3 12 3Z"></path>
</svg>
</span>
            <div
              id="github-686008473fea0db783dbc48f7bfc8224-full_name"
              class="m-0 font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-gray-300">
              AmitKumar-AK/Sitecore-XM0-Topology
            </div>
          </div>

          <p id="github-686008473fea0db783dbc48f7bfc8224-description" class="m-0 mt-2 text-md text-neutral-800 dark:text-gray-300">
            This repo will provide Sitecore Container images for XP0, XP1, XM0 and XM1 topologies. With Sitecore XM0 Topology Container Images, you can encapsulate the entire Sitecore XM environment, including its dependencies, configurations, and code, into a lightweight, isolated container.
          </p>

          <div class="m-0 mt-2 flex items-center">
            <span class="mr-1 inline-block h-3 w-3 rounded-full language-dot" data-language="TypeScript"></span>
            <div class="m-0 mr-5 text-md text-neutral-800 dark:text-gray-300">
              TypeScript
            </div>

            <span class="text-md mr-1 text-neutral-800 dark:text-gray-300"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"/></svg></span>
            <div id="github-686008473fea0db783dbc48f7bfc8224-stargazers" class="m-0 mr-5 text-md text-neutral-800 dark:text-gray-300">
              0
            </div>

            <span class="text-md mr-1 text-neutral-800 dark:text-gray-300"><svg height=1.2em class="hx:inline-block hx:align-middle" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M7 5C7 3.89543 7.89543 3 9 3C10.1046 3 11 3.89543 11 5C11 5.74028 10.5978 6.38663 10 6.73244V14.0396H11.7915C12.8961 14.0396 13.7915 13.1441 13.7915 12.0396V10.7838C13.1823 10.4411 12.7708 9.78837 12.7708 9.03955C12.7708 7.93498 13.6662 7.03955 14.7708 7.03955C15.8753 7.03955 16.7708 7.93498 16.7708 9.03955C16.7708 9.77123 16.3778 10.4111 15.7915 10.7598V12.0396C15.7915 14.2487 14.0006 16.0396 11.7915 16.0396H10V17.2676C10.5978 17.6134 11 18.2597 11 19C11 20.1046 10.1046 21 9 21C7.89543 21 7 20.1046 7 19C7 18.2597 7.4022 17.6134 8 17.2676V6.73244C7.4022 6.38663 7 5.74028 7 5Z" fill="#000000"></path> </g></svg></span>
            <div id="github-686008473fea0db783dbc48f7bfc8224-forks" class="m-0 mr-5 text-md text-neutral-800 dark:text-gray-300">
              0
            </div>
          </div>
        </div>
      </div>
      
      
      <script
        async
        type="text/javascript"
        src="/js/fetch-repo.min.dc5533c50cefd50405344b235937142271f26229fe39cbee27fd4960e8bb897a0beebfad77a1091ca91cd0d1fb14e70fc37cc114dd9674fb2c32e0ab512ec8a4.js"
        integrity="sha512-3FUzxQzv1QQFNEsjWTcUInHyYin&#43;OcvuJ/1JYOi7iXoL7r&#43;td6EJHKkc0NH7FOcPw3zBFN2WdPssMuCrUS7IpA=="
        data-repo-url="https://api.github.com/repos/AmitKumar-AK/Sitecore-XM0-Topology"
        data-repo-id="github-686008473fea0db783dbc48f7bfc8224"></script>
    </a>
  </div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="creditreferences" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧾Credit/References</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>



<div class="table-wrapper">
<table class="style-table"><tbody><tr><td>A big thank you to the Sitecore Support Team for their invaluable guidance on this solution.</td><td><a href="https://doc.sitecore.com/sai/en/developers/sitecoreai/making-fields-from-the-standard-template-publishable.html" target="_blank" rel="noopener">Making fields from the standard template publishable </a></td><td><a href="https://ericastockwellalpert.wordpress.com/tag/standard-fields/" target="_blank" rel="noopener">Unicorn code generation, standard fields, and GlassMapper performance issues</a></td></tr><tr><td><a href="https://sitecore.stackexchange.com/questions/37762/component-graphql-query-field-is-ignored-in-experience-editor" target="_blank" rel="noopener">Component GraphQL Query&quot; field is ignored in Experience Editor </a></td><td><a href="https://doc.sitecore.com/xp/en/developers/hd/latest/sitecore-headless-development/the-experience-edge-schema.html" target="_blank" rel="noopener">The Experience Edge schema</a></td><td><a href="https://doc.sitecore.com/xp/en/developers/hd/latest/sitecore-headless-development/publishing-to-experience-edge.html" target="_blank" rel="noopener">Publishing to Experience Edge</a></td></tr><tr><td><a href="https://doc.sitecore.com/xp/en/developers/hd/latest/sitecore-headless-development/sitecore-experience-edge-for-xm.html" target="_blank" rel="noopener">Sitecore Experience Edge for XM</a></td><td><a href="https://sitecore.stackexchange.com/questions/30743/extend-graphql-schema-for-custom-field" target="_blank" rel="noopener">Extend GraphQL schema for custom field</a></td><td><a href="https://www.amitk.net/blog/sitecoreai-contentsdk-component-testing/" target="_blank" rel="noopener">Content SDK Unit Testing</a></td></tr></tbody>
  
</table>
</div>
]]></content:encoded></item><item><title>Implementing SitecoreAI Wildcard Pages with the Next.js App Router and Content SDK</title><link>https://www.amitk.net/blog/nextjs-app-router-content-sdk-sitecore-wildcard-pages/</link><pubDate>Wed, 31 Dec 2025 00:00:00 +0000</pubDate><author>amit@amitk.net (Amit Kumar)</author><guid>https://www.amitk.net/blog/nextjs-app-router-content-sdk-sitecore-wildcard-pages/</guid><media:content url="https://www.amitk.net/images/sitecore-nextjs-app-router-content-sdk-routing/sitecoreai-content-sdk-app-router-catch-all-path.gif" medium="image" type="image/gif"/><description>
Resolve SitecoreAI wildcard URLs with Next.js App Router using [[...path]] route to load external API data for dynamic breadcrumbs and SEO‑friendly pages.</description><content:encoded><![CDATA[







<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-use-case-background" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">⚔️ Use case Background</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>While working on a <a href="https://www.amitk.net/blog/sitecoreai-contentsdk-component-testing/" target="_blank" rel="noopener">SitecoreAI Content SDK</a>
 project with <strong>Next.js</strong>, I received a requirement that We needed to <strong>display thousands of records</strong> - specifically <strong>blog posts</strong> and <strong>product details</strong> (dynamic wildcard pages) - stored in an <strong>external system</strong> (a Headless Commerce engine and a PIM). The <strong>goal</strong> was to support <strong>dynamic wildcard pages</strong> that behave like nested <strong>blog slugs</strong> while still resolving each <strong>request</strong> to a <strong>real item</strong> in the Sitecore content tree.</p>
<p>The business wanted:</p>
<ul>
<li><span class="dark:text-gray-300 font-semibold text-bug-color">Dynamic pages generated from an external API.</span></li>
<li><span class="dark:text-gray-300 font-semibold text-bug-color">Nested URLs similar to a blog slug structure.</span></li>
<li><span class="dark:text-gray-300 font-semibold text-bug-color">No manual creation of Sitecore items for every page.</span></li>
<li><span class="dark:text-gray-300 font-semibold text-bug-color">Dynamic breadcrumbs and page titles.</span></li>
<li><span class="dark:text-gray-300 font-semibold text-bug-color">A scalable solution for future integrations like PIM or Headless Commerce.</span></li>
</ul>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-what-are-wildcard-pages-in-sitecore-ai-sitecore-xm-cloud" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧠 What Are Wildcard Pages in Sitecore AI (Sitecore XM Cloud)?</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>Before starting the implementation, I reviewed Sitecore&rsquo;s documentation on <a href="https://developers.sitecore.com/learn/accelerate/xm-cloud/implementation/information-architecture/wildcard-pages" target="_blank" rel="noopener"><strong>wildcard pages</strong></a>
.</p>
<div class="callout note">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" width="22" height="22"><path stroke-linecap="round" stroke-linejoin="round" d="m11.25 11.25.041-.02a.75.75.0 011.063.852l-.708 2.836a.75.75.0 001.063.853l.041-.021M21 12A9 9 0 113 12a9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"></path></svg><p>SitecoreAI Wildcard Pages</p>
    </div>
    <div class="callout-body">
        <p>Wildcard items allow you to create flexible, dynamic URL structures in <strong>SitecoreAI (XM Cloud)</strong> by placing a <strong>wildcard item (*)</strong> in the content tree, enabling handling of all requests matching that path pattern.</p>
    </div>
</div>


<p class="font-semibold text-xl  text-primary dark:text-gray-300">For example:</p>
<ul>
<li>To manage URLs like <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">/blogs/my-first-post</span> or <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">/blogs/category/subcategory/article-slug</span>, create a wildcard item under <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">/blogs</span>.</li>
<li>The wildcard item uses a shared layout and components, but the actual content is determined dynamically at runtime based on the URL slug.</li>
</ul>


<p class="font-semibold text-xl  text-primary dark:text-gray-300">Benefits include:</p>
<ul>
<li>Less clutter in the content tree - no need to manually create pages for each external record.</li>
<li>Easy integration with external APIs for real-time or cached data.</li>
<li>Support for nested routes, like multi-level slugs such as blog categories.</li>
<li>Dynamic updates to metadata, like page titles and breadcrumbs, for better SEO.</li>
</ul>
<p>This is particularly useful for pulling data from external sources such as PIM systems, e-commerce catalogs, or custom APIs, enabling truly headless experiences.</p>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-implementation-highlights" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">⚙️ Implementation Highlights</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<h3 id="1-dynamic-wildcard-routing"><strong>1. Dynamic Wildcard Routing</strong></h3>
<p><span class="dark:text-gray-300 font-semibold text-primary-color">File:</span> <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">src/app/[site]/[locale]/[[...path]]/page.tsx</span></p>
<p><span class="dark:text-gray-300 font-semibold text-primary-color">Details:</span>
This project uses <a href="https://nextjs.org/docs/app" target="_blank" rel="noopener">Next.js App Router</a>
 using <a href="https://doc.sitecore.com/sai/en/developers/content-sdk/getting-started-with-next-js-app-router-using-content-sdk.html" target="_blank" rel="noopener">Content SDK</a>
 which handles all routes with the help of <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">src/app/[site]/[locale]/[[...path]]/page.tsx</span> and it acts a <strong>catch‑all App Router</strong> entry.</p>
<div class="callout tip">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"/></svg><p>Next.js App Router using Content SDK</p>
    </div>
    <div class="callout-body">
        <p>The <a href="https://developers.sitecore.com/changelog/sitecoreai/30102025/content-sdk-v1.2-%E2%80%94-modernize-routing-architecture-with-app-router-support" target="_blank" rel="noopener">Sitecore Content SDK App Router</a>
 handles every <strong>Sitecore‑driven URL</strong> and <strong>Dynamic URL</strong> (dynamic segments), no matter how <strong>deep the path is</strong>. The route uses <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">params.site</span>, <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">params.locale</span>, and <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">params.path</span> to <strong>resolve</strong> the correct Sitecore item through the Content SDK route resolver and then <strong>enriches</strong> the page with any required <strong>external data</strong> (for example from PIM, headless commerce, or custom APIs using custom rendering).</p>
    </div>
</div>
<p>This <strong>single dynamic route</strong> powers <strong>all wildcard</strong> and <strong>nested blog‑style URLs without duplicating static page files</strong>. At the same time, it keeps the routing logic consistent so that visual editing, server‑side rendering, and analytics all see the same canonical path. This forms the <strong>foundation</strong> for a <strong>flexible</strong>, <strong>wildcard‑aware routing model</strong> in the <strong>App Router</strong>.​</p>


<p class="font-semibold text-xl  text-primary dark:text-gray-300">This approach ensures:</p>
<ul>
<li>No hardcoded routes</li>
<li>Unlimited nesting</li>
<li>Clean SEO-friendly URLs</li>
</ul>
<h3 id="2-dynamic-context-provider"><strong>2. Dynamic Context Provider</strong></h3>
<p><span class="dark:text-gray-300 font-semibold text-primary-color">File:</span> <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">src/contexts/DynamicParamsContext.tsx</span>, <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">src/contexts/ProvidersWithParams.tsx</span></p>
<p><span class="dark:text-gray-300 font-semibold text-primary-color">Details:</span>
Passes <strong>route params</strong>, <strong>slugs</strong>, and <strong>path info</strong> to <strong>all components</strong> via <strong>React context</strong>. This makes <strong>dynamic data</strong> (like blog slugs or path arrays) <strong>available</strong> throughout the app for rendering <strong>breadcrumbs</strong>, <strong>page titles</strong>, and more.</p>


<p class="font-semibold text-xl  text-primary dark:text-gray-300">I introduced a context provider that:</p>
<ul>
<li>Extracts route parameters at runtime</li>
<li>Makes the full slug available across components</li>
<li>Keeps page components clean and reusable</li>
</ul>
<p>This <strong>context</strong> becomes the <strong>single source of truth</strong> for:</p>
<ul>
<li>API queries</li>
<li>Breadcrumb construction</li>
<li>Page title resolution</li>
</ul>
<h4 id="-dynamicparamscontexttsx">🔗 <a href="https://github.com/AmitKumar-AK/xmcloud-starter-js/blob/09ae40b64b1c82dc97a3f78e29be91acdfa1a942/examples/basic-nextjs/src/contexts/DynamicParamsContext.tsx" target="_blank" rel="noopener">DynamicParamsContext.tsx</a>
</h4>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-typescript" data-lang="typescript"><span style="display:flex;"><span><span style="color:#6272a4">// This context provides dynamic route parameters (id, slug, path, etc.)
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// to all components in the Next.js App Router using Sitecore Content SDK.
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// It enables features like dynamic breadcrumbs, page titles, and external API queries
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// for deeply nested and wildcard routes, without needing multiple static files.
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// Used in conjunction with ProvidersWithParams to inject route data from [[...path]] catch-all routes.
</span></span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f1fa8c">&#39;use client&#39;</span>;
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">import</span> { createContext, useContext } <span style="color:#ff79c6">from</span> <span style="color:#f1fa8c">&#39;react&#39;</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#6272a4">// Type for dynamic route parameters extracted from Next.js App Router
</span></span></span><span style="display:flex;"><span><span style="color:#ff79c6">export</span> <span style="color:#ff79c6">interface</span> DynamicParams {
</span></span><span style="display:flex;"><span>  id?: <span style="color:#8be9fd">string</span>;        <span style="color:#6272a4">// e.g. /blog/123 → id = &#39;123&#39;
</span></span></span><span style="display:flex;"><span>  someslug?: <span style="color:#8be9fd">string</span>;  <span style="color:#6272a4">// e.g. /blog/123/slug → someslug = &#39;slug&#39;
</span></span></span><span style="display:flex;"><span>  path?: <span style="color:#8be9fd">string</span>[];    <span style="color:#6272a4">// Full path segments from [[...path]]
</span></span></span><span style="display:flex;"><span>  blogSlug?: <span style="color:#8be9fd">string</span>;  <span style="color:#6272a4">// e.g. /blogs/[slug] → blogSlug = slug
</span></span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#6272a4">// Context for sharing dynamic params across the app
</span></span></span><span style="display:flex;"><span><span style="color:#ff79c6">export</span> <span style="color:#ff79c6">const</span> DynamicParamsContext <span style="color:#ff79c6">=</span> createContext&lt;<span style="color:#ff79c6">DynamicParams</span>&gt;({});
</span></span><span style="display:flex;"><span><span style="color:#6272a4">// Hook for consuming dynamic params in any component
</span></span></span><span style="display:flex;"><span><span style="color:#ff79c6">export</span> <span style="color:#ff79c6">const</span> useDynamicParams <span style="color:#ff79c6">=</span> () <span style="color:#ff79c6">=&gt;</span> useContext(DynamicParamsContext);</span></span></code></pre></div>
<h4 id="-providerswithparamstsx">🔗 <a href="https://github.com/AmitKumar-AK/xmcloud-starter-js/blob/09ae40b64b1c82dc97a3f78e29be91acdfa1a942/examples/basic-nextjs/src/contexts/ProvidersWithParams.tsx" target="_blank" rel="noopener">ProvidersWithParams.tsx</a>
</h4>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-typescript" data-lang="typescript"><span style="display:flex;"><span><span style="color:#6272a4">// This client component wraps the app in DynamicParamsContext,
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// providing dynamic route parameters to all child components.
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// Used in Next.js App Router with Sitecore Content SDK to enable
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// dynamic breadcrumbs, page titles, and API queries for wildcard/nested routes.
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// Receives route params from [[...path]] and passes them via context.
</span></span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f1fa8c">&#39;use client&#39;</span>;
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">import</span> { DynamicParamsContext } <span style="color:#ff79c6">from</span> <span style="color:#f1fa8c">&#39;src/contexts/DynamicParamsContext&#39;</span>;
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">import</span> Providers <span style="color:#ff79c6">from</span> <span style="color:#f1fa8c">&#39;src/Providers&#39;</span>;
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">import</span> Layout <span style="color:#ff79c6">from</span> <span style="color:#f1fa8c">&#39;src/Layout&#39;</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">export</span> <span style="color:#ff79c6">default</span> <span style="color:#8be9fd;font-style:italic">function</span> ProvidersWithParams({ id, someslug, path, blogSlug, page, componentProps }) {
</span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">return</span> (
</span></span><span style="display:flex;"><span>    &lt;<span style="color:#ff79c6">DynamicParamsContext.Provider</span> <span style="color:#50fa7b">value</span><span style="color:#ff79c6">=</span>{{ id, someslug, path, blogSlug }}&gt;
</span></span><span style="display:flex;"><span>      &lt;<span style="color:#ff79c6">Providers</span> <span style="color:#50fa7b">page</span><span style="color:#ff79c6">=</span>{page} <span style="color:#50fa7b">componentProps</span><span style="color:#ff79c6">=</span>{componentProps}&gt;
</span></span><span style="display:flex;"><span>        &lt;<span style="color:#ff79c6">Layout</span> <span style="color:#50fa7b">page</span><span style="color:#ff79c6">=</span>{page} /&gt;
</span></span><span style="display:flex;"><span>      &lt;/<span style="color:#ff79c6">Providers</span>&gt;
</span></span><span style="display:flex;"><span>    &lt;/<span style="color:#ff79c6">DynamicParamsContext.Provider</span>&gt;
</span></span><span style="display:flex;"><span>  );
</span></span><span style="display:flex;"><span>}</span></span></code></pre></div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h3 id="3-dynamic-breadcrumbs" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">3. Dynamic Breadcrumbs</h3>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p><span class="dark:text-gray-300 font-semibold text-primary-color">File:</span> <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">src/components/breadcrumbs/Breadcrumb.tsx</span></p>
<p><span class="dark:text-gray-300 font-semibold text-primary-color">Details:</span>
<strong>Breadcrumbs</strong> are <strong>generated</strong> based on the <strong>current route</strong> and <strong>content</strong>. Breadcrumbs are <strong>rendered</strong> for <strong>all nested routes</strong> using the <strong>path array</strong> from <strong>context</strong>.</p>


<p class="font-semibold text-xl  text-primary dark:text-gray-300">Using the slug array:</p>
<ul>
<li>Each <strong>segment</strong> is <strong>converted</strong> into a <strong>breadcrumb node</strong></li>
<li><strong>Labels</strong> are <strong>resolved dynamically</strong> (API response or formatted slug)</li>
<li><strong>Links</strong> are generated progressively based on <strong>hierarchy</strong></li>
</ul>
<p>This ensures <strong>breadcrumbs</strong> remain:</p>
<ul>
<li>SEO-friendly</li>
<li>Accurate</li>
<li>Fully dynamic</li>
</ul>
<h4 id="-breadcrumbtsx">🔗 <a href="https://github.com/AmitKumar-AK/xmcloud-starter-js/blob/09ae40b64b1c82dc97a3f78e29be91acdfa1a942/examples/basic-nextjs/src/components/breadcrumbs/Breadcrumb.tsx" target="_blank" rel="noopener">Breadcrumb.tsx</a>
</h4>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-typescript" data-lang="typescript"><span style="display:flex;"><span><span style="color:#6272a4">// Breadcrumb component for Next.js App Router using Sitecore Content SDK.
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// Dynamically renders breadcrumbs for any nested/wildcard route using the path array from context.
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// Enables SEO-friendly navigation and reflects the current content hierarchy without static routes.
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// Consumes dynamic params from DynamicParamsContext, which is populated by ProvidersWithParams.
</span></span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">import</span> React <span style="color:#ff79c6">from</span> <span style="color:#f1fa8c">&#39;react&#39;</span>;
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">import</span> { useDynamicParams } <span style="color:#ff79c6">from</span> <span style="color:#f1fa8c">&#39;src/contexts/DynamicParamsContext&#39;</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">const</span> Breadcrumb <span style="color:#ff79c6">=</span> () <span style="color:#ff79c6">=&gt;</span> {
</span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">const</span> { path } <span style="color:#ff79c6">=</span> useDynamicParams();
</span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">return</span> (
</span></span><span style="display:flex;"><span>    &lt;<span style="color:#ff79c6">nav</span> <span style="color:#50fa7b">id</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">&#34;breadcrumb&#34;</span> <span style="color:#50fa7b">className</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">&#34;breadcrumb&#34;</span>&gt;
</span></span><span style="display:flex;"><span>      &lt;<span style="color:#ff79c6">a</span> <span style="color:#50fa7b">href</span><span style="color:#ff79c6">=</span><span style="color:#f1fa8c">&#34;/&#34;</span>&gt;Home&lt;/<span style="color:#ff79c6">a</span>&gt;
</span></span><span style="display:flex;"><span>      {<span style="color:#8be9fd;font-style:italic">Array</span>.isArray(path) <span style="color:#ff79c6">&amp;&amp;</span> path.map((segment, idx) <span style="color:#ff79c6">=&gt;</span> (
</span></span><span style="display:flex;"><span>        &lt;<span style="color:#ff79c6">span</span> <span style="color:#50fa7b">key</span><span style="color:#ff79c6">=</span>{idx}&gt;
</span></span><span style="display:flex;"><span>          {<span style="color:#f1fa8c">&#39; / &#39;</span>}
</span></span><span style="display:flex;"><span>          &lt;<span style="color:#ff79c6">a</span> <span style="color:#50fa7b">href</span><span style="color:#ff79c6">=</span>{<span style="color:#f1fa8c">`/</span><span style="color:#f1fa8c">${</span>path.slice(<span style="color:#bd93f9">0</span>, idx <span style="color:#ff79c6">+</span> <span style="color:#bd93f9">1</span>).join(<span style="color:#f1fa8c">&#39;/&#39;</span>)<span style="color:#f1fa8c">}</span><span style="color:#f1fa8c">`</span>}&gt;{segment}&lt;/<span style="color:#ff79c6">a</span>&gt;
</span></span><span style="display:flex;"><span>        &lt;/<span style="color:#ff79c6">span</span>&gt;
</span></span><span style="display:flex;"><span>      ))}
</span></span><span style="display:flex;"><span>    &lt;/<span style="color:#ff79c6">nav</span>&gt;
</span></span><span style="display:flex;"><span>  );
</span></span><span style="display:flex;"><span>};
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">export</span> <span style="color:#ff79c6">default</span> Breadcrumb;</span></span></code></pre></div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h3 id="4-dynamic-page-title-and-metadata" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">4. Dynamic Page Title and Metadata</h3>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p><span class="dark:text-gray-300 font-semibold text-primary-color">File:</span> <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">src/app/[site]/[locale]/[[...path]]/page.tsx</span></p>
<p><span class="dark:text-gray-300 font-semibold text-primary-color">Details:</span>
<strong>Page titles</strong> are generated based on the <strong>current route</strong> and <strong>content</strong>. <strong>Wildcard pages</strong> use the <strong>last path segment</strong> for the <strong>title</strong> if Sitecore returns a <strong>generic value</strong> (e.g., <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">*</span>).</p>


<p class="font-semibold text-xl  text-primary dark:text-gray-300">This ensures:</p>
<ul>
<li>Unique titles per URL</li>
<li>Better SEO indexing</li>
<li>Improved click-through rates</li>
</ul>
<p>Example conceptually:</p>
<ul>
<li><strong>/blog/sitecore/wildcard-pages</strong></li>
<li>Title: <strong>Wildcard–Page</strong></li>
</ul>
<h4 id="-pagetsx">🔗 <a href="https://github.com/AmitKumar-AK/xmcloud-starter-js/blob/09ae40b64b1c82dc97a3f78e29be91acdfa1a942/examples/basic-nextjs/src/app/%5Bsite%5D/%5Blocale%5D/%5B%5B...path%5D%5D/page.tsx" target="_blank" rel="noopener">page.tsx</a>
</h4>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-typescript" data-lang="typescript"><span style="display:flex;"><span><span style="color:#ff79c6">import</span> { isDesignLibraryPreviewData } <span style="color:#ff79c6">from</span> <span style="color:#f1fa8c">&#34;@sitecore-content-sdk/nextjs/editing&#34;</span>;
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">import</span> { notFound } <span style="color:#ff79c6">from</span> <span style="color:#f1fa8c">&#34;next/navigation&#34;</span>;
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">import</span> { draftMode } <span style="color:#ff79c6">from</span> <span style="color:#f1fa8c">&#34;next/headers&#34;</span>;
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">import</span> { SiteInfo } <span style="color:#ff79c6">from</span> <span style="color:#f1fa8c">&#34;@sitecore-content-sdk/nextjs&#34;</span>;
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">import</span> sites <span style="color:#ff79c6">from</span> <span style="color:#f1fa8c">&#34;.sitecore/sites.json&#34;</span>;
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">import</span> { routing } <span style="color:#ff79c6">from</span> <span style="color:#f1fa8c">&#34;src/i18n/routing&#34;</span>;
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">import</span> scConfig <span style="color:#ff79c6">from</span> <span style="color:#f1fa8c">&#34;sitecore.config&#34;</span>;
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">import</span> client <span style="color:#ff79c6">from</span> <span style="color:#f1fa8c">&#34;src/lib/sitecore-client&#34;</span>;
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">import</span> Layout, { RouteFields } <span style="color:#ff79c6">from</span> <span style="color:#f1fa8c">&#34;src/Layout&#34;</span>;
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">import</span> components <span style="color:#ff79c6">from</span> <span style="color:#f1fa8c">&#34;.sitecore/component-map&#34;</span>;
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">import</span> Providers <span style="color:#ff79c6">from</span> <span style="color:#f1fa8c">&#34;src/Providers&#34;</span>;
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">import</span> { NextIntlClientProvider } <span style="color:#ff79c6">from</span> <span style="color:#f1fa8c">&#34;next-intl&#34;</span>;
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">import</span> { setRequestLocale } <span style="color:#ff79c6">from</span> <span style="color:#f1fa8c">&#34;next-intl/server&#34;</span>;
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">import</span> ProvidersWithParams <span style="color:#ff79c6">from</span> <span style="color:#f1fa8c">&#39;src/contexts/ProvidersWithParams&#39;</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">type</span> PageProps <span style="color:#ff79c6">=</span> {
</span></span><span style="display:flex;"><span>  params: <span style="color:#8be9fd">Promise</span><span style="color:#ff79c6">&lt;</span>{
</span></span><span style="display:flex;"><span>    site: <span style="color:#8be9fd">string</span>;
</span></span><span style="display:flex;"><span>    locale: <span style="color:#8be9fd">string</span>;
</span></span><span style="display:flex;"><span>    path?: <span style="color:#8be9fd">string</span>[];
</span></span><span style="display:flex;"><span>    [key: <span style="color:#8be9fd">string</span>]<span style="color:#ff79c6">:</span> <span style="color:#8be9fd">string</span> <span style="color:#ff79c6">|</span> <span style="color:#8be9fd">string</span>[] <span style="color:#ff79c6">|</span> <span style="color:#ff79c6">undefined</span>;
</span></span><span style="display:flex;"><span>  }<span style="color:#ff79c6">&gt;</span>;
</span></span><span style="display:flex;"><span>  searchParams: <span style="color:#8be9fd">Promise</span><span style="color:#ff79c6">&lt;</span>{ [key: <span style="color:#8be9fd">string</span>]<span style="color:#ff79c6">:</span> <span style="color:#8be9fd">string</span> <span style="color:#ff79c6">|</span> <span style="color:#8be9fd">string</span>[] <span style="color:#ff79c6">|</span> <span style="color:#ff79c6">undefined</span> }<span style="color:#ff79c6">&gt;</span>;
</span></span><span style="display:flex;"><span>};
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">export</span> <span style="color:#ff79c6">default</span> <span style="color:#ff79c6">async</span> <span style="color:#8be9fd;font-style:italic">function</span> Page({ params, searchParams }<span style="color:#ff79c6">:</span> PageProps) {
</span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">const</span> { site, locale, path } <span style="color:#ff79c6">=</span> <span style="color:#ff79c6">await</span> params;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#8be9fd;font-style:italic">let</span> id, someslug, blogSlug;
</span></span><span style="display:flex;"><span>  <span style="color:#8be9fd;font-style:italic">let</span> isBlogDetail <span style="color:#ff79c6">=</span> <span style="color:#ff79c6">false</span>;
</span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">if</span> (<span style="color:#8be9fd;font-style:italic">Array</span>.isArray(path)) {
</span></span><span style="display:flex;"><span>    <span style="color:#6272a4">// blogs/[slug] → path = [&#39;blogs&#39;, &#39;some-blog-slug&#39;]
</span></span></span><span style="display:flex;"><span>    <span style="color:#ff79c6">if</span> (path[<span style="color:#bd93f9">0</span>] <span style="color:#ff79c6">===</span> <span style="color:#f1fa8c">&#39;blogs&#39;</span> <span style="color:#ff79c6">&amp;&amp;</span> path.length <span style="color:#ff79c6">===</span> <span style="color:#bd93f9">2</span>) {
</span></span><span style="display:flex;"><span>      isBlogDetail <span style="color:#ff79c6">=</span> <span style="color:#ff79c6">true</span>;
</span></span><span style="display:flex;"><span>      blogSlug <span style="color:#ff79c6">=</span> path[<span style="color:#bd93f9">1</span>];
</span></span><span style="display:flex;"><span>    } <span style="color:#ff79c6">else</span> <span style="color:#ff79c6">if</span> (path.length <span style="color:#ff79c6">===</span> <span style="color:#bd93f9">1</span>) {
</span></span><span style="display:flex;"><span>      <span style="color:#6272a4">// Single-segment page, e.g., /About
</span></span></span><span style="display:flex;"><span>      <span style="color:#6272a4">// You can use path[0] as the page name/slug
</span></span></span><span style="display:flex;"><span>    } <span style="color:#ff79c6">else</span> <span style="color:#ff79c6">if</span> (path.length <span style="color:#ff79c6">&gt;=</span> <span style="color:#bd93f9">3</span>) {
</span></span><span style="display:flex;"><span>      <span style="color:#6272a4">// Multi-segment, e.g., /mypath/123/slug
</span></span></span><span style="display:flex;"><span>      id <span style="color:#ff79c6">=</span> path[path.length <span style="color:#ff79c6">-</span> <span style="color:#bd93f9">2</span>];
</span></span><span style="display:flex;"><span>      someslug <span style="color:#ff79c6">=</span> path[path.length <span style="color:#ff79c6">-</span> <span style="color:#bd93f9">1</span>];
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">const</span> draft <span style="color:#ff79c6">=</span> <span style="color:#ff79c6">await</span> draftMode();
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#6272a4">// Set site and locale to be available in src/i18n/request.ts for fetching the dictionary
</span></span></span><span style="display:flex;"><span>  setRequestLocale(<span style="color:#f1fa8c">`</span><span style="color:#f1fa8c">${</span>site<span style="color:#f1fa8c">}</span><span style="color:#f1fa8c">_</span><span style="color:#f1fa8c">${</span>locale<span style="color:#f1fa8c">}</span><span style="color:#f1fa8c">`</span>);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#6272a4">// Fetch the page data from Sitecore
</span></span></span><span style="display:flex;"><span>  <span style="color:#8be9fd;font-style:italic">let</span> page;
</span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">if</span> (draft.isEnabled) {
</span></span><span style="display:flex;"><span>    <span style="color:#ff79c6">const</span> editingParams <span style="color:#ff79c6">=</span> <span style="color:#ff79c6">await</span> searchParams;
</span></span><span style="display:flex;"><span>    <span style="color:#ff79c6">if</span> (isDesignLibraryPreviewData(editingParams)) {
</span></span><span style="display:flex;"><span>      page <span style="color:#ff79c6">=</span> <span style="color:#ff79c6">await</span> client.getDesignLibraryData(editingParams);
</span></span><span style="display:flex;"><span>    } <span style="color:#ff79c6">else</span> {
</span></span><span style="display:flex;"><span>      page <span style="color:#ff79c6">=</span> <span style="color:#ff79c6">await</span> client.getPreview(editingParams);
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>  } <span style="color:#ff79c6">else</span> {
</span></span><span style="display:flex;"><span>    <span style="color:#ff79c6">if</span> (isBlogDetail <span style="color:#ff79c6">&amp;&amp;</span> blogSlug) {
</span></span><span style="display:flex;"><span>      <span style="color:#6272a4">// Fetch blog detail page by slug, e.g., from Sitecore or your API
</span></span></span><span style="display:flex;"><span>      <span style="color:#6272a4">// Example: page = await client.getBlogDetail(blogSlug, { site, locale });
</span></span></span><span style="display:flex;"><span>      page <span style="color:#ff79c6">=</span> <span style="color:#ff79c6">await</span> client.getPage([<span style="color:#f1fa8c">&#39;blogs&#39;</span>, blogSlug], { site, locale });
</span></span><span style="display:flex;"><span>    } <span style="color:#ff79c6">else</span> {
</span></span><span style="display:flex;"><span>      page <span style="color:#ff79c6">=</span> <span style="color:#ff79c6">await</span> client.getPage(path <span style="color:#ff79c6">??</span> [], { site, locale });
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#6272a4">// If the page is not found, return a 404
</span></span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">if</span> (<span style="color:#ff79c6">!</span>page) {
</span></span><span style="display:flex;"><span>    notFound();
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#6272a4">// Fetch the component data from Sitecore (Likely will be deprecated)
</span></span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">const</span> componentProps <span style="color:#ff79c6">=</span> <span style="color:#ff79c6">await</span> client.getComponentData(
</span></span><span style="display:flex;"><span>    page.layout,
</span></span><span style="display:flex;"><span>    {},
</span></span><span style="display:flex;"><span>    components
</span></span><span style="display:flex;"><span>  );
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#6272a4">// ProvidersWithParams wraps the app in a dynamic context provider, making route params
</span></span></span><span style="display:flex;"><span>  <span style="color:#6272a4">// (id, slug, path, blogSlug) available to all components. This enables dynamic breadcrumbs,
</span></span></span><span style="display:flex;"><span>  <span style="color:#6272a4">// page titles, and API queries for deeply nested/wildcard routes in the Next.js App Router
</span></span></span><span style="display:flex;"><span>  <span style="color:#6272a4">// using Sitecore Content SDK. It receives route params from the catch-all [[...path]] route.
</span></span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">return</span> (
</span></span><span style="display:flex;"><span>    &lt;<span style="color:#ff79c6">NextIntlClientProvider</span>&gt;
</span></span><span style="display:flex;"><span>      &lt;<span style="color:#ff79c6">ProvidersWithParams</span> <span style="color:#50fa7b">id</span><span style="color:#ff79c6">=</span>{id} <span style="color:#50fa7b">someslug</span><span style="color:#ff79c6">=</span>{someslug} <span style="color:#50fa7b">path</span><span style="color:#ff79c6">=</span>{path} <span style="color:#50fa7b">page</span><span style="color:#ff79c6">=</span>{page} <span style="color:#50fa7b">componentProps</span><span style="color:#ff79c6">=</span>{componentProps} <span style="color:#50fa7b">blogSlug</span><span style="color:#ff79c6">=</span>{blogSlug} /&gt;
</span></span><span style="display:flex;"><span>    &lt;/<span style="color:#ff79c6">NextIntlClientProvider</span>&gt;
</span></span><span style="display:flex;"><span>  );
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#6272a4">// This function gets called at build and export time to determine
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// pages for SSG (&#34;paths&#34;, as tokenized array).
</span></span></span><span style="display:flex;"><span><span style="color:#ff79c6">export</span> <span style="color:#ff79c6">const</span> generateStaticParams <span style="color:#ff79c6">=</span> <span style="color:#ff79c6">async</span> () <span style="color:#ff79c6">=&gt;</span> {
</span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">if</span> (process.env.NODE_ENV <span style="color:#ff79c6">!==</span> <span style="color:#f1fa8c">&#34;development&#34;</span> <span style="color:#ff79c6">&amp;&amp;</span> scConfig.generateStaticPaths) {
</span></span><span style="display:flex;"><span>    <span style="color:#6272a4">// Filter sites to only include the sites this starter is designed to serve.
</span></span></span><span style="display:flex;"><span>    <span style="color:#6272a4">// This prevents cross-site build errors when multiple starters share the same XM Cloud instance.
</span></span></span><span style="display:flex;"><span>    <span style="color:#ff79c6">const</span> defaultSite <span style="color:#ff79c6">=</span> scConfig.defaultSite;
</span></span><span style="display:flex;"><span>    <span style="color:#ff79c6">const</span> allowedSites <span style="color:#ff79c6">=</span> defaultSite
</span></span><span style="display:flex;"><span>      <span style="color:#ff79c6">?</span> sites
</span></span><span style="display:flex;"><span>          .filter((site: <span style="color:#8be9fd">SiteInfo</span>) <span style="color:#ff79c6">=&gt;</span> site.name <span style="color:#ff79c6">===</span> defaultSite)
</span></span><span style="display:flex;"><span>          .map((site: <span style="color:#8be9fd">SiteInfo</span>) <span style="color:#ff79c6">=&gt;</span> site.name)
</span></span><span style="display:flex;"><span>      <span style="color:#ff79c6">:</span> sites.map((site: <span style="color:#8be9fd">SiteInfo</span>) <span style="color:#ff79c6">=&gt;</span> site.name);
</span></span><span style="display:flex;"><span>    <span style="color:#ff79c6">return</span> <span style="color:#ff79c6">await</span> client.getAppRouterStaticParams(
</span></span><span style="display:flex;"><span>      allowedSites,
</span></span><span style="display:flex;"><span>      routing.locales.slice()
</span></span><span style="display:flex;"><span>    );
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">return</span> [];
</span></span><span style="display:flex;"><span>};
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#6272a4">// Metadata fields for the page.
</span></span></span><span style="display:flex;"><span><span style="color:#ff79c6">export</span> <span style="color:#ff79c6">const</span> generateMetadata <span style="color:#ff79c6">=</span> <span style="color:#ff79c6">async</span> ({ params }<span style="color:#ff79c6">:</span> PageProps) <span style="color:#ff79c6">=&gt;</span> {
</span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">const</span> { path, site, locale } <span style="color:#ff79c6">=</span> <span style="color:#ff79c6">await</span> params;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#6272a4">// The same call as for rendering the page. Should be cached by default react behavior
</span></span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">const</span> page <span style="color:#ff79c6">=</span> <span style="color:#ff79c6">await</span> client.getPage(path <span style="color:#ff79c6">??</span> [], { site, locale });
</span></span><span style="display:flex;"><span>  <span style="color:#8be9fd;font-style:italic">let</span> title <span style="color:#ff79c6">=</span> (page<span style="color:#ff79c6">?</span>.layout.sitecore.route<span style="color:#ff79c6">?</span>.fields <span style="color:#ff79c6">as</span> RouteFields)<span style="color:#ff79c6">?</span>.Title<span style="color:#ff79c6">?</span>.value<span style="color:#ff79c6">?</span>.toString();
</span></span><span style="display:flex;"><span>  <span style="color:#6272a4">// If title is &#39;*&#39; (wildcard), use the last path segment or fallback
</span></span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">if</span> (title <span style="color:#ff79c6">===</span> <span style="color:#f1fa8c">&#39;*&#39;</span> <span style="color:#ff79c6">&amp;&amp;</span> <span style="color:#8be9fd;font-style:italic">Array</span>.isArray(path) <span style="color:#ff79c6">&amp;&amp;</span> path.length <span style="color:#ff79c6">&gt;</span> <span style="color:#bd93f9">0</span>) {
</span></span><span style="display:flex;"><span>    title <span style="color:#ff79c6">=</span> path[path.length <span style="color:#ff79c6">-</span> <span style="color:#bd93f9">1</span>];
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">return</span> {
</span></span><span style="display:flex;"><span>    title: <span style="color:#8be9fd">title</span> <span style="color:#ff79c6">||</span> <span style="color:#f1fa8c">&#34;Page&#34;</span>,
</span></span><span style="display:flex;"><span>  };
</span></span><span style="display:flex;"><span>};</span></span></code></pre></div>
<p>All without creating a new Sitecore item.</p>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h3 id="5-external-api-integration" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">5. External API Integration</h3>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p><span class="dark:text-gray-300 font-semibold text-primary-color">File:</span> <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">src/components/dynamic-data/DynamicData.tsx</span></p>
<p><span class="dark:text-gray-300 font-semibold text-primary-color">Details:</span>
On each <strong>dynamic page</strong>, queries an <strong>external API</strong> (e.g., public dummy API) to fetch <strong>related records</strong>. <strong>Displays API data contextually</strong> based on the <strong>current route</strong>, <strong>demonstrating</strong> how external systems can be <strong>integrated</strong> with SitecoreAI content.</p>
<h4 id="-dynamicdatatsx">🔗 <a href="https://github.com/AmitKumar-AK/xmcloud-starter-js/blob/09ae40b64b1c82dc97a3f78e29be91acdfa1a942/examples/basic-nextjs/src/components/dynamic-data/DynamicData.tsx" target="_blank" rel="noopener">DynamicData.tsx</a>
</h4>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-typescript" data-lang="typescript"><span style="display:flex;"><span><span style="color:#f1fa8c">&#34;use client&#34;</span>;
</span></span><span style="display:flex;"><span><span style="color:#6272a4">// DynamicData component for Next.js App Router using Sitecore Content SDK.
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// Consumes dynamic params from context and fetches external API data based on the current route.
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// Demonstrates how to integrate external systems (e.g., PIM, Commerce) with Sitecore-driven pages.
</span></span></span><span style="display:flex;"><span><span style="color:#6272a4">// Useful for showing contextual data (e.g., blog slug, wildcard path) and API results on dynamic/wildcard pages.
</span></span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">import</span> React, { useEffect, useState } <span style="color:#ff79c6">from</span> <span style="color:#f1fa8c">&#39;react&#39;</span>;
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">import</span> { useDynamicParams } <span style="color:#ff79c6">from</span> <span style="color:#f1fa8c">&#39;src/contexts/DynamicParamsContext&#39;</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">const</span> DUMMY_API_URL <span style="color:#ff79c6">=</span> <span style="color:#f1fa8c">&#39;https://jsonplaceholder.typicode.com/posts?_limit=3&#39;</span>;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">const</span> DynamicData: <span style="color:#8be9fd">React.FC</span> <span style="color:#ff79c6">=</span> () <span style="color:#ff79c6">=&gt;</span> {
</span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">const</span> { blogSlug, path } <span style="color:#ff79c6">=</span> useDynamicParams();
</span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">const</span> [dummyData, setDummyData] <span style="color:#ff79c6">=</span> useState&lt;<span style="color:#ff79c6">any</span>[]&gt;([]);
</span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">const</span> [loading, setLoading] <span style="color:#ff79c6">=</span> useState(<span style="color:#ff79c6">false</span>);
</span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">const</span> [error, setError] <span style="color:#ff79c6">=</span> useState&lt;<span style="color:#ff79c6">string</span> | <span style="color:#50fa7b">null</span>&gt;(<span style="color:#ff79c6">null</span>);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  useEffect(() <span style="color:#ff79c6">=&gt;</span> {
</span></span><span style="display:flex;"><span>    setLoading(<span style="color:#ff79c6">true</span>);
</span></span><span style="display:flex;"><span>    fetch(DUMMY_API_URL)
</span></span><span style="display:flex;"><span>      .then((res) <span style="color:#ff79c6">=&gt;</span> res.json())
</span></span><span style="display:flex;"><span>      .then((data) <span style="color:#ff79c6">=&gt;</span> {
</span></span><span style="display:flex;"><span>        setDummyData(data);
</span></span><span style="display:flex;"><span>        setLoading(<span style="color:#ff79c6">false</span>);
</span></span><span style="display:flex;"><span>      })
</span></span><span style="display:flex;"><span>      .<span style="color:#ff79c6">catch</span>((err) <span style="color:#ff79c6">=&gt;</span> {
</span></span><span style="display:flex;"><span>        setError(<span style="color:#f1fa8c">&#39;Failed to fetch dummy data&#39;</span>);
</span></span><span style="display:flex;"><span>        setLoading(<span style="color:#ff79c6">false</span>);
</span></span><span style="display:flex;"><span>      });
</span></span><span style="display:flex;"><span>  }, []);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#ff79c6">return</span> (
</span></span><span style="display:flex;"><span>    &lt;<span style="color:#ff79c6">div</span> <span style="color:#50fa7b">style</span><span style="color:#ff79c6">=</span>{{ padding<span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#39;1rem&#39;</span>, border<span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#39;1px solid #ccc&#39;</span>, margin<span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#39;1rem 0&#39;</span> }}&gt;
</span></span><span style="display:flex;"><span>      &lt;<span style="color:#ff79c6">h2</span>&gt;Dynamic Data Component&lt;/<span style="color:#ff79c6">h2</span>&gt;
</span></span><span style="display:flex;"><span>      {blogSlug <span style="color:#ff79c6">&amp;&amp;</span> (
</span></span><span style="display:flex;"><span>        &lt;<span style="color:#ff79c6">div</span>&gt;
</span></span><span style="display:flex;"><span>          &lt;<span style="color:#ff79c6">strong</span>&gt;Blog Slug<span style="color:#ff79c6">:</span>&lt;/<span style="color:#ff79c6">strong</span>&gt; {blogSlug}
</span></span><span style="display:flex;"><span>        &lt;/<span style="color:#ff79c6">div</span>&gt;
</span></span><span style="display:flex;"><span>      )}
</span></span><span style="display:flex;"><span>      {path <span style="color:#ff79c6">&amp;&amp;</span> path.length <span style="color:#ff79c6">&gt;</span> <span style="color:#bd93f9">0</span> <span style="color:#ff79c6">&amp;&amp;</span> (
</span></span><span style="display:flex;"><span>        &lt;<span style="color:#ff79c6">div</span>&gt;
</span></span><span style="display:flex;"><span>          &lt;<span style="color:#ff79c6">strong</span>&gt;Wildcard Path<span style="color:#ff79c6">:</span>&lt;/<span style="color:#ff79c6">strong</span>&gt; {path.join(<span style="color:#f1fa8c">&#39; / &#39;</span>)}
</span></span><span style="display:flex;"><span>        &lt;/<span style="color:#ff79c6">div</span>&gt;
</span></span><span style="display:flex;"><span>      )}
</span></span><span style="display:flex;"><span>      &lt;<span style="color:#ff79c6">div</span> <span style="color:#50fa7b">style</span><span style="color:#ff79c6">=</span>{{ marginTop<span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#39;1rem&#39;</span> }}&gt;
</span></span><span style="display:flex;"><span>        &lt;<span style="color:#ff79c6">strong</span>&gt;Dummy API Data<span style="color:#ff79c6">:</span>&lt;/<span style="color:#ff79c6">strong</span>&gt;
</span></span><span style="display:flex;"><span>        {loading <span style="color:#ff79c6">&amp;&amp;</span> &lt;<span style="color:#ff79c6">div</span>&gt;Loading...&lt;/<span style="color:#ff79c6">div</span>&gt;}
</span></span><span style="display:flex;"><span>        {error <span style="color:#ff79c6">&amp;&amp;</span> &lt;<span style="color:#ff79c6">div</span> <span style="color:#50fa7b">style</span><span style="color:#ff79c6">=</span>{{ color<span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#39;red&#39;</span> }}&gt;{error}&lt;/<span style="color:#ff79c6">div</span>&gt;}
</span></span><span style="display:flex;"><span>        {<span style="color:#ff79c6">!</span>loading <span style="color:#ff79c6">&amp;&amp;</span> <span style="color:#ff79c6">!</span>error <span style="color:#ff79c6">&amp;&amp;</span> (
</span></span><span style="display:flex;"><span>          &lt;<span style="color:#ff79c6">ul</span>&gt;
</span></span><span style="display:flex;"><span>            {dummyData.map((item) <span style="color:#ff79c6">=&gt;</span> (
</span></span><span style="display:flex;"><span>              &lt;<span style="color:#ff79c6">li</span> <span style="color:#50fa7b">key</span><span style="color:#ff79c6">=</span>{item.id}&gt;
</span></span><span style="display:flex;"><span>                &lt;<span style="color:#ff79c6">strong</span>&gt;{item.title}&lt;/<span style="color:#ff79c6">strong</span>&gt;
</span></span><span style="display:flex;"><span>                &lt;<span style="color:#ff79c6">div</span>&gt;{item.body}&lt;/<span style="color:#ff79c6">div</span>&gt;
</span></span><span style="display:flex;"><span>              &lt;/<span style="color:#ff79c6">li</span>&gt;
</span></span><span style="display:flex;"><span>            ))}
</span></span><span style="display:flex;"><span>          &lt;/<span style="color:#ff79c6">ul</span>&gt;
</span></span><span style="display:flex;"><span>        )}
</span></span><span style="display:flex;"><span>      &lt;/<span style="color:#ff79c6">div</span>&gt;
</span></span><span style="display:flex;"><span>    &lt;/<span style="color:#ff79c6">div</span>&gt;
</span></span><span style="display:flex;"><span>  );
</span></span><span style="display:flex;"><span>};
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">export</span> <span style="color:#ff79c6">default</span> DynamicData;</span></span></code></pre></div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-key-implementation-details" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">💡 Key Implementation Details</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h3 id="wildcard-item-configuration-in-sitecore" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">Wildcard Item Configuration in Sitecore</h3>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<ul>
<li><strong>Create Wildcard Items:</strong> In the Sitecore content tree, create items with names like <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">*</span> to act as wildcard placeholders</li>
<li><strong>Template Configuration:</strong> Ensure wildcard items use templates.</li>
<li><strong>Presentation Details:</strong> Assign layout and renderings that can handle dynamic content</li>
</ul>
<p>

<p class="font-semibold text-xl  text-primary dark:text-gray-300">SitecoreAI Content Tree:</p>





















  
  
    
    <img
      title="Sitecore Content SDK v1.2: Dynamic Wildcard Routing with Next.js App Router"
      loading="lazy"
      decoding="async"
      src="https://www.amitk.net/images/sitecore-nextjs-app-router-content-sdk-routing/Sitecore-wildcard-items-Sitecore-MVP-Amit-Kumar.png"
      alt="Sitecore Content SDK v1.2: Dynamic Wildcard Routing with Next.js App Router"
      class="img justify-self-center  "
      width=""
      height="" />
  
  




</p>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-example-use-cases" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">📖 Example Use Cases</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<ul>
<li><strong>Blogs:</strong> <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">/blogs/tech/ai/12345</span> resolves to a specific blog post, fetching details from Sitecore and/or an external API</li>
<li><strong>Articles:</strong> <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">/articles/marketing/2024/5678</span> dynamically loads the article content and metadata</li>
<li><strong>Commerce:</strong> <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">/products/category/shoes/sku123</span> pulls product data from a headless commerce API</li>
<li><strong>Nested Content:</strong> <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">/about/team/leadership</span> displays nested team info from Sitecore</li>
<li><strong>External Systems:</strong> <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">/pim/items/sku999</span> fetches product info from a PIM system</li>
</ul>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-key-takeaways-for-your-implementation" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🔑 Key Takeaways for Your Implementation</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<ul>
<li><strong>Use Wildcards for Scale:</strong> If your content lives in an external API, don&rsquo;t sync it to Sitecore items. Use the <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">*</span> item.</li>
<li><strong>Context is King:</strong> Implement a <strong>DynamicParamsContext</strong> (as seen in the <a href="https://github.com/AmitKumar-AK/xmcloud-starter-js/blob/09ae40b64b1c82dc97a3f78e29be91acdfa1a942/examples/basic-nextjs/src/contexts/DynamicParamsContext.tsx" target="_blank" rel="noopener">xmcloud-starter-js &gt; DynamicParamsContext.tsx</a>
) to manage route-specific data.</li>
<li><strong>SEO Matters:</strong> Always make sure your dynamic data is included in your SEO components, like Meta tags, OpenGraph, and Breadcrumbs.</li>
<li><strong>Performance:</strong> Use Next.js Incremental Static Regeneration (ISR) or strong caching for your external API calls to keep the dynamic pages <a href="https://www.amitk.net/blog/sitecore-ai-caching-guide/" target="_blank" rel="noopener">very fast</a>
.</li>
</ul>
<p>

<p class="font-semibold text-xl  text-primary dark:text-gray-300">Dynamic Wildcard Routing and External API Integration Demo:</p>





















  
  
    
    <img
      title="Screen recording showing dynamic wildcard page routing, breadcrumbs, and external API data integration in a Next.js App Router project using Sitecore Content SDK"
      loading="lazy"
      decoding="async"
      src="https://www.amitk.net/images/sitecore-nextjs-app-router-content-sdk-routing/sitecore-nextjs-app-router-content-sdk-routing-Sitecore-MVP-Amit-Kumar.gif"
      alt="Screen recording showing dynamic wildcard page routing, breadcrumbs, and external API data integration in a Next.js App Router project using Sitecore Content SDK"
      class="img justify-self-center  "
      width=""
      height="" />
  
  




</p>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-conclusion" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧭 Conclusion</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>Dynamic <a href="https://developers.sitecore.com/learn/accelerate/xm-cloud/implementation/information-architecture/wildcard-pages" target="_blank" rel="noopener">wildcard</a>
 routing in <a href="https://www.sitecore.com/platform" target="_blank" rel="noopener">SitecoreAI (Sitecore XM Cloud)</a>
 with <a href="https://developers.sitecore.com/changelog/sitecoreai/15122025/content-sdk-v1.3.1-released-with-general-availability-of-app-router" target="_blank" rel="noopener">Next.js App Router</a>
 enables seamless integration of external content systems, such as PIM and headless commerce, using clean, SEO-friendly URLs. This approach allows editors to manage layouts and navigation efficiently, while developers maintain streamlined routing logic. By leveraging Sitecore&rsquo;s wildcard functionality and <a href="https://nextjs.org/docs/app/api-reference/file-conventions/dynamic-routes" target="_blank" rel="noopener">Next.js dynamic routing</a>
, the solution supports scalable content orchestration, bridging static and dynamic data sources. <a href="https://www.sitecore.com/resources/insights/digital-transformation/what-is-a-composable-dxp" target="_blank" rel="noopener">Sitecore&rsquo;s composable architecture</a>
 further enhances flexibility by integrating <a href="https://www.sitecore.com/resources/insights/development/composable-dxp-benefits" target="_blank" rel="noopener">modular components</a>
 tailored to specific needs, allowing businesses to scale efficiently and maintain a cohesive digital experience. This modularity ensures agility and future-proofing in the digital ecosystem.</p>
<p><strong>Enjoyed this guide? Give it a ⭐ and show your support!</strong></p>
<div class="callout tip">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M8.684 13.342C8.886 12.938 9 12.482 9 12c0-.482-.114-.938-.316-1.342m0 2.684a3 3 0 110-2.684m0 2.684l6.632 3.316m-6.632-6l6.632-3.316m0 0a3 3 0 105.367-2.684 3 3 0 00-5.367 2.684zm0 9.316a3 3 0 105.368 2.684 3 3 0 00-5.368-2.684z"/></svg><p>Share Your Experience</p>
    </div>
    <div class="callout-body">
        <p>For complete setup details and code examples, check the <strong>examples/basic-nextjs</strong> folder in the  <strong>feature/dynamic-parameters</strong> branch. Access the full GitHub repository below 👇 and don’t forget to share your feedback.</p>
    </div>
</div>
<div class="github-card-wrapper">
    <a id="github-5d81d8774ce249d3d8168b2e7de3531f" target="_blank" href="https://github.com/AmitKumar-AK/xmcloud-starter-js" class="cursor-pointer">
      <div
        class="w-full md:w-auto p-0 m-0 border border-neutral-200 dark:border-neutral-700 border rounded-md shadow-2xl"><div class="w-full nozoom">
            <img
              src="https://opengraph.githubassets.com/0/AmitKumar-AK/xmcloud-starter-js"
              alt="GitHub Repository Thumbnail"
              class="nozoom mt-0 mb-0 w-full h-full object-cover">
          </div><div class="w-full md:w-auto pt-3 p-5">
          <div class="flex items-center">
            <span class="text-2xl text-neutral-800 dark:text-gray-300 me-2"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="currentColor" viewBox="3 3 18 18">
  <path d="M12 3C7.0275 3 3 7.12937 3 12.2276C3 16.3109 5.57625 19.7597 9.15374 20.9824C9.60374 21.0631 9.77249 20.7863 9.77249 20.5441C9.77249 20.3249 9.76125 19.5982 9.76125 18.8254C7.5 19.2522 6.915 18.2602 6.735 17.7412C6.63375 17.4759 6.19499 16.6569 5.8125 16.4378C5.4975 16.2647 5.0475 15.838 5.80124 15.8264C6.51 15.8149 7.01625 16.4954 7.18499 16.7723C7.99499 18.1679 9.28875 17.7758 9.80625 17.5335C9.885 16.9337 10.1212 16.53 10.38 16.2993C8.3775 16.0687 6.285 15.2728 6.285 11.7432C6.285 10.7397 6.63375 9.9092 7.20749 9.26326C7.1175 9.03257 6.8025 8.08674 7.2975 6.81794C7.2975 6.81794 8.05125 6.57571 9.77249 7.76377C10.4925 7.55615 11.2575 7.45234 12.0225 7.45234C12.7875 7.45234 13.5525 7.55615 14.2725 7.76377C15.9937 6.56418 16.7475 6.81794 16.7475 6.81794C17.2424 8.08674 16.9275 9.03257 16.8375 9.26326C17.4113 9.9092 17.76 10.7281 17.76 11.7432C17.76 15.2843 15.6563 16.0687 13.6537 16.2993C13.98 16.5877 14.2613 17.1414 14.2613 18.0065C14.2613 19.2407 14.25 20.2326 14.25 20.5441C14.25 20.7863 14.4188 21.0746 14.8688 20.9824C16.6554 20.364 18.2079 19.1866 19.3078 17.6162C20.4077 16.0457 20.9995 14.1611 21 12.2276C21 7.12937 16.9725 3 12 3Z"></path>
</svg>
</span>
            <div
              id="github-5d81d8774ce249d3d8168b2e7de3531f-full_name"
              class="m-0 font-bold text-xl text-neutral-800 decoration-primary-500 hover:underline hover:underline-offset-2 dark:text-gray-300">
              AmitKumar-AK/xmcloud-starter-js
            </div>
          </div>

          <p id="github-5d81d8774ce249d3d8168b2e7de3531f-description" class="m-0 mt-2 text-md text-neutral-800 dark:text-gray-300">
            
          </p>

          <div class="m-0 mt-2 flex items-center">
            <span class="mr-1 inline-block h-3 w-3 rounded-full language-dot" data-language="PowerShell"></span>
            <div class="m-0 mr-5 text-md text-neutral-800 dark:text-gray-300">
              PowerShell
            </div>

            <span class="text-md mr-1 text-neutral-800 dark:text-gray-300"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"/></svg></span>
            <div id="github-5d81d8774ce249d3d8168b2e7de3531f-stargazers" class="m-0 mr-5 text-md text-neutral-800 dark:text-gray-300">
              0
            </div>

            <span class="text-md mr-1 text-neutral-800 dark:text-gray-300"><svg height=1.2em class="hx:inline-block hx:align-middle" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M7 5C7 3.89543 7.89543 3 9 3C10.1046 3 11 3.89543 11 5C11 5.74028 10.5978 6.38663 10 6.73244V14.0396H11.7915C12.8961 14.0396 13.7915 13.1441 13.7915 12.0396V10.7838C13.1823 10.4411 12.7708 9.78837 12.7708 9.03955C12.7708 7.93498 13.6662 7.03955 14.7708 7.03955C15.8753 7.03955 16.7708 7.93498 16.7708 9.03955C16.7708 9.77123 16.3778 10.4111 15.7915 10.7598V12.0396C15.7915 14.2487 14.0006 16.0396 11.7915 16.0396H10V17.2676C10.5978 17.6134 11 18.2597 11 19C11 20.1046 10.1046 21 9 21C7.89543 21 7 20.1046 7 19C7 18.2597 7.4022 17.6134 8 17.2676V6.73244C7.4022 6.38663 7 5.74028 7 5Z" fill="#000000"></path> </g></svg></span>
            <div id="github-5d81d8774ce249d3d8168b2e7de3531f-forks" class="m-0 mr-5 text-md text-neutral-800 dark:text-gray-300">
              0
            </div>
          </div>
        </div>
      </div>
      
      
      <script
        async
        type="text/javascript"
        src="/js/fetch-repo.min.dc5533c50cefd50405344b235937142271f26229fe39cbee27fd4960e8bb897a0beebfad77a1091ca91cd0d1fb14e70fc37cc114dd9674fb2c32e0ab512ec8a4.js"
        integrity="sha512-3FUzxQzv1QQFNEsjWTcUInHyYin&#43;OcvuJ/1JYOi7iXoL7r&#43;td6EJHKkc0NH7FOcPw3zBFN2WdPssMuCrUS7IpA=="
        data-repo-url="https://api.github.com/repos/AmitKumar-AK/xmcloud-starter-js"
        data-repo-id="github-5d81d8774ce249d3d8168b2e7de3531f"></script>
    </a>
  </div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="creditreferences" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧾Credit/References</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>



<div class="table-wrapper">
<table class="style-table"><tbody><tr><td><a href="https://developers.sitecore.com/learn/accelerate/xm-cloud/implementation/information-architecture/wildcard-pages" target="_blank" rel="noopener">Sitecore XM Cloud Wildcard Pages Documentation</a></td><td><a href="https://nextjs.org/docs/app" target="_blank" rel="noopener">Next.js App Router</a></td><td><a href="https://doc.sitecore.com/sai/en/developers/content-sdk/getting-started-with-next-js-app-router-using-content-sdk.html" target="_blank" rel="noopener">Getting started with Next.js App Router using Content SDK</a></td></tr><tr><td><a href="https://doc.sitecore.com/sai/en/developers/content-sdk/sitecore-content-sdk-for-sitecoreai.html" target="_blank" rel="noopener">Sitecore Content SDK for SitecoreAI</a></td><td><a href="https://doc.sitecore.com/sai/en/developers/content-sdk/route-handling-and-data-fetching-in-content-sdk-apps.html" target="_blank" rel="noopener">Route handling and data fetching in Content SDK apps</a></td><td><a href="https://developers.sitecore.com/changelog/sitecoreai/30102025/content-sdk-v1.2-%e2%80%94-modernize-routing-architecture-with-app-router-support" target="_blank" rel="noopener">Content SDK v1.2 — Modernize Routing Architecture with App Router Support</a></td></tr><tr><td><a href="https://www.miguelminoldo.fr/posts/sitecoreai-content-sdk-app-router-ga-time-to-move" target="_blank" rel="noopener">SitecoreAI Content SDK v1.3.1: App Router is now GA! - Time to Make the Move</a></td><td><a href="https://blog.martinmiles.net/post/sitecore-content-sdk-1-2-brings-app-router-into-xm-cloud" target="_blank" rel="noopener">The Future is Now: Sitecore Content SDK 1.2 brings App Router into XM Cloud</a></td><td><a href="hhttps://doc.sitecore.com/sai/en/developers/content-sdk/migrate-your-content-sdk-1-2-pages-router-app-to-app-router.html">Migrate your Content SDK 1.2 Pages Router app to App Router</a></td></tr></tbody>
  
</table>
</div>
]]></content:encoded></item><item><title>Fix Git "Dubious Ownership" Error in SitecoreAI Development Setup: For Multi-Repo Developers</title><link>https://www.amitk.net/blog/sitecoreai-fix-git-dubious-ownership-error/</link><pubDate>Tue, 16 Dec 2025 00:00:00 +0000</pubDate><author>amit@amitk.net (Amit Kumar)</author><guid>https://www.amitk.net/blog/sitecoreai-fix-git-dubious-ownership-error/</guid><media:content url="https://www.amitk.net/images/sitecoreai-git-error/git-dubious-ownership-fix-Sitecore-MVP-Amit-Kumar.gif" medium="image" type="image/gif"/><description>
Fix Git’s "dubious ownership" error in SitecoreAI projects. Learn safe directory setup and correct Git identity for secure commits across multi‑repo workflows.</description><content:encoded><![CDATA[







<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-understanding-the-sitecoreai-development-error" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">⚠️ Understanding the SitecoreAI Development Error</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>This security <strong>fatal: detected dubious ownership in repository</strong> error is particularly common in <strong>development environments</strong> where developers work with <strong>multiple code repositories</strong> with <strong>multiple id&rsquo;s</strong> simultaneously and Git detects mismatched ownership.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-powershell" data-lang="powershell"><span style="display:flex;"><span>fatal: detected dubious ownership <span style="color:#ff79c6">in</span> repository at <span style="color:#f1fa8c">&#39;C:/xmcloud-starter-js&#39;</span>
</span></span><span style="display:flex;"><span><span style="color:#f1fa8c">&#39;C:/xmcloud-starter-js/.git&#39;</span> is owned by: <span style="color:#f1fa8c">&#39;x-x-x-xx-xxx&#39;</span>
</span></span><span style="display:flex;"><span>but the current user is: <span style="color:#f1fa8c">&#39;x-x-x-xx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx&#39;</span></span></span></code></pre></div>
<div class="callout note">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" width="22" height="22"><path stroke-linecap="round" stroke-linejoin="round" d="m11.25 11.25.041-.02a.75.75.0 011.063.852l-.708 2.836a.75.75.0 001.063.853l.041-.021M21 12A9 9 0 113 12a9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"></path></svg><p>Information</p>
    </div>
    <div class="callout-body">
        <p>It&rsquo;s a built-in security feature in Git versions 2.35.2+ to address <a href="https://nvd.nist.gov/vuln/detail/cve-2022-24765" target="_blank" rel="noopener">CVE-2022-24765</a>
, preventing potential vulnerabilities from running in untrusted directories.</p>
    </div>
</div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-why-does-this-error-occur" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">❓ Why Does This Error Occur?</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>Git&rsquo;s <strong>dubious ownership</strong> warning is a <strong>critical security feature</strong> that ensures directory ownership is verified to prevent <strong>unauthorized access</strong>. This issue occurs when the <strong>current user</strong> differs from the <strong>directory owner</strong>, which is essential in environments where you are working with <strong>different Git Repositories</strong> of <strong>SitecoreAI</strong> and other <strong>Sitecore application</strong> repositories. Common scenarios include:</p>
<ul>
<li><strong>Switching</strong> between <strong>repositories</strong>.</li>
<li>Working on <strong>multiple</strong> microservices or headless <strong>repositories</strong> (e.g., SitecoreAI, specialized AI service repos).</li>
<li>Working with your <strong>personal repositories</strong> alongside <strong>enterprise repositories</strong>.</li>
<li>You use <strong>different credentials</strong> or <strong>user contexts</strong> to clone and work with repositories from <strong>various platforms</strong> (GitHub, Azure DevOps, GitLab).</li>
<li>The local directory <strong>ownership</strong> (e.g., your Windows user SID) differs from the user who <strong>originally cloned</strong> the repository (e.g., running commands as an Administrator).</li>
</ul>
<div class="callout info">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" width="22" height="22"><path stroke-linecap="round" stroke-linejoin="round" d="m11.25 11.25.041-.02a.75.75.0 011.063.852l-.708 2.836a.75.75.0 001.063.853l.041-.021M21 12A9 9 0 113 12a9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"></path></svg><p>Information</p>
    </div>
    <div class="callout-body">
        <p>Git <strong>blocks</strong> operations if the directory is <strong>owned</strong> by a <strong>different Security Identifier (SID)</strong> than the <strong>current user</strong>, such as S-x-x-xx-xxx, to <strong>ensure security</strong>. <strong>Credential mismatches</strong> can occur when <strong>switching</strong> between <strong>multiple Git accounts</strong> or working on <strong>different SitecoreAI projects</strong>. To <strong>mitigate</strong> these issues, maintain <strong>consistent user credentials</strong> and contexts across repositories and platforms, ensuring smooth operations and security in complex development environments.</p>
    </div>
</div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-how-to-fix-the-error" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🔧 How to Fix the Error</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<h3 id="-step-1-mark-your-sitecoreai-application-directory-as-safe"><strong>🛡 Step 1: Mark Your SitecoreAI Application Directory as Safe</strong></h3>
<p>To allow Git operations for your <strong>SitecoreAI</strong> repo (for example, C:/xmcloud-starter-js), run the following command in <strong>Command Prompt</strong>, <strong>PowerShell</strong>, or <strong>Git Bash</strong>:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-powershell" data-lang="powershell"><span style="display:flex;"><span>  git config --global --add safe.directory C:/<span style="color:#8be9fd;font-style:italic">xmcloud-starter</span>-js</span></span></code></pre></div>
<h3 id="-step-2-set-correct-git-user-for-your-sitecoreai-commits"><strong>👤 Step 2: Set Correct Git User for Your SitecoreAI Commits</strong></h3>
<p>After marking the <strong>directory as safe</strong>, configure <strong>Git</strong> so that your <strong>commits</strong> in SitecoreAI and Sitecore implementation repositories use the <strong>correct developer identity</strong>. Run:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-powershell" data-lang="powershell"><span style="display:flex;"><span>  git config user.name <span style="color:#f1fa8c">&#34;AmitKumar-AK&#34;</span>
</span></span><span style="display:flex;"><span>  git config user.email <span style="color:#f1fa8c">&#34;dev@contoso.com&#34;</span></span></span></code></pre></div>
<div class="callout tip">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"/></svg><p>Details</p>
    </div>
    <div class="callout-body">
        <p>This <strong>ensures</strong> that <strong>any commits</strong> you make in this <strong>Sitecore</strong> solution folder <strong>appear under</strong> the <strong>correct author</strong> in <strong>Git history</strong>, which is important for <strong>tracking changes</strong> across multiple SitecoreAI, and content delivery repositories.</p>
    </div>
</div>
<p><strong>Next</strong>, update the <strong>remote URL</strong> to point to the <strong>correct GitHub repository and user</strong>:</p>
<h4 id="-update-remote-repository-url"><strong>🔗 Update Remote Repository URL</strong></h4>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-powershell" data-lang="powershell"><span style="display:flex;"><span>  git remote <span style="color:#8be9fd;font-style:italic">set-url</span> origin https://<span style="color:#8be9fd;font-style:italic">AmitKumar-AK</span><span style="color:#8be9fd;font-style:italic">@github</span>.com/<span style="color:#8be9fd;font-style:italic">AmitKumar-AK</span>/<span style="color:#8be9fd;font-style:italic">xmcloud-starter</span>-js.git</span></span></code></pre></div>
<div class="callout tip">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"/></svg><p>Details</p>
    </div>
    <div class="callout-body">
        <p>This <strong>prevents commits</strong> from being <strong>pushed</strong> under the <strong>wrong account</strong>, which can easily happen when <strong>switching between different Sitecore or SitecoreAI projects</strong> and remotes.</p>
    </div>
</div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h3 id="-step-3-verify-your-sitecoreai-git-setup" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">✅ Step 3: Verify Your SitecoreAI Git Setup</h3>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p><strong>Before</strong> continuing <strong>development</strong> or <strong>committing</strong> Sitecore templates, renderings, or SitecoreAI-related code, <strong>verify the configuration</strong>:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-powershell" data-lang="powershell"><span style="display:flex;"><span>    git config --get user.name
</span></span><span style="display:flex;"><span>    git config --get user.email
</span></span><span style="display:flex;"><span>    git remote -v</span></span></code></pre></div>
<p><strong>Check that:</strong></p>
<ul>
<li><strong>user.name</strong> is your intended <strong>Sitecore developer identity</strong>, which you <a href="#-step-2-set-correct-git-user-for-your-sitecoreai-commits"><strong>configured in Step 2</strong></a>
.</li>
<li><strong>user.email</strong> is your intended <strong>Sitecore developer email address</strong>, which you <a href="#-step-2-set-correct-git-user-for-your-sitecoreai-commits"><strong>configured in Step 2</strong></a>
.</li>
<li>The <strong>remote URL</strong> points to the correct <strong>SitecoreAI repository</strong>, which you <a href="#-step-2-set-correct-git-user-for-your-sitecoreai-commits"><strong>configured in Step 2</strong></a>
.</li>
</ul>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-best-practices-for-sitecoreai-multi-repo-developers" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧠 Best Practices for SitecoreAI Multi-Repo Developers</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<ul>
<li>Use one <span class="dark:text-gray-300 font-semibold text-primary-color">Git identity per organization</span></li>
<li>Verify <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">git config --list</span> before <span class="dark:text-gray-300 font-semibold text-primary-color">committing</span> any changes</li>
<li><span class="dark:text-gray-300 font-semibold text-primary-color">Avoid</span> running Git commands <span class="dark:text-gray-300 font-semibold text-primary-color">as admin</span> unless required</li>
<li>Separate <span class="dark:text-gray-300 font-semibold text-primary-color">personal</span> and <span class="dark:text-gray-300 font-semibold text-primary-color">enterprise</span> repos</li>
</ul>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-summary" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧩 Summary</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>The Git <span class="dark:text-gray-300 font-semibold text-bug-color">detected dubious ownership</span> error is a <span class="dark:text-gray-300 font-semibold text-abstract-color">security feature</span>, not a <span class="dark:text-gray-300 font-semibold text-danger-color">blocker</span>.</p>
<p>For <span class="dark:text-gray-300 font-semibold text-bug-color">SitecoreAI</span> development teams, the fix is simple:</p>
<ol>
<li>Mark the repository as safe</li>
<li>Configure the correct Git user and remote URL</li>
</ol>


<p class="font-semibold text-example-color italic dark:text-gray-300">This ensures secure, traceable, and compliant development across SitecoreAI, and multi-repository environments.</p>
<div class="callout tip">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M18.364 5.636l-3.536 3.536m0 5.656l3.536 3.536M9.172 9.172L5.636 5.636m3.536 9.192l-3.536 3.536M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-5 0a4 4 0 11-8 0 4 4 0 018 0z"/></svg><p>Support</p>
    </div>
    <div class="callout-body">
        <p><strong>If you enjoy this content, consider <a href="https://www.youtube.com/@AmitKumar-Info?sub_confirmation=1" target="_blank" rel="noopener">subscribing</a>
 📰 for more updates and insights. Your engagement is very important to me and helps me keep providing valuable resources! 🌟</strong></p>
    </div>
</div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="creditreferences" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧾Credit/References</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<table>
  <thead>
      <tr>
          <th><a href="https://nvd.nist.gov/vuln/detail/cve-2022-24765" target="_blank" rel="noopener">National Vulnerability Database: CVE-2022-24765</a>
</th>
          <th><a href="https://www.reddit.com/r/git/comments/16y4c2d/anyone_know_what_this_error_means_detected/" target="_blank" rel="noopener">Anyone know what this error means? detected dubious ownership GIT</a>
</th>
          <th><a href="https://github.com/orgs/community/discussions/48355" target="_blank" rel="noopener">fatal: detected dubious ownership in repository at #48355</a>
</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><a href="https://www.khueapps.com/blog/article/how-to-fix-fatal-detected-dubious-ownership-in-repository-safe-directory" target="_blank" rel="noopener">Fix Git &lsquo;detected dubious ownership&rsquo; via safe.directory</a>
</td>
          <td><a href="https://doc.sitecore.com/sai/en/developers/content-sdk/sitecore-content-sdk-for-sitecoreai.html" target="_blank" rel="noopener">Sitecore Content SDK for SitecoreAI</a>
</td>
          <td><a href="https://stackoverflow.com/questions/73485958/how-to-correct-git-reporting-detected-dubious-ownership-in-repository-withou" target="_blank" rel="noopener">detected dubious ownership in repository</a>
</td>
      </tr>
  </tbody>
</table>
]]></content:encoded></item><item><title>How to Set Up Unit Testing for SitecoreAI Content SDK Next.js Projects</title><link>https://www.amitk.net/blog/sitecoreai-contentsdk-component-testing/</link><pubDate>Fri, 12 Dec 2025 00:00:00 +0000</pubDate><author>amit@amitk.net (Amit Kumar)</author><guid>https://www.amitk.net/blog/sitecoreai-contentsdk-component-testing/</guid><media:content url="https://www.amitk.net/images/sitecoreai-contentsdk-component-testing/sitecore-contentsdk-unit-testing-guide.gif" medium="image" type="image/gif"/><description>
Learn how to set up, configure, and optimize unit testing for SitecoreAI Content SDK Next.js headless projects. This guide covers installation, configuration, writing tests, coverage reports, and troubleshooting for Sitecore components.</description><content:encoded><![CDATA[







<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-introduction" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🏁 Introduction</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>Unit testing plays a critical role in ensuring code quality, stability, and maintainability for modern headless CMS solutions. When working with <a href="https://doc.sitecore.com/sai/en/developers/content-sdk/sitecore-content-sdk-for-sitecoreai.html" target="_blank" rel="noopener">SitecoreAI Content SDK Next.js</a>
 applications, implementing a robust testing strategy is essential. This guide provides a comprehensive walkthrough for setting up unit testing in a <a href="https://doc.sitecore.com/sai" target="_blank" rel="noopener">SitecoreAI-powered</a>
 Next.js project using Jest and React Testing Library. You’ll learn how to install the required dependencies, configure <a href="https://jestjs.io/docs/getting-started" target="_blank" rel="noopener">Jest</a>
 for <a href="https://nextjs.org/docs/app/building-your-application/testing" target="_blank" rel="noopener">Next.js</a>
, and structure effective test cases for SitecoreAI components to achieve reliable and scalable applications. <a href="https://developers.sitecore.com/sitecoreai" target="_blank" rel="noopener">SitecoreAI</a>
</p>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-prerequisites" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">⚙️ Prerequisites</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>Before you begin setting up unit testing for SitecoreAI <a href="https://amitkumarmca04.blogspot.com/2025/07/sitecore-content-sdk-migration-guide.html" target="_blank" rel="noopener">Content SDK Next.js</a>
 applications, ensure your development environment is properly configured. Meeting these prerequisites will help you integrate Jest and React Testing Library seamlessly and avoid common setup issues.</p>
<p><strong>You’ll need:</strong></p>
<ul>
<li><strong>Node.js (v14 or higher)</strong> for running Next.js and testing tools</li>
<li><strong>npm or Yarn</strong> as your package manager</li>
<li>An existing <strong>SitecoreAI Content SDK</strong> Next.js project ready for testing</li>
<li>Basic knowledge of React and TypeScript for writing and maintaining test cases</li>
</ul>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-tools-libraries" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🛠️ Tools &amp; Libraries</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>This setup leverages industry-standard tools for a robust testing stack:</p>
<ul>
<li><strong>Jest:</strong> JavaScript testing framework</li>
<li><strong>React Testing Library:</strong> For React component testing</li>
<li><strong>TypeScript:</strong> For type-safe tests</li>
<li><strong>Jest DOM:</strong> Enhances DOM assertions for Sitecore component testing.</li>
</ul>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-package-installation" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">📦 Package Installation</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<h3 id="step-1-install-core-testing-dependencies">Step 1: Install Core Testing Dependencies</h3>
<p>Navigate to your Sitecore Content SDK Next.js project directory and install the required packages:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-powershell" data-lang="powershell"><span style="display:flex;"><span><span style="color:#8be9fd;font-style:italic">cd xmcloud-starter</span>-js/examples/<span style="color:#8be9fd;font-style:italic">kit-nextjs</span>-article-starter
</span></span><span style="display:flex;"><span>npm install --silent
</span></span><span style="display:flex;"><span>npm ci --silent
</span></span><span style="display:flex;"><span>npm install --save-dev jest <span style="color:#8be9fd;font-style:italic">@testing</span>-library/react <span style="color:#8be9fd;font-style:italic">@testing</span>-library/<span style="color:#8be9fd;font-style:italic">jest-dom</span> <span style="color:#8be9fd;font-style:italic">@types</span>/jest <span style="color:#8be9fd;font-style:italic">jest-environment</span>-jsdom</span></span></code></pre></div>
<p><strong>Output of the Command:</strong></p>
<p><img src="https://www.amitk.net/images/sitecoreai-contentsdk-component-testing/sitecore-content-sdk-jest-install.png" alt="Placeholder"></p>
<h3 id="step-2-add-typescript-support">Step 2: Add TypeScript Support</h3>
<p>For TypeScript-enabled Sitecore projects:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-powershell" data-lang="powershell"><span style="display:flex;"><span>npm install --save-dev <span style="color:#8be9fd;font-style:italic">ts-jest</span></span></span></code></pre></div>
<p><strong>Output of the Command:</strong></p>
<p><img src="https://www.amitk.net/images/sitecoreai-contentsdk-component-testing/sitecore-content-sdk-ts-jest.png" alt="Placeholder"></p>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h3 id="step-3-verify-installation" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">Step 3: Verify Installation</h3>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>Confirm all core packages are installed correctly:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-powershell" data-lang="powershell"><span style="display:flex;"><span>npm list --depth=<span style="color:#bd93f9">0</span> | <span style="color:#8be9fd;font-style:italic">Select-String</span> <span style="color:#f1fa8c">&#34;jest|testing&#34;</span></span></span></code></pre></div>
<p><strong>Output of the Command:</strong></p>
<p><img src="https://www.amitk.net/images/sitecoreai-contentsdk-component-testing/sitecore-content-sdk-npm-list.png" alt="Placeholder"></p>
<h3 id="step-4-create-jest-configuration">Step 4: Create Jest Configuration</h3>
<p>Create a <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">jest.config.js</span>  file in your project root to handle Next.js integration and module mapping. This file loads your Next app, configures <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">setupFilesAfterEnv</span>, maps module aliases, and sets <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">jest-environment-jsdom</span> as the test environment.</p>
<p>Update jest.config.js to align with path aliases defined in tsconfig.json.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-js" data-lang="js"><span style="display:flex;"><span><span style="color:#6272a4">// jest.config.js file
</span></span></span><span style="display:flex;"><span><span style="color:#ff79c6">const</span> nextJest <span style="color:#ff79c6">=</span> require(<span style="color:#f1fa8c">&#39;next/jest&#39;</span>);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">const</span> createJestConfig <span style="color:#ff79c6">=</span> nextJest({
</span></span><span style="display:flex;"><span>  dir<span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#39;./&#39;</span>,
</span></span><span style="display:flex;"><span>});
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">const</span> customJestConfig <span style="color:#ff79c6">=</span> {
</span></span><span style="display:flex;"><span>  setupFilesAfterEnv<span style="color:#ff79c6">:</span> [<span style="color:#f1fa8c">&#39;&lt;rootDir&gt;/jest.setup.js&#39;</span>],
</span></span><span style="display:flex;"><span>  moduleNameMapper<span style="color:#ff79c6">:</span> {
</span></span><span style="display:flex;"><span>    <span style="color:#f1fa8c">&#39;^@/(.*)$&#39;</span><span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#39;&lt;rootDir&gt;/src/$1&#39;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f1fa8c">&#39;^components/(.*)$&#39;</span><span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#39;&lt;rootDir&gt;/src/components/$1&#39;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f1fa8c">&#39;^shadcd/(.*)$&#39;</span><span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#39;&lt;rootDir&gt;/shadcn/$1&#39;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f1fa8c">&#39;^lib/(.*)$&#39;</span><span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#39;&lt;rootDir&gt;/src/lib/$1&#39;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f1fa8c">&#39;^temp/(.*)$&#39;</span><span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#39;&lt;rootDir&gt;/src/temp/$1&#39;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f1fa8c">&#39;^assets/(.*)$&#39;</span><span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#39;&lt;rootDir&gt;/src/assets/$1&#39;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f1fa8c">&#39;^enumerations/(.*)$&#39;</span><span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#39;&lt;rootDir&gt;/src/enumerations/$1&#39;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f1fa8c">&#39;^types/(.*)$&#39;</span><span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#39;&lt;rootDir&gt;/src/types/$1&#39;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f1fa8c">&#39;^graphql-types$&#39;</span><span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#39;&lt;rootDir&gt;/node_modules/@types/graphql-let/__generated__/__types__&#39;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f1fa8c">&#39;^react$&#39;</span><span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#39;&lt;rootDir&gt;/node_modules/react&#39;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f1fa8c">&#39;^@/tw/(.*)$&#39;</span><span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#39;&lt;rootDir&gt;/tailwind-config/$1&#39;</span>,
</span></span><span style="display:flex;"><span>  },
</span></span><span style="display:flex;"><span>  testEnvironment<span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#39;jest-environment-jsdom&#39;</span>,
</span></span><span style="display:flex;"><span>  testMatch<span style="color:#ff79c6">:</span> [
</span></span><span style="display:flex;"><span>    <span style="color:#f1fa8c">&#39;**/tests/**/*.(test|spec).(ts|tsx|js)&#39;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f1fa8c">&#39;**/__tests__/**/*.(test|spec).(ts|tsx|js)&#39;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f1fa8c">&#39;**/*.(test|spec).(ts|tsx|js)&#39;</span>
</span></span><span style="display:flex;"><span>  ],
</span></span><span style="display:flex;"><span>  testPathIgnorePatterns<span style="color:#ff79c6">:</span> [<span style="color:#f1fa8c">&#39;&lt;rootDir&gt;/.next/&#39;</span>, <span style="color:#f1fa8c">&#39;&lt;rootDir&gt;/node_modules/&#39;</span>],
</span></span><span style="display:flex;"><span>  collectCoverageFrom<span style="color:#ff79c6">:</span> [<span style="color:#f1fa8c">&#39;src/**/*.{ts,tsx}&#39;</span>, <span style="color:#f1fa8c">&#39;!src/**/*.d.ts&#39;</span>, <span style="color:#f1fa8c">&#39;!src/**/*.stories.{ts,tsx}&#39;</span>],
</span></span><span style="display:flex;"><span>};
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>module.exports <span style="color:#ff79c6">=</span> createJestConfig(customJestConfig);</span></span></code></pre></div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h3 id="step-5-create-jest-setup-file" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">Step 5: Create Jest Setup File</h3>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>Create <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">jest.setup.js</span>  in your project root to import Jest DOM matchers:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-js" data-lang="js"><span style="display:flex;"><span><span style="color:#6272a4">// jest.setup.js file
</span></span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">import</span> <span style="color:#f1fa8c">&#39;@testing-library/jest-dom&#39;</span>;</span></span></code></pre></div>
<h3 id="step-6-update-typescript-configuration">Step 6: Update TypeScript Configuration</h3>
<p>Add Jest types to your <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">tsconfig.json</span>:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-js" data-lang="js"><span style="display:flex;"><span><span style="color:#6272a4">// tsconfig.json file
</span></span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  <span style="color:#f1fa8c">&#34;compilerOptions&#34;</span><span style="color:#ff79c6">:</span> {
</span></span><span style="display:flex;"><span>    <span style="color:#6272a4">// ... other options
</span></span></span><span style="display:flex;"><span>    <span style="color:#f1fa8c">&#34;types&#34;</span><span style="color:#ff79c6">:</span> [<span style="color:#f1fa8c">&#34;node&#34;</span>, <span style="color:#f1fa8c">&#34;jest&#34;</span>]
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>}</span></span></code></pre></div>
<h3 id="step-7-add-test-scripts-to-packagejson">Step 7: Add Test Scripts to package.json</h3>
<p>Update your <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">package.json</span>:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-js" data-lang="js"><span style="display:flex;"><span><span style="color:#6272a4">// package.json file
</span></span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  <span style="color:#f1fa8c">&#34;scripts&#34;</span><span style="color:#ff79c6">:</span> {
</span></span><span style="display:flex;"><span>    <span style="color:#f1fa8c">&#34;test&#34;</span><span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#34;jest&#34;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f1fa8c">&#34;test:watch&#34;</span><span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#34;jest --watch&#34;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f1fa8c">&#34;test:coverage&#34;</span><span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#34;jest --coverage&#34;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#f1fa8c">&#34;test:ci&#34;</span><span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#34;jest --ci --coverage --watchAll=false&#34;</span>
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>}</span></span></code></pre></div>
<p>if below entry present then update with <span class="dark:text-gray-300 font-medium text-primary">"test": "jest"</span>:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-js" data-lang="js"><span style="display:flex;"><span><span style="color:#6272a4">// package.json file
</span></span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  <span style="color:#f1fa8c">&#34;scripts&#34;</span><span style="color:#ff79c6">:</span> {
</span></span><span style="display:flex;"><span>    <span style="color:#f1fa8c">&#34;test&#34;</span><span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#34;echo &#39;No tests implemented yet&#39; &amp;&amp; exit 0&#34;</span>,
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>}</span></span></code></pre></div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-writing-unit-tests" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">✍️ Writing Unit Tests</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>Creating effective unit tests for SitecoreAI Content SDK Next.js components is key to ensuring your application performs reliably across different scenarios. Prioritize testing Sitecore-specific elements such as component fields and rendering variants.</p>
<h3 id="step-1-create-tests-folder">Step 1: Create tests folder</h3>
<p>Create a <span class="dark:text-gray-300 font-medium text-primary">tests</span> folder in your project root to store the unit test files.</p>
<h3 id="step-2-create-test-file-for-a-sitecoreai-nextjs-component">Step 2: Create Test File for a SitecoreAI Next.js Component</h3>
<p>Create a test file inside a <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">tests/</span> folder, for example, examples\kit-nextjs-article-starter\tests\<span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">rich-text-block\RichTextBlock.test.tsx</span></p>
<div class="callout quote">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M9 12l2 2 4-4M7.835 4.697a3.42 3.42 0 001.946-.806 3.42 3.42 0 014.438 0 3.42 3.42 0 001.946.806 3.42 3.42 0 013.138 3.138 3.42 3.42 0 00.806 1.946 3.42 3.42 0 010 4.438 3.42 3.42 0 00-.806 1.946 3.42 3.42 0 01-3.138 3.138 3.42 3.42 0 00-1.946.806 3.42 3.42 0 01-4.438 0 3.42 3.42 0 00-1.946-.806 3.42 3.42 0 01-3.138-3.138 3.42 3.42 0 00-.806-1.946 3.42 3.42 0 010-4.438 3.42 3.42 0 00.806-1.946 3.42 3.42 0 013.138-3.138z"/></svg><p>Recommendations</p>
    </div>
    <div class="callout-body">
        <p>The recommended structure uses a dedicated <span class="dark:text-gray-300 font-medium text-primary">tests/</span> directory to prevent test files from being included in the component build.</p>
    </div>
</div>
<h3 id="step-3-key-testing-patterns">Step 3: Key Testing Patterns</h3>
<h4 id="mocking-sitecoreai-nextjs-components">Mocking SitecoreAI Next.js Components</h4>
<p>Since Sitecore Content SDK components like <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">Link</span> and <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">NextImage</span> are wrappers around native tags, they must be mocked to run outside a Sitecore/Next.js environment.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-js" data-lang="js"><span style="display:flex;"><span><span style="color:#6272a4">// Mock Sitecore Content SDK
</span></span></span><span style="display:flex;"><span>jest.mock(<span style="color:#f1fa8c">&#39;@sitecore-content-sdk/nextjs&#39;</span>, () =&gt; ({
</span></span><span style="display:flex;"><span>  RichText<span style="color:#ff79c6">:</span> ({ field }<span style="color:#ff79c6">:</span> any) =&gt; (
</span></span><span style="display:flex;"><span>    <span style="color:#ff79c6">&lt;</span>div role<span style="color:#ff79c6">=</span><span style="color:#f1fa8c">&#34;region&#34;</span> className<span style="color:#ff79c6">=</span><span style="color:#f1fa8c">&#34;prose custom-style&#34;</span> data<span style="color:#ff79c6">-</span>component<span style="color:#ff79c6">-</span>name<span style="color:#ff79c6">=</span><span style="color:#f1fa8c">&#34;rich-text-block&#34;</span> id<span style="color:#ff79c6">=</span><span style="color:#f1fa8c">&#34;test-id&#34;</span><span style="color:#ff79c6">&gt;</span>
</span></span><span style="display:flex;"><span>      <span style="color:#ff79c6">&lt;</span>div data<span style="color:#ff79c6">-</span>testid<span style="color:#ff79c6">=</span><span style="color:#f1fa8c">&#34;rich-text&#34;</span><span style="color:#ff79c6">&gt;</span>{field}<span style="color:#ff79c6">&lt;</span>/div&gt;
</span></span><span style="display:flex;"><span>    <span style="color:#ff79c6">&lt;</span>/div&gt;
</span></span><span style="display:flex;"><span>  ),
</span></span><span style="display:flex;"><span>}));
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#6272a4">// Mock NoDataFallback component
</span></span></span><span style="display:flex;"><span>jest.mock(<span style="color:#f1fa8c">&#39;@/utils/NoDataFallback&#39;</span>, () =&gt; ({
</span></span><span style="display:flex;"><span>  NoDataFallback<span style="color:#ff79c6">:</span> () =&gt; <span style="color:#ff79c6">&lt;</span>div data<span style="color:#ff79c6">-</span>testid<span style="color:#ff79c6">=</span><span style="color:#f1fa8c">&#34;no-data&#34;</span><span style="color:#ff79c6">&gt;</span>Rich text<span style="color:#ff79c6">&lt;</span>/div&gt;,
</span></span><span style="display:flex;"><span>}));
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#6272a4">// Mock Sitecore SDK components
</span></span></span><span style="display:flex;"><span>jest.mock(<span style="color:#f1fa8c">&#39;@sitecore-content-sdk/nextjs&#39;</span>, () =&gt; ({
</span></span><span style="display:flex;"><span>  Text<span style="color:#ff79c6">:</span> (props<span style="color:#ff79c6">:</span> any) =&gt; <span style="color:#ff79c6">&lt;</span>span data<span style="color:#ff79c6">-</span>testid<span style="color:#ff79c6">=</span><span style="color:#f1fa8c">&#34;text&#34;</span> {...props}<span style="color:#ff79c6">&gt;</span>{props.field<span style="color:#ff79c6">?</span>.value}<span style="color:#ff79c6">&lt;</span>/span&gt;,
</span></span><span style="display:flex;"><span>  useSitecore<span style="color:#ff79c6">:</span> () =&gt; ({ page<span style="color:#ff79c6">:</span> { mode<span style="color:#ff79c6">:</span> { isEditing<span style="color:#ff79c6">:</span> <span style="color:#ff79c6">false</span> } } }),
</span></span><span style="display:flex;"><span>}));
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#6272a4">// Mock TextBanner variants (named export Default for each)
</span></span></span><span style="display:flex;"><span>jest.mock(<span style="color:#f1fa8c">&#39;@/components/text-banner/TextBannerDefault.dev&#39;</span>, () =&gt; ({
</span></span><span style="display:flex;"><span>  Default<span style="color:#ff79c6">:</span> (props<span style="color:#ff79c6">:</span> any) =&gt; <span style="color:#ff79c6">&lt;</span>div data<span style="color:#ff79c6">-</span>testid<span style="color:#ff79c6">=</span><span style="color:#f1fa8c">&#34;text-banner-default&#34;</span><span style="color:#ff79c6">&gt;</span>Default {props.isPageEditing <span style="color:#ff79c6">?</span> <span style="color:#f1fa8c">&#39;editing&#39;</span> <span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#39;view&#39;</span>}<span style="color:#ff79c6">&lt;</span>/div&gt;,
</span></span><span style="display:flex;"><span>}));</span></span></code></pre></div>
<h4 id="creating-test-data-factories">Creating Test Data Factories</h4>
<p>Use functions to generate consistent mock data, making tests clean and easy to maintain.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-js" data-lang="js"><span style="display:flex;"><span><span style="color:#6272a4">// Helper to create mock props
</span></span></span><span style="display:flex;"><span><span style="color:#ff79c6">const</span> createMockProps <span style="color:#ff79c6">=</span> (overrides<span style="color:#ff79c6">:</span> any <span style="color:#ff79c6">=</span> {}) =&gt; ({
</span></span><span style="display:flex;"><span>  params<span style="color:#ff79c6">:</span> {
</span></span><span style="display:flex;"><span>    RenderingIdentifier<span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#39;test-id&#39;</span>,
</span></span><span style="display:flex;"><span>    styles<span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#39;custom-style&#39;</span>,
</span></span><span style="display:flex;"><span>    ...overrides.params,
</span></span><span style="display:flex;"><span>  },
</span></span><span style="display:flex;"><span>  fields<span style="color:#ff79c6">:</span> {
</span></span><span style="display:flex;"><span>    Content<span style="color:#ff79c6">:</span> { value<span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#39;&lt;p&gt;Test Content&lt;/p&gt;&#39;</span> },
</span></span><span style="display:flex;"><span>    ...overrides.fields,
</span></span><span style="display:flex;"><span>  },
</span></span><span style="display:flex;"><span>});
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#6272a4">// Usage
</span></span></span><span style="display:flex;"><span><span style="color:#ff79c6">const</span> props <span style="color:#ff79c6">=</span> createMockProps();
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">const</span> props <span style="color:#ff79c6">=</span> createMockProps({
</span></span><span style="display:flex;"><span>      fields<span style="color:#ff79c6">:</span> {
</span></span><span style="display:flex;"><span>        Content<span style="color:#ff79c6">:</span> <span style="color:#ff79c6">undefined</span>, <span style="color:#6272a4">// Explicitly remove Content to trigger fallback
</span></span></span><span style="display:flex;"><span>      },
</span></span><span style="display:flex;"><span>    });
</span></span><span style="display:flex;"><span><span style="color:#ff79c6">const</span> props <span style="color:#ff79c6">=</span> createMockProps({
</span></span><span style="display:flex;"><span>      params<span style="color:#ff79c6">:</span> { styles<span style="color:#ff79c6">:</span> <span style="color:#f1fa8c">&#39;mystyle&#39;</span>, RenderingIdentifier<span style="color:#ff79c6">:</span> <span style="color:#ff79c6">undefined</span> },
</span></span><span style="display:flex;"><span>    });</span></span></code></pre></div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-running-tests" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">▶️ Running Tests</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<h3 id="step-1-validate-setup-and-configuration">Step 1: Validate Setup and Configuration</h3>
<p>Validate your Jest setup with <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">npx jest --version</span> and <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">npx jest --showConfig</span> before running individual or directory‑wide tests.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-powershell" data-lang="powershell"><span style="display:flex;"><span><span style="color:#6272a4"># Verify Jest installation and version</span>
</span></span><span style="display:flex;"><span>npx jest --version
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#6272a4"># Run Jest configuration check</span>
</span></span><span style="display:flex;"><span>npx jest --showConfig</span></span></code></pre></div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h3 id="step-2-running-individual-tests" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">Step 2: Running Individual Tests</h3>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>Run specific tests for faster debugging:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-powershell" data-lang="powershell"><span style="display:flex;"><span><span style="color:#6272a4"># Run tests for the Hero component</span>
</span></span><span style="display:flex;"><span>npm test tests\components\hero\Hero.test.tsx</span></span></code></pre></div>
<div class="callout info">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" width="22" height="22"><path stroke-linecap="round" stroke-linejoin="round" d="m11.25 11.25.041-.02a.75.75.0 011.063.852l-.708 2.836a.75.75.0 001.063.853l.041-.021M21 12A9 9 0 113 12a9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"></path></svg><p>Information</p>
    </div>
    <div class="callout-body">
        <p>This command runs only the tests in the <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">Hero.test.tsx</span> file. Use it to quickly check the Hero component’s functionality without running the entire test suite. Ideal for focused development and debugging.</p>
    </div>
</div>
<h3 id="step-3-run-tests-by-name-pattern">Step 3: Run Tests by Name Pattern</h3>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-powershell" data-lang="powershell"><span style="display:flex;"><span><span style="color:#6272a4"># Run tests by name pattern</span>
</span></span><span style="display:flex;"><span>npx jest --testNamePattern=<span style="color:#f1fa8c">&#34;Hero&#34;</span></span></span></code></pre></div>
<div class="callout info">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" width="22" height="22"><path stroke-linecap="round" stroke-linejoin="round" d="m11.25 11.25.041-.02a.75.75.0 011.063.852l-.708 2.836a.75.75.0 001.063.853l.041-.021M21 12A9 9 0 113 12a9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"></path></svg><p>Information</p>
    </div>
    <div class="callout-body">
        <p>This command executes all tests whose names match the pattern <strong>Hero</strong>. It’s useful for running a subset of tests across multiple files, especially when you want to target tests related to a specific feature or component.</p>
    </div>
</div>
<h3 id="step-4-run-a-specific-test-file-with-coverage-and-verbose-output">Step 4: Run a Specific Test File with Coverage and Verbose Output</h3>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-powershell" data-lang="powershell"><span style="display:flex;"><span>npx jest tests\components\hero\Hero.test.tsx --coverage --verbose</span></span></code></pre></div>
<div class="callout info">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" width="22" height="22"><path stroke-linecap="round" stroke-linejoin="round" d="m11.25 11.25.041-.02a.75.75.0 011.063.852l-.708 2.836a.75.75.0 001.063.853l.041-.021M21 12A9 9 0 113 12a9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"></path></svg><p>Information</p>
    </div>
    <div class="callout-body">
        <p>This command runs the <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">Hero.test.tsx</span> file, generates a detailed coverage report, and provides verbose output for each test. It’s perfect for ensuring your component is fully tested and for reviewing which lines of code are covered.</p>
    </div>
</div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h3 id="step-5-run-tests-by-file-pattern-with-coverage-and-verbose-output" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">Step 5: Run Tests by File Pattern with Coverage and Verbose Output</h3>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-powershell" data-lang="powershell"><span style="display:flex;"><span>npm run test:coverage -- --testPathPattern=Hero --verbose</span></span></code></pre></div>
<p><img src="https://www.amitk.net/images/sitecoreai-contentsdk-component-testing/test-coverage-verbose-all-hero.png" alt="Placeholder"></p>
<div class="callout info">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" width="22" height="22"><path stroke-linecap="round" stroke-linejoin="round" d="m11.25 11.25.041-.02a.75.75.0 011.063.852l-.708 2.836a.75.75.0 001.063.853l.041-.021M21 12A9 9 0 113 12a9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"></path></svg><p>Information</p>
    </div>
    <div class="callout-body">
        <p>This command runs all test files whose paths match <strong>Hero</strong>, generates a coverage report, and outputs detailed test results. It’s useful for validating all Hero-related tests and ensuring comprehensive coverage.</p>
    </div>
</div>
<h3 id="step-6-run-all-tests-once">Step 6: Run All Tests Once</h3>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-powershell" data-lang="powershell"><span style="display:flex;"><span>npm test</span></span></code></pre></div>
<div class="callout info">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" width="22" height="22"><path stroke-linecap="round" stroke-linejoin="round" d="m11.25 11.25.041-.02a.75.75.0 011.063.852l-.708 2.836a.75.75.0 001.063.853l.041-.021M21 12A9 9 0 113 12a9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"></path></svg><p>Information</p>
    </div>
    <div class="callout-body">
        <p>This command runs the entire test suite once. Use it to validate your whole project before committing or deploying, ensuring that all components and features are working as expected.</p>
    </div>
</div>
<h3 id="step-7-run-tests-in-watch-mode">Step 7: Run Tests in Watch Mode</h3>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-powershell" data-lang="powershell"><span style="display:flex;"><span>npm run test:watch</span></span></code></pre></div>
<div class="callout info">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" width="22" height="22"><path stroke-linecap="round" stroke-linejoin="round" d="m11.25 11.25.041-.02a.75.75.0 011.063.852l-.708 2.836a.75.75.0 001.063.853l.041-.021M21 12A9 9 0 113 12a9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"></path></svg><p>Information</p>
    </div>
    <div class="callout-body">
        <p>This command starts Jest in watch mode, automatically rerunning relevant tests when files change. It’s ideal for active development, providing instant feedback as you code.</p>
    </div>
</div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h3 id="step-8-run-tests-without-watch-mode-and-with-coverage-ci-mode" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">Step 8: Run Tests Without Watch Mode and With Coverage (CI Mode)</h3>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-powershell" data-lang="powershell"><span style="display:flex;"><span>npm run test:ci</span></span></code></pre></div>
<div class="callout info">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" width="22" height="22"><path stroke-linecap="round" stroke-linejoin="round" d="m11.25 11.25.041-.02a.75.75.0 011.063.852l-.708 2.836a.75.75.0 001.063.853l.041-.021M21 12A9 9 0 113 12a9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"></path></svg><p>Information</p>
    </div>
    <div class="callout-body">
        <p>This command runs all tests once in continuous integration (CI) mode, generates a coverage report, and disables watch mode. It’s best for automated pipelines and pre-deployment checks, ensuring code quality and test completeness.</p>
    </div>
</div>


<p class="font-medium text-primary dark:text-gray-300">These commands help streamline your testing workflow, whether you’re developing locally, debugging a specific component, or running tests in a CI/CD pipeline. They also ensure you can easily view and improve your code coverage.</p>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-test-coverage-reports" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">📊 Test Coverage Reports</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<h3 id="step-1-generate-coverage-reports">Step 1: Generate Coverage Reports</h3>
<p>Generate detailed analysis of lines, functions, and branches:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-powershell" data-lang="powershell"><span style="display:flex;"><span>npm run test:coverage</span></span></code></pre></div>
<div class="callout info">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" width="22" height="22"><path stroke-linecap="round" stroke-linejoin="round" d="m11.25 11.25.041-.02a.75.75.0 011.063.852l-.708 2.836a.75.75.0 001.063.853l.041-.021M21 12A9 9 0 113 12a9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"></path></svg><p>Information</p>
    </div>
    <div class="callout-body">
        <p>This command runs all tests and generates a full code coverage report for your project. Use it to identify untested code and improve your test coverage metrics.</p>
    </div>
</div>
<p>It will generate the report at <span class="rounded-lg inlinehighlight shadow transition dark:bg-gray-100 dark:text-gray-600 bg-primary text-white">\kit-nextjs-article-starter\coverage\lcov-report\index.html</span> location:</p>
<p><img src="https://www.amitk.net/images/sitecoreai-contentsdk-component-testing/test-coverage-report.png" alt="Placeholder"></p>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-best-practices" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">💡 Best Practices</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>


<p class="font-semibold text-xl  text-primary dark:text-gray-300">✔ Testing Strategy</p>
<ul>
<li>Test behavior, not implementation</li>
<li>Clear test names</li>
<li>Use Arrange / Act / Assert</li>
<li>Mock external APIs &amp; Sitecore fields</li>
</ul>


<p class="font-semibold text-xl  text-primary dark:text-gray-300">✔ Component Testing Guidelines</p>
<ul>
<li>Test all component variants</li>
<li>Cover empty or missing data cases</li>
<li>Validate accessibility</li>
<li>Confirm field mapping</li>
</ul>


<p class="font-semibold text-xl  text-primary dark:text-gray-300">✔ Organization</p>
<ul>
<li>Keep tests in a separate /tests folder</li>
<li>Use factories for consistency</li>
<li>Group related cases with describe()</li>
</ul>
<h3 id="recommended-file-structure">Recommended File Structure</h3>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>kit-nextjs-article-starter/
</span></span><span style="display:flex;"><span>├── src/
</span></span><span style="display:flex;"><span>│   └── components/   // Component source files
</span></span><span style="display:flex;"><span>└── tests/
</span></span><span style="display:flex;"><span>    └── components/   // ✅ All test files go here (Isolated from build)</span></span></code></pre></div>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="-conclusion" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧭 Conclusion</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<p>You now have a fully configured, production-ready unit testing environment for SitecoreAI Content SDK Next.js applications. This setup delivers a solid foundation for comprehensive testing, enabling faster development cycles, improved code stability, seamless CI/CD integration, and enhanced developer experience - ensuring high-quality, scalable Sitecore implementations.</p>
<p><strong>Enjoyed this guide? Give it a ⭐ and show your support!</strong></p>
<p><div class="callout tip">
    <div class="callout-head"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M8.684 13.342C8.886 12.938 9 12.482 9 12c0-.482-.114-.938-.316-1.342m0 2.684a3 3 0 110-2.684m0 2.684l6.632 3.316m-6.632-6l6.632-3.316m0 0a3 3 0 105.367-2.684 3 3 0 00-5.367 2.684zm0 9.316a3 3 0 105.368 2.684 3 3 0 00-5.368-2.684z"/></svg><p>Share Your Experience</p>
    </div>
    <div class="callout-body">
        <p>For complete setup details and code samples, scan the QR code below 👇 to access the full GitHub repository and don’t forget to share your feedback.</p>
    </div>
</div>
<a href="https://github.com/AmitKumar-AK/xmcloud-starter-js/tree/feature/unit-testing-setup/examples/kit-nextjs-article-starter" target="_blank" rel="noopener">




















  
  
    
    <img
      title=""
      loading="lazy"
      decoding="async"
      src="https://www.amitk.net/images/sitecoreai-contentsdk-component-testing/SitecoreAI_ContentSDK_UnitTesting.png"
      alt="Sitecore Content SDK Unit Testing"
      class="img   "
      width="400"
      height="100" />
  
  




</a>
</p>








<div class="flex items-center gap-2 flex-wrap mt-0 !mt-0 p-0" style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">
  
    <h2 id="creditreferences" class="mt-0 !mt-0 pt-0 pb-0 " style="margin-top:0.5em!important;margin-bottom:-0.3em!important;padding-top:0!important;">🧾Credit/References</h2>
  
  
    <span class="go-to-top">
      <a class="go-to-top-a " href="#TableOfContents" title="Go to Top"><svg height=1.2em class="hx:inline-block hx:align-middle" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg></a>      
    </span>
  
</div>
<table>
  <thead>
      <tr>
          <th><a href="https://nextjs.org/docs/app/building-your-application/testing" target="_blank" rel="noopener">Next.js Documentation: Testing</a>
</th>
          <th><a href="https://jestjs.io/docs/getting-started" target="_blank" rel="noopener">Jest Official Documentation</a>
</th>
          <th><a href="https://testing-library.com/docs/react-testing-library/intro/" target="_blank" rel="noopener">React Testing Library Official Docs</a>
</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><a href="https://github.com/testing-library/jest-dom" target="_blank" rel="noopener">Jest DOM Official Documentation</a>
</td>
          <td><a href="https://doc.sitecore.com/sai/en/developers/content-sdk/sitecore-content-sdk-for-sitecoreai.html" target="_blank" rel="noopener">Sitecore Content SDK for SitecoreAI</a>
</td>
          <td><a href="https://github.com/Sitecore/xmcloud-starter-js" target="_blank" rel="noopener">Sitecore Content SDK for SitecoreAI GitHub Repository</a>
</td>
      </tr>
      <tr>
          <td><a href="https://github.com/sapegin/jest-cheat-sheet" target="_blank" rel="noopener">Jest Cheat Sheet</a>
</td>
          <td><a href="https://github.com/jestjs/jest/tree/main/examples" target="_blank" rel="noopener">Jest Examples GitHub Repository</a>
</td>
          <td><a href="https://amitkumarmca04.blogspot.com/2025/07/sitecore-content-sdk-migration-guide.html" target="_blank" rel="noopener">Upgrade JSS Next.js apps to Content SDK</a>
</td>
      </tr>
  </tbody>
</table>
]]></content:encoded></item><item><title>Vercel Caching Guide: Maximize SitecoreAI Performance and CDN Speed</title><link>https://www.amitk.net/blog/sitecore-ai-caching-guide/</link><pubDate>Sat, 08 Nov 2025 00:00:00 +0000</pubDate><author>amit@amitk.net (Amit Kumar)</author><guid>https://www.amitk.net/blog/sitecore-ai-caching-guide/</guid><media:content url="https://www.amitk.net/images/sitecore-ai-caching-guide/Sitecore-XM-Cloud-Caching-On-Vercel.gif" medium="image" type="image/gif"/><description>
A practical guide to maximizing Sitecore XM Cloud delivery speed through optimized Vercel CDN caching strategies. Essential for top-tier performance. Optimize SitecoreAI Performance: Vercel Caching Strategies for XM Cloud</description><content:encoded><![CDATA[<h2 id="overview"><strong>📊Overview</strong></h2>
<p>This guide describes a hybrid caching plan for Sitecore XM Cloud apps on Vercel, using various caching layers to enhance performance in different environments. In this article, I will explain the caching details using sample components that call external APIs to fetch necessary information and use Vercel&rsquo;s edge network for quick content delivery. Advanced caching methods, such as response headers, ETag checks, and Vercel edge functions, are crucial for speed, scalability, and smooth content delivery in a Next.js or headless Sitecore setup. Effective caching reduces API calls to XM Cloud’s GraphQL endpoint, decreases server load, and improves Core Web Vitals, which boosts SEO rankings.</p>
<p>Key Features:</p>
<ul>
<li>Multi-Layer Caching: Edge, HTTP, and In-Memory strategies</li>
<li>Environment-Aware: Different behaviors for development vs production</li>
<li>Performance Monitoring: Different behaviors for development vs production</li>
<li>Error Handling: Graceful fallbacks and resilience</li>
<li>SEO Optimization: Proper cache headers for search engines</li>
</ul>
<hr>
<blockquote>
<p>📢 Read the full SitecoreAI Performance guide <a href="https://amitkumarmca04.blogspot.com/2025/07/sitecore-content-sdk-migration-guide.html" target="_blank" rel="noopener">here</a>
</p>
</blockquote>
]]></content:encoded></item><item><title>Sitecore Content SDK for XM Cloud: The JSS to SDK Migration Checklist</title><link>https://www.amitk.net/blog/sitecore-content-sdk-migration-guide-jss/</link><pubDate>Wed, 30 Jul 2025 00:00:00 +0000</pubDate><author>amit@amitk.net (Amit Kumar)</author><guid>https://www.amitk.net/blog/sitecore-content-sdk-migration-guide-jss/</guid><media:content url="https://www.amitk.net/images/sitecore-content-sdk-migration/migrate-sitecore-jss-to-content-sdk-Sitecore-MVP-Amit-Kumar.gif" medium="image" type="image/gif"/><description>
A comprehensive, step-by-step guide to migrating your legacy Sitecore JSS application to the modern Sitecore Content SDK. Learn the critical code changes and deployment steps.</description><content:encoded><![CDATA[<h2 id="introduction-solving-modern-web-deployment-challenges"><strong>👋Introduction: Solving Modern Web Deployment Challenges</strong></h2>
<p>The Sitecore Content SDK for XM Cloud is a transformative tool for front-end development. This modern SDK simplifies the complexities of the JSS Next.js SDK, enhancing performance and developer efficiency. It offers seamless integration with XM Cloud’s headless architecture, featuring built-in GraphQL utilities, real-time visual editing, and support for multi-site, personalization, and analytics. Learn how to migrate your existing JSS app to the Content SDK and connect it to a local XM Cloud setup using Docker, optimizing your development process with a streamlined Next.js template.</p>
<p>In this guide, we’ll explore:</p>
<ul>
<li>What the Content SDK is</li>
<li>Key benefits over JSS</li>
<li>How to migrate from JSS</li>
<li>Connecting to a local XM Cloud Docker setup</li>
</ul>
<hr>
<blockquote>
<p>📢 Checkout essential checklist for migrating Sitecore JSS projects to the Content SDK <a href="https://amitkumarmca04.blogspot.com/2025/07/sitecore-content-sdk-migration-guide.html" target="_blank" rel="noopener">here</a>
</p>
</blockquote>
]]></content:encoded></item><item><title>Mastering ASP.NET MVC Deployment: How .wpp.targets Files Revolutionize Sitecore Project Publishing</title><link>https://www.amitk.net/blog/mastering-sitecore-aspnet-mvc-deployment-publishing/</link><pubDate>Mon, 14 Jul 2025 00:00:00 +0000</pubDate><author>amit@amitk.net (Amit Kumar)</author><guid>https://www.amitk.net/blog/mastering-sitecore-aspnet-mvc-deployment-publishing/</guid><media:content url="https://www.amitk.net/images/sitecore-aspnet-mvc/Mastering-ASP.NET-MVC-Deployment.gif" medium="image" type="image/gif"/><description>
Discover how .wpp.targets files streamline ASP.NET and Sitecore deployments, eliminate DLL conflicts, reduce package sizes by 70%, and automate hotfixes.</description><content:encoded><![CDATA[<h2 id="introduction-solving-modern-web-deployment-challenges"><strong>👋Introduction: Solving Modern Web Deployment Challenges</strong></h2>
<p>Deploying ASP.NET MVC applications, especially Sitecore-based projects, can be tricky due to <strong>dependency conflicts</strong>, <strong>unwanted assemblies</strong>, and <strong>missing updates</strong>. Traditional deployment methods often lead to <strong>bloated packages</strong>, <strong>version conflicts</strong>, and <strong>manual steps</strong> that slow down delivery.</p>
<p>The <strong>.wpp.targets</strong> file is a powerful <strong>MSBuild tool</strong> that can turn the <strong>Web Publishing Pipeline (WPP)</strong> into a <strong>precise</strong> deployment tool. This guide shows how development teams use .wpp.targets files to make deployments <strong>smooth</strong> and <strong>efficient.</strong></p>
<hr>
<blockquote>
<p>📢 For a deep dive into deployment optimization with .wpp.targets check out our <strong>full tutorial</strong> <a href="https://amitkumarmca04.blogspot.com/2025/07/msbuild-wpp-targets-aspnet-sitecore-deployment_01019975030.html" target="_blank" rel="noopener">here</a>
</p>
</blockquote>
]]></content:encoded></item></channel></rss>