Skip to content

Commit d5f8266

Browse files
committed
docs(README): Update documentation for v0.5.0 release
1 parent 7eb1316 commit d5f8266

File tree

1 file changed

+31
-21
lines changed

1 file changed

+31
-21
lines changed

README.md

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Declarative [MCP Java SDK](https://github.com/modelcontextprotocol/java-sdk) Dev
1515
- Get rid of complex and lengthy JSON schema definitions.
1616
- Just focus on your core logic (resources/prompts/tools).
1717
- Configuration file compatible with the Spring AI framework.
18+
- Built-in multi-languages support for MCP server (resources/prompts/tools).
1819

1920
## Showcase
2021

@@ -30,18 +31,15 @@ import com.github.codeboyzhou.mcp.declarative.McpServers;
3031
public class MyMcpServer {
3132

3233
public static void main(String[] args) {
34+
McpServers servers = McpServers.run(MyMcpServer.class, args);
3335
// Start a STDIO MCP server
34-
McpServers.run(MyMcpServer.class, args).startSyncStdioServer(
35-
McpServerInfo.builder().name("mcp-server").version("1.0.0").build()
36-
);
36+
servers.startStdioServer(McpServerInfo.builder().name("mcp-server").version("1.0.0").build());
3737
// or a HTTP SSE MCP server
38-
McpServers.run(MyMcpServer.class, args).startSyncSseServer(
39-
McpSseServerInfo.builder().name("mcp-server").version("1.0.0").port(8080).build()
40-
);
41-
// or start with yaml configuration file (compatible with the Spring AI framework)
42-
McpServers.run(MyMcpServer.class, args).startServer();
43-
// or start with a specific configuration file (compatible with the Spring AI framework)
44-
McpServers.run(MyMcpServer.class, args).startServer("my-mcp-server.yml");
38+
servers.startSseServer(McpSseServerInfo.builder().name("mcp-server").version("1.0.0").port(8080).build());
39+
// or start with yaml config file (compatible with the Spring AI framework)
40+
servers.startServer();
41+
// or start with a custom config file (compatible with the Spring AI framework)
42+
servers.startServer("my-mcp-server.yml");
4543
}
4644

4745
}
@@ -54,16 +52,21 @@ enabled: true
5452
stdio: false
5553
name: mcp-server
5654
version: 1.0.0
57-
instructions: mcp-server
58-
request-timeout: 30000
59-
type: SYNC
60-
resource-change-notification: true
61-
prompt-change-notification: true
62-
tool-change-notification: true
63-
sse-message-endpoint: /mcp/message
64-
sse-endpoint: /sse
65-
base-url: http://localhost:8080
66-
sse-port: 8080
55+
type: ASYNC
56+
request-timeout: 20000
57+
capabilities:
58+
resource: true
59+
prompt: true
60+
tool: true
61+
change-notification:
62+
resource: true
63+
prompt: true
64+
tool: true
65+
sse:
66+
message-endpoint: /mcp/message
67+
endpoint: /sse
68+
base-url: http://localhost:8080
69+
port: 8080
6770
```
6871
6972
No need to care about the low-level details of native MCP Java SDK and how to create the MCP resources, prompts, and tools. Just annotate them like this:
@@ -74,6 +77,8 @@ public class MyMcpResources {
7477

7578
// This method defines a MCP resource to expose the OS env variables
7679
@McpResource(uri = "env://variables", description = "OS env variables")
80+
// or you can use it like this to support multi-languages
81+
@McpResource(uri = "env://variables", descriptionI18nKey = "your_i18n_key_in_properties_file")
7782
public String getSystemEnv() {
7883
// Just put your logic code here, forget about the MCP SDK details.
7984
return System.getenv().toString();
@@ -87,7 +92,10 @@ public class MyMcpResources {
8792
@McpPrompts
8893
public class MyMcpPrompts {
8994

95+
// This method defines a MCP prompt to read a file
9096
@McpPrompt(description = "A simple prompt to read a file")
97+
// or you can use it like this to support multi-languages
98+
@McpPrompt(descriptionI18nKey = "your_i18n_key_in_properties_file")
9199
public String readFile(
92100
@McpPromptParam(name = "path", description = "filepath", required = true) String path) {
93101
// Just put your logic code here, forget about the MCP SDK details.
@@ -103,6 +111,8 @@ public class MyMcpTools {
103111

104112
// This method defines a MCP tool to read a file
105113
@McpTool(description = "Read complete file contents with UTF-8 encoding")
114+
// or you can use it like this to support multi-languages
115+
@McpTool(descriptionI18nKey = "your_i18n_key_in_properties_file")
106116
public String readFile(
107117
@McpToolParam(name = "path", description = "filepath", required = true) String path) {
108118
// Just put your logic code here, forget about the MCP SDK details.
@@ -133,7 +143,7 @@ Add the following Maven dependency to your project:
133143
<dependency>
134144
<groupId>io.github.codeboyzhou</groupId>
135145
<artifactId>mcp-declarative-java-sdk</artifactId>
136-
<version>0.4.0</version>
146+
<version>0.5.0</version>
137147
</dependency>
138148
```
139149

0 commit comments

Comments
 (0)