Showing posts with label SitecoreCommunity. Show all posts
Showing posts with label SitecoreCommunity. Show all posts

Tuesday, September 22, 2026

Building a Custom Sitecore MCP Server in .NET — Tailored for Real Project Work

Hello Sitecorian Community! 👋

This is the blog I have been building toward across the whole series. Blogs 1–3 covered the foundations — understanding MCP, building a minimal .NET server, and setting up Anton Tishchenko’s community server against a live XP instance. All of that was preparation for this: building something genuinely mine, shaped around the actual work I do every day on a Sitecore project.

The Problem I Wanted to Solve

When I started thinking about what to build, the answer came quickly — because the pain was already obvious.

On every Sitecore project I have worked on, there is a category of work that is critical but relentlessly repetitive: managing Content Security Domain (CSD) role access. CSD is Sitecore’s standard security model for controlling which roles can read, write, rename, create, delete, or administer content nodes in the content tree.

On the surface it sounds simple — give a role access to a path. In practice, on an active project with multiple content authors, developers, and client stakeholders all requesting access at different points, it turns into a constant stream of small but time-consuming tasks.

The Before: A Manual, Repetitive Grind

Here is what the daily reality looked like before this server existed.

Every request followed the same path through the Sitecore Security Editor:

  1. Open the Security Editor in the Sitecore Content Editor
  2. Search for the role by name — sounds trivial, but role names across multiple domains (sitecore\, cog\, client-specific) are easy to get wrong, especially for roles you don't work with daily
  3. Navigate to each content node — sometimes a single path, often multiple paths (content root + media library root for the same site)
  4. Tick the correct permission type — CSD access (Read + Write) or CSD Admin (6 rights), with inheritance enabled so child items pick it up
  5. Repeat for every path in the request — a single request often covers 2–4 paths
  6. Repeat the whole thing for every role — some requests cover multiple roles at once
  7. Verify the rules were applied correctly and propagated as expected

The hidden cost: this work required a developer. It was not something a BA or project manager could safely do through the Sitecore UI. Every request became a ticket, a context switch, an interruption to actual development work — adding zero feature value, carrying real risk of human error.

Figure 1 — The same CSD access request: a 5-step manual process taking 15–20 minutes vs a single natural language prompt taking under 1 minute
Figure 2 — Developer hours spent on CSD access management. The onboarding scenario (30–40 requests) sees the greatest saving: 5+ hours to ~45 minutes

The After: Natural Language + MCP

With the Sitecore MCP Server connected to VSCode, the same work now looks like this:

I need to set up CSD access for the "cgdev" team on the DemoSite.

1. Search for Sitecore roles matching "cgdev" to find the exact role names.
2. Grant CSD access (Read and Write) for the found roles on:
- /sitecore/content/DemoSite
- /sitecore/media library/DemoSite
3. Also grant CSD Admin access to any role matching "cgadmin" on the same paths.

GitHub Copilot in agent mode chains the tool calls in sequence — search, then grant, then confirm — and summarises the result. The whole thing takes under a minute. No Security Editor. No navigation. No repeated clicking across paths and roles.

The CSD Tools — Five Tools That Changed My Daily Workflow

The server exposes five tools specifically for CSD role access management. Here is each one in detail.

Figure 3 — Grant flow (top) and revoke flow (bottom). Both start with SearchCsdRole to confirm the exact identity. The no-Deny constraint in the revoke tools is enforced in code — not a prompt instruction

SearchCsdRole — Find the exact role identity first

Before granting or revoking access, you need the exact role identity string — including the domain prefix. On a real project with multiple domains (sitecore\, cog\, client-specific), guessing is error-prone.

This tool searches across all Sitecore domains by partial name match and returns the exact identities.

Search for Sitecore roles matching the name "cgdev".

Returns results like sitecore\cgdev, cog\cgdeveloper — whichever match. You pass those exact strings to the grant or revoke tools. This one step alone eliminates a common class of access mistakes.

GrantCsdAccess — Read + Write with inheritance

Grants CSD access (Read and Write) to one or more roles across one or more content paths. All rules apply with PropagationType Any, meaning they inherit to all child items automatically.

Grant CSD access for the role "sitecore\cgdev" on the following paths:
- /sitecore/content/DemoSite
- /sitecore/media library/DemoSite

You can also pass multiple roles at once. What used to be 4 separate Security Editor operations — 2 roles × 2 paths — is now one prompt.

Safety behaviour: paths that do not exist in Sitecore are reported as PathNotFound and skipped. The tool never silently fails and never applies partial access without telling you.

