Skip to content

Commit 8514c0e

Browse files
committed
Review changes
1 parent 819be0a commit 8514c0e

File tree

6 files changed

+52
-47
lines changed

6 files changed

+52
-47
lines changed

apps/mcp/mcp-coffee-shop-declarative/README.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ menu items they want to order.
1616

1717
The application uses an H2 in-memory database pre-populated with a sample menu containing various coffee drinks
1818
(Latte, Cappuccino, Espresso, etc.), food items (Avocado Toast, Blueberry Muffin, etc.), and one sample order.
19-
The application leverage Helidon Data, providing a unified and efficient approach to data persistence and retrieval operations.
19+
The application leverages Helidon Data, providing a unified and efficient approach to data persistence and retrieval operations.
2020

2121
## Build And Run The Application
2222

@@ -25,22 +25,22 @@ mvn clean package
2525
java -jar target/helidon-mcp-coffee-shop-declarative.jar
2626
```
2727

28-
The server will start on `http://localhost:8081` with the MCP endpoint available at `/mcp-coffee-shop`.
28+
The server will start at `http://localhost:8081` with the MCP endpoint available at `/mcp-coffee-shop`.
2929

3030
## Exercise The Application
3131

3232
### Using MCP Client
3333

34-
The application is designed to work with MCP-compatible clients supporting `2024-11-05` and `2025-03-26`. The test suite
34+
The application is designed to work with MCP-compatible clients supporting MCP versions `2024-11-05` and `2025-03-26`. The test suite
3535
demonstrates how to use it with Langchain4j MCP client:
3636

37-
1. **List Available Tools**: The MCP client can discover the three available tools (`get-menu`, `list-order`, `take-order`)
37+
1. **List Available Tools**: The MCP client can discover the three available tools (`getMenu`, `listOrders`, `takeOrder`)
3838

39-
2. **Get Menu**: Call the `get-menu` tool to retrieve the complete menu as JSON objects
39+
2. **Get Menu**: Call the `getMenu` tool to retrieve the complete menu as JSON objects
4040

41-
3. **List Orders**: Call the `list-order` tool to see current orders
41+
3. **List Orders**: Call the `listOrders` tool to see current orders
4242

43-
4. **Take Order**: Call the `take-order` tool with an order request containing:
43+
4. **Take Order**: Call the `takeOrder` tool with an order request containing:
4444
- `name`: Customer name (string)
4545
- `content`: Array of menu item names (array of strings)
4646

@@ -55,22 +55,22 @@ Example order request:
5555
### Using Claude Desktop
5656

