File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -23,14 +23,18 @@ Just put this one line code in your `main` method:
23
23
// You can use this annotation to specify the base package
24
24
// to scan for MCP resources, prompts, tools, but it's optional.
25
25
// If not specified, it will scan the package where the main method is located.
26
- @McpComponentScan (basePackage = " com.github.codeboyzhou.mcp.examples" )
26
+ @McpComponentScan (basePackage = " com.github.codeboyzhou.mcp.server. examples" )
27
27
public class MyMcpServer {
28
28
29
29
public static void main (String [] args ) {
30
30
// Start a STDIO MCP server
31
- McpServers . run(MyMcpServer . class, args). startSyncStdioServer(" mcp-server" , " 1.0.0" );
31
+ McpServers . run(MyMcpServer . class, args). startSyncStdioServer(
32
+ McpServerInfo . builder(). name(" mcp-server" ). version(" 1.0.0" ). build()
33
+ );
32
34
// or a HTTP SSE MCP server
33
- McpServers . run(MyMcpServer . class, args). startSyncSseServer(" mcp-server" , " 1.0.0" );
35
+ McpServers . run(MyMcpServer . class, args). startSyncSseServer(
36
+ McpSseServerInfo . builder(). name(" mcp-server" ). version(" 1.0.0" ). port(8080 ). build()
37
+ );
34
38
}
35
39
36
40
}
You can’t perform that action at this time.
0 commit comments