spring-projects / spring-projects/spring-ai
Single MCP Client cannot be autowired
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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