5757
1. [Install Claude desktop](https://claude.ai/download)
58-
2. Update Claude desktop configuration to register your MCP server. Edit the `claude_desktop_config.json` file with the
59-
following content:
60-
```json
61-
{
62-
"mcpServers": {
63-
"helidon-coffee-shop": {
64-
"command": "npx",
65-
"args": [
66-
"-y",
67-
"mcp-remote",
68-
"http://localhost:8081/mcp-coffee-shop"
69-
]
70-
}
71-
}
58+
2. Update Claude desktop configuration to register your MCP server. Edit the `claude_desktop_config.json` file located under
59+
`Settings -> Developer -> Edit Config` with the following content:
60+
```json
61+
{
62+
"mcpServers": {
63+
"helidon-coffee-shop": {
64+
"command": "npx",
65+
"args": [
66+
"-y",
67+
"mcp-remote",
68+
"http://localhost:8081/mcp-coffee-shop"
69+
]
7270
}
73-
```
71+
}
72+
}
73+
```
7474
3. Open claude desktop application. Claude automatically connects to the coffee shop server at startup.
7575
4. Ask the following question:
7676
1. `What is on the menu today?`

apps/mcp/mcp-coffee-shop-declarative/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
<properties>
3636
<mainClass>io.helidon.labs.apps.mcp.coffee.shop.declarative.Main</mainClass>
37-
<version.lib.mcp>1.0.1</version.lib.mcp>
37+
<version.lib.mcp>1.0.2</version.lib.mcp>
3838
</properties>
3939

4040
<dependencies>

apps/mcp/mcp-coffee-shop-declarative/src/main/java/io/helidon/labs/apps/mcp/coffee/shop/declarative/CoffeeShopServer.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@
2121
import java.util.List;
2222
import java.util.stream.Collectors;
2323

24-
import io.helidon.common.LazyValue;
2524
import io.helidon.extensions.mcp.server.Mcp;
2625
import io.helidon.extensions.mcp.server.McpToolContent;
2726
import io.helidon.extensions.mcp.server.McpToolErrorException;
2827
import io.helidon.json.schema.JsonSchema;
29-
import io.helidon.service.registry.Services;
28+
import io.helidon.service.registry.Service;
3029
import io.helidon.transaction.Tx;
3130
import io.helidon.transaction.TxException;
3231

@@ -41,9 +40,11 @@
4140
@Mcp.Path("/mcp-coffee-shop")
4241
@Mcp.Server("mcp-server-coffee-shop")
4342
class CoffeeShopServer {
44-
private final OrderRepository orderRepository = Services.get(OrderRepository.class);
45-
private final MenuItemRepository itemRepository = Services.get(MenuItemRepository.class);
46-
private final LazyValue<List<MenuItem>> menu = LazyValue.create(itemRepository::listOrderById);
43+
@Service.Inject
44+
OrderRepository orderRepository;
45+
46+
@Service.Inject
47+
MenuItemRepository itemRepository;
4748

4849
@Mcp.Tool("Provides the coffee shop menu")
4950
List<McpToolContent> getMenu() {
@@ -82,7 +83,8 @@ List<McpToolContent> takeOrder(OrderRequest orderRequest) {
8283
BigDecimal totalPrice = new BigDecimal(0);
8384

8485
for (String item : orderRequest.getContent()) {
85-
BigDecimal price = menu.get().stream()
86+
BigDecimal price = itemRepository.listOrderById()
87+
.stream()
8688
.filter(it -> item.equals(it.getName()))
8789
.map(MenuItem::getPrice)
8890
.findFirst()

apps/mcp/mcp-coffee-shop/README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ mvn clean package
2323
java -jar target/helidon-mcp-coffee-shop-declarative.jar
2424
```
2525

26-
The server will start on `http://localhost:8081` with the MCP endpoint available at `/mcp-coffee-shop`.
26+
The server will start at `http://localhost:8081` with the MCP endpoint available at `/mcp-coffee-shop`.
2727

2828
## Exercise The Application
2929

3030
### Using MCP Client
3131

32-
The application is designed to work with MCP-compatible clients supporting `2024-11-05` and `2025-03-26`. The test suite
32+
The application is designed to work with MCP-compatible clients supporting MCP versions `2024-11-05` and `2025-03-26`. The test suite
3333
demonstrates how to use it with Langchain4j MCP client:
3434

3535
1. **List Available Tools**: The MCP client can discover the three available tools (`get-menu`, `list-order`, `take-order`)
@@ -53,22 +53,22 @@ Example order request:
5353
### Using Claude Desktop
5454

5555
1. [Install Claude desktop](https://claude.ai/download)
56-
2. Update Claude desktop configuration to register your MCP server. Edit the `claude_desktop_config.json` file with the
57-
following content:
58-
```json
59-
{
60-
"mcpServers": {
61-
"helidon-coffee-shop": {
62-
"command": "npx",
63-
"args": [
64-
"-y",
65-
"mcp-remote",
66-
"http://localhost:8081/mcp-coffee-shop"
67-
]
68-
}
69-
}
56+
2. Update Claude desktop configuration to register your MCP server. Edit the `claude_desktop_config.json` file located under
57+
`Settings -> Developer -> Edit Config` with the following content:
58+
```json
59+
{
60+
"mcpServers": {
61+
"helidon-coffee-shop": {
62+
"command": "npx",
63+
"args": [
64+
"-y",
65+
"mcp-remote",
66+
"http://localhost:8081/mcp-coffee-shop"
67+
]
7068
}
71-
```
69+
}
70+
}
71+
```
7272
3. Open claude desktop application. Claude automatically connects to the coffee shop server at startup.
7373
4. Ask the following question:
7474
1. `What is on the menu today?`

apps/mcp/mcp-coffee-shop/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
<properties>
3636
<mainClass>io.helidon.labs.apps.mcp.coffee.shop.Main</mainClass>
37-
<version.lib.mcp>1.0.1</version.lib.mcp>
37+
<version.lib.mcp>1.0.2</version.lib.mcp>
3838
</properties>
3939

4040
<dependencies>

etc/checkstyle-suppressions.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,8 @@
3030
<!-- Helidon MCP: ignore JsonSchema redundant public constructor -->
3131
<suppress checks="RedundantModifier"
3232
files="apps/mcp/"/>
33+
<!-- Helidon MCP: ignore private field for declarative injection -->
34+
<suppress checks="VisibilityModifier"
35+
files="apps/mcp/mcp-coffee-shop-declarative/.*"/>
3336
</suppressions>
3437

0 commit comments

Comments
 (0)