Skip to content

Commit 21c4283

Browse files
committed
refactor: rename MCP auto-configuration classes with Mcp prefix
- Rename ClientAnnotationScannerAutoConfiguration to McpClientAnnotationScannerAutoConfiguration - Rename ClientAnnotationScannerProperties to McpClientAnnotationScannerProperties - Rename ClientSpecificationFactoryAutoConfiguration to McpClientSpecificationFactoryAutoConfiguration - Rename ServerAnnotationScannerAutoConfiguration to McpServerAnnotationScannerAutoConfiguration - Rename ServerAnnotationScannerProperties to McpServerAnnotationScannerProperties - Rename ServerSpecificationFactoryAutoConfiguration to McpServerSpecificationFactoryAutoConfiguration - Update all import statements and configuration references accordingly This improves naming consistency and clarity across MCP client and server auto-configuration modules. Signed-off-by: Christian Tzolov <[email protected]>
1 parent ef71e4e commit 21c4283

File tree

10 files changed

+48
-38
lines changed

10 files changed

+48
-38
lines changed
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.springframework.ai.mcp.annotation.spring.scan.AbstractAnnotatedMethodBeanPostProcessor;
2828
import org.springframework.ai.mcp.annotation.spring.scan.AbstractMcpAnnotatedBeans;
2929
import org.springframework.boot.autoconfigure.AutoConfiguration;
30+
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
3031
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
3132
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
3233
import org.springframework.boot.context.properties.EnableConfigurationProperties;
@@ -36,10 +37,11 @@
3637
* @author Christian Tzolov
3738
*/
3839
@AutoConfiguration
39-
@ConditionalOnProperty(prefix = ClientAnnotationScannerProperties.CONFIG_PREFIX, name = "enabled", havingValue = "true",
40-
matchIfMissing = true)
41-
@EnableConfigurationProperties(ClientAnnotationScannerProperties.class)
42-
public class ClientAnnotationScannerAutoConfiguration {
40+
@ConditionalOnClass(McpLogging.class)
41+
@ConditionalOnProperty(prefix = McpClientAnnotationScannerProperties.CONFIG_PREFIX, name = "enabled",
42+
havingValue = "true", matchIfMissing = true)
43+
@EnableConfigurationProperties(McpClientAnnotationScannerProperties.class)
44+
public class McpClientAnnotationScannerAutoConfiguration {
4345

4446
private static final Set<Class<? extends Annotation>> CLIENT_MCP_ANNOTATIONS = Set.of(McpLogging.class,
4547
McpSampling.class, McpElicitation.class, McpProgress.class);
@@ -53,7 +55,7 @@ public ClientMcpAnnotatedBeans clientAnnotatedBeans() {
5355
@Bean
5456
@ConditionalOnMissingBean
5557
public ClientAnnotatedMethodBeanPostProcessor clientAnnotatedMethodBeanPostProcessor(
56-
ClientMcpAnnotatedBeans clientMcpAnnotatedBeans, ClientAnnotationScannerProperties properties) {
58+
ClientMcpAnnotatedBeans clientMcpAnnotatedBeans, McpClientAnnotationScannerProperties properties) {
5759
return new ClientAnnotatedMethodBeanPostProcessor(clientMcpAnnotatedBeans, CLIENT_MCP_ANNOTATIONS);
5860
}
5961

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
/**
2222
* @author Christian Tzolov
2323
*/
24-
@ConfigurationProperties(prefix = ClientAnnotationScannerProperties.CONFIG_PREFIX)
25-
public class ClientAnnotationScannerProperties {
24+
@ConfigurationProperties(prefix = McpClientAnnotationScannerProperties.CONFIG_PREFIX)
25+
public class McpClientAnnotationScannerProperties {
2626

2727
public static final String CONFIG_PREFIX = "spring.ai.mcp.client.annotation-scanner";
2828

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,22 @@
3333

3434
import org.springframework.ai.mcp.annotation.spring.AsyncMcpAnnotationProviders;
3535
import org.springframework.ai.mcp.annotation.spring.SyncMcpAnnotationProviders;
36-
import org.springframework.ai.mcp.client.common.autoconfigure.annotations.ClientAnnotationScannerAutoConfiguration.ClientMcpAnnotatedBeans;
36+
import org.springframework.ai.mcp.client.common.autoconfigure.annotations.McpClientAnnotationScannerAutoConfiguration.ClientMcpAnnotatedBeans;
3737
import org.springframework.ai.mcp.client.common.autoconfigure.properties.McpClientCommonProperties;
3838
import org.springframework.boot.autoconfigure.AutoConfiguration;
39+
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
3940
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
4041
import org.springframework.context.annotation.Bean;
4142
import org.springframework.context.annotation.Configuration;
4243

4344
/**
4445
* @author Christian Tzolov
4546
*/
46-
@AutoConfiguration(after = ClientAnnotationScannerAutoConfiguration.class)
47-
@ConditionalOnProperty(prefix = ClientAnnotationScannerProperties.CONFIG_PREFIX, name = "enabled", havingValue = "true",
48-
matchIfMissing = true)
49-
public class ClientSpecificationFactoryAutoConfiguration {
47+
@AutoConfiguration(after = McpClientAnnotationScannerAutoConfiguration.class)
48+
@ConditionalOnClass(McpLogging.class)
49+
@ConditionalOnProperty(prefix = McpClientAnnotationScannerProperties.CONFIG_PREFIX, name = "enabled",
50+
havingValue = "true", matchIfMissing = true)
51+
public class McpClientSpecificationFactoryAutoConfiguration {
5052

5153
@Configuration(proxyBeanMethods = false)
5254
@ConditionalOnProperty(prefix = McpClientCommonProperties.CONFIG_PREFIX, name = "type", havingValue = "SYNC",

auto-configurations/mcp/spring-ai-autoconfigure-mcp-client-common/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717
org.springframework.ai.mcp.client.common.autoconfigure.StdioTransportAutoConfiguration
1818
org.springframework.ai.mcp.client.common.autoconfigure.McpClientAutoConfiguration
1919
org.springframework.ai.mcp.client.common.autoconfigure.McpToolCallbackAutoConfiguration
20-
org.springframework.ai.mcp.client.common.autoconfigure.annotations.ClientSpecificationFactoryAutoConfiguration
21-
org.springframework.ai.mcp.client.common.autoconfigure.annotations.ClientAnnotationScannerAutoConfiguration
20+
org.springframework.ai.mcp.client.common.autoconfigure.annotations.McpClientSpecificationFactoryAutoConfiguration
21+
org.springframework.ai.mcp.client.common.autoconfigure.annotations.McpClientAnnotationScannerAutoConfiguration
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.springframework.ai.mcp.annotation.spring.scan.AbstractAnnotatedMethodBeanPostProcessor;
2828
import org.springframework.ai.mcp.annotation.spring.scan.AbstractMcpAnnotatedBeans;
2929
import org.springframework.boot.autoconfigure.AutoConfiguration;
30+
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
3031
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
3132
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
3233
import org.springframework.boot.context.properties.EnableConfigurationProperties;
@@ -36,10 +37,11 @@
3637
* @author Christian Tzolov
3738
*/
3839
@AutoConfiguration
39-
@ConditionalOnProperty(prefix = ServerAnnotationScannerProperties.CONFIG_PREFIX, name = "enabled", havingValue = "true",
40-
matchIfMissing = true)
41-
@EnableConfigurationProperties(ServerAnnotationScannerProperties.class)
42-
public class ServerAnnotationScannerAutoConfiguration {
40+
@ConditionalOnClass(McpTool.class)
41+
@ConditionalOnProperty(prefix = McpServerAnnotationScannerProperties.CONFIG_PREFIX, name = "enabled",
42+
havingValue = "true", matchIfMissing = true)
43+
@EnableConfigurationProperties(McpServerAnnotationScannerProperties.class)
44+
public class McpServerAnnotationScannerAutoConfiguration {
4345

4446
private static final Set<Class<? extends Annotation>> SERVER_MCP_ANNOTATIONS = Set.of(McpTool.class,
4547
McpResource.class, McpPrompt.class, McpComplete.class);
@@ -53,7 +55,7 @@ public ServerMcpAnnotatedBeans serverAnnotatedBeanRegistry() {
5355
@Bean
5456
@ConditionalOnMissingBean
5557
public ServerAnnotatedMethodBeanPostProcessor serverAnnotatedMethodBeanPostProcessor(
56-
ServerMcpAnnotatedBeans serverMcpAnnotatedBeans, ServerAnnotationScannerProperties properties) {
58+
ServerMcpAnnotatedBeans serverMcpAnnotatedBeans, McpServerAnnotationScannerProperties properties) {
5759
return new ServerAnnotatedMethodBeanPostProcessor(serverMcpAnnotatedBeans, SERVER_MCP_ANNOTATIONS);
5860
}
5961

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
/**
2222
* @author Christian Tzolov
2323
*/
24-
@ConfigurationProperties(prefix = ServerAnnotationScannerProperties.CONFIG_PREFIX)
25-
public class ServerAnnotationScannerProperties {
24+
@ConfigurationProperties(prefix = McpServerAnnotationScannerProperties.CONFIG_PREFIX)
25+
public class McpServerAnnotationScannerProperties {
2626

2727
public static final String CONFIG_PREFIX = "spring.ai.mcp.server.annotation-scanner";
2828

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@
2727
import org.springframework.ai.mcp.annotation.spring.AsyncMcpAnnotationProviders;
2828
import org.springframework.ai.mcp.annotation.spring.SyncMcpAnnotationProviders;
2929
import org.springframework.ai.mcp.server.common.autoconfigure.McpServerAutoConfiguration;
30-
import org.springframework.ai.mcp.server.common.autoconfigure.annotations.ServerAnnotationScannerAutoConfiguration.ServerMcpAnnotatedBeans;
30+
import org.springframework.ai.mcp.server.common.autoconfigure.annotations.McpServerAnnotationScannerAutoConfiguration.ServerMcpAnnotatedBeans;
3131
import org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerProperties;
3232
import org.springframework.boot.autoconfigure.AutoConfiguration;
33+
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
3334
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
3435
import org.springframework.context.annotation.Bean;
3536
import org.springframework.context.annotation.Conditional;
@@ -38,11 +39,12 @@
3839
/**
3940
* @author Christian Tzolov
4041
*/
41-
@AutoConfiguration(after = ServerAnnotationScannerAutoConfiguration.class)
42-
@ConditionalOnProperty(prefix = ServerAnnotationScannerProperties.CONFIG_PREFIX, name = "enabled", havingValue = "true",
43-
matchIfMissing = true)
42+
@AutoConfiguration(after = McpServerAnnotationScannerAutoConfiguration.class)
43+
@ConditionalOnClass(McpTool.class)
44+
@ConditionalOnProperty(prefix = McpServerAnnotationScannerProperties.CONFIG_PREFIX, name = "enabled",
45+
havingValue = "true", matchIfMissing = true)
4446
@Conditional(McpServerAutoConfiguration.NonStatlessServerCondition.class)
45-
public class ServerSpecificationFactoryAutoConfiguration {
47+
public class McpServerSpecificationFactoryAutoConfiguration {
4648

4749
@Configuration(proxyBeanMethods = false)
4850
@ConditionalOnProperty(prefix = McpServerProperties.CONFIG_PREFIX, name = "type", havingValue = "SYNC",

auto-configurations/mcp/spring-ai-autoconfigure-mcp-server-common/src/main/java/org/springframework/ai/mcp/server/common/autoconfigure/annotations/StatelessServerSpecificationFactoryAutoConfiguration.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import org.springframework.ai.mcp.server.common.autoconfigure.McpServerStatelessAutoConfiguration;
3131
import org.springframework.ai.mcp.server.common.autoconfigure.McpServerStdioDisabledCondition;
3232
import org.springframework.ai.mcp.server.common.autoconfigure.StatelessToolCallbackConverterAutoConfiguration;
33-
import org.springframework.ai.mcp.server.common.autoconfigure.annotations.ServerAnnotationScannerAutoConfiguration.ServerMcpAnnotatedBeans;
33+
import org.springframework.ai.mcp.server.common.autoconfigure.annotations.McpServerAnnotationScannerAutoConfiguration.ServerMcpAnnotatedBeans;
3434
import org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerProperties;
3535
import org.springframework.boot.autoconfigure.AutoConfiguration;
3636
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@@ -41,9 +41,9 @@
4141
/**
4242
* @author Christian Tzolov
4343
*/
44-
@AutoConfiguration(after = ServerAnnotationScannerAutoConfiguration.class)
45-
@ConditionalOnProperty(prefix = ServerAnnotationScannerProperties.CONFIG_PREFIX, name = "enabled", havingValue = "true",
46-
matchIfMissing = true)
44+
@AutoConfiguration(after = McpServerAnnotationScannerAutoConfiguration.class)
45+
@ConditionalOnProperty(prefix = McpServerAnnotationScannerProperties.CONFIG_PREFIX, name = "enabled",
46+
havingValue = "true", matchIfMissing = true)
4747
@Conditional({ McpServerStdioDisabledCondition.class,
4848
McpServerStatelessAutoConfiguration.EnabledStatelessServerCondition.class,
4949
StatelessToolCallbackConverterAutoConfiguration.ToolCallbackConverterCondition.class })

auto-configurations/mcp/spring-ai-autoconfigure-mcp-server-common/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ org.springframework.ai.mcp.server.common.autoconfigure.McpServerAutoConfiguratio
1717
org.springframework.ai.mcp.server.common.autoconfigure.ToolCallbackConverterAutoConfiguration
1818
org.springframework.ai.mcp.server.common.autoconfigure.McpServerStatelessAutoConfiguration
1919
org.springframework.ai.mcp.server.common.autoconfigure.StatelessToolCallbackConverterAutoConfiguration
20-
org.springframework.ai.mcp.server.common.autoconfigure.annotations.ServerSpecificationFactoryAutoConfiguration
21-
org.springframework.ai.mcp.server.common.autoconfigure.annotations.ServerAnnotationScannerAutoConfiguration
20+
org.springframework.ai.mcp.server.common.autoconfigure.annotations.McpServerSpecificationFactoryAutoConfiguration
21+
org.springframework.ai.mcp.server.common.autoconfigure.annotations.McpServerAnnotationScannerAutoConfiguration

auto-configurations/mcp/spring-ai-autoconfigure-mcp-server-webflux/src/test/java/org/springframework/ai/mcp/server/autoconfigure/StreamableMcpAnnotationsIT.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@
7272

7373
import org.springframework.ai.mcp.client.common.autoconfigure.McpClientAutoConfiguration;
7474
import org.springframework.ai.mcp.client.common.autoconfigure.McpToolCallbackAutoConfiguration;
75-
import org.springframework.ai.mcp.client.common.autoconfigure.annotations.ClientAnnotationScannerAutoConfiguration;
76-
import org.springframework.ai.mcp.client.common.autoconfigure.annotations.ClientSpecificationFactoryAutoConfiguration;
75+
import org.springframework.ai.mcp.client.common.autoconfigure.annotations.McpClientAnnotationScannerAutoConfiguration;
76+
import org.springframework.ai.mcp.client.common.autoconfigure.annotations.McpClientSpecificationFactoryAutoConfiguration;
7777
import org.springframework.ai.mcp.client.webflux.autoconfigure.StreamableHttpWebFluxTransportAutoConfiguration;
7878
import org.springframework.ai.mcp.server.common.autoconfigure.McpServerAutoConfiguration;
7979
import org.springframework.ai.mcp.server.common.autoconfigure.ToolCallbackConverterAutoConfiguration;
80-
import org.springframework.ai.mcp.server.common.autoconfigure.annotations.ServerAnnotationScannerAutoConfiguration;
81-
import org.springframework.ai.mcp.server.common.autoconfigure.annotations.ServerSpecificationFactoryAutoConfiguration;
80+
import org.springframework.ai.mcp.server.common.autoconfigure.annotations.McpServerAnnotationScannerAutoConfiguration;
81+
import org.springframework.ai.mcp.server.common.autoconfigure.annotations.McpServerSpecificationFactoryAutoConfiguration;
8282
import org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerProperties;
8383
import org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerStreamableHttpProperties;
8484
import org.springframework.beans.factory.ObjectProvider;
@@ -101,12 +101,14 @@ public class StreamableMcpAnnotationsIT {
101101
.withPropertyValues("spring.ai.mcp.server.protocol=STREAMABLE")
102102
.withConfiguration(AutoConfigurations.of(McpServerAutoConfiguration.class,
103103
ToolCallbackConverterAutoConfiguration.class, McpServerStreamableHttpWebFluxAutoConfiguration.class,
104-
ServerAnnotationScannerAutoConfiguration.class, ServerSpecificationFactoryAutoConfiguration.class));
104+
McpServerAnnotationScannerAutoConfiguration.class,
105+
McpServerSpecificationFactoryAutoConfiguration.class));
105106

106107
private final ApplicationContextRunner clientApplicationContext = new ApplicationContextRunner()
107108
.withConfiguration(AutoConfigurations.of(McpToolCallbackAutoConfiguration.class,
108109
McpClientAutoConfiguration.class, StreamableHttpWebFluxTransportAutoConfiguration.class,
109-
ClientAnnotationScannerAutoConfiguration.class, ClientSpecificationFactoryAutoConfiguration.class));
110+
McpClientAnnotationScannerAutoConfiguration.class,
111+
McpClientSpecificationFactoryAutoConfiguration.class));
110112

111113
@Test
112114
void clientServerCapabilities() {

0 commit comments

Comments
 (0)