Skip to content

Commit e8b8c3e

Browse files
committed
API v1
1 parent 8993d29 commit e8b8c3e

File tree

22 files changed

+483
-57
lines changed

22 files changed

+483
-57
lines changed

docs/src/main/asciidoc/mp/guides/upgrade_3x.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ NOTE: See xref:{rootdir}/mp/integrations/oci.adoc#oci-compatibility[Resolving co
166166
167167
Deprecations in the following classes:
168168
169-
* `Resource` - old configuration approach (since 2.0)
169+
* `ResourceTemp` - old configuration approach (since 2.0)
170170
* `ThreadPoolSupplier` - Named thread pools (since 2.4.2)
171171
172172
More information in the following link:https://github.com/oracle/helidon/issues/4363[Task].

docs/src/main/asciidoc/se/guides/upgrade.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ include::{sourcedir}/se/guides/UpgradeSnippets.java[tag=snippet_3, indent=0]
8383
8484
== Resource Class When Loaded from Config
8585
86-
The configuration approach to `Resource` class was using prefixes which was not aligned with our approach to configuration.
86+
The configuration approach to `ResourceTemp` class was using prefixes which was not aligned with our approach to configuration.
8787
All usages were refactored as follows:
8888
89-
1. The `Resource` class expects a config node `resource` that will be used to read it
89+
1. The `ResourceTemp` class expects a config node `resource` that will be used to read it
9090
2. The feature set remains unchanged - we support path, classpath, url, content as plain text, and content as base64
9191
3. Classes using resources are changed as well, such as `KeyConfig` - see details below
9292
@@ -121,14 +121,14 @@ The new JSON MediaSupport classes are:
121121
122122
== Security: OidcConfig
123123
124-
Configuration has been updated to use the new `Resource` approach:
124+
Configuration has been updated to use the new `ResourceTemp` approach:
125125
126126
1. `oidc-metadata.resource` is the new key for loading `oidc-metadata` from local resource
127127
2. `sign-jwk.resource` is the new key for loading signing JWK resource
128128
129129
== Security: JwtProvider and JwtAuthProvider
130130
131-
Configuration has been updated to use the new `Resource` approach:
131+
Configuration has been updated to use the new `ResourceTemp` approach:
132132
133133
1. `jwk.resource` is the new key for loading JWK for verifying signatures
134134
2. `jwt.resource` is also used for outbound as key for loading JWK for signing tokens
@@ -172,7 +172,7 @@ pem:
172172
173173
== GrpcTlsDescriptor
174174
175-
Configuration has been updated to use the new `Resource` approach:
175+
Configuration has been updated to use the new `ResourceTemp` approach:
176176
177177
1. `tls-cert.resource` is the new key for certificate
178178
2. `tls-key.resource` is the new key for private key

