Skip to content

Commit 4e6589b

Browse files
authored
Add dashboard MCP server (#12148)
1 parent c05b6d2 commit 4e6589b

File tree

84 files changed

+2383
-602
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+2383
-602
lines changed

Directory.Packages.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@
9797
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components" Version="4.13.0" />
9898
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.Icons" Version="4.13.0" />
9999
<PackageVersion Include="Milvus.Client" Version="2.3.0-preview.1" />
100-
<PackageVersion Include="ModelContextProtocol" Version="0.3.0-preview.4" />
100+
<PackageVersion Include="ModelContextProtocol" Version="0.4.0-preview.3" />
101+
<PackageVersion Include="ModelContextProtocol.AspNetCore" Version="0.4.0-preview.3" />
101102
<PackageVersion Include="MongoDB.Driver" Version="3.5.0" />
102103
<PackageVersion Include="MongoDB.Driver.Core.Extensions.DiagnosticSources" Version="2.1.0" />
103104
<PackageVersion Include="MySqlConnector.DependencyInjection" Version="2.4.0" />

THIRD-PARTY-NOTICES.TXT

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,96 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
101101
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
102102
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
103103
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
104+
105+
License notice for Humanizer
106+
----------------------------------------------------------------------------------------------
107+
108+
The MIT License (MIT)
109+
110+
Copyright (c) .NET Foundation and Contributors
111+
112+
Permission is hereby granted, free of charge, to any person obtaining a copy
113+
of this software and associated documentation files (the "Software"), to deal
114+
in the Software without restriction, including without limitation the rights
115+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
116+
copies of the Software, and to permit persons to whom the Software is
117+
furnished to do so, subject to the following conditions:
118+
119+
The above copyright notice and this permission notice shall be included in
120+
all copies or substantial portions of the Software.
121+
122+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
123+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
124+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
125+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
126+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
127+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
128+
THE SOFTWARE.
129+
130+
License notice for D3
131+
----------------------------------------------------------------------------------------------
132+
133+
Copyright 2010-2023 Mike Bostock
134+
135+
Permission to use, copy, modify, and/or distribute this software for any purpose
136+
with or without fee is hereby granted, provided that the above copyright notice
137+
and this permission notice appear in all copies.
138+
139+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
140+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
141+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
142+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
143+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
144+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
145+
THIS SOFTWARE.
146+
147+
License notice for OpenAI .NET API library
148+
----------------------------------------------------------------------------------------------
149+
150+
The MIT License (MIT)
151+
152+
Copyright (c) 2024 OpenAI (https://openai.com)
153+
154+
155+
Permission is hereby granted, free of charge, to any person obtaining a copy
156+
of this software and associated documentation files (the "Software"), to deal
157+
in the Software without restriction, including without limitation the rights
158+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
159+
copies of the Software, and to permit persons to whom the Software is
160+
furnished to do so, subject to the following conditions:
161+
162+
The above copyright notice and this permission notice shall be included in
163+
all copies or substantial portions of the Software.
164+
165+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
166+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
167+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
168+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
169+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
170+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
171+
THE SOFTWARE.
172+
173+
License notice for MCP C# SDK
174+
----------------------------------------------------------------------------------------------
175+
176+
MIT License
177+
178+
Copyright (c) Anthropic and Contributors
179+
180+
Permission is hereby granted, free of charge, to any person obtaining a copy
181+
of this software and associated documentation files (the "Software"), to deal
182+
in the Software without restriction, including without limitation the rights
183+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
184+
copies of the Software, and to permit persons to whom the Software is
185+
furnished to do so, subject to the following conditions:
186+
187+
The above copyright notice and this permission notice shall be included in all
188+
copies or substantial portions of the Software.
189+
190+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
191+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
192+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
193+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
194+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
195+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
196+
SOFTWARE.

playground/TestShop/TestShop.AppHost/Properties/launchSettings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"ASPNETCORE_ENVIRONMENT": "Development",
1010
"DOTNET_ENVIRONMENT": "Development",
1111
"ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:16037",
12+
//"ASPIRE_DASHBOARD_MCP_ENDPOINT_URL": "https://localhost:16036",
1213
//"ASPIRE_DASHBOARD_OTLP_HTTP_ENDPOINT_URL": "https://localhost:16038",
1314
"ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:17037"
1415
}
@@ -22,6 +23,7 @@
2223
"ASPNETCORE_ENVIRONMENT": "Development",
2324
"DOTNET_ENVIRONMENT": "Development",
2425
"ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:16031",
26+
//"ASPIRE_DASHBOARD_MCP_ENDPOINT_URL": "http://localhost:16033",
2527
//"ASPIRE_DASHBOARD_OTLP_HTTP_ENDPOINT_URL": "http://localhost:16032",
2628
"ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:17031",
2729
"ASPIRE_ALLOW_UNSECURED_TRANSPORT": "true"

src/Aspire.Cli/Commands/RunCommand.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ protected override async Task<int> ExecuteAsync(ParseResult parseResult, Cancell
207207
env["ASPNETCORE_ENVIRONMENT"] = "Development";
208208
env["DOTNET_ENVIRONMENT"] = "Development";
209209
env["ASPNETCORE_URLS"] = "https://localhost:17193;http://localhost:15069";
210+
env["ASPIRE_DASHBOARD_MCP_ENDPOINT_URL"] = "https://localhost:21294";
210211
env["ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL"] = "https://localhost:21293";
211212
env["ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL"] = "https://localhost:22086";
212213
}

src/Aspire.Dashboard/Aspire.Dashboard.csproj

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
<RollForward>Major</RollForward>
2020

2121
<DefineConstants>$(DefineConstants);ASPIRE_DASHBOARD</DefineConstants>
22+
23+
<!--
24+
Enable raw string literals support in Razor. Can remove when target switches to .NET 10+.
25+
See https://devblogs.microsoft.com/dotnet/enhancing-razor-productivity-with-new-features/
26+
-->
27+
<Features>use-roslyn-tokenizer</Features>
2228
</PropertyGroup>
2329

2430
<PropertyGroup>
@@ -51,6 +57,8 @@
5157
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" />
5258
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components" />
5359
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components.Icons" />
60+
<PackageReference Include="ModelContextProtocol" />
61+
<PackageReference Include="ModelContextProtocol.AspNetCore" />
5462
</ItemGroup>
5563

5664
<ItemGroup>
@@ -297,6 +305,11 @@
297305

298306
<ItemGroup>
299307
<Content Remove="wwwroot\js\README.md" />
308+
<EmbeddedResource Include="Mcp\Resources\aspire-16.png" />
309+
<EmbeddedResource Include="Mcp\Resources\aspire-256.png" />
310+
<EmbeddedResource Include="Mcp\Resources\aspire-32.png" />
311+
<EmbeddedResource Include="Mcp\Resources\aspire-48.png" />
312+
<EmbeddedResource Include="Mcp\Resources\aspire-64.png" />
300313
<None Include="wwwroot\js\README.md" />
301314
</ItemGroup>
302315
</Project>

src/Aspire.Dashboard/Authentication/Connection/ConnectionType.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ public enum ConnectionType
77
{
88
None,
99
Frontend,
10-
Otlp
10+
OtlpGrpc,
11+
OtlpHttp,
12+
Mcp
1113
}

src/Aspire.Dashboard/Authentication/Connection/ConnectionTypeAuthenticationHandler.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ protected override Task<AuthenticateResult> HandleAuthenticateAsync()
2222
return Task.FromResult(AuthenticateResult.Fail("No type specified on this connection."));
2323
}
2424

