package cc.unitmesh.xiuper.fs.mcp import cc.unitmesh.xiuper.fs.* import kotlin.test.Test import kotlin.test.assertTrue import kotlinx.coroutines.test.runTest /** * Basic tests for MCP Backend. * * Note: These tests are platform-specific since MCP SDK availability varies by platform. * iOS doesn't support MCP SDK, so tests are minimal. */ class McpBackendTest { @Test fun backendCreationTest() = runTest { // Test that we can create a backend configuration val config = McpServerConfig( name = "test-server", command = "test-command", args = listOf("--test"), env = mapOf("TEST" to "true") ) // Verify config creation works assertTrue(config.name == "test-server") assertTrue(config.command == "test-command") assertTrue(config.args.contains("--test")) assertTrue(config.env["TEST"] == "true") } @Test fun createMcpBackendReturnsNullForUnsupportedPlatforms() = runTest { val config = McpServerConfig( name = "test-server", command = "test-command" ) // This should return null on platforms where MCP is not supported // or when no actual MCP server is available val backend = createMcpBackend(config) // We don't assert anything specific about the result since it's platform-dependent // On JVM/Android with proper MCP server setup, it might return a backend // On iOS or without MCP server, it should return null println("MCP backend creation result: ${backend != null}") } }