Skip to content

Commit 859fda9

Browse files
committed
docs(README): Update README.md to introduce yaml configuration example
1 parent 8b80f91 commit 859fda9

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

README.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Declarative [MCP Java SDK](https://github.com/modelcontextprotocol/java-sdk) Dev
2121
Just put this one line code in your `main` method:
2222

2323
```java
24+
import com.github.codeboyzhou.mcp.declarative.McpServers;
25+
2426
// You can use this annotation to specify the base package
2527
// to scan for MCP resources, prompts, tools, but it's optional.
2628
// If not specified, it will scan the package where the main method is located.
@@ -36,13 +38,34 @@ public class MyMcpServer {
3638
McpServers.run(MyMcpServer.class, args).startSyncSseServer(
3739
McpSseServerInfo.builder().name("mcp-server").version("1.0.0").port(8080).build()
3840
);
39-
// or start with yaml configuration file compatible with the Spring AI framework
41+
// or start with yaml configuration file (compatible with the Spring AI framework)
4042
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");
4145
}
4246

4347
}
4448
```
4549

50+
This is a yaml configuration file example (named `mcp-server.yml` by default, or also `mcp-server.yaml`) only if you are using `startServer()` method:
51+
52+
```yaml
53+
enabled: true
54+
stdio: false
55+
name: mcp-server
56+
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
67+
```
68+
4669
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:
4770
4871
```java
@@ -106,11 +129,11 @@ Now it's all set, run your MCP server, choose one MCP client you like and start
106129
Add the following Maven dependency to your project:
107130

108131
```xml
109-
<!-- Internally relies on native MCP Java SDK 0.9.0 -->
132+
<!-- Internally relies on native MCP Java SDK 0.10.0 -->
110133
<dependency>
111134
<groupId>io.github.codeboyzhou</groupId>
112135
<artifactId>mcp-declarative-java-sdk</artifactId>
113-
<version>0.3.0</version>
136+
<version>0.4.0</version>
114137
</dependency>
115138
```
116139

src/main/java/com/github/codeboyzhou/mcp/declarative/configuration/McpServerConfiguration.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import com.fasterxml.jackson.annotation.JsonProperty;
44
import com.github.codeboyzhou.mcp.declarative.util.StringHelper;
55

6-
import java.util.Map;
7-
86
public record McpServerConfiguration(
97
@JsonProperty("enabled") boolean enabled,
108
@JsonProperty("stdio") boolean stdio,
@@ -16,7 +14,6 @@ public record McpServerConfiguration(
1614
@JsonProperty("resource-change-notification") boolean resourceChangeNotification,
1715
@JsonProperty("prompt-change-notification") boolean promptChangeNotification,
1816
@JsonProperty("tool-change-notification") boolean toolChangeNotification,
19-
@JsonProperty("tool-response-mime-type") Map<String, String> toolResponseMimeType,
2017
@JsonProperty("sse-message-endpoint") String sseMessageEndpoint,
2118
@JsonProperty("sse-endpoint") String sseEndpoint,
2219
@JsonProperty("base-url") String baseUrl,
@@ -35,7 +32,6 @@ public static McpServerConfiguration defaultConfiguration() {
3532
true,
3633
true,
3734
true,
38-
Map.of(),
3935
"/mcp/message",
4036
"/sse",
4137
StringHelper.EMPTY,

0 commit comments

Comments
 (0)