Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.alibaba.cloud.ai</groupId>
<artifactId>spring-ai-alibaba</artifactId>
<version>${revision}</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>spring-ai-alibaba-autoconfigure-nacos-mcp-gateway</artifactId>

<name>Spring AI Alibaba Nacos Mcp Gateway Autoconfiguration</name>
<description>Spring AI Alibaba Nacos Mcp Gateway Autoconfiguration</description>
<url>https://github.com/alibaba/spring-ai-alibaba</url>
<scm>
<connection>git://github.com/alibaba/spring-ai-alibaba.git</connection>
<developerConnection>git@github.com:alibaba/spring-ai-alibaba.git</developerConnection>
<url>https://github.com/alibaba/spring-ai-alibaba</url>
</scm>

<dependencies>

<dependency>
<groupId>com.alibaba.cloud.ai</groupId>
<artifactId>spring-ai-alibaba-mcp-gateway</artifactId>
<version>${revision}</version>
</dependency>

<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-starter-mcp-server</artifactId>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-retry</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>

<!-- Test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.alibaba.cloud.ai.autoconfigure.mcp.server;
package com.alibaba.cloud.ai.autoconfigure.mcp.gateway;

import com.alibaba.cloud.ai.mcp.nacos.NacosMcpProperties;
import com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties;
Expand Down Expand Up @@ -63,8 +63,8 @@
* @author aias00
*/
@EnableConfigurationProperties({ NacosMcpProperties.class, NacosMcpGatewayProperties.class, McpServerProperties.class })
@AutoConfiguration(after = { McpServerAutoConfiguration.class, NacosMcpRegistryAutoConfiguration.class })
@ConditionalOnProperty(prefix = McpServerProperties.CONFIG_PREFIX, name = "enabled", havingValue = "true",
@AutoConfiguration(after = { McpServerAutoConfiguration.class })
@ConditionalOnProperty(prefix = NacosMcpGatewayProperties.CONFIG_PREFIX, name = "enabled", havingValue = "true",
matchIfMissing = true)
public class NacosMcpGatewayAutoConfiguration implements ApplicationContextAware {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
{
"groups": [
{
"name": "spring.ai.alibaba.mcp.nacos",
"type": "com.alibaba.cloud.ai.mcp.nacos.NacosMcpProperties",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.NacosMcpProperties",
"description": "Configuration properties for Nacos MCP integration."
},
{
"name": "spring.ai.alibaba.mcp.nacos.gateway",
"type": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties",
"description": "Configuration properties for Nacos MCP gateway service discovery."
}
],
"properties": [
{
"name": "spring.ai.alibaba.mcp.nacos.server-addr",
"type": "java.lang.String",
"description": "Nacos server address.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.NacosMcpProperties",
"defaultValue": "localhost:8848"
},
{
"name": "spring.ai.alibaba.mcp.nacos.namespace",
"type": "java.lang.String",
"description": "Nacos namespace for MCP service.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.NacosMcpProperties",
"defaultValue": ""
},
{
"name": "spring.ai.alibaba.mcp.nacos.username",
"type": "java.lang.String",
"description": "Nacos username to authenticate.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.NacosMcpProperties",
"defaultValue": ""
},
{
"name": "spring.ai.alibaba.mcp.nacos.password",
"type": "java.lang.String",
"description": "Nacos password to authenticate.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.NacosMcpProperties",
"defaultValue": ""
},
{
"name": "spring.ai.alibaba.mcp.nacos.access-key",
"type": "java.lang.String",
"description": "Nacos access key to authenticate.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.NacosMcpProperties",
"defaultValue": ""
},
{
"name": "spring.ai.alibaba.mcp.nacos.secret-key",
"type": "java.lang.String",
"description": "Nacos secret key to authenticate.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.NacosMcpProperties",
"defaultValue": ""
},
{
"name": "spring.ai.alibaba.mcp.nacos.endpoint",
"type": "java.lang.String",
"description": "Nacos server endpoint.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.NacosMcpProperties",
"defaultValue": ""
},
{
"name": "spring.ai.alibaba.mcp.nacos.gateway.enabled",
"type": "java.lang.Boolean",
"description": "Whether to enable gateway discovery of MCP server info from Nacos.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties",
"defaultValue": false
},
{
"name": "spring.ai.alibaba.mcp.nacos.gateway.service-group",
"type": "java.lang.String",
"description": "Service group for gateway discovery of MCP servers.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties",
"defaultValue": "DEFAULT_GROUP"
},
{
"name": "spring.ai.alibaba.mcp.nacos.gateway.service-names",
"type": "java.util.List<java.lang.String>",
"description": "Service names for gateway discovery of MCP servers.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties"
},
{
"name": "spring.ai.mcp.server.enabled",
"type": "java.lang.Boolean",
"description": "Whether to enable MCP server.",
"defaultValue": true
},
{
"name": "spring.ai.alibaba.mcp.nacos.gateway.max-connections",
"type": "java.lang.Integer",
"description": "Maximum number of HTTP connections for the MCP server.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties",
"defaultValue": 50
},
{
"name": "spring.ai.alibaba.mcp.nacos.gateway.acquire-timeout",
"type": "java.lang.Integer",
"description": "Timeout in milliseconds for acquiring a connection.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties",
"defaultValue": 30000
},
{
"name": "spring.ai.alibaba.mcp.nacos.gateway.max-idle-time",
"type": "java.lang.Integer",
"description": "Maximum idle time in seconds for connections.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties",
"defaultValue": 30
},
{
"name": "spring.ai.alibaba.mcp.nacos.gateway.max-life-time",
"type": "java.lang.Integer",
"description": "Maximum lifetime in seconds for connections.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties",
"defaultValue": 120
},
{
"name": "spring.ai.alibaba.mcp.nacos.gateway.connection-timeout",
"type": "java.lang.Integer",
"description": "Connection timeout in milliseconds.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties",
"defaultValue": 3000
},
{
"name": "spring.ai.alibaba.mcp.nacos.gateway.read-timeout",
"type": "java.lang.Integer",
"description": "Read timeout in milliseconds.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties",
"defaultValue": 5000
},
{
"name": "spring.ai.alibaba.mcp.nacos.gateway.write-timeout",
"type": "java.lang.Integer",
"description": "Write timeout in milliseconds.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties",
"defaultValue": 5000
}
],
"hints": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# Copyright 2025-2025 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
com.alibaba.cloud.ai.autoconfigure.mcp.gateway.NacosMcpGatewayAutoConfiguration


Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@
"type": "com.alibaba.cloud.ai.mcp.nacos.registry.NacosMcpRegistryProperties",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.registry.NacosMcpRegistryProperties",
"description": "Configuration properties for Nacos MCP server registration."
},
{
"name": "spring.ai.alibaba.mcp.nacos.gateway",
"type": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties",
"description": "Configuration properties for Nacos MCP gateway service discovery."
}
],
"properties": [
Expand Down Expand Up @@ -97,80 +91,11 @@
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.registry.NacosMcpRegistryProperties",
"defaultValue": "/mcp"
},
{
"name": "spring.ai.alibaba.mcp.nacos.gateway.enabled",
"type": "java.lang.Boolean",
"description": "Whether to enable gateway discovery of MCP server info from Nacos.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties",
"defaultValue": false
},
{
"name": "spring.ai.alibaba.mcp.nacos.gateway.service-group",
"type": "java.lang.String",
"description": "Service group for gateway discovery of MCP servers.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties",
"defaultValue": "DEFAULT_GROUP"
},
{
"name": "spring.ai.alibaba.mcp.nacos.gateway.service-names",
"type": "java.util.List<java.lang.String>",
"description": "Service names for gateway discovery of MCP servers.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties"
},
{
"name": "spring.ai.mcp.server.enabled",
"type": "java.lang.Boolean",
"description": "Whether to enable MCP server.",
"defaultValue": true
},
{
"name": "spring.ai.alibaba.mcp.nacos.gateway.max-connections",
"type": "java.lang.Integer",
"description": "Maximum number of HTTP connections for the MCP server.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties",
"defaultValue": 50
},
{
"name": "spring.ai.alibaba.mcp.nacos.gateway.acquire-timeout",
"type": "java.lang.Integer",
"description": "Timeout in milliseconds for acquiring a connection.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties",
"defaultValue": 30000
},
{
"name": "spring.ai.alibaba.mcp.nacos.gateway.max-idle-time",
"type": "java.lang.Integer",
"description": "Maximum idle time in seconds for connections.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties",
"defaultValue": 30
},
{
"name": "spring.ai.alibaba.mcp.nacos.gateway.max-life-time",
"type": "java.lang.Integer",
"description": "Maximum lifetime in seconds for connections.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties",
"defaultValue": 120
},
{
"name": "spring.ai.alibaba.mcp.nacos.gateway.connection-timeout",
"type": "java.lang.Integer",
"description": "Connection timeout in milliseconds.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties",
"defaultValue": 3000
},
{
"name": "spring.ai.alibaba.mcp.nacos.gateway.read-timeout",
"type": "java.lang.Integer",
"description": "Read timeout in milliseconds.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties",
"defaultValue": 5000
},
{
"name": "spring.ai.alibaba.mcp.nacos.gateway.write-timeout",
"type": "java.lang.Integer",
"description": "Write timeout in milliseconds.",
"sourceType": "com.alibaba.cloud.ai.mcp.nacos.gateway.properties.NacosMcpGatewayProperties",
"defaultValue": 5000
}
],
"hints": []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@
# limitations under the License.
#
com.alibaba.cloud.ai.autoconfigure.mcp.server.NacosMcpRegistryAutoConfiguration
com.alibaba.cloud.ai.autoconfigure.mcp.server.NacosMcpGatewayAutoConfiguration


