File tree Expand file tree Collapse file tree 3 files changed +14
-6
lines changed
samples/integration-tests/src
main/java/org/springaicommunity/mcp/security/tests Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Original file line number Diff line number Diff line change 7474 <maven .compiler.target>17</maven .compiler.target>
7575
7676 <mcp .java.sdk.version>0.15.0</mcp .java.sdk.version>
77- <spring-ai .version>1.1.0-M4 </spring-ai .version>
77+ <spring-ai .version>1.1.0</spring-ai .version>
7878 <spring-boot .version>3.5.4</spring-boot .version>
7979
8080 <!-- plugin versions -->
Original file line number Diff line number Diff line change 1616
1717package org .springaicommunity .mcp .security .tests ;
1818
19- import io .modelcontextprotocol .client .McpSyncClient ;
2019import java .util .HashMap ;
2120import java .util .List ;
2221import java .util .Map ;
2322
23+ import io .modelcontextprotocol .client .McpSyncClient ;
24+
2425import org .springframework .ai .mcp .client .common .autoconfigure .properties .McpClientCommonProperties ;
2526
2627/**
@@ -30,15 +31,23 @@ public class InMemoryMcpClientRepository {
3031
3132 private final Map <String , McpSyncClient > clients = new HashMap <>();
3233
33- public InMemoryMcpClientRepository (List <McpSyncClient > clients , McpClientCommonProperties commonProperties ) {
34+ private final String defaultPrefix ;
35+
36+ public InMemoryMcpClientRepository (List <McpSyncClient > clients ) {
37+ this .defaultPrefix = new McpClientCommonProperties ().getName ();
38+
3439 for (var client : clients ) {
3540 var name = client .getClientInfo ().name ();
36- this .clients .putIfAbsent (name . replace ( commonProperties . getName () + " - " , "" ) , client );
41+ this .clients .putIfAbsent (name , client );
3742 }
3843 }
3944
4045 public McpSyncClient getClientByName (String name ) {
41- return this .clients .get (name );
46+ var client = this .clients .get (name );
47+ if (client != null ) {
48+ return client ;
49+ }
50+ return this .clients .get (defaultPrefix + " - " + name );
4251 }
4352
4453 public void addClient (String name , McpSyncClient client ) {
Original file line number Diff line number Diff line change @@ -10,4 +10,3 @@ spring.security.oauth2.client.registration.authserver-client-credentials.authori
1010spring.security.oauth2.client.registration.authserver-client-credentials.provider =authserver
1111# Authserver common config
1212spring.security.oauth2.client.provider.authserver.issuer-uri =${authorization.server.url}
13- # spring.ai.mcp.client.toolcallback.enabled=true
You can’t perform that action at this time.
0 commit comments