Develop widgets with Sitefinity MCP Server
Overview
Using the Sitefinity MCP (Model Context Protocol) server for generating ASP.NET Core and Next.js widgets, you utilize the power of Large Language Models (LLM) to quickly and easily generate new widgets for your decoupled renderer project.
This way, you can start enriching your project based on decoupled renderer architecture with new widgets immediately.
First, you describe to an LLM your business needs. For example – create a carousel widget with image, title, and two buttons. Then, using the MCP protocol, the Sitefinity MCP server generates all the required code and configurations in your editor.
This feature enables faster testing and iteration, faster team scaling, and enables new developers to contribute from day one.
Sitefinity MCP server enriches the IDEs you are using with specific knowledge about Sitefinity CMS, thus, the code and configuration it creates align with Sitefinity’s widget structure, naming conventions, and rendering logic. It follows the best practices and feels natural to the underlying platform.
In this sample, you learn how to configure Sitefinity MCP Server in your editor of choice and create a Next.js widget using prompting.
PREREQUISITES: To use this sample, you must comply with the following:
- To develop Next.js widgets, you must have installed Sitefinity CMS 15.2 or later
- To develop ASP.NET Core widgets, you must have installed Sitefinity CMS 14.4 or later
- You must have an existing project using either Sitefinity Next.js or ASP.NET Core renderer.
For more information, see Develop with Next.js and Develop with ASP.NET Core.- The sample assumes you are using Visual Studio Code (VS Code).
You can use any MCP-enabled development environment, such as Cursor or Windsurf, but you have to adjust the procedure accordingly.
Procedure
This sample guides you to configure your development environment using VS Code to start building Sitefinity widgets with the hosted MCP server.
Perform the following:
-
Open your decoupled renderer project in VS Code. Both ASP.NET Core and Next.js are supported.
-
Add the Sitefinity MCP Server:
-
Open the Command Palette (under Windows, press
Ctrl+Shift+P). -
In the Command palette, enter
MCP:Add Server… -
Select HTTP (HTTP or Server-Sent Events)
-
In URL of the MCP Server, enter the URL of the corresponding Sitefinity MCP Server.
For developing with Next.js, enterhttps://mcp.sitefinity.cloud/nextjs-widgets.
For developing with ASP.NET Core, enterhttps://mcp.sitefinity.cloud/netcore-widgets. -
Set a name of your MCP server. For example,
mcp-widgets. -
For Configuration target, select
Global.RESULT: The
mcp.jsonfile opens in a new tab. It contains the MCP server you have configured. -
In the
mcp-widgetsobject, add the headers object, containing thex-sitefinity-urlproperty. You set the value of this property to the URL of the API endpoint exposed by your Sitefinity CMS instance.
For example, if your Sitefinity is hosted onwww.example.comand you have named your MCP servermcp-widgets, the JSON should look like the following.
For Next.js:JSON{ "servers": { "mcp-widgets": { "url": "https://mcp.sitefinity.cloud/nextjs-widgets/", "type": "http", "headers": { "x-sitefinity-url": "https://www.example.com/api/default" } } } }For ASP.NET Core:
JSON{ "servers": { "mcp-widgets": { "url": "https://mcp.sitefinity.cloud/netcore-widgets/", "type": "http", "headers": { "x-sitefinity-url": "https://www.example.com/api/default" } } } }
-
-
Start the MCP server connection.
If you have just added the MCP Server using the procedure in Step 2, the MCP server is automatically started and you can skip this procedure.
Use this procedure to start the MCP server manually.
Perform the following:-
Open the Command Palette (under Windows, press
Ctrl+Shift+P). -
In the Command palette, enter
MCP:List Servers… -
Select the MCP server that you configured in Step 2.
For example, selectmcp-widgets. -
Click Start Server.
NOTE: If the server has already been started, the Start Server option is unavailable.
-
To open the Chat panel, click View » Chat.
-
To select Agent mode, in the Chat panel, click
(Set Agent) and select Agent. -
Optionally, configure the used LLM by clicking the Models button in the Chat panel.
-
RESULT: Your Sitefinity MCP Server is ready. You can start prompting it and create widgets.
Example
To build a carousel widget, perform the following:
-
In the Chat panel, enter
Create a carousel widget with an image, title, and two buttons. -
When Copilot asks you for confirmation, use the dropdown box to select one of the Allow options, then click Continue.
If you intend to use the Sitefinity MCP Server multiple times in your project, we recommend using the Allow in this workspace option.
For more information, see Visual Studio Code documentation » Approvals & Permissions. -
When prompted about changed files in the Chat panel, click Keep.
-
Review the generated code.
IMPORTANT: Sitefinity MCP Server relies on an LLM to generate code. Because LLMs can generate unreliable code, you should always check their output before using it in a production project.
-
Navigate to your Sitefinity CMS backend using your decoupled renderer as a proxy.
-
Open or create a new page, based on a renderer template that uses the same technology as the one you used to create the widget.
For example, if you used Sitefinity MCP Server to create a widget based on ASP.NET Core, you must use an ASP.NET Core-based renderer and edit ASP.NET Core pages to place the newly generated widget. -
Place the newly generated widget.