# 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 use the power of Large Language Models (LLM) to quickly and easily generate new widgets for your project.

This way, you can start enriching your ASP.NET Core / Next.js project 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 experimentation and iteration, faster team scaling, and enables new developers to contribute from day one.

The Sitefinity MCP server enriches the IDEs you are using with specific knowledge about Sitefinity CMS application. Therefore, 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 the included example, you will learn how to configure the Sitefinity MCP Server in your editor of choice and create a widget using prompting.

> info **PREREQUISITES**:
>
> * To develop Next.js widgets, you need Sitefinity CMS 15.2 or newer version.
> * You must have an existing project using either Next.js or ASP.NET Core Renderers.\
>   For more information, see [Set up the project for local development (using ASP.NET Core Renderer)](https://www.progress.com/documentation/sitefinity-cms/cloud/develop-and-deploy/set-up-the-project-for-local-development--using-asp.net-core-renderer-) and [Set up the project for local development (using Next.js Renderer)](https://www.progress.com/documentation/sitefinity-cms/cloud/develop-and-deploy/set-up-the-project-for-local-development--using-next.js-renderer-).
> * The sample assumes you are using [Visual Studio Code](https://code.visualstudio.com/) (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 Sitefinity MCP server.\
Perform the following:

1. Open your ASP.NET Core / Next.js project in VS Code.

2. Add the Sitefinity MCP Server:
   1. Open the *Command Palette* (under Windows, press `Ctrl+Shift+P`).
   2. In the *Command palette*, enter `MCP:Add Server…`
   3. Select *HTTP (HTTP or Server-Sent Events)*.
   4. For a *URL of the MCP Server*, enter the URL of the corresponding Sitefinity MCP Server.\
      For developing with Next.js, enter `https://mcp.sitefinity.cloud/nextjs-widgets/`.\
      For developing with ASP.NET Core, enter `https://mcp.sitefinity.cloud/netcore-widgets/`.
   5. Set a name of your MCP server.\
      For example, `mcp-widgets`.
   6. For *Configuration target*, select `Global`.

      > success **RESULT**: The `mcp.json` file opens in a new tab. It contains the MCP server you have configured.
   7. In the `mcp-widgets` object, add the headers object, containing the `x-sitefinity-url` property. 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 on `www.example.com` and you have named your MCP server `mcp-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"
                  }
              }
          }
      }
      ```

3. 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:
   1. Open the *Command Palette* (under Windows, press `Ctrl+Shift+P`).
   2. In the *Command palette*, enter `MCP:List Servers…`
   3. Select the MCP server that you configured in *Step 2*.\
      For example, select `mcp-widgets`.
   4. Click *Start Server*.

      > info **NOTE**: If the server has already been started, the *Start Server* option is unavailable.
   5. To open the *Chat* panel, click *View » Chat*.
   6. To select Agent mode, in the *Chat* panel, click [![Set Agent](https://www.progress.com/documentation/sitefinity-cms/cloud/assets/7040a6f459ea2768875f401bec34e88d/vscode-agent-button.png "Set Agent")](https://www.progress.com/documentation/sitefinity-cms/cloud/assets/7040a6f459ea2768875f401bec34e88d/vscode-agent-button.png) *(Set Agent)* and select *Agent*.
   7. Optionally, configure the used LLM by clicking the *Models* button in the *Chat* panel.

> success **RESULT**: Your Sitefinity MCP Server is ready. You can start prompting it and generate new widgets.

## Example

To build a carousel widget, perform the following:

1. In the *Chat* bubble, enter `Create a carousel widget with an image, title, and two buttons`.
2. When Copilot asks you for confirmation, use the dropdown 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](https://code.visualstudio.com/docs/agents/run/approvals).
3. When prompted about *changed files* in the *Chat* panel, click *Keep*.
4. Review the generated code.
   > important **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.
5. Navigate to your Sitefinity backend using your local decoupled Renderer as a proxy.
6. 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 have created a widget with Sitefinity MCP Server 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.
7. Place the newly generated widget.
