Skip to content

Commit a1c0276

Browse files
committed
refactor(mcp-server-chat2mysql): Refactor project structure to support both native and declarative SDK examples
1 parent bb998fc commit a1c0276

File tree

16 files changed

+228
-53
lines changed

16 files changed

+228
-53
lines changed
File renamed without changes.

mcp-server-chat2mysql/commons/pom.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>com.github.codeboyzhou</groupId>
9+
<artifactId>mcp-server-chat2mysql</artifactId>
10+
<version>1.0.0-SNAPSHOT</version>
11+
</parent>
12+
13+
<artifactId>commons</artifactId>
14+
<packaging>jar</packaging>
15+
16+
<properties>
17+
<java.version>17</java.version>
18+
<maven.compiler.source>${java.version}</maven.compiler.source>
19+
<maven.compiler.target>${java.version}</maven.compiler.target>
20+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
21+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
22+
</properties>
23+
24+
</project>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.github.mcp.examples.server.chat2mysql.enums;
1+
package com.github.mcp.server.chat2mysql.enums;
22

33
public enum PromptMessageEnding {
44

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.github.mcp.server.chat2mysql.util;
2+
3+
public interface ServerInfo {
4+
5+
String SERVER_NAME = "mcp-server-chat2mysql";
6+
7+
String SERVER_VERSION = "1.0.0";
8+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.github.mcp.examples.server.chat2mysql.util;
1+
package com.github.mcp.server.chat2mysql.util;
22

33
import org.slf4j.Logger;
44
import org.slf4j.LoggerFactory;

mcp-server-chat2mysql-native/pom.xml renamed to mcp-server-chat2mysql/declarative-sdk-example/pom.xml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
<parent>
88
<groupId>com.github.codeboyzhou</groupId>
9-
<artifactId>mcp-java-sdk-examples</artifactId>
9+
<artifactId>mcp-server-chat2mysql</artifactId>
1010
<version>1.0.0-SNAPSHOT</version>
1111
</parent>
1212

13-
<artifactId>mcp-server-chat2mysql-native</artifactId>
13+
<artifactId>declarative-sdk-example</artifactId>
1414
<packaging>jar</packaging>
1515

1616
<properties>
@@ -19,17 +19,12 @@
1919
<maven.compiler.target>${java.version}</maven.compiler.target>
2020
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2121
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
22-
<!--==================== maven plugin versions ====================-->
23-
<maven-shade-plugin.version>3.6.0</maven-shade-plugin.version>
24-
<!--==================== dependency versions ====================-->
25-
<mysql-connector-java.version>8.0.33</mysql-connector-java.version>
2622
</properties>
2723

2824
<dependencies>
2925
<dependency>
30-
<groupId>mysql</groupId>
31-
<artifactId>mysql-connector-java</artifactId>
32-
<version>${mysql-connector-java.version}</version>
26+
<groupId>com.github.codeboyzhou</groupId>
27+
<artifactId>commons</artifactId>
3328
</dependency>
3429
</dependencies>
3530

@@ -49,7 +44,7 @@
4944
<configuration>
5045
<transformers>
5146
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
52-
<mainClass>com.github.mcp.examples.server.chat2mysql.McpStdioServer</mainClass>
47+
<mainClass>com.github.mcp.server.chat2mysql.McpStdioServer</mainClass>
5348
</transformer>
5449
</transformers>
5550
</configuration>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.github.mcp.server.chat2mysql;
2+
3+
import com.github.codeboyzhou.mcp.declarative.McpServers;
4+
import com.github.codeboyzhou.mcp.declarative.annotation.McpComponentScan;
5+
import com.github.codeboyzhou.mcp.declarative.server.McpServerInfo;
6+
7+
import static com.github.mcp.server.chat2mysql.util.ServerInfo.SERVER_NAME;
8+
import static com.github.mcp.server.chat2mysql.util.ServerInfo.SERVER_VERSION;
9+
10+
@McpComponentScan(basePackageClass = McpStdioServer.class)
11+
public class McpStdioServer {
12+
13+
public static void main(String[] args) {
14+
McpServers servers = McpServers.run(McpStdioServer.class, args);
15+
servers.startSyncStdioServer(McpServerInfo.builder().name(SERVER_NAME).version(SERVER_VERSION).build());
16+
}
17+
18+
}

0 commit comments

Comments
 (0)