GrantCsdAdminAccess — Full admin rights with inheritance

Grants full CSD Admin access — Read, Write, Rename, Create, Delete, and Administer — with inheritance. Used for roles that need full editorial control over a site section, not just content authoring. Previously this required manually ticking six checkboxes per role per path in the Security Editor — easy to miss one under time pressure.

Grant CSD Admin access to the role "sitecore\cgadmin" on /sitecore/content/DemoSite 
and /sitecore/media library/DemoSite.

RevokeCsdAccess — Remove Read + Write safely

Removes CSD Read and Write Allow rules from roles on specified content paths. Designed for offboarding team members or restructuring access when a content section is reorganised.

Revoke CSD access for "sitecore\cgdev" on /sitecore/content/DemoSite 
and /sitecore/media library/DemoSite.

The most important design decision in this tool: it reads the item’s explicit ACL, filters out only the target Allow entries for the specified role, and resets the ACL with those entries removed. No Deny rules are ever written. A mistake during a revoke operation should never lock someone out of Sitecore content unexpectedly. This constraint is enforced in code — it cannot be overridden by a prompt.

If a role had no rules on an item, the tool reports RulesRevoked: 0 for that path and continues. It never fails silently.

RevokeCsdAdminAccess — Remove all 6 admin rights safely

Same safe revoke behaviour, but targets all six CSD Admin rights. Used when a role is being downgraded from admin to standard CSD access, or fully removed from a section.

Revoke all CSD Admin permissions for "sitecore\cgadmin" on /sitecore/content/DemoSite.

CSD Access Rights Reference

Figure 4 — CSD grants Read + Write. CSD Admin grants all 6 rights. Both propagate to all descendants automatically

How the CSD Tools Work Under the Hood

The CSD tools build inline SPE (Sitecore PowerShell Extensions) scripts at call time and execute them through the same PowerShell remoting client used by the RunSitecorePowerShellScript tool.

  • Role searches use Get-Role -Filter with the partial name you provide
  • Access grants use New-ItemAcl and Add-ItemAcl with PropagationType Any
  • Access revokes read the item’s full explicit ACL, filter out the target Allow entries for the specified role, and apply the cleaned ACL back with Set-ItemAcl — no Deny rules are ever constructed or written

The Time Saving — In Real Numbers

Across a normal working week, that is roughly 8–10 hours of developer time moving from access management back to actual development work.

The Other Tools in the Server

Figure 5 — All 8 tools across 4 areas. CSD tools are the most project-specific; GraphQL, Item Service, and PowerShell cover broader daily Sitecore interactions

QuerySitecoreGraphQl

Run any GraphQL query against a Sitecore schema (edge, master, core). Handles the HTTP POST with the sc_apikey header. Supports variables and schema introspection.

Query the Sitecore Home item via GraphQL using the path /sitecore/content/Home in English.

Run a Sitecore GraphQL introspection query to list all available types on the edge schema.

GetSitecoreItemByPath

Retrieve a Sitecore item and all its fields by content tree path using the Item Service API (SSC). Supports any database and language.

Get the Sitecore item /sitecore/content/Home from the web database and tell me 
if it has been published — check the __Updated field.

RunSitecorePowerShellScript

Execute any script via SPE remoting — the most open-ended tool in the set. Copilot constructs the script from your intent, or you write it yourself.

Run a Sitecore PowerShell script to get all direct children of /sitecore/content/Home 
and return their Name, ID, and TemplateName as JSON.

Run a Sitecore PowerShell script to clear all Sitecore caches on the CM server.

Program.cs — How It All Wires Up

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

var builder = Host.CreateApplicationBuilder(args);
// All logs to stderr - stdout is reserved for MCP protocol messages
builder.Logging.AddConsole(o => o.LogToStandardErrorThreshold = LogLevel.Trace);
builder.Services
.AddMcpServer()
.WithStdioServerTransport()
.WithTools<GraphQlTools>()
.WithTools<ItemServiceTools>()
.WithTools<PowerShellTools>()
.WithTools<CsdAccessTools>();
await builder.Build().RunAsync();

Each tool class registered independently with .WithTools<T>(). Adding a new tool category is one line.

Prerequisites

  • .NET 8 SDK
  • Sitecore XP or XM CM instance with GraphQL endpoint enabled, Item Service (SSC) enabled, and SPE installed with remoting enabled

Getting Started

git clone https://github.com/gaurarun777/sitecore-mcp.git
cd sitecore-mcp

