Claus Ibsen created CAMEL-24810:
-----------------------------------
Summary: camel-jbang-mcp - tool that maps a class or package name
to its Maven dependency, known dependencies first then Maven Central
Key: CAMEL-24810
URL: https://issues.apache.org/jira/browse/CAMEL-24810
Project: Camel
Issue Type: New Feature
Components: camel-jbang-mcp
Reporter: Claus Ibsen
When an AI assistant or a person writes a bean of a third-party type, such as a
datasource or a connection factory, the question "which Maven dependency
provides this class" has no tool answer today. With camel run the
known-dependencies mapping downloads many of them on demand, but on a Spring
Boot or Quarkus project nothing downloads on demand and the coordinates must go
into the pom.
h3. Proposal
A tool in camel-jbang-mcp, for example {{camel_dependency_for_class}}, that
takes a class or package name and answers with the Maven GAV and how to declare
it. Lookup order:
# The known-dependencies files camel-kamelet-main ships
({{camel-main-known-dependencies.properties}},
{{camel-component-known-dependencies.properties}},
{{camel-factoryfinder-known-dependencies.properties}}), matched the way the
runtime matches (class, then each enclosing package). A hit also says that
camel run downloads it automatically.
# The Camel component mapping, so a class in
{{org.apache.camel.component.kafka}} answers {{org.apache.camel:camel-kafka}}
with the running Camel version.
# Fallback: Maven Central's class search
({{search.maven.org/solrsearch/select?q=fc:"<class>"}}). It answers in well
under a second but returns one document per version and shaded copy, oldest
first (8,233 hits for {{com.zaxxer.hikari.HikariDataSource}}), so the tool must
group by group and artifact, prefer the artifact whose name matches the
package, and fetch the latest version with a second query. Needs a timeout and
a cache; the tool must degrade to "unknown, declare it yourself" without
network.
The answer carries the three declaration forms:
{{camel.jbang.dependencies=...}} in application.properties, {{--dep}} on camel
run, and a pom.xml snippet for Spring Boot and Quarkus projects. The offline
part of the lookup is what the validator in camel-jbang-core already does (PR
#26574); the tool adds the online fallback and the declaration forms.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)