|
| 1 | +--- |
| 2 | +title: MCP Server as a NuGet Package |
| 3 | +page_title: Telerik WinForms MCP (Model Context Protocol) Server as a NuGet Package |
| 4 | +description: Learn how to add and use the Telerik WinForms MCP Server via a NuGet package with the dnx command as a WinForms AI coding assistant and code generator for better developer productivity. The Telerik WinForms MCP server provides proprietary context about Telerik UI for WinForms to AI-powered software. |
| 5 | +slug: ai-mcp-server-as-a-nuget |
| 6 | +tags: telerik,winforms,ai,ai server,dotnetWF,coding assistant,nuget |
| 7 | +position: 3 |
| 8 | +--- |
| 9 | + |
| 10 | +# Telerik WinForms MCP Server (NuGet) |
| 11 | + |
| 12 | +The Telerik WinForms [MCP (Model Context Protocol) Server](https://modelcontextprotocol.io/introduction) is also available as a NuGet package. This NuGet distribution exposes the same AI Coding Assistant functionality as the npm package. Beginning with .NET 10 it can be executed directly via the `dnx` command. For .NET 8 and .NET 9 (where `dnx` is not available) you can install it as a local dotnet tool and invoke its executable. |
| 13 | + |
| 14 | +## Prerequisites |
| 15 | + |
| 16 | +To use the Telerik WinForms MCP server via NuGet, you need: |
| 17 | + |
| 18 | +| Target Runtime | Required SDK | Invocation Method | Notes | |
| 19 | +|----------------|--------------|-------------------|-------| |
| 20 | +| .NET 8 / .NET 9 | .NET 8 or .NET 9 SDK | Local dotnet tool (`telerik-winforms-mcp.exe`) | `dnx` not supported; install tool manually | |
| 21 | +| .NET 10 | .NET 10 SDK (Preview 6 or newer) | `dnx` dynamic execution | Simplest approach; no prior install step | |
| 22 | + |
| 23 | +Common requirements: |
| 24 | + |
| 25 | +* An [MCP-compatible client](https://modelcontextprotocol.io/clients) that supports MCP tools (latest version recommended). |
| 26 | +* A WinForms project targeting net8.0-windows, net9.0-windows, or net10.0-windows if you want local project context to be part of AI responses. |
| 27 | +* A valid [Telerik license key]({%slug license-key%}). |
| 28 | + |
| 29 | +## Summary of Installation Approaches |
| 30 | + |
| 31 | +| Aspect | .NET 8 / 9 | .NET 10 | |
| 32 | +|--------|------------|---------| |
| 33 | +| Availability of `dnx` | Not available | Available | |
| 34 | +| Install Command | `dotnet tool install --tool-path ./.tools Telerik.WinForms.MCP` | None (resolved on demand) | |
| 35 | +| Executable Path | `./.tools/telerik-winforms-mcp.exe` | Handled by `dnx` | |
| 36 | +| .mcp.json Command | `.\\.tools\\telerik-winforms-mcp.exe` | `dnx` | |
| 37 | +| .mcp.json Args | _None_ | `Telerik.WinForms.MCP`, `--yes` | |
| 38 | +| Update Version | Re-run tool install with `--version` or `tool update` | Handled by latest package resolved by `dnx` | |
| 39 | +| Offline Use | Requires prior tool install | Requires prior NuGet cache warm-up | |
| 40 | + |
| 41 | +## Server Installation |
| 42 | + |
| 43 | +### .NET 8 / .NET 9 |
| 44 | + |
| 45 | +Install the MCP server as a local tool in your solution root (or another chosen path): |
| 46 | + |
| 47 | +```powershell |
| 48 | +dotnet tool install --tool-path ./.tools Telerik.WinForms.MCP |
| 49 | +``` |
| 50 | + |
| 51 | +If updating: |
| 52 | + |
| 53 | +```powershell |
| 54 | +dotnet tool update --tool-path ./.tools Telerik.WinForms.MCP |
| 55 | +``` |
| 56 | + |
| 57 | +This creates the executable at `./.tools/telerik-winforms-mcp.exe`. |
| 58 | + |
| 59 | +### .NET 10 |
| 60 | + |
| 61 | +No manual install step is needed. The `dnx` command will download and execute the NuGet package on demand. |
| 62 | + |
| 63 | +## Server Configuration |
| 64 | + |
| 65 | +### .NET 8 / .NET 9 Configuration (`.mcp.json`) |
| 66 | + |
| 67 | +Add a `.mcp.json` file to your solution root (or to `%USERPROFILE%` for global usage): |
| 68 | + |
| 69 | +```json |
| 70 | +{ |
| 71 | + "servers": { |
| 72 | + "telerik-winforms-assistant": { |
| 73 | + "type": "stdio", |
| 74 | + "command": ".\\.tools\\telerik-winforms-mcp.exe", |
| 75 | + "env": { |
| 76 | + "TELERIK_LICENSE_PATH": "THE_PATH_TO_YOUR_LICENSE_FILE" |
| 77 | + } |
| 78 | + } |
| 79 | + } |
| 80 | +} |
| 81 | +``` |
| 82 | + |
| 83 | +If you prefer embedding the license string directly: |
| 84 | + |
| 85 | +```json |
| 86 | +"env": { |
| 87 | + "TELERIK_LICENSE": "YOUR_LICENSE_KEY" |
| 88 | +} |
| 89 | +``` |
| 90 | + |
| 91 | +### .NET 10 Configuration (`.mcp.json`) |
| 92 | + |
| 93 | +Use these settings when configuring the server in your MCP client: |
| 94 | + |
| 95 | +| Setting | Value | |
| 96 | +|---------|-------| |
| 97 | +| Package Name | `Telerik.WinForms.MCP` | |
| 98 | +| Type | `stdio` | |
| 99 | +| Command | `dnx` | |
| 100 | +| Arguments | `Telerik.WinForms.MCP`, `--yes` | |
| 101 | +| Server Name | `telerik-winforms-assistant` (customizable) | |
| 102 | + |
| 103 | +### Workspace-Specific Setup |
| 104 | + |
| 105 | +Add a `.mcp.json` file to your solution (root) folder. Choose the variant that matches your target .NET runtime: |
| 106 | + |
| 107 | +#### .NET 8 / .NET 9 Example |
| 108 | + |
| 109 | +```json |
| 110 | +{ |
| 111 | + "servers": { |
| 112 | + "telerik-winforms-assistant": { |
| 113 | + "type": "stdio", |
| 114 | + "command": ".\\.tools\\telerik-winforms-mcp.exe", |
| 115 | + "env": { |
| 116 | + "TELERIK_LICENSE_PATH": "THE_PATH_TO_YOUR_LICENSE_FILE" |
| 117 | + } |
| 118 | + } |
| 119 | + } |
| 120 | +} |
| 121 | +``` |
| 122 | + |
| 123 | +#### .NET 10 Example (using `dnx`) |
| 124 | + |
| 125 | + |
| 126 | +```json |
| 127 | +{ |
| 128 | + "servers": { |
| 129 | + "telerik-winforms-assistant": { |
| 130 | + "type": "stdio", |
| 131 | + "command": "dnx", |
| 132 | + "args": ["Telerik.WinForms.MCP", "--yes"], |
| 133 | + "env": { |
| 134 | + "TELERIK_LICENSE_PATH": "THE_PATH_TO_YOUR_LICENSE_FILE" |
| 135 | + } |
| 136 | + } |
| 137 | + } |
| 138 | +} |
| 139 | + |
| 140 | +``` |
| 141 | + |
| 142 | +You may substitute `TELERIK_LICENSE` instead of `TELERIK_LICENSE_PATH` (see License Configuration section below for details and recommendations). The `inputs` array is optional and not required for current functionality. |
| 143 | + |
| 144 | +After saving the file, restart Visual Studio and enable the `telerik-winforms-assistant` tool in the [Copilot Chat window's tool selection dropdown](https://learn.microsoft.com/en-us/visualstudio/ide/mcp-servers?view=vs-2022#configuration-example-with-github-mcp-server). |
| 145 | + |
| 146 | + |
| 147 | +### Global Setup |
| 148 | + |
| 149 | +To enable the server globally for all projects, add the `.mcp.json` file to your user directory (`%USERPROFILE%`, e.g., `C:\Users\YourName\.mcp.json`). The same distinction applies: use the executable path for .NET 8/9, or `dnx` for .NET 10. |
| 150 | + |
| 151 | +## License Configuration |
| 152 | + |
| 153 | +Add your [Telerik license key]({%slug license-key%}) using one of these options in the `env` section. |
| 154 | + |
| 155 | +__Option 1: License File Path (Recommended)__ |
| 156 | + |
| 157 | +```json |
| 158 | +"env": { |
| 159 | + "TELERIK_LICENSE_PATH": "THE_PATH_TO_YOUR_LICENSE_FILE" |
| 160 | +} |
| 161 | +``` |
| 162 | + |
| 163 | +The `THE_PATH_TO_YOUR_LICENSE_FILE` should point to the `telerik-license.txt` file, usually in the AppData folder. Often it will look like: |
| 164 | + |
| 165 | +`"TELERIK_LICENSE_PATH": "%appdata%/Telerik/telerik-license.txt"` |
| 166 | + |
| 167 | +__Option 2: Direct License Key__ |
| 168 | + |
| 169 | +```json |
| 170 | +"env": { |
| 171 | + "TELERIK_LICENSE": "YOUR_LICENSE_KEY_HERE" |
| 172 | +} |
| 173 | +``` |
| 174 | + |
| 175 | +> Option 1 is recommended unless you're sharing settings across different systems. Remember to [update your license key]({%slug license-key%}#updating-your-license-key) when necessary. |
| 176 | +
|
| 177 | +## See also |
| 178 | + |
| 179 | +* [Telerik WinForms GitHub Copilot Extension]({%slug ai-copilot-extension%}) |
| 180 | +* [AI Coding Assistant Overview]({%slug ai-overview%}) |
| 181 | +* [npm-based Telerik WinForms MCP Server]({%slug ai-mcp-server%}) |
0 commit comments