@@ -12,16 +12,28 @@ public static class McpInspectorResourceBuilderExtensions
12
12
/// </summary>
13
13
/// <param name="builder">The <see cref="IDistributedApplicationBuilder"/> to which the MCP Inspector resource will be added.</param>
14
14
/// <param name="name">The name of the MCP Inspector container resource.</param>
15
- public static IResourceBuilder < McpInspectorResource > AddMcpInspector ( this IDistributedApplicationBuilder builder , [ ResourceName ] string name )
15
+ /// <param name="clientPort">The port for the client application. Defaults to 6274.</param>
16
+ /// <param name="serverPort">The port for the server proxy application. Defaults to 6277.</param>
17
+ public static IResourceBuilder < McpInspectorResource > AddMcpInspector ( this IDistributedApplicationBuilder builder , [ ResourceName ] string name , int clientPort = 6274 , int serverPort = 6277 )
16
18
{
17
19
var resource = builder . AddResource ( new McpInspectorResource ( name ) )
18
20
. WithArgs ( [ "-y" , $ "@modelcontextprotocol/inspector@{ McpInspectorResource . InspectorVersion } "] )
19
21
. ExcludeFromManifest ( )
20
- . WithHttpEndpoint ( isProxied : false , port : Random . Shared . Next ( 3000 , 4000 ) , env : "CLIENT_PORT" , name : McpInspectorResource . ClientEndpointName )
21
- . WithHttpEndpoint ( isProxied : false , port : Random . Shared . Next ( 4000 , 5000 ) , env : "SERVER_PORT" , name : McpInspectorResource . ServerProxyEndpointName )
22
+ . WithHttpEndpoint ( isProxied : false , port : clientPort , env : "CLIENT_PORT" , name : McpInspectorResource . ClientEndpointName )
23
+ . WithHttpEndpoint ( isProxied : false , port : serverPort , env : "SERVER_PORT" , name : McpInspectorResource . ServerProxyEndpointName )
22
24
. WithEnvironment ( "DANGEROUSLY_OMIT_AUTH" , "true" )
23
25
. WithHttpHealthCheck ( "/" , endpointName : McpInspectorResource . ClientEndpointName )
24
- . WithHttpHealthCheck ( "/config" , endpointName : McpInspectorResource . ServerProxyEndpointName ) ;
26
+ . WithHttpHealthCheck ( "/config" , endpointName : McpInspectorResource . ServerProxyEndpointName )
27
+ . WithUrlForEndpoint ( McpInspectorResource . ClientEndpointName , annotation =>
28
+ {
29
+ annotation . DisplayText = "Client" ;
30
+ annotation . DisplayOrder = 2 ;
31
+ } )
32
+ . WithUrlForEndpoint ( McpInspectorResource . ServerProxyEndpointName , annotation =>
33
+ {
34
+ annotation . DisplayText = "Server Proxy" ;
35
+ annotation . DisplayOrder = 1 ;
36
+ } ) ;
25
37
26
38
builder . Eventing . Subscribe < BeforeResourceStartedEvent > ( resource . Resource , async ( @event , ct ) =>
27
39
{
0 commit comments