From 12c7fe6ff77facfccf504ebf47762ef8a43eb0eb Mon Sep 17 00:00:00 2001 From: Hai Phuc Nguyen <3423575+haiphucnguyen@users.noreply.github.com> Date: Sun, 5 Jul 2026 23:32:28 -0700 Subject: [PATCH] feat(core): Add capability to proactively clear ephemeral MCP instances - Implements `clearEphemeralInstances()` in `McpInstanceService`, allowing explicit cleanup of transient tools. - Invalidates the cache upon manual instance clearing, ensuring fresh lookup on subsequent requests. - Updates build tooling versions (Gradle distribution and LangChain4j dependencies) for stability and compatibility with recent API changes. - Removes obsolete 'Star History' widget from `README.md` to clean up installation documentation. chore(deps): Update core dependencies and build environment dependencies --- README.md | 12 ------------ gradle/libs.versions.toml | 6 +++--- gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 4 ++-- gradlew.bat | 4 ++-- .../io/askimo/core/mcp/McpInstanceService.kt | 18 ++++++++++++++++++ .../OpenAiCompatibleChatModelFactory.kt | 1 + 7 files changed, 27 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 544e2dca..14b50e88 100644 --- a/README.md +++ b/README.md @@ -235,15 +235,3 @@ Join the [Askimo Discord](https://discord.gg/eXSBR4fNmm) for help, feedback, and ---- - -## Star History - - - - - - Star History Chart - - - diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f76961cb..63f374a8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,9 +1,9 @@ [versions] graalvm-plugin = "0.11.5" jline = "3.30.6" -langchain4j = "1.16.3" -langchain4j-extra = "1.16.3-beta26" -langchain4j-jvector = "1.16.0-beta26" +langchain4j = "1.17.1" +langchain4j-extra = "1.17.1-beta27" +langchain4j-jvector = "1.17.0-beta27" commonmark = "0.28.0" kotlinxSerializationJson = "1.10.0" kotlinxCoroutines = "1.10.2" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b52fb7e7..eb84db68 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.0-bin.zip networkTimeout=10000 retries=0 retryBackOffMs=500 diff --git a/gradlew b/gradlew index b9bb139f..249efbb0 100755 --- a/gradlew +++ b/gradlew @@ -20,7 +20,7 @@ ############################################################################## # -# Gradle start up script for POSIX generated by Gradle. +# gradlew start up script for POSIX generated by Gradle. # # Important for running: # @@ -29,7 +29,7 @@ # bash, then to run this script, type that shell name before the whole # command line, like: # -# ksh Gradle +# ksh gradlew # # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: diff --git a/gradlew.bat b/gradlew.bat index aa5f10b0..8508ef68 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -19,7 +19,7 @@ @if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem -@rem Gradle startup script for Windows +@rem gradlew startup script for Windows @rem @rem ########################################################################## @@ -72,7 +72,7 @@ echo location of your Java installation. 1>&2 -@rem Execute Gradle +@rem Execute gradlew @rem endlocal doesn't take effect until after the line is parsed and variables are expanded @rem which allows us to clear the local environment before executing the java command endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel diff --git a/shared/src/main/kotlin/io/askimo/core/mcp/McpInstanceService.kt b/shared/src/main/kotlin/io/askimo/core/mcp/McpInstanceService.kt index e1c2ebab..1e1fed8d 100644 --- a/shared/src/main/kotlin/io/askimo/core/mcp/McpInstanceService.kt +++ b/shared/src/main/kotlin/io/askimo/core/mcp/McpInstanceService.kt @@ -213,6 +213,24 @@ class McpInstanceService( } } + /** + * Replaces the current set of ephemeral instances. + * Call this after fetching org-managed MCP servers from the team server. + * Invalidates the tools cache so the new instances are picked up on the next request. + */ + fun setEphemeralInstances(instances: List) { + ephemeralInstances = instances + invalidateCache() + log.debug("Registered {} ephemeral MCP instances", instances.size) + } + + /** Remove all ephemeral instances (e.g. on logout). */ + fun clearEphemeralInstances() { + ephemeralInstances = emptyList() + invalidateCache() + log.debug("Cleared ephemeral MCP instances") + } + // ── Tool resolution ────────────────────────────────────────────────────── private fun getEnabledInstances(): List = getInstances().filter { it.enabled } diff --git a/shared/src/main/kotlin/io/askimo/core/providers/OpenAiCompatibleChatModelFactory.kt b/shared/src/main/kotlin/io/askimo/core/providers/OpenAiCompatibleChatModelFactory.kt index c8906060..5a66db11 100644 --- a/shared/src/main/kotlin/io/askimo/core/providers/OpenAiCompatibleChatModelFactory.kt +++ b/shared/src/main/kotlin/io/askimo/core/providers/OpenAiCompatibleChatModelFactory.kt @@ -223,6 +223,7 @@ abstract class OpenAiCompatibleChatModelFactory : ChatModelFactory reasoningEffort(reasoningLevel.value) } } + .strictTools(true) .listeners(listOf(listener)) .build() }