Skip to content

Replace custom MCP client logic with Koog#2622

Draft
lshala wants to merge 105 commits into
mainfrom
ls/mcp-client-with-koog
Draft

Replace custom MCP client logic with Koog#2622
lshala wants to merge 105 commits into
mainfrom
ls/mcp-client-with-koog

Conversation

@lshala
Copy link
Copy Markdown
Contributor

@lshala lshala commented Mar 10, 2026

No description provided.

lshala and others added 30 commits September 11, 2025 10:20
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* Update CODEOWNERS

The Code owners are updated with specific responsibilities for passes.

* Add Second responsible to language frontends and remove the language specific pass responsibles
* Change dokka config to new dsl

* Delete unused code

* Delete .kotlin/sessions directory

* Add V2Enabled mode to gradle.properties

* Delete tmp.json

* Remove set previous docs folder

---------

Co-authored-by: Konrad Weiss <konrad.weiss@aisec.fraunhofer.de>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
….0 (#2397)

* Update dependency com.vanniktech:gradle-maven-publish-plugin to v0.34.0

* Fixed

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Christian Banse <christian.banse@aisec.fraunhofer.de>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* create initial Size evaluator for modifiable lists

* move all collection dependant logic into collection class

* add support for static arrays

* implement narrowing and widening operations

* add narrowing and widening to loop analysis

* handle branches in analysis

* improve loops by preprocessing, better narrowing and valid starting ranges

* improve subtraction by handling 0 as lowest possible value

* mark branching nodes as nodes with an effect

* correctly identify nodes of deeper branch layers in a loop

* add documentation

* temporarily repurpose cpg-neo4j for debugging

* rework lattice intervals to support negative values

* rename target package to circumvent gitignore

* implement comparable for the LatticeInterval

* implement the IntervalState

* update the evaluator name in tests

* implement equals check for intervals

* add method stub for condition evaluation

* Spotless

* Squashed commit of the following:

commit 5c20b05
Author: Robert Haimerl <robert.haimerl@aisec.fraunhofer.de>
Date:   Wed Oct 16 13:25:06 2024 +0200

    fix breaking merge changes

commit cc8eb48
Merge: 3e3c094 344ea58
Author: Robert Haimerl <robert.haimerl@aisec.fraunhofer.de>
Date:   Wed Oct 16 13:08:46 2024 +0200

    Merge branch 'rh/abstract-value-analysis' into rh/abstract-value-analysis-worklist

    # Conflicts:
    #	cpg-analysis/src/main/kotlin/de/fraunhofer/aisec/cpg/analysis/abstracteval/AbstractEvaluator.kt
    #	cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/helpers/EOGWorklist.kt

commit 3e3c094
Author: Robert Haimerl <robert.haimerl@aisec.fraunhofer.de>
Date:   Wed Oct 16 13:04:45 2024 +0200

    remove redundant pushes to the worklist itself

commit 6d731f2
Author: Robert Haimerl <robert.haimerl@aisec.fraunhofer.de>
Date:   Wed Oct 16 13:04:21 2024 +0200

    override methods to use custom functionality in IntervalStates

commit 1eb5a51
Author: Robert Haimerl <robert.haimerl@aisec.fraunhofer.de>
Date:   Wed Oct 16 13:03:57 2024 +0200

    enhance analysis for simple value operations

commit 108f374
Author: Robert Haimerl <robert.haimerl@aisec.fraunhofer.de>
Date:   Wed Oct 16 09:56:22 2024 +0200

    join intervals for multiple EOG (branch joins)

commit d4383b4
Author: Robert Haimerl <robert.haimerl@aisec.fraunhofer.de>
Date:   Wed Oct 16 09:33:41 2024 +0200

    revert the change to the worklist pop to make it FIFO again

commit 46798c5
Author: Robert Haimerl <robert.haimerl@aisec.fraunhofer.de>
Date:   Wed Oct 16 09:33:23 2024 +0200

    return a new altered state instead of directly modifying the current state

commit c634646
Author: Robert Haimerl <robert.haimerl@aisec.fraunhofer.de>
Date:   Mon Oct 14 13:12:46 2024 +0200

    remove getInitialRange from the evaluator

commit f984a2c
Author: Robert Haimerl <robert.haimerl@aisec.fraunhofer.de>
Date:   Mon Oct 14 13:11:58 2024 +0200

    remove the "getInitialRange" method for values and instead mark declarations as operations with effect

commit beb4d38
Author: Robert Haimerl <robert.haimerl@aisec.fraunhofer.de>
Date:   Mon Oct 14 12:26:22 2024 +0200

    simplify evaluator to only use one worklist without special handling for loops and branches

commit 6ec77dc
Author: Robert Haimerl <robert.haimerl@aisec.fraunhofer.de>
Date:   Mon Oct 14 12:25:04 2024 +0200

    add "until" to iteration, add state information to Worklist, fix pop order

commit 253debb
Author: Robert Haimerl <robert.haimerl@aisec.fraunhofer.de>
Date:   Mon Oct 14 12:23:17 2024 +0200

    remove all modes from the IntervalState

commit 31ca4ac
Author: Robert Haimerl <robert.haimerl@aisec.fraunhofer.de>
Date:   Mon Oct 14 12:17:45 2024 +0200

    remove boolean information about whether the operation had an impact

commit ccd839e
Author: Robert Haimerl <robert.haimerl@aisec.fraunhofer.de>
Date:   Mon Oct 14 09:17:11 2024 +0200

    add three different state modes

commit e0e1a28
Author: Robert Haimerl <robert.haimerl@aisec.fraunhofer.de>
Date:   Mon Oct 7 12:08:52 2024 +0200

    rewrite the handleBranch branch

commit 672f27f
Author: Robert Haimerl <robert.haimerl@aisec.fraunhofer.de>
Date:   Mon Oct 7 11:45:10 2024 +0200

    rewrite the handleLoop branch

commit 33f3531
Author: Robert Haimerl <robert.haimerl@aisec.fraunhofer.de>
Date:   Mon Oct 7 10:54:15 2024 +0200

    rewrite the applyEffect branch

commit ca88bb7
Author: Robert Haimerl <robert.haimerl@aisec.fraunhofer.de>
Date:   Mon Oct 7 10:20:39 2024 +0200

    rewrite evaluate function to use "iterateEOG"

* fix LatticeInterval.push to join with the previous value as it is already propagated from predecessors

* Fix Declaration to only effect matching integers

* correctly propagate widening only within loops

* added second evaluate call with more defined arguments

* support functions with side effects by creating a function-local evaluator

* moved side effect analysis to list instead of integer...

* add new 'assignMinus' expression and add the name as code when creating a reference

* cleanup

* add tests for the new Evaluator

* first implementation for other integer operations

* add prefix versions of the inc and dec operator

* Add test case for all implemented Integer operations

* add auto-generated hashcode function

* cleanup and documentation

* remove old code

* import cleanup

* automatically switch interval bounds if the lower bound is greater than the upper bound

* remove min and max comparisons after multiplication as the constructor now handles the order

* convert Bounded from data class to real class to remove constructor variables

* fix division to estimate x / ∞ = 0

* simplify division cases

* Fix invalid division cases

* make modulo calculation more concise

* beautify toString representation

* add first LatticeInterval tests

* fix meet of intervals when they do not overlap

* add equals operator for the Interval wrapper

* add tests for meet, widen, narrow and the wrapper

* fix meet test method

* change default of plusAssign and minusAssign to lose all information

* add tests for the Integer Value

* check name of array declaration

* move code block for function side effects further up

* add tests for array and mutable list

* remove unfinished code block in MutableList

* made spotless

* changed the name of the Value classes to prevent confusion with builtin classes

* Some renaming and extended test

* formatting

* Do not stop on target node and change int to long

* Template for eventually using new iteration

* Fix comment

* Minor cosmetic changes

* Move code to correct location

* Several updates, missing widening and narrowing for integer tests

* Some fixes

* Fix integer tests

* Some idea on integrating widening and narrowing

* Try to integrate widening

* Integrate widening and fix comparisons

* Try to include conditions

* Fix

* Also handle negated condition

* Redesign of list size evaluation

* Small cleanup

* Rework array value

* Small cleanup

* Fix list removeall

* Size evaluation for sets

* test set size evaluator

* Improvements and more tests for sets

* Integration into value evaluator system and query API

* Revert unnecessary changes in EOGWorklist.kt

* Split division by 0 and other test

* Try to fix problematic integer lookup - no success

* somewhat fix problem with equal but non-identical Integer objects used as keys

* Fix min and max operations

* Add more operators, implement shl

* right shifting

* bitwise and and or

* trigger build

* define some of the exceptional cases to avoid exceptions

* Several fixes in tests and in minus

* throw less exceptions and catch them

* Fix asserts

* Less unsupported operators

* Some cleanup

* Fix test

* Remove commented out code

---------

Co-authored-by: Robert Haimerl <robert.haimerl@aisec.fraunhofer.de>
Co-authored-by: KuechA <31155350+KuechA@users.noreply.github.com>
Co-authored-by: Alexander Kuechler <alexander.kuechler@aisec.fraunhofer.de>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* Timeout for CDG and CFSensitiveDFG pass

* Make the timeout an argument of iterateEOG

* remove existing dfg edges only on success

* apply strategy usage to to timeoutless invocation

* updating call due to having non positional argument

* Returning a non null time to solve the issue because apparently we are able to

* Adding Test. Fixing coding issue that actually reran the iteration without timeout if the iteration timeouted

* Add nullness conditional checks

* Fixing coding issue that actually reran the iteration without timeout if the iteration timeouted

* Spotless

---------

Co-authored-by: Konrad Weiss <konrad.weiss@aisec.fraunhofer.de>
…hat are part of the AST (#2403)

* Added API to return methods of a Type

* Added members, fields and methods

* Add `declaringScope` to `Declaration`.

* Extended unit test

* Rename fields/methods/... in `RecordDeclaration` to `innerFields`, ...

This should make it clear that it only contains those that are directly embedded into the AST structure.

* Do not add Go's method to innerMethod AST property anymore

* Fixed Go tests by using the correct Type API

* Do not add outside methods in C++ to record inner methods

* Trying to get rid of addXXX functions

* Fixed test

* Removed INNER_
* Make MCP configurable

* Readme++
…tead of a file (#1706)

* Changing function signature of `parse` to accept the file content instead of a file

This PR changes the way `parse` works (in a backwards compatible way). Instead of parsing a `File`, we parse the file contents (and a path). The reasoning behind this is that almost all language frontends currently need to read the file contents and we can harmonize this. This will also allow us to provide more common statistics about the parsing context in the future.

* Fixed spotless

* fixing uri handling due to it being nullable now

* Fixing parameter order

* Addign a Converter for the newly introduced TranslationStats

---------

Co-authored-by: Konrad Weiss <konrad.weiss@aisec.fraunhofer.de>
* Move unit tests depending on Python language frontend to integration test

* Add missing dependency for Python language frontend in integration tests

* Remove test condition for available Python language frontend

---------

Co-authored-by: Christian Banse <christian.banse@aisec.fraunhofer.de>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
#2446)

* Merging namespace skip if it has no location with ast tree exploration if nodes have no location to better match

* moving iterative search into getEnclosingChild

* Add condidate search to enclosing node search and neares node search in comment matcher

* Move back testfile

* Some refactoring

* Nesting the comment test file into several folders to implicitly create namespaces
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
lshala added 27 commits March 4, 2026 13:47
According to the release notes for version 0.9.0 there is a breaking change regarding the "handler" function, which we use in almost every test. It now accepts a ClientConnection as receiver, which for our tests would mean creating a dummy class with some boilerplate code. The better way is using the newly introduced kotlin-sdk-testing, which provides a way to test the client-server functionalities without network (in-memory). The test setup implementation follows the sample here: https://github.com/modelcontextprotocol/kotlin-sdk/blob/5b58814613069babb1bbd5cab4572331eaed4b45/kotlin-sdk-testing/Module.md
@lshala lshala mentioned this pull request Mar 10, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 10, 2026

Codecov Report

❌ Patch coverage is 19.79866% with 717 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.50%. Comparing base (2b6ca85) to head (dc7b343).
⚠️ Report is 13 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...e/fraunhofer/aisec/codyze/console/ai/ChatClient.kt 0.00% 130 Missing ⚠️
...er/aisec/codyze/console/ai/clients/OpenAiClient.kt 0.00% 122 Missing ⚠️
...er/aisec/codyze/console/ai/clients/GeminiClient.kt 0.00% 100 Missing ⚠️
...aunhofer/aisec/codyze/console/ai/KoogChatClient.kt 0.00% 71 Missing ⚠️
...er/aisec/codyze/console/ai/clients/ClientModels.kt 0.00% 38 Missing ⚠️
...isec/cpg/mcp/mcpserver/tools/CpgDfgBackwardTool.kt 0.00% 36 Missing ⚠️
.../fraunhofer/aisec/codyze/console/ai/ChatService.kt 0.00% 35 Missing ⚠️
...fraunhofer/aisec/codyze/console/ai/clients/Util.kt 0.00% 27 Missing ⚠️
...de/fraunhofer/aisec/codyze/console/ai/McpModels.kt 0.00% 24 Missing ⚠️
.../kotlin/de/fraunhofer/aisec/cpg/mcp/Application.kt 0.00% 23 Missing ⚠️
... and 10 more

❌ Your patch check has failed because the patch coverage (19.79%) is below the target coverage (75.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
Files with missing lines Coverage Δ
.../fraunhofer/aisec/codyze/console/ConsoleService.kt 56.30% <100.00%> (+0.37%) ⬆️
...er/aisec/cpg/mcp/mcpserver/tools/CpgAnalyzeTool.kt 72.76% <100.00%> (-0.13%) ⬇️
...aisec/cpg/mcp/mcpserver/tools/CpgLlmAnalyzeTool.kt 100.00% <100.00%> (+5.97%) ⬆️
...er/aisec/cpg/mcp/mcpserver/tools/utils/Payloads.kt 56.60% <100.00%> (+6.60%) ⬆️
...kotlin/de/fraunhofer/aisec/codyze/console/Nodes.kt 47.26% <0.00%> (-2.41%) ⬇️
...isec/cpg/mcp/mcpserver/tools/utils/Serializable.kt 69.11% <84.21%> (+3.83%) ⬆️
...hofer/aisec/codyze/console/ai/clients/LlmClient.kt 0.00% <0.00%> (ø)
...de/fraunhofer/aisec/cpg/mcp/mcpserver/McpServer.kt 0.00% <0.00%> (-100.00%) ⬇️
...unhofer/aisec/codyze/console/ai/McpServerHelper.kt 40.00% <40.00%> (ø)
...hofer/aisec/cpg/serialization/NodeSerialization.kt 69.76% <69.76%> (ø)
... and 14 more

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@KuechA
Copy link
Copy Markdown
Contributor

KuechA commented Mar 11, 2026

Why does the build need 7 minutes now instead of 2 on main?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants