File tree Expand file tree Collapse file tree 7 files changed +7
-9
lines changed
agents/reflection/src/main/java/org/springframework/ai/openai/samples/helloworld
sampling/mcp-weather-webmvc-server
main/java/org/springframework/ai/mcp/sample/server
test/java/org/springframework/ai/mcp/sample/client
weather/starter-webmvc-server
src/test/java/org/springframework/ai/mcp/sample/client Expand file tree Collapse file tree 7 files changed +7
-9
lines changed Original file line number Diff line number Diff line change 1
1
package org .springframework .ai .openai .samples .helloworld ;
2
2
3
- import org .springframework .ai .chat .client .ChatClient ;
3
+ import java .util .Scanner ;
4
+
4
5
import org .springframework .boot .CommandLineRunner ;
5
6
import org .springframework .boot .SpringApplication ;
6
7
import org .springframework .boot .autoconfigure .SpringBootApplication ;
7
8
import org .springframework .context .annotation .Bean ;
8
9
9
- import java .util .Scanner ;
10
-
11
10
@ SpringBootApplication
12
11
public class Application {
13
12
Original file line number Diff line number Diff line change @@ -140,7 +140,7 @@ You can connect to the weather server using either STDIO or SSE transport:
140
140
For servers using SSE transport:
141
141
142
142
``` java
143
- var transport = new HttpClientSseClientTransport (" http://localhost:8080" );
143
+ var transport = HttpClientSseClientTransport . builder (" http://localhost:8080" ) . build( );
144
144
var client = McpClient . sync(transport). build();
145
145
```
146
146
Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ You can connect to the weather server using either STDIO or SSE transport:
166
166
For servers using SSE transport:
167
167
168
168
``` java
169
- var transport = new HttpClientSseClientTransport (" http://localhost:8080" );
169
+ var transport = HttpClientSseClientTransport . builder (" http://localhost:8080" ) . build( );
170
170
var client = McpClient . sync(transport). build();
171
171
```
172
172
Original file line number Diff line number Diff line change 18
18
import java .time .LocalDateTime ;
19
19
import java .util .List ;
20
20
21
- import io .modelcontextprotocol .server .McpSyncServerExchange ;
22
21
import io .modelcontextprotocol .spec .McpSchema ;
23
22
import io .modelcontextprotocol .spec .McpSchema .CreateMessageResult ;
24
23
import io .modelcontextprotocol .spec .McpSchema .LoggingLevel ;
Original file line number Diff line number Diff line change 24
24
public class ClientSse {
25
25
26
26
public static void main (String [] args ) {
27
- var transport = new HttpClientSseClientTransport ("http://localhost:8080" );
27
+ var transport = HttpClientSseClientTransport . builder ("http://localhost:8080" ). build ( );
28
28
new SampleClient (transport ).run ();
29
29
}
30
30
Original file line number Diff line number Diff line change @@ -140,7 +140,7 @@ You can connect to the weather server using either STDIO or SSE transport:
140
140
For servers using SSE transport:
141
141
142
142
``` java
143
- var transport = new HttpClientSseClientTransport (" http://localhost:8080" );
143
+ var transport = HttpClientSseClientTransport . builder (" http://localhost:8080" ) . build( );
144
144
var client = McpClient . sync(transport). build();
145
145
```
146
146
Original file line number Diff line number Diff line change 24
24
public class ClientSse {
25
25
26
26
public static void main (String [] args ) {
27
- var transport = new HttpClientSseClientTransport ("http://localhost:8080" );
27
+ var transport = HttpClientSseClientTransport . builder ("http://localhost:8080" ). build ( );
28
28
new SampleClient (transport ).run ();
29
29
}
30
30
You can’t perform that action at this time.
0 commit comments