Open in VSCode — the .vscode/mcp.json prompts for all credentials interactively when the server starts. Nothing sensitive is hardcoded.

⭐ github.com/gaurarun777/sitecore-mcp

Key Lessons from Building This

Design safety into the tool, not into the prompt

The no-Deny-rules constraint in the CSD revoke tools is enforced in code. It cannot be overridden by any prompt. On tools that touch access control, safety behaviour belongs in the implementation — not in hoping the caller remembers the right instruction.

Search before act

The SearchCsdRole tool exists for a reason. Role names across multiple Sitecore domains are easy to misremember. Searching first and confirming the exact identity before granting or revoking is the difference between a clean operation and an access mistake that takes time to diagnose and fix.

Repetitive work is the right first target

The CSD tools did not replace complex, high-judgment Sitecore development work. They replaced work that was clearly repetitive, time-consuming, and low-judgment — the kind where the value is accuracy and speed, not deep thinking. That is always the right first target for any automation.

One prompt can chain multiple tool calls

Copilot in agent mode chains tool calls automatically. You do not need to build orchestration into the server. Design tools to be focused and single-purpose — let the AI chain them together in response to a compound prompt.

The Full Journey

When I sat in that SUGCON India 2026 session, I wasn’t thinking about access management scripts. But when I looked at where developer time was actually going on the project, the answer was obvious. The MCP server did not solve an interesting engineering problem — it solved a real, daily, expensive one.

That is probably the most useful thing you can build.

Till then, Happy Sitecoring! 😊

References:
github.com/gaurarun777/sitecore-mcp
Microsoft Learn — Build MCP Server with C#
Flux Digital — Sitecore MCP Server with XP + VSCode & CoPilot
Anton Tishchenko — mcp-sitecore-server (GitHub)
SUGCON India 2026 — sitecoreknowledgeshare.blogspot.com

Monday, June 8, 2026

SUGCON India 2026 — My Key Takeaways from Two Days in Delhi

 

Hello Sitecorian Community,

SUGCON (Sitecore User Group Conference) India 2026 just wrapped up in Delhi on June 4–5, and what an incredible two days it was!

If you couldn’t make it this year, or if you attended and want a structured recap of everything that happened — this post is for you. I’m going to walk through the biggest announcements, the sessions that stood out, and what I personally think you should be paying attention to as a Sitecore practitioner right now.

Let’s dive in. 🚀

🔷 The Big Announcement: Sitecore vNext

If there was one topic that had every room buzzing at SUGCON India 2026, it was Sitecore vNext.

The next major evolution of the Sitecore Platform DXP is officially on the horizon — and here’s what makes it genuinely exciting: it’s not the kind of “upgrade” that forces you to rewrite everything overnight.

What we know about vNext so far:

  • Built on a modern .NET foundation, fully aligned with Microsoft’s long-term roadmap
  • Uses the Strangler Fig pattern for gradual modernization — you adopt new capabilities at your own pace, alongside your existing implementation
  • No forced migrations, no massive rewrites
  • AI-powered authoring experiences built in from the start
  • A refreshed Content Editor and Experience Editor experience
  • Support for Windows Server 2025, SQL Server 2025, Solr 10, and .NET 10
🔥 What really got the room talking: The Strangler Fig approach means organisations can introduce vNext capabilities gradually — running them alongside what they already have, and transitioning components when the time is right for them. That’s a massive shift from the traditional “big bang” upgrade model Sitecore customers have been used to.

And the bridge to get there? Sitecore 10.5.

Sitecore 10.5 is the next stepping stone and it’s already delivering AI-powered authoring capabilities as a preview of what vNext will bring at scale.

✅ Three Things You Can Start Doing Right Now

  1. Build clean separation between your Sitecore implementation and custom code — this is what makes the Strangler Fig approach actually work
  2. Stay current — 10.4 and 10.5 are key modernization milestones, don’t fall behind
  3. Invest in automation — DevOps pipelines, CI/CD, and regression testing will be your best friends during any gradual migration

🔷 AI Is Moving From Buzzword to Engineering Discipline

This was the theme that ran through almost every technical session at SUGCON India 2026: AI has moved out of the slide deck and into the codebase.

The conversations weren’t about whether to use AI. They were about how to engineer with it properly.

Two sessions stood out here in particular.

Building AI-Powered Migration Engines with MCP

The Model Context Protocol (MCP) is enabling a genuinely new class of developer tools. Sessions at SUGCON showed teams using MCP to build migration engines that dramatically cut the time and risk of moving content and configurations across Sitecore environments.

