spring-projects / spring-projects/spring-ai

Single MCP Client cannot be autowired

Open
#2,250 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

mcp
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

Bug description
When using the Spring AI MCP Client Auto-configuration, I cannot autowire a single McpSyncClient or McpAsyncClient object. Instead, I have to autowire a List<McpSyncClient> or List<McpAsyncClient>, even though I have only one.

Environment
Spring AI: 1.0.0-M6

Expected behavior
I expect to be able to autowire a single MCP Client if I only have one.

Minimal Complete Reproducible example
See: https://github.com/ThomasVitale/llm-apps-java-spring-ai/tree/main/mcp/mcp-clients/mcp-brave
In the example, there is only one MCP Client defined, but I have to autowire a list anyway.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Spring AI MCP Client Auto-configuration and the McpSyncClient and McpAsyncClient entry points. Reproduce the issue using the mcp/mcp-clients/mcp-brave example, which currently autowires a list despite having one client. Done means a single MCP client can be autowired when only one is configured, while the existing list behavior remains available.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.