Skip to content

Commit d59fa65

Browse files
docs: complete and improve Javadoc across main sources
Document public API and key internals (AnnotationProcessor, component registration, and configuration builders) for clearer published API docs. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 79f5906 commit d59fa65

41 files changed

Lines changed: 715 additions & 84 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/java/com/github/thought2code/mcp/annotated/configuration/ConfigurationLoader.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
import org.slf4j.LoggerFactory;
1515

1616
/**
17-
* This record represents a YAML configuration loader for MCP (Model Context Protocol) server
18-
* configuration.
17+
* Loads and merges {@link ServerConfiguration} from YAML files on the classpath or filesystem.
1918
*
20-
* <p>It loads the server configuration from a specified YAML file. If no file name is provided, the
21-
* default file name "mcp-server.yml" will be used.
19+
* <p>When {@code profile} is set in the base file, a companion {@code mcp-server-{profile}.yml} is
20+
* merged on top using Jackson merge semantics.
2221
*
22+
* @param configFileName YAML file name (for example {@code mcp-server.yml})
2323
* @see <a href="https://thought2code.github.io/mcp-annotated-java-sdk/getting-started">MCP
2424
* Annotated Java SDK Documentation</a>
2525
* @author codeboyzhou

src/main/java/com/github/thought2code/mcp/annotated/configuration/ServerCapabilities.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,16 @@
33
import com.fasterxml.jackson.annotation.JsonProperty;
44

55
/**
6-
* This record represents the capabilities of an MCP (Model Context Protocol) server.
6+
* MCP capability flags loaded from server configuration.
77
*
8+
* <p>Each flag maps to whether the server advertises support for resources, prompts, tools,
9+
* completions, and resource subscriptions during initialization.
10+
*
11+
* @param resource whether listing/reading resources is supported
12+
* @param subscribeResource whether resource subscription is supported
13+
* @param prompt whether prompts are supported
14+
* @param tool whether tools are supported
15+
* @param completion whether argument completions are supported
816
* @author codeboyzhou
917
*/
1018
public record ServerCapabilities(
@@ -23,7 +31,11 @@ public static Builder builder() {
2331
return new Builder();
2432
}
2533

26-
/** Builder class for {@code ServerCapabilities}. */
34+
/**
35+
* Mutable builder for {@link ServerCapabilities}.
36+
*
37+
* <p>Each flag maps to an MCP server capability advertised during initialization.
38+
*/
2739
public static class Builder {
2840
/** The resource capability. */
2941
private Boolean resource = ServerDefaults.CAPABILITY_ENABLED;

src/main/java/com/github/thought2code/mcp/annotated/configuration/ServerChangeNotification.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
import com.fasterxml.jackson.annotation.JsonProperty;
44

55
/**
6-
* This record represents a change notification for MCP (Model Context Protocol) server
7-
* capabilities.
8-
*
9-
* <p>It contains boolean flags indicating whether the server supports resource, prompt, and tool
10-
* change notification.
6+
* MCP list-change notification capability flags from server configuration.
117
*
8+
* @param resource whether the server may notify clients when the resource list changes
9+
* @param prompt whether the server may notify clients when the prompt list changes
10+
* @param tool whether the server may notify clients when the tool list changes
1211
* @author codeboyzhou
1312
*/
1413
public record ServerChangeNotification(
@@ -25,7 +24,11 @@ public static Builder builder() {
2524
return new Builder();
2625
}
2726

28-
/** Builder class for {@code ServerChangeNotification}. */
27+
/**
28+
* Mutable builder for {@link ServerChangeNotification}.
29+
*
30+
* <p>Controls whether list-change notifications are emitted per component kind.
31+
*/
2932
public static class Builder {
3033
/** The resource change notification flag. */
3134
private Boolean resource = ServerDefaults.CHANGE_NOTIFICATION_ENABLED;

src/main/java/com/github/thought2code/mcp/annotated/configuration/ServerConfiguration.java

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,24 @@
77
import com.github.thought2code.mcp.annotated.util.StringHelper;
88

99
/**
10-
* This record represents the configuration of an MCP (Model Context Protocol) server.
10+
* Root YAML configuration for an annotated MCP server application.
1111
*
12-
* <p>It contains various properties such as enabled status, server mode, name, version, type,
13-
* instructions, request timeout, capabilities, change notification, SSE (Server-Sent Events), and
14-
* streamable configuration.
12+
* <p>Loaded by {@link ConfigurationLoader} and merged with profile-specific overlays. Drives server
13+
* mode ({@link com.github.thought2code.mcp.annotated.enums.ServerMode}), transport endpoints, MCP
14+
* capability flags, and change-notification settings.
1515
*
16+
* @param profile optional profile name; when set, {@code mcp-server-{profile}.yml} is merged
17+
* @param enabled whether the MCP server should start
18+
* @param mode transport mode (stdio, streamable HTTP, or deprecated SSE)
19+
* @param name MCP server implementation name
20+
* @param version MCP server implementation version
21+
* @param type sync vs async MCP server API style
22+
* @param instructions optional server instructions sent to clients
23+
* @param requestTimeout default request timeout in seconds
24+
* @param capabilities feature flags advertised during initialization
25+
* @param changeNotification list-change notification capability flags
26+
* @param sse deprecated HTTP SSE transport settings
27+
* @param streamable streamable HTTP transport settings
1628
* @see <a href="https://thought2code.github.io/mcp-annotated-java-sdk/getting-started">MCP
1729
* Annotated Java SDK Documentation</a>
1830
* @author codeboyzhou
@@ -40,7 +52,11 @@ public static Builder builder() {
4052
return new Builder();
4153
}
4254

43-
/** Builder class for {@code ServerConfiguration}. */
55+
/**
56+
* Mutable builder for {@link ServerConfiguration}.
57+
*
58+
* <p>Primarily used in tests; YAML files are deserialized directly into the record.
59+
*/
4460
public static class Builder {
4561
/** The profile. */
4662
private String profile = StringHelper.EMPTY;

src/main/java/com/github/thought2code/mcp/annotated/configuration/ServerSse.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
import com.fasterxml.jackson.annotation.JsonProperty;
44

55
/**
6-
* Server-Sent Events (SSE) configuration for an MCP server.
6+
* Deprecated HTTP SSE transport settings for an MCP server.
77
*
8+
* @param messageEndpoint client POST endpoint for outbound messages
9+
* @param endpoint SSE stream endpoint path
10+
* @param baseUrl optional base URL override for published endpoints
11+
* @param port Jetty listen port
812
* @see <a href="https://thought2code.github.io/mcp-annotated-java-sdk/getting-started">MCP
913
* Annotated Java SDK Documentation</a>
1014
* @author codeboyzhou
@@ -29,7 +33,11 @@ public static Builder builder() {
2933
return new Builder();
3034
}
3135

32-
/** Builder class for {@code ServerSse}. */
36+
/**
37+
* Mutable builder for {@link ServerSse}.
38+
*
39+
* @deprecated HTTP SSE mode is deprecated; use {@link ServerStreamable} instead.
40+
*/
3341
@Deprecated(since = "0.16.0", forRemoval = true)
3442
public static class Builder {
3543
/** The message endpoint. */

src/main/java/com/github/thought2code/mcp/annotated/configuration/ServerStreamable.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
import com.fasterxml.jackson.annotation.JsonProperty;
44

55
/**
6-
* This record represents the streamable http server configuration for an MCP (Model Context
7-
* Protocol) server.
8-
*
9-
* <p>It contains properties such as the MCP endpoint, disallow delete flag, keep-alive interval,
10-
* and port.
6+
* Streamable HTTP transport settings for an MCP server.
117
*
8+
* @param mcpEndpoint servlet path segment for the MCP endpoint
9+
* @param disallowDelete whether HTTP DELETE on the MCP session is rejected
10+
* @param keepAliveInterval optional SSE keep-alive interval in milliseconds
11+
* @param port Jetty listen port
1212
* @see <a href="https://thought2code.github.io/mcp-annotated-java-sdk/getting-started">MCP
1313
* Annotated Java SDK Documentation</a>
1414
* @author codeboyzhou
@@ -28,7 +28,11 @@ public static Builder builder() {
2828
return new Builder();
2929
}
3030

31-
/** Builder class for {@code ServerStreamable}. */
31+
/**
32+
* Mutable builder for {@link ServerStreamable}.
33+
*
34+
* <p>Holds HTTP endpoint, session, and keep-alive settings for STREAMABLE transport.
35+
*/
3236
public static class Builder {
3337
/** The MCP endpoint. */
3438
private String mcpEndpoint = ServerDefaults.STREAMABLE_MCP_ENDPOINT;

src/main/java/com/github/thought2code/mcp/annotated/enums/JavaTypeToJsonSchemaMapper.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package com.github.thought2code.mcp.annotated.enums;
22

33
/**
4-
* This enum is used to map Java types to JSON schema data types.
4+
* Maps common Java types to JSON Schema primitive type strings.
5+
*
6+
* <p>Used when reflecting tool parameter and output schemas. Unknown types default to {@code
7+
* string} via {@link #getJsonSchemaType(Class)}.
58
*
69
* @author codeboyzhou
710
*/

src/main/java/com/github/thought2code/mcp/annotated/enums/McpServerError.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ public String withDetail(String detail) {
7070
return String.format("[%s] %s Detail: %s", getCode(), getMessage(), detail);
7171
}
7272

73+
/**
74+
* Returns {@code [code] message} for logging and exception text.
75+
*
76+
* @return formatted code and message without a detail suffix
77+
*/
7378
@Override
7479
public String toString() {
7580
return String.format("[%s] %s", getCode(), getMessage());

src/main/java/com/github/thought2code/mcp/annotated/enums/ServerMode.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package com.github.thought2code.mcp.annotated.enums;
22

33
/**
4-
* This enum represents the mode of MCP (Model Context Protocol) server.
4+
* MCP transport mode selected in server configuration.
55
*
6-
* <p>It can be either {@link #STDIO}, {@link #SSE}, or {@link #STREAMABLE}.
6+
* <p>Determines which {@link com.github.thought2code.mcp.annotated.server.AnnotatedMcpServer}
7+
* implementation {@link com.github.thought2code.mcp.annotated.McpApplication} constructs at
8+
* startup.
79
*
810
* @author codeboyzhou
911
*/

src/main/java/com/github/thought2code/mcp/annotated/exception/McpServerConfigurationException.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package com.github.thought2code.mcp.annotated.exception;
22

33
/**
4-
* This exception is thrown to indicate a configuration error in the MCP (Model Context Protocol)
5-
* server.
4+
* Unchecked exception for invalid or unloadable MCP server configuration.
5+
*
6+
* <p>Thrown by {@link com.github.thought2code.mcp.annotated.configuration.ConfigurationLoader} and
7+
* configuration validation helpers when YAML cannot be read or required settings are missing.
68
*
79
* @author codeboyzhou
810
*/

0 commit comments

Comments
 (0)