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

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

Description and use

Using Solon AI annotations, developers can quickly spin up an MCP server and client that automatically discovers and invokes LLM tools without manual protocol code, featuring built‑in retries and caching.

Problem

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

Outcome

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

Workflow

  • 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.

Evidence

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

Source

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

Source

  • Record date: 2026-09-15T00:46:03.815Z