Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

MCP Without the Boilerplate: Solon AI's Annotation-Driven Server and Self-Healing Client

说明与用途

通过 Solon AI 注解,开发者可以快速创建 MCP 服务器和客户端,自动发现并调用 LLM 工具,无需手动协议代码,内置重试和缓存功能。

问题

Integrating LLM tools into Java applications often requires manual protocol code, hard‑coded function calls, and complex transport wiring.

结果

The annotation‑driven approach eliminates boilerplate, reduces maintenance, and provides robust, self‑healing connections between Java code and LLM tools.

工作流

  • 1. Annotate a class with @McpServerEndpoint and methods with @ToolMapping, @ResourceMapping, or @PromptMapping.
  • 2. Build the server; McpPlugin scans annotations and registers providers automatically.
  • 3. In the client, create an McpClientProvider with the server URL and add it to ChatModel via defaultToolAdd().
  • 4. Call chatModel.prompt("…").call() to let the model select and invoke remote tools.
  • 5. Optionally customize channel, heartbeat, or cache settings via the builder or options API.
  • 6. Rely on built‑in retry logic for transient transport errors and heartbeats for connection health.

证据

The provider is lazy: the underlying McpAsyncClient is created on first use, guarded by a lock.

来源

Network transport code fails in boring, repetitive ways. McpClientProvider centralizes the retry.

来源

  • 记录日期: 2026-09-15T00:46:03.815Z