Browse Source

Use dynamic server URL in MCP HTTP client service

Replaced hardcoded TestServerUrl with awaitable GetMcpServerUrlAsync() in CallToolAsync, CheckServerHealthAsync, and GetToolDefinitionsAsync methods to ensure the correct server URL is used dynamically.
pull/24677/head
Mansur Besleney 4 weeks ago
parent
commit
783a97cff0
  1. 6
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/McpHttpClientService.cs

6
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/McpHttpClientService.cs

@ -76,7 +76,7 @@ public class McpHttpClientService : ITransientDependency
public async Task<string> CallToolAsync(string toolName, JsonElement arguments)
{
var baseUrl = TestServerUrl;//await GetMcpServerUrlAsync();
var baseUrl = await GetMcpServerUrlAsync();
var url = $"{baseUrl}/tools/call";
try
@ -163,7 +163,7 @@ public class McpHttpClientService : ITransientDependency
public async Task<bool> CheckServerHealthAsync()
{
var baseUrl = TestServerUrl;//await GetMcpServerUrlAsync();
var baseUrl = await GetMcpServerUrlAsync();
try
{
@ -180,7 +180,7 @@ public class McpHttpClientService : ITransientDependency
public async Task<List<McpToolDefinition>> GetToolDefinitionsAsync()
{
var baseUrl = TestServerUrl;//await GetMcpServerUrlAsync();
var baseUrl = await GetMcpServerUrlAsync();
var url = $"{baseUrl}/tools";
try

Loading…
Cancel
Save