summaryrefslogtreecommitdiff
path: root/tests/Agent.Core.Tests/McpStdioTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Agent.Core.Tests/McpStdioTests.cs')
-rw-r--r--tests/Agent.Core.Tests/McpStdioTests.cs35
1 files changed, 8 insertions, 27 deletions
diff --git a/tests/Agent.Core.Tests/McpStdioTests.cs b/tests/Agent.Core.Tests/McpStdioTests.cs
index 66f4851..fcef80e 100644
--- a/tests/Agent.Core.Tests/McpStdioTests.cs
+++ b/tests/Agent.Core.Tests/McpStdioTests.cs
@@ -1,4 +1,4 @@
-using Agent.App.Configuration;
+using Agent.Mcp.TestHost;
using ModelContextProtocol;
using ModelContextProtocol.Client;
using ModelContextProtocol.Protocol;
@@ -15,17 +15,18 @@ public sealed class McpStdioTests
{
using var directory = new TestDirectory();
await using var ollama = new FakeOllamaServer();
- string configPath = CreateBundleConfiguration(directory, ollama.Endpoint);
- string application = typeof(ConfigurationLoader).Assembly.Location;
+ string localeDirectory = CreateLocale(directory);
+ string application = typeof(Marker).Assembly.Location;
var transport = new StdioClientTransport(new StdioClientTransportOptions
{
Name = "agent-mcp-test",
Command = "dotnet",
- Arguments = [application, "serve", "--config", configPath, "--lang", "en"],
+ Arguments = [application, localeDirectory, System.IO.Path.Combine(directory.Path, "mcp-tasks")],
WorkingDirectory = directory.Path
});
- await using McpClient client = await McpClient.CreateAsync(transport, cancellationToken: TestContext.Current.CancellationToken);
+ await using McpClient client = await McpClient.CreateAsync(transport,
+ new McpClientOptions { ProtocolVersion = "2025-11-25" }, cancellationToken: TestContext.Current.CancellationToken);
IList<McpClientTool> tools = await client.ListToolsAsync(cancellationToken: TestContext.Current.CancellationToken);
Assert.Equal(["agent_run", "agent_status"], tools.Select(static tool => tool.Name).Order(StringComparer.Ordinal));
foreach (McpClientTool tool in tools)
@@ -71,30 +72,10 @@ public sealed class McpStdioTests
return Guid.Parse(line[(key.Length + 1)..].Trim());
}
- private static string CreateBundleConfiguration(TestDirectory directory, Uri endpoint)
+ private static string CreateLocale(TestDirectory directory)
{
- directory.File("prompts/user-system.md", string.Empty);
directory.File("config/locales/en.json", """{"app.starting":"Starting","check.success":"OK","check.failure":"Failed {message}","check.wfp_admin_required":"Administrator required","config.invalid":"Invalid {message}","locale.invalid":"Locale {message}","mcp.task_queued":"Task {task} queued in {session}","mcp.task_not_found":"Task {task} not found","sandbox.access_denied":"Denied {path}","ollama.vision_unsupported":"No vision"}""");
- Directory.CreateDirectory(System.IO.Path.Combine(directory.Path, "skills"));
- return directory.File("agent.yaml", $$"""
- schema_version: 1
- application:
- language: en
- mcp:
- transport: stdio
- agent:
- user_system_prompt: prompts/user-system.md
- ollama:
- endpoint: {{endpoint}}
- model: model
- localization:
- directory: config/locales
- fallback: en
- skills:
- directory: skills
- logging:
- directory: logs
- """);
+ return System.IO.Path.Combine(directory.Path, "config", "locales");
}
private sealed class FakeOllamaServer : IAsyncDisposable