What used to be weeks of careful manual work is being transformed into guided, AI-assisted workflows. For anyone who has managed a large content migration on a Sitecore project — you’ll understand just how significant that is.

Building Hallucination-Safe AI Assistants

This was one of the most practically useful sessions of the conference.

Building AI assistants on top of a DXP is only valuable if those assistants can be trusted. Speakers walked through architectural patterns for:

  • Grounding AI responses in verified, approved content sources
  • Implementing guardrails that prevent out-of-scope or incorrect responses
  • Designing systems that fail gracefully — rather than confidently generating wrong answers
⚠️ Key insight from this session: The shift isn’t just about adding AI to your implementation. It’s about treating AI as an engineering discipline with proper reliability, testing, and governance built in from day one.

🔷 XM Cloud and Headless: Maturing Faster Than You Might Think

For developers in the headless space, the XM Cloud and Next.js sessions offered some of the most immediately actionable content of the two days.

The state of headless Sitecore in mid-2026 is genuinely more mature than it was even 12 months ago. Sessions covered:

  • Next.js performance optimization for Sitecore-powered sites — tackling real-world bottlenecks around rendering strategies, edge caching, and ISR/SSR tradeoffs
  • Composable DXP architecture patterns that are proving out at scale in production environments
  • Developer experience improvements in XM Cloud — local development tooling, component scaffolding, and how teams are structuring their headless codebases for maintainability

The clearest signal from these sessions: headless isn’t the “advanced” or “optional” approach anymore. It’s becoming the default, and the ecosystem tooling around it is catching up fast.

✅ Tip: If you’re still on a traditional Sitecore rendering model and haven’t started exploring a composable path yet, now is the time to start. The XM Cloud ecosystem is ready.

🔷 The Community: Still What Makes SUGCON Special

I’d be doing a disservice to the conference if I only talked about the technology.

What makes SUGCON India genuinely different from any other enterprise tech event is the people — and the culture of openness they’ve built together. Sitecore MVPs, architects, developers, and product leaders all in the same space, sharing knowledge freely, asking hard questions, and genuinely helping each other figure things out.

This edition had a particularly meaningful moment: a heartfelt farewell to Tamas Varga, whose energy and vision have shaped the SUGCON community for years. And a warm welcome to Sebastian Winter, stepping into his new leadership role — wishing him the very best as he continues building on that momentum.

A huge shoutout to the organizing committee who made this all happen in Delhi:

Sakshi Khurana, Sean Broderick, Rob Earlam, Hardeep Bhamra, Vikas Kumar, Yamini Punyavathi Muttevi, Raman Gupta — and every volunteer and sponsor who contributed behind the scenes.

And to the sponsors — Horizontal Digital, Altudo, Arroact Technologies, BIZTECHNOSYS, Codehouse, EPAM Systems, and Techxot — thank you for supporting the community.

🔷 My Personal Takeaways — What I’m Doing Differently Now

Here’s what I’m taking back to the desk and actually acting on:

On vNext and platform modernization: Start getting familiar with the Strangler Fig approach now — don’t wait for a migration to be forced. Understanding the pattern early means you can start shaping your current implementation to support it.

On AI: Move past experimentation. If you’re building anything with AI in the Sitecore space, invest in understanding MCP and hallucination-safe design patterns. The maturity bar for production AI implementations is rising quickly.

On headless and XM Cloud: If you haven’t started the composable journey yet, the ecosystem is ready for you. The tooling, patterns, and community knowledge are all there now.

On community: Show up. Whether at SUGCON, local Sitecore user groups, or online forums — the knowledge shared in this community is one of the most underrated resources in the Sitecore ecosystem, and it only works because people contribute to it.

Wrapping Up

SUGCON India 2026 was a reminder that the Sitecore ecosystem isn’t standing still. vNext signals a platform team that has listened carefully to years of community feedback and is building for the next decade — not defending the last one.

The combination of modern .NET foundations, AI woven thoughtfully into the platform, and a maturing headless ecosystem makes the next 12–18 months a genuinely exciting time to be working in this space.

I hope this recap was useful — whether you attended and want to consolidate your notes, or you couldn’t make it and wanted a proper rundown of what happened.

Stay tuned for more Sitecore articles, tips, and deep-dives right here on the blog.

Till then, Happy Sitecoring! 😊

Did you attend SUGCON India 2026? What was your biggest takeaway? Drop it in the comments below — I’d love to hear from you!