Conversation
There was a problem hiding this comment.
Pull request overview
This PR migrates lox-mcp from a JVM-only Gradle project to Kotlin Multiplatform (KMP), aiming to support JVM plus Linux native (x64/arm64) while refactoring core MCP registration/config loading, LoxCC decompression, and docs fetching into common code.
Changes:
- Migrates build + sources to KMP (
commonMain/jvmMain/linuxMain) and updates dependency versions/catalog entries. - Introduces platform abstractions (
Platform.kt) and moves MCP YAML config intocommonMain/resources. - Refactors core server pieces (tools/resources registries, dynamic handlers) and adds/relocates JVM-only tests into
jvmTest.
Reviewed changes
Copilot reviewed 21 out of 37 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/resources/mcp-config.yaml | Removed old JVM-only embedded MCP config YAML. |
| src/commonMain/resources/mcp-config.yaml | Added new shared MCP config YAML for KMP builds. |
| src/main/kotlin/LoxoneXmlProcessor.kt | Removed old JVM-only XML processor implementation. |
| src/commonMain/kotlin/LoxoneXmlProcessor.kt | Reintroduced XML sanitization in common code; delegates slimming to platform actual. |
| src/jvmMain/kotlin/slimXml.jvm.kt | Adds JVM actual XML slimming implementation using DOM. |
| src/linuxMain/kotlin/Platform.linux.kt | Adds Linux actual implementations for env/stdin/stdout/shutdown/resources/xml slimming (currently stubbed for resources + slimming). |
| src/jvmMain/kotlin/Platform.jvm.kt | Adds JVM actual implementations for env/stdin/stdout/shutdown/resource loading. |
| src/commonMain/kotlin/Platform.kt | Introduces expect/actual API for env, IO, shutdown, resources, and XML slimming. |
| src/main/kotlin/LoxCC.kt | Removed old JVM-only LoxCC decompressor. |
| src/commonMain/kotlin/LoxCC.kt | Adds KMP-friendly LoxCC decompressor (byte-array based). |
| src/commonMain/kotlin/server/McpServer.kt | Switches stdio transport to platform stdin/stdout sources/sinks. |
| src/commonMain/kotlin/server/ToolsRegistry.kt | New tool registry: loads YAML tools + registers built-in get_loxone_xml. |
| src/commonMain/kotlin/server/ResourcesRegistry.kt | New resource registry driven by YAML config. |
| src/commonMain/kotlin/server/ResourcesAsToolsRegistry.kt | Adds optional “resources as tools” compatibility layer. |
| src/commonMain/kotlin/server/GetLoxoneXmlHandler.kt | Updates ZIP extraction to use kmp-zip + KMP-friendly decoding. |
| src/commonMain/kotlin/server/DynamicToolHandler.kt | Minor safety cleanup (removes unnecessary !! for defaults). |
| src/commonMain/kotlin/server/DynamicResourceHandler.kt | URL decoding + locale handling adjusted for KMP (ktor decodeURLPart, uppercase()). |
| src/commonMain/kotlin/server/LoxoneQueryHelper.kt | Adds shared query helpers for rooms/categories/controls and JSON formatting. |
| src/commonMain/kotlin/loxonedocs/Models.kt | Adds serializable docs models for parsed structure-file docs. |
| src/commonMain/kotlin/loxonedocs/LoxoneDocsProvider.kt | Moves from Java HttpClient to Ktor client; adds timeouts; loads docs via readResourceBytes. |
| src/commonMain/kotlin/LoxoneAdapter.kt | Adds KMP-compatible adapter wrapper around loxone-client-kotlin APIs. |
| src/commonMain/kotlin/credentials/CredentialSource.kt | Switches env var reads to platform getEnv. |
| src/commonMain/kotlin/credentials/CredentialResolver.kt | Adds CLI-based credential source resolution. |
| src/commonMain/kotlin/config/Models.kt | Adds serializable YAML config model types. |
| src/commonMain/kotlin/config/McpServerProperties.kt | Adds cached runtime properties + config loading orchestration. |
| src/commonMain/kotlin/config/ConfigLoader.kt | Moves YAML parsing to yamlkt + uses platform FS/resource reads. |
| src/commonMain/kotlin/Constants.kt | Switches versioning to generated SERVER_VERSION constant. |
| src/commonMain/kotlin/Application.kt | Switches HTTP engine Netty→CIO and shutdown hook to platform callback. |
| src/jvmTest/kotlin/server/LoxoneQueryHelperTest.kt | Adds unit tests for room/category lookup helpers. |
| src/jvmTest/kotlin/server/GetLoxoneXmlHandlerTest.kt | Adds LoxCC backref tests + get_loxone_xml handler tests incl. ZIP cases. |
| src/jvmTest/kotlin/server/DynamicResourceHandlerStatisticsTest.kt | Adds tests for statistics resource parsing/validation/success paths. |
| src/jvmTest/kotlin/loxonedocs/LoxoneDocsProviderTest.kt | Adds docs version parsing/resolution tests. |
| src/jvmTest/kotlin/LoxoneAdapterTest.kt | Adds tests for address type resolution. |
| src/jvmTest/kotlin/credentials/CredentialResolverTest.kt | Adds tests for credential source resolution and error cases. |
| src/jvmTest/kotlin/config/ConfigLoaderTest.kt | Updates YAML parsing library usage and expected URIs. |
| gradle/libs.versions.toml | Updates Kotlin/Ktor/coroutines versions; adds KMP-related libs (yamlkt, okio, kmp-zip, etc.). |
| build.gradle.kts | Migrates to Kotlin Multiplatform plugin, adds JVM + Linux targets, generated version source, and resource wiring for docs. |
jimirocks
requested changes
Jun 9, 2026
jimirocks
left a comment
Contributor
There was a problem hiding this comment.
Opravte 4 kritické issues (data loss, null resource loading, no-op slimXml, bounds errors) a zvažte graceful shutdown nuance na Linux signal handleru.
task: SHS-1298
jimirocks
approved these changes
Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
build.gradle.kts— Switch to KMP plugin, add JVM + Linux targets, configureshadowJarandprocessResourcestask dependencies for both Linux targetssrc/commonMain/kotlin/LoxCC.kt— Replace O(n²) buffer copy loop with O(1)ByteArray.copyIntoback-reference algorithm; remove@file:Suppress("ClassName")src/commonMain/kotlin/loxonedocs/LoxoneDocsProvider.kt— AddHttpTimeoutplugin to Ktor client; wrapdownloadFromUrlinrunBlocking(Dispatchers.Default) { withTimeout(...) }src/linuxMain/kotlin/Platform.linux.kt— Remove redundant.toLong()castssrc/jvmTest/kotlin/— Move all test files fromcommonTesttojvmTest(tests use JVM-only dependencies: mockk, kotest, java.util.zip, java.nio)Task
task: SHS-1298