Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 78 additions & 78 deletions ai-coding-assistant/mcp-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@ An active Telerik Reporting license is required to use the Telerik Reporting MCP
- When installing the MCP server by using the .NET tooling (`dnx` or `dotnet tool install`), the [license key file](slug:license-key) will be retrieved automatically if it is present in the default directory on your system (**%AppData%\Telerik\telerik-license.txt** on Windows and **~/.telerik/telerik-license.txt** on Linux).
- When using the .NET tooling, if your [license key file](slug:license-key) is not in the default directory, you can add the [license key file](slug:license-key) as an environment variable in the `mcp.json` file using one of the following options:

```JSON Path
"env": {
"TELERIK_LICENSE_PATH": "THE_PATH_TO_YOUR_LICENSE_FILE"
}
```
```JSON Inline
"env": {
"TELERIK_LICENSE": "YOUR_LICENSE_KEY_HERE"
}
```
```JSON Path
"env": {
"TELERIK_LICENSE_PATH": "THE_PATH_TO_YOUR_LICENSE_FILE"
}
```
```JSON Inline
"env": {
"TELERIK_LICENSE": "YOUR_LICENSE_KEY_HERE"
}
```

> tip Using a license file path is _recommended_ unless you are sharing settings across different systems. Remember to [update the license key](slug:license-key#updating-your-license-key) when renewing.

Expand All @@ -83,59 +83,59 @@ The Telerik Reporting MCP server is available as a NuGet package: https://www.nu
### Automatic Configuration through the Visual Studio UI

1. Open the Configure MCP server menu in Visual Studio
- Open the [Visual Studio GitHub Copilot Chat](https://learn.microsoft.com/en-us/visualstudio/ide/visual-studio-github-copilot-get-started?view=vs-2022)
- Click on the button at the bottom right corner to open the _Select tools_ context menu.
- Click on the `+` button at the top right corner of the menu to open the _Configure MCP server_ menu.

![Steps to open the Configure MCP server menu in the Visual Studio GitHub Copilot Chat](images/vs-autoinstall-open-mcp-configuration-menu.png)
- Open the [Visual Studio GitHub Copilot Chat](https://learn.microsoft.com/en-us/visualstudio/ide/visual-studio-github-copilot-get-started?view=vs-2022)
- Click on the button at the bottom right corner to open the _Select tools_ context menu.
- Click on the `+` button at the top right corner of the menu to open the _Configure MCP server_ menu.
![Steps to open the Configure MCP server menu in the Visual Studio GitHub Copilot Chat](images/vs-autoinstall-open-mcp-configuration-menu.png)

1. Use the following values for the configuration fields:
- In `Destination` select either _Global-Available in all solutions_ or _Solution-Available in this solution_.
- For `Server ID` use _telerik-reporting-assistant_.
- Select _stdio_ as `Type`.
- The `Command (with optional arguments)` field should contain _dnx Telerik.Reporting.MCP --yes_.
- Click on the `Save` button to preserve the configuration.

![Steps to configure the MCP server in the Visual Studio](images/vs-autoinstall-configure-mcp-server.png)
- In `Destination` select either _Global-Available in all solutions_ or _Solution-Available in this solution_.
- For `Server ID` use _telerik-reporting-assistant_.
- Select _stdio_ as `Type`.
- The `Command (with optional arguments)` field should contain _dnx Telerik.Reporting.MCP --yes_.
- Click on the `Save` button to preserve the configuration.
![Steps to configure the MCP server in the Visual Studio](images/vs-autoinstall-configure-mcp-server.png)

1. Enable the `telerik-reporting-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).

The `telerik-reporting-assistant` tool should now appear in the _Select tools_ context menu. Check it to enable the Telerik Reporting AI Coding Assistant:

![Enable the just added `telerik-reporting-assistant` tool in the Visual Studio](images/vs-autoinstall-enable-reporting-assistant.png)
The `telerik-reporting-assistant` tool should now appear in the _Select tools_ context menu. Check it to enable the Telerik Reporting AI Coding Assistant:
![Enable the just added `telerik-reporting-assistant` tool in the Visual Studio](images/vs-autoinstall-enable-reporting-assistant.png)

### Manual Configuration

The steps below describe the sample procedure for configuring the Telerik Reporting MCP server in Visual Studio.

1. Add an `.mcp.json` file to either of the following locations:
- For a workspace-specific setup, add the file to the solution's folder.
- For a global setup, add the file to your user directory, `%USERPROFILE%` (for example, `C:\Users\YourName\.mcp.json`).
- For a workspace-specific setup, add the file to the solution's folder.
- For a global setup, add the file to your user directory, `%USERPROFILE%` (for example, `C:\Users\YourName\.mcp.json`).

1. Add the following configuration to the `.mcp.json` file:

```JSON .NET 10
{
"servers": {
"telerik-reporting-assistant": {
"type": "stdio",
"command": "dnx",
"args": ["Telerik.Reporting.MCP", "--yes"]
}
}
}
```
```JSON .NET 8/9
{
"servers": {
"telerik-reporting-assistant": {
"type": "stdio",
"command": "dotnet",
"args": ["tool", "run", "telerik-reporting-assistant"]
}
}
}
```
```JSON .NET 10
{
"servers": {
"telerik-reporting-assistant": {
"type": "stdio",
"command": "dnx",
"args": ["Telerik.Reporting.MCP", "--yes"]
}
}
}
```
```JSON .NET 8/9
{
"servers": {
"telerik-reporting-assistant": {
"type": "stdio",
"command": "dotnet",
"args": ["tool", "run", "telerik-reporting-assistant"]
}
}
}
```

1. Restart Visual Studio.
1. Enable the `telerik-reporting-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).
Expand Down Expand Up @@ -173,8 +173,8 @@ The `Add/Update GitHub Copilot Instructions` option is visible only if you have
After configuration and restart:

1. Open Copilot Chat.
2. Enable the `telerik-reporting-assistant` tool.
3. Grant permissions when prompted (_per session, workspace, or always_).
1. Enable the `telerik-reporting-assistant` tool.
1. Grant permissions when prompted (_per session, workspace, or always_).

![An image demonstrating how to allow the usage of the Telerik Reporting MCP tool in the VS Copilot Chat](images/mcp-images/vs-allow-reporting-mcp-tool.png)

Expand All @@ -192,38 +192,38 @@ The basic setup in Visual Studio Code involves the following steps:
1. Enable [`chat.mcp.enabled`](vscode://settings/chat.mcp.enabled) in Visual Studio Code settings.
1. Create `.vscode/mcp.json` in your workspace root (or user folder for global setup).

The settings below allow you to use the `#telerik-reporting-assistant` handle to call the Telerik Reporting MCP server. To use a custom handle, change the server name in the `mcp.json`.
The settings below allow you to use the `#telerik-reporting-assistant` handle to call the Telerik Reporting MCP server. To use a custom handle, change the server name in the `mcp.json`.

```JSON .NET 10
{
"servers": {
"telerik-reporting-assistant": {
"type": "stdio",
"command": "dnx",
"args": ["Telerik.Reporting.MCP", "--yes"]
```JSON .NET 10
{
"servers": {
"telerik-reporting-assistant": {
"type": "stdio",
"command": "dnx",
"args": ["Telerik.Reporting.MCP", "--yes"]
}
}
}
}
```
```JSON .NET 8/9
{
"servers": {
"telerik-reporting-assistant": {
"type": "stdio",
"command": "dotnet",
"args": ["tool", "run", "telerik-reporting-assistant"]
```
```JSON .NET 8/9
{
"servers": {
"telerik-reporting-assistant": {
"type": "stdio",
"command": "dotnet",
"args": ["tool", "run", "telerik-reporting-assistant"]
}
}
}
}
```
```

1. For global discovery, enable [`chat.mcp.discovery.enabled`](vscode://settings/chat.mcp.discovery.enabled) in `settings.json`:

```JSON
{
"chat.mcp.discovery.enabled": true
}
```
```JSON
{
"chat.mcp.discovery.enabled": true
}
```

1. Restart Visual Studio Code.

Expand Down Expand Up @@ -269,9 +269,9 @@ To use the Telerik Reporting MCP Server:
1. Choose your preferred mode and model.<br/>At the time of publishing, **Claude Sonnet 4** and **GPT-5** produce optimal results.
1. Start your prompt with `#telerik-reporting-assistant` (or with '#' followed by your [custom MCP server name](#configuration), if set):
1. Inspect the output and verify that the MCP server is used. Look for messages similar to the ones below:
- Visual Studio: `Running telerik-reporting-assistant`
- Visual Studio Code: `Running telerik-reporting-assistant`
- Cursor: `Calling MCP tool telerik-reporting-assistant`
- Visual Studio: `Running telerik-reporting-assistant`
- Visual Studio Code: `Running telerik-reporting-assistant`
- Cursor: `Calling MCP tool telerik-reporting-assistant`

1. If the Telerik Reporting MCP server is not used even though it's installed and enabled, double-check the server name in your configuration and try rephrasing your prompt.
1. If requested, grant the Telerik Reporting MCP Server permissions to run for this session, workspace, or always.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,7 @@ We will use the **AdventureWorks** sample database and the [Telerik Report Desig
1. Cancel the Telerik Report Wizard, because it would not be needed for the current example.
1. Start the CrossTab Wizard and create a new SqlDataSource with the following select statement:

```SQL
SELECT
C.FirstName + ' ' + COALESCE (C.MiddleName, '') + ' ' + C.LastName AS SalesPersonName
, YEAR(SOH.OrderDate) as OrderYear
, PC.Name as CategoryName
FROM
Sales.SalesPerson AS SP
INNER JOIN Sales.SalesOrderHeader AS SOH ON SOH.SalesPersonID = SP.SalesPersonID
INNER JOIN Sales.SalesOrderDetail AS SOD ON SOD.SalesOrderID = SOH.SalesOrderID
INNER JOIN Production.Product AS P ON P.ProductID = SOD.ProductID
INNER JOIN Production.ProductSubcategory AS PSC ON PSC.ProductSubcategoryID = P.ProductSubcategoryID
INNER JOIN Production.ProductCategory AS PC ON PC.ProductCategoryID = PSC.ProductCategoryID
INNER JOIN HumanResources.Employee AS E ON E.EmployeeID = SP.SalesPersonID
INNER JOIN Person.Contact AS C ON C.ContactID = E.ContactID
```

{{source=CodeSnippets\CS\SQL\SelectSalesPersonByYear.sql}}
1. On the following page add the **SalesPersonName** field to the **RowGroups** box, **OrderYear** to the **Column Groups** box and the **CategoryName** field to the **Detail Values** box, where it will be automatically changed to **Count(CategoryName)**. After the wizard ends, you can make some design adjustments to the generated crosstab to make it look better.
1. Set the row group's **Filters** to `"Count(Fields.CategoryName) Top N =5"`. Your group properties should now be set like this:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,7 @@ When complicated logic should be applied or.NET framework routines need to be ut
1. Add an SqlDataSource connected to **AdventureWorks** sample database and set it as a report's datasource.
1. Put the following text in the SqlDataSource's SelectCommand value:

```SQL
select Contact.*
from Person.Contact
where Contact.AdditionalContactInfo is not null
```

{{source=CodeSnippets\CS\SQL\SelectContactsWithAdditionalInfo.sql}}
1. Place two textboxes on your report’s detail section.
1. Set the first textbox's expression to

Expand Down Expand Up @@ -93,13 +88,7 @@ The following screenshot shows the expected report output that should be created
1. Create or open an existing report.
1. Add an SqlDataSource as a report's DataSource and set its SelectCommand property to:

```SQL
select top 100 Product.Name, Product.ProductNumber, Product.Color, Product.SafetyStockLevel
from Production.Product
where Product.Color is not null
order by Product.Name, Product.Color
```

{{source=CodeSnippets\CS\SQL\SelectTop100ColoredProducts.sql}}
1. Place two textboxes on your report's detail section and set their expressions to

`= Fields.Name`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
---
title: Connecting to OLAP Database
page_title: Connecting CubeDataSource to OLAP Database
description: "Learn how to use the configured Telerik Reporting CubeDataSource component to connect to an OLAP database."
Expand All @@ -21,16 +21,7 @@ The sample code below illustrates how to connect a `CubeDataSource` component to

Instead of setting connection strings as property settings in the __CubeDataSource__ object, you can store them centrally as part of your application's configuration settings using the `connectionStrings` configuration element. This enables you to manage connection strings independently of your reports, including encrypting them using __Protected Configuration__. The following example shows how to connect to the __Adventure Works DW 2008R2__ sample database using a connection string which stored in the `connectionStrings` configuration element named __MyAdventureWorksDW__:

````XML
<configuration>
<connectionStrings>
<add name="MyAdventureWorksDW"
connectionString="Data Source=localhost;Initial Catalog=Adventure Works DW 2008R2"
providerName="Microsoft.AnalysisServices.AdomdClient" />
</connectionStrings>
</configuration>
````

{{source=CodeSnippets\MvcCS\XmlConfiguration\CubeDataSourceConfiguration.xml region=CubeDataSourceConfiguration}}
When the connection string is stored in the configuration file you need to specify the name of the configuration element as a value for the `ConnectionString` property of the `CubeDataSource` component:

{{source=CodeSnippets\CS\API\Telerik\Reporting\CubeDataSourceSnippets.cs region=ConnectionNameSnippet}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@ You can specify an __MDX__ query for the `CubeDataSource` component to execute b

The following example demonstrates an __MDX__ query that retrieves a result set consisting of product sales grouped by category and subcategory:

````SQL
select non empty { [Measures].[Sales Amount] } on columns,
non empty { [Product].[Category].[Category] *
[Product].[Subcategory].[Subcategory] } on rows
from [Adventure Works]
````

{{source=CodeSnippets\CS\SQL\MdxSalesAmountByCategory.sql}}
The next code sample illustrates how to set the `ConnectionString` and `SelectCommand` properties of a `CubeDataSource` component to retrieve the data from the above __MDX__ query:

{{source=CodeSnippets\CS\API\Telerik\Reporting\CubeDataSourceSnippets.cs region=SelectCommandSnippet}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,15 @@ The `CubeDataSource` component supports parameterized __MDX__ queries by associa

When creating a parameterized query, you identify the parameter name by prefixing the name with the *"@"* character. For example, *"@Year"* would be a valid parameter name. __MDX__ supports only parameters for literal or scalar values. To create a parameter that references a member, set, or tuple, you would have to use a function such as __StrToMember__ or __StrToSet__. To illustrate this, let us define a simple __MDX__ query that selects product sales grouped by category and subcategory, and define a slicing axis by year, where the chosen year is specified as a parameter. Since the *"@Year"* parameter is passed as a string literal value, we need to use the __StrToMember__ function to convert that value to a valid member of the cube as shown below:

````SQL
select non empty { [Measures].[Sales Amount] } on columns,
non empty { [Product].[Category].[Category] *
[Product].[Subcategory].[Subcategory] } on rows
from [Adventure Works]
where StrToMember(@Year)
````

{{source=CodeSnippets\CS\SQL\MdxSalesAmountFilterByMember.sql}}
The following code sample illustrates how to pass a value to the *"@Year"* parameter of the query using the `Parameters` collection of the `CubeDataSource` component:

{{source=CodeSnippets\CS\API\Telerik\Reporting\CubeDataSourceSnippets.cs region=SingleValueParameterSnippet}}
{{source=CodeSnippets\VB\API\Telerik\Reporting\CubeDataSourceSnippets.vb region=SingleValueParameterSnippet}}

When you need to pass multiple values as a single parameter to the query, use the __StrToSet__ function instead. For example, to pass several years for the slicing axis at once, we can modify the previous query as shown below:

````SQL
select non empty { [Measures].[Sales Amount] } on columns,
non empty { [Product].[Category].[Category] *
[Product].[Subcategory].[Subcategory] } on rows
from [Adventure Works]
where StrToSet(@Year)
````

{{source=CodeSnippets\CS\SQL\MdxSalesAmountFilterBySet.sql}}
Now it is possible to assign an array of years to the data source parameter:

{{source=CodeSnippets\CS\API\Telerik\Reporting\CubeDataSourceSnippets.cs region=MultiValueParameterSnippet}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ Another common problem is related to the lazy loading feature of the [ADO.NET E

The above expression relies upon the built-in lazy loading mechanism to obtain the `ProductSubcategory` entity for the current `Product` entity via the corresponding relation property, and then the `ProductCategory` entity for the current `ProductSubcategory` entity. While convenient, lazy loading requires additional round-trips to the database for the entities that are not present in memory. If this happens frequently it might significantly impact the performance of the report. To overcome this you can try performing eager loading of the entities instead. For example, the following statement uses the Include method to preload the `ProductSubcategory` and the `ProductCategory` entities while retrieving the `Product` entities:

````C#
```C#
this.Products.Include("ProductSubcategory").Include("ProductSubcategory.ProductCategory").ToList();
````
````VB
```
```VB.NET
Me.Products.Include("ProductSubcategory").Include("ProductSubcategory.ProductCategory").ToList()
````
```

However in certain scenarios eager loading might be costly too. Given the previous example, we materialize all `ProductSubcategory` and `ProductCategory` entities only to show the category name of each product. This means a lot of unnecessary data is downloaded from database just to be discarded later. The most flexible and efficient method for retrieving data from the __Entity Data Model__ is to execute a custom query against the entities. The following sample method uses a __LINQ__ query to obtain only the necessary data for the report and then packs it into a collection of __POCOs:__

Expand All @@ -53,4 +53,3 @@ The sample code that binds the EntityDataSource component to that method is show

{{source=CodeSnippets\CS\API\Telerik\Reporting\EntityDataSourceSnippets.cs region=LinqBindingSnippet}}
{{source=CodeSnippets\VB\API\Telerik\Reporting\EntityDataSourceSnippets.vb region=LinqBindingSnippet}}

Loading