2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
<!-- Nacos3 version -->
<module>auto-configurations/spring-ai-alibaba-autoconfigure-nacos-mcp-client</module>
<module>auto-configurations/spring-ai-alibaba-autoconfigure-nacos-mcp-server</module>
<module>auto-configurations/spring-ai-alibaba-autoconfigure-nacos-mcp-gateway</module>

<!-- Spring AI Alibaba Nacos Prompt Template -->
<module>auto-configurations/spring-ai-alibaba-autoconfigure-nacos-prompt</module>
Expand All @@ -161,6 +162,7 @@
<module>spring-ai-alibaba-spring-boot-starters/spring-ai-alibaba-starter-nacos2-mcp-server</module>
<module>spring-ai-alibaba-spring-boot-starters/spring-ai-alibaba-starter-nacos-mcp-client</module>
<module>spring-ai-alibaba-spring-boot-starters/spring-ai-alibaba-starter-nacos-mcp-server</module>
<module>spring-ai-alibaba-spring-boot-starters/spring-ai-alibaba-starter-nacos-mcp-gateway</module>
<module>spring-ai-alibaba-spring-boot-starters/spring-ai-alibaba-starter-nl2sql</module>
</modules>

Expand Down
6 changes: 6 additions & 0 deletions spring-ai-alibaba-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.alibaba.cloud.ai</groupId>
<artifactId>spring-ai-alibaba-starter-nacos-mcp-gateway</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.alibaba.cloud.ai</groupId>
<artifactId>spring-ai-alibaba-starter-nacos-prompt</artifactId>
Expand Down
2 changes: 2 additions & 0 deletions spring-ai-alibaba-mcp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<modules>
<module>spring-ai-alibaba-mcp-nacos2</module>
<module>spring-ai-alibaba-mcp-nacos</module>
<module>spring-ai-alibaba-mcp-nacos-common</module>
<module>spring-ai-alibaba-mcp-gateway</module>
</modules>
<scm>
<connection>git://github.com/alibaba/spring-ai-alibaba.git</connection>
Expand Down
Loading
Loading