Skip to content
Flows
Tier 5 · MCP & tool frameworks MCP & tooling · fetched 2026-07-02

Spring AI MCP Agent

An experimental MCP agent framework for the Spring/Java ecosystem explicitly based on Anthropic's 'Building Effective Agents' design practices - workflow patterns (chaining, routing, parallelization) implemented over MCP.

View source on GitHub

Key takeaways

  • 01

    Implements the canonical 'Building Effective Agents' patterns on MCP

  • 02

    Brings MCP tooling conventions to the JVM enterprise world

Flows built on this research

From the archive

Verbatim excerpts mined from our local archive of this repository — the prompts, schemas, and patterns worth stealing.

Prompt

The orchestrator's plan prompt: 3 steps, 4 parallel subtasks

You are tasked with orchestrating a plan to complete an objective.
You can analyze results from the previous steps already executed to decide if the objective is complete.
Your plan must be structured in sequential steps (up to 3 steps), with each step containing independent parallel subtasks (up to 4 subtasks).

Objective: %s

If the previous results achieve the objective, return is_complete=True.
Otherwise, generate remaining steps needed.

For each subtask specify:
  1. Clear description of the task that an LLM can execute
  2. Name of 1 Agent OR List of MCP server names to use for the task

From the Spring AI community: a replanning loop with hard fan-out limits - the planner re-reads all prior step results each round and must explicitly declare completion.

src/main/java/com/example/agentic/orchestration/OrchestratorPrompts.java

MCP & tools

An agent is a named set of MCP servers

public class McpAgent {
  private String name;
  private String instruction;
  /** List of MCP server names that this agent can access. */
  private List<String> serverNames;
  /** ChatClient configured to use the MCP servers' tools. */
  private ChatClient chatClient;
}

Planner system prompt: "Given an objective task and a list of MCP servers (which are collections of tools) or Agents (which are collections of servers), break down the objective into a series of steps."

A clean composition hierarchy: tools live in MCP servers, agents are named bundles of servers plus an instruction, and the planner routes tasks to either.

src/main/java/com/example/agentic/McpAgent.java