Skip to content

Commit 0aaf57a

Browse files
committed
docs: update documentation for server configuration and i18n
- Refactor server startup examples to use McpServerConfiguration.Builder - Add Javadoc comments for main methods - Update Chinese translations in i18n example - Fix typo in "5-Minutes Tutorial" heading - Add missing SSE server example
1 parent 43942c9 commit 0aaf57a

File tree

2 files changed

+31
-22
lines changed

2 files changed

+31
-22
lines changed

docs/components.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,15 @@ This SDK has built-in multilingual support, which can be enabled through the `@M
120120
@McpServerApplication
121121
@McpI18nEnabled(resourceBundleBaseName = "messages")
122122
public class I18nMcpServer {
123+
/**
124+
* Main method to start the MCP server with i18n support.
125+
*
126+
* @param args Command line arguments.
127+
*/
123128
public static void main(String[] args) {
124-
McpServers.run(I18nMcpServer.class, args)
125-
.startStdioServer(McpServerInfo.builder()
126-
.name("i18n-server")
127-
.version("1.0.0")
128-
.build());
129+
McpServerConfiguration.Builder configuration =
130+
McpServerConfiguration.builder().name("i18n-mcp-server").version("1.0.0");
131+
McpServers.run(I18nMcpServer.class, args).startStdioServer(configuration);
129132
}
130133
}
131134
```
@@ -149,13 +152,13 @@ Create `messages_zh_CN.properties` file:
149152

150153
```properties
151154
# messages_zh_CN.properties
152-
tool.add.description=Calculate the sum of two numbers
153-
tool.add.param.a.description=First number
154-
tool.add.param.b.description=Second number
155-
resource.system.info.description=System information
156-
prompt.generate.code.description=Generate code for a given task
157-
prompt.generate.code.param.language.description=Programming language
158-
prompt.generate.code.param.task.description=Task description
155+
tool.add.description=计算两个数字的和
156+
tool.add.param.a.description=第一个数字
157+
tool.add.param.b.description=第二个数字
158+
resource.system.info.description=系统信息
159+
prompt.generate.code.description=根据任务描述生成代码
160+
prompt.generate.code.param.language.description=编程语言
161+
prompt.generate.code.param.task.description=任务描述
159162
```
160163

161164
Using internationalized messages in components:

docs/getting-started.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,22 @@ This guide will help you build your first MCP server in 5 minutes.
3030
implementation 'io.github.thought2code:mcp-annotated-java-sdk:0.10.0'
3131
```
3232

33-
## 5-Minute Tutorial
33+
## 5-Minutes Tutorial
3434

3535
### Step 1: Create MCP Server Main Class
3636

3737
```java
3838
@McpServerApplication
39-
// If your MCP server components don't need multilingual support, you can remove this annotation
40-
@McpI18nEnabled(resourceBundleBaseName = "i18n/mcp_server_components_info")
4139
public class MyFirstMcpServer {
40+
/**
41+
* Main method to start the MCP server.
42+
*
43+
* @param args Command line arguments.
44+
*/
4245
public static void main(String[] args) {
43-
McpServers.run(MyFirstMcpServer.class, args)
44-
.startStdioServer(McpServerInfo.builder()
45-
.name("my-first-mcp-server")
46-
.version("1.0.0")
47-
.build());
46+
McpServerConfiguration.Builder configuration =
47+
McpServerConfiguration.builder().name("my-first-mcp-server").version("1.0.0");
48+
McpServers.run(MyFirstMcpServer.class, args).startStdioServer(configuration);
4849
}
4950
}
5051
```
@@ -109,18 +110,23 @@ Based on standard input/output communication, suitable for CLI tools.
109110

110111
```java
111112
// Start STDIO server
112-
McpServers.run(MyMcpServer.class, args).startStdioServer(serverInfo);
113+
McpServers.run(MyMcpServer.class, args).startStdioServer(configuration);
113114
```
114115

115116
### 2. SSE (Server-Sent Events) Mode
116117
HTTP-based real-time communication (deprecated).
117118

119+
```java
120+
// Start SSE server
121+
McpServers.run(MyMcpServer.class, args).startSseServer(configuration);
122+
```
123+
118124
### 3. Streamable HTTP Mode
119125
HTTP streaming for web applications.
120126

121127
```java
122128
// Start Streamable HTTP server
123-
McpServers.run(MyMcpServer.class, args).startStreamableServer(serverInfo);
129+
McpServers.run(MyMcpServer.class, args).startStreamableServer(configuration);
124130
```
125131

126132
## Project Structure

0 commit comments

Comments
 (0)