25-
if (!connectionTypeFeature.ConnectionTypes.Contains(Options.RequiredConnectionType))
25+
if (!Options.RequiredConnectionTypes.Any(connectionTypeFeature.ConnectionTypes.Contains))
2626
{
27-
return Task.FromResult(AuthenticateResult.Fail($"Connection type {Options.RequiredConnectionType} is not enabled on this connection."));
27+
return Task.FromResult(AuthenticateResult.Fail($"Connection types '{string.Join(", ", Options.RequiredConnectionTypes)}' are not enabled on this connection."));
2828
}
2929

3030
return Task.FromResult(AuthenticateResult.NoResult());
@@ -35,9 +35,10 @@ public static class ConnectionTypeAuthenticationDefaults
3535
{
3636
public const string AuthenticationSchemeFrontend = "ConnectionFrontend";
3737
public const string AuthenticationSchemeOtlp = "ConnectionOtlp";
38+
public const string AuthenticationSchemeMcp = "ConnectionMcp";
3839
}
3940

4041
public sealed class ConnectionTypeAuthenticationHandlerOptions : AuthenticationSchemeOptions
4142
{
42-
public ConnectionType RequiredConnectionType { get; set; }
43+
public HashSet<ConnectionType> RequiredConnectionTypes { get; set; } = [];
4344
}

src/Aspire.Dashboard/Authentication/Connection/ConnectionTypeMiddleware.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
namespace Aspire.Dashboard.Authentication.Connection;
77

88
/// <summary>
9-
/// This connection middleware registers an OTLP feature on the connection.
10-
/// OTLP services check for this feature when authorizing incoming requests to
11-
/// ensure OTLP is only available on specified connections.
9+
/// This connection middleware registers a connection type feature on the connection.
10+
/// OTLP and MCP services check for this feature when authorizing incoming requests to
11+
/// ensure services are only available on specified connections.
1212
/// </summary>
1313
internal sealed class ConnectionTypeMiddleware
1414
{

src/Aspire.Dashboard/Authentication/Connection/ListenOptionsConnectionTypeExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ namespace Aspire.Dashboard.Authentication.Connection;
77

88
internal static class ListenOptionsConnectionTypeExtensions
99
{
10-
public static void UseConnectionTypes(this ListenOptions listenOptions, ConnectionType[] connectionTypes)
10+
public static void UseConnectionTypes(this ListenOptions listenOptions, IEnumerable<ConnectionType> connectionTypes)
1111
{
12-
listenOptions.Use(next => new ConnectionTypeMiddleware(connectionTypes, next).OnConnectionAsync);
12+
listenOptions.Use(next => new ConnectionTypeMiddleware(connectionTypes.ToArray(), next).OnConnectionAsync);
1313
}
1414
}

src/Aspire.Dashboard/Authentication/UnsecuredAuthenticationHandler.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System.Security.Claims;
55
using System.Text.Encodings.Web;
6+
using Aspire.Dashboard.Configuration;
67
using Microsoft.AspNetCore.Authentication;
78
using Microsoft.Extensions.Options;
89

0 commit comments

Comments
 (0)