Research conducted on modern AI coding assistants (Cursor, GitHub Copilot, Cline,
Aider, Windsurf, Replit Agent) to understand architecture patterns, context management,
code editing workflows, and tool use protocols.
Key Decision: Pivoted from building full CLI (40-50h) to validation-driven MCP-first
approach (10-15h). Build 5 core CODEX MCP tools that work with ANY coding assistant,
validate adoption over 2-4 weeks, then decide on full CLI if demand proven.
Files:
- research/ai-systems/modern-coding-assistants-architecture.md (comprehensive research)
- research/ai-systems/codex-coding-assistant-implementation-plan.md (original CLI plan, preserved)
- research/ai-systems/codex-mcp-tools-implementation-plan.md (approved MCP-first plan)
- ideas/registry.json (updated with approved MCP tools proposal)
Architech Validation: APPROVED with pivot to MCP-first approach
Human Decision: Approved (pragmatic validation-driven development)
Next: Begin Phase 1 implementation (10-15 hours, 5 core MCP tools)
🤖 Generated with CODEX Research System
Co-Authored-By: The Archivist <archivist@codex.svrnty.io>
Co-Authored-By: The Architech <architech@codex.svrnty.io>
Co-Authored-By: Mathias Beaulieu-Duncan <mat@svrnty.io>
129 lines
3.4 KiB
C#
129 lines
3.4 KiB
C#
using Xunit;
|
|
using OpenHarbor.MCP.Gateway.Infrastructure.Transport;
|
|
using OpenHarbor.MCP.Gateway.Core.Models;
|
|
|
|
namespace OpenHarbor.MCP.Gateway.Infrastructure.Tests.Transport;
|
|
|
|
/// <summary>
|
|
/// Unit tests for transport factory logic.
|
|
/// Tests transport creation based on server configuration.
|
|
/// </summary>
|
|
public class TransportFactoryTests
|
|
{
|
|
[Fact]
|
|
public void StdioTransport_WithValidCommand_CreatesSuccessfully()
|
|
{
|
|
// Arrange & Act
|
|
var transport = new StdioServerTransport("echo", new[] { "test" });
|
|
|
|
// Assert
|
|
Assert.NotNull(transport);
|
|
Assert.False(transport.IsConnected);
|
|
}
|
|
|
|
[Fact]
|
|
public void StdioTransport_WithEmptyArgs_CreatesSuccessfully()
|
|
{
|
|
// Arrange & Act
|
|
var transport = new StdioServerTransport("ls", Array.Empty<string>());
|
|
|
|
// Assert
|
|
Assert.NotNull(transport);
|
|
}
|
|
|
|
[Fact]
|
|
public void HttpTransport_WithValidUrl_CreatesSuccessfully()
|
|
{
|
|
// Arrange & Act
|
|
var transport = new HttpServerTransport("http://localhost:8080");
|
|
|
|
// Assert
|
|
Assert.NotNull(transport);
|
|
Assert.False(transport.IsConnected);
|
|
}
|
|
|
|
[Fact]
|
|
public void HttpTransport_WithHttpsUrl_CreatesSuccessfully()
|
|
{
|
|
// Arrange & Act
|
|
var transport = new HttpServerTransport("https://api.example.com");
|
|
|
|
// Assert
|
|
Assert.NotNull(transport);
|
|
}
|
|
|
|
[Fact]
|
|
public void StdioTransport_WithNullArgs_UsesEmptyArray()
|
|
{
|
|
// Arrange & Act
|
|
var transport = new StdioServerTransport("echo", null!);
|
|
|
|
// Assert
|
|
Assert.NotNull(transport);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("http://localhost:5000")]
|
|
[InlineData("https://api.example.com:8443")]
|
|
[InlineData("http://192.168.1.1:3000")]
|
|
public void HttpTransport_WithVariousUrls_CreatesSuccessfully(string baseUrl)
|
|
{
|
|
// Arrange & Act
|
|
var transport = new HttpServerTransport(baseUrl);
|
|
|
|
// Assert
|
|
Assert.NotNull(transport);
|
|
Assert.False(transport.IsConnected);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("dotnet", "run")]
|
|
[InlineData("python3", "server.py")]
|
|
[InlineData("node", "index.js")]
|
|
public void StdioTransport_WithVariousCommands_CreatesSuccessfully(string command, string arg)
|
|
{
|
|
// Arrange & Act
|
|
var transport = new StdioServerTransport(command, new[] { arg });
|
|
|
|
// Assert
|
|
Assert.NotNull(transport);
|
|
}
|
|
|
|
[Fact]
|
|
public void StdioTransport_Dispose_CanBeCalledMultipleTimes()
|
|
{
|
|
// Arrange
|
|
var transport = new StdioServerTransport("echo", new[] { "test" });
|
|
|
|
// Act & Assert - should not throw
|
|
transport.Dispose();
|
|
transport.Dispose();
|
|
}
|
|
|
|
[Fact]
|
|
public void HttpTransport_Dispose_CanBeCalledMultipleTimes()
|
|
{
|
|
// Arrange
|
|
var httpClient = new HttpClient();
|
|
var transport = new HttpServerTransport("http://localhost:5000", httpClient);
|
|
|
|
// Act & Assert - should not throw
|
|
transport.Dispose();
|
|
transport.Dispose();
|
|
}
|
|
|
|
[Fact]
|
|
public void HttpTransport_WithCustomHttpClient_UsesProvidedClient()
|
|
{
|
|
// Arrange
|
|
var customHttpClient = new HttpClient();
|
|
customHttpClient.Timeout = TimeSpan.FromSeconds(5);
|
|
|
|
// Act
|
|
var transport = new HttpServerTransport("http://localhost:5000", customHttpClient);
|
|
|
|
// Assert
|
|
Assert.NotNull(transport);
|
|
}
|
|
}
|