docs/src/main/asciidoc/se/guides/upgrade_3x.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ NOTE: See xref:{rootdir}/se/integrations/oci.adoc#oci-compatibility[Resolving co
144144
145145
Deprecations in the following classes:
146146
147-
* `Resource` - old configuration approach (since 2.0)
147+
* `ResourceTemp` - old configuration approach (since 2.0)
148148
* `ThreadPoolSupplier` - Named thread pools (since 2.4.2)
149149
150150
More information in the following link:https://github.com/oracle/helidon/issues/4363[Task].
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package io.helidon.integrations.mcp.server;
2+
3+
public enum CapabilitiesTemp {
4+
TOOL_LIST_CHANGED,
5+
RESOURCE_LIST_CHANGED,
6+
RESOURCE_SUBSCRIBE,
7+
PROMPT_LIST_CHANGED
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package io.helidon.integrations.mcp.server;
2+
3+
import io.helidon.common.parameters.Parameters;
4+
5+
@FunctionalInterface
6+
public interface Handler {
7+
String handle(Parameters arguments);
8+
}

integrations/mcp/server/src/main/java/io/helidon/integrations/mcp/server/Mcp.java

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,6 @@ public final class Mcp {
4444
String description() default "none"; //optional
4545
}
4646

47-
@Target(PARAMETER)
48-
@Retention(RUNTIME)
49-
public @interface PromptParam {
50-
String value();
51-
}
52-
5347
@Target(METHOD)
5448
@Retention(RUNTIME)
5549
public @interface Tool {
@@ -60,7 +54,7 @@ public final class Mcp {
6054

6155
@Target(PARAMETER)
6256
@Retention(RUNTIME)
63-
public @interface ToolParam {
57+
public @interface Param {
6458
String value();
6559
}
6660

@@ -69,19 +63,9 @@ public final class Mcp {
6963
public @interface Server {
7064
String name() default "Helidon MCP Server";
7165
String version() default "0.0.1";
66+
CapabilitiesTemp[] capabilities() default {};
7267
}
7368

74-
@Target(ElementType.TYPE)
75-
@Retention(RUNTIME)
76-
public @interface Notification {
77-
String[] value();
78-
}
79-
80-
@Target(ElementType.TYPE)
81-
@Retention(RUNTIME)
82-
public @interface Subscribe {
83-
String[] value();
84-
}
8569

8670

8771

integrations/mcp/server/src/main/java/io/helidon/integrations/mcp/server/McpHttpFeature.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,27 @@ public class McpHttpFeature implements HttpFeature {
4646
private final ObjectMapper mapper = new ObjectMapper();
4747
private final Map<String, McpSession> sessions = new ConcurrentHashMap<>();
4848

49-
public McpHttpFeature(Builder builder) {
50-
this.server = builder.server;
51-
}
52-
5349
@Service.Inject
5450
public McpHttpFeature(McpServer server) {
5551
this.server = server;
5652
}
5753

54+
public McpHttpFeature(McpServerAPI... server) {
55+
this.server = null;
56+
}
57+
58+
public McpHttpFeature(Builder builder) {
59+
this.server = builder.server;
60+
}
61+
5862
public static Builder builder() {
5963
return new Builder();
6064
}
6165

66+
public static McpHttpFeature create(McpServerAPI... servers) {
67+
return new McpHttpFeature(servers);
68+
}
69+
6270
@Override
6371
public void setup(HttpRouting.Builder routing) {
6472
routing.get("/sse", this::sse)
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package io.helidon.integrations.mcp.server;
2+
3+
import java.util.ArrayList;
4+
import java.util.Arrays;
5+
import java.util.List;
6+
7+
public interface McpRouting {
8+
//
9+
// static Builder builder() {
10+
// return new Builder();
11+
// }
12+
//
13+
// class Builder {
14+
// List<Tool> tools = new ArrayList<>();
15+
// List<ResourceTemp> resources = new ArrayList<>();
16+
// List<PromptTemp> prompts = new ArrayList<>();
17+
//
18+
// public Builder register(Tool... tool) {
19+
// this.tools.addAll(Arrays.asList(tool));
20+
// return this;
21+
// }
22+
//
23+
// public Builder register(ToolInfo info, Handler handler) {
24+
// this.tools.add(new Tool() {
25+
// @Override
26+
// public ToolInfo info() {
27+
// return info;
28+
// }
29+
//
30+
// @Override
31+
// public Handler process() {
32+
// return handler;
33+
// }
34+
// });
35+
// return this;
36+
// }
37+
//
38+
// public Builder register(ResourceTemp... resource) {
39+
// this.resources.addAll(Arrays.asList(resource));
40+
// return this;
41+
// }
42+
//
43+
// public Builder register(PromptTemp... prompt) {
44+
// this.prompts.addAll(Arrays.asList(prompt));
45+
// return this;
46+
// }
47+
//
48+
// public McpRouting build() {
49+
// return new McpRouting(this);
50+
// }
51+
// }
52+
}

integrations/mcp/server/src/main/java/io/helidon/integrations/mcp/server/McpServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
@RuntimeType.PrototypedBy(McpServerConfig.class)
2828
public interface McpServer extends RuntimeType.Api<McpServerConfig> {
2929

30-
static final String PROTOCOLE_VERSION = "2024-11-05";
30+
String PROTOCOLE_VERSION = "2024-11-05";
3131

3232
static McpServer create(McpServerConfig serverConfig) {
3333
return new McpServerImpl(serverConfig);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package io.helidon.integrations.mcp.server;
2+
3+
public interface McpServerAPI {
4+
//
5+
// McpServerInfo info();
6+
//
7+
// void setup(McpRouting.Builder routing);
8+
}

0 commit comments

Comments
 (0)