Skip to content

Commit f8358ee

Browse files
committed
Helidon MCP coffee shop examples
1 parent 70607ad commit f8358ee

File tree

35 files changed

+2642
-0
lines changed

35 files changed

+2642
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Helidon MCP Coffee Shop Declarative
2+
3+
This application demonstrates a Helidon Model Context Protocol (MCP) server for a coffee shop. The server provides tools that
4+
allow MCP clients to interact with a coffee shop's menu and order management system.
5+
6+
The coffee shop MCP server exposes three main tools:
7+
8+
1. **getMenu** - Provides the complete coffee shop menu including drinks and food items
9+
with their descriptions, prices, categories, tags, and available add-ons.
10+
11+
2. **listOrders** - Returns a list of all current orders in the system, showing customer
12+
names, order contents, and total prices.
13+
14+
3. **takeOrder** - Allows taking new orders by specifying a customer name and a list of
15+
menu items they want to order.
16+
17+
The application uses an H2 in-memory database pre-populated with a sample menu containing various coffee drinks
18+
(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.
20+
21+
## Build And Run The Application
22+
23+
```bash
24+
mvn clean package
25+
java -jar target/helidon-mcp-coffee-shop-declarative.jar
26+
```
27+
28+
The server will start on `http://localhost:8081` with the MCP endpoint available at `/mcp-coffee-shop`.
29+
30+
## Exercise The Application
31+
32+
### Using MCP Client
33+
34+
The application is designed to work with MCP-compatible clients supporting `2024-11-05` and `2025-03-26`. The test suite
35+
demonstrates how to use it with Langchain4j MCP client:
36+
37+
1. **List Available Tools**: The MCP client can discover the three available tools (`get-menu`, `list-order`, `take-order`)
38+
39+
2. **Get Menu**: Call the `get-menu` tool to retrieve the complete menu as JSON objects
40+
41+
3. **List Orders**: Call the `list-order` tool to see current orders
42+
43+
4. **Take Order**: Call the `take-order` tool with an order request containing:
44+
- `name`: Customer name (string)
45+
- `content`: Array of menu item names (array of strings)
46+
47+
Example order request:
48+
```json
49+
{
50+
"name": "John Doe",
51+
"content": ["Latte", "Avocado Toast"]
52+
}
53+
```
54+
55+
### Using Claude Desktop
56+
57+
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+
}
72+
}
73+
```
74+
3. Open claude desktop application. Claude automatically connects to the coffee shop server at startup.
75+
4. Ask the following question:
76+
1. `What is on the menu today?`
77+
2. `Can I order a hot chocolate?`
78+
3. `What are the current orders?`
79+
80+
Note: Any application similar to Claude that support MCP can be used instead.
Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Copyright (c) 2025 Oracle and/or its affiliates.
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
18+
-->
19+
<project xmlns="http://maven.apache.org/POM/4.0.0"
20+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
22+
<modelVersion>4.0.0</modelVersion>
23+
<parent>
24+
<groupId>io.helidon.applications</groupId>
25+
<artifactId>helidon-se</artifactId>
26+
<version>4.3.1</version>
27+
<relativePath/>
28+
</parent>
29+
30+
<groupId>io.helidon.labs.apps</groupId>
31+
<artifactId>helidon-labs-mcp-coffee-shop-declarative</artifactId>
32+
<version>1.0.0-SNAPSHOT</version>
33+
<name>Helidon MCP Coffee Shop Declarative</name>
34+
35+
<properties>
36+
<mainClass>io.helidon.labs.apps.mcp.coffee.shop.declarative.Main</mainClass>
37+
<version.lib.mcp>1.0.1</version.lib.mcp>
38+
</properties>
39+
40+
<dependencies>
41+
<dependency>
42+
<groupId>io.helidon.extensions.mcp</groupId>
43+
<artifactId>helidon4-extensions-mcp-server</artifactId>
44+
<version>${version.lib.mcp}</version>
45+
</dependency>
46+
<dependency>
47+
<groupId>io.helidon.json.schema</groupId>
48+
<artifactId>helidon-json-schema</artifactId>
49+
</dependency>
50+
<dependency>
51+
<groupId>io.helidon.config</groupId>
52+
<artifactId>helidon-config-yaml</artifactId>
53+
</dependency>
54+
<dependency>
55+
<groupId>io.helidon.data</groupId>
56+
<artifactId>helidon-data</artifactId>
57+
</dependency>
58+
<dependency>
59+
<groupId>io.helidon.data.jakarta.persistence</groupId>
60+
<artifactId>helidon-data-jakarta-persistence</artifactId>
61+
</dependency>
62+
<dependency>
63+
<groupId>io.helidon.integrations.db</groupId>
64+
<artifactId>h2</artifactId>
65+
</dependency>
66+
<dependency>
67+
<groupId>jakarta.json</groupId>
68+
<artifactId>jakarta.json-api</artifactId>
69+
</dependency>
70+
<dependency>
71+
<groupId>jakarta.persistence</groupId>
72+
<artifactId>jakarta.persistence-api</artifactId>
73+
</dependency>
74+
<dependency>
75+
<groupId>io.helidon.logging</groupId>
76+
<artifactId>helidon-logging-jul</artifactId>
77+
<scope>runtime</scope>
78+
</dependency>
79+
<dependency>
80+
<groupId>io.helidon.data.sql.datasource</groupId>
81+
<artifactId>helidon-data-sql-datasource-ucp</artifactId>
82+
<scope>runtime</scope>
83+
</dependency>
84+
<dependency>
85+
<groupId>org.eclipse.persistence</groupId>
86+
<artifactId>org.eclipse.persistence.jpa</artifactId>
87+
<scope>runtime</scope>
88+
</dependency>
89+
<dependency>
90+
<groupId>org.eclipse.persistence</groupId>
91+
<artifactId>org.eclipse.persistence.core</artifactId>
92+
<scope>runtime</scope>
93+
</dependency>
94+
<dependency>
95+
<groupId>org.eclipse.parsson</groupId>
96+
<artifactId>parsson</artifactId>
97+
<scope>runtime</scope>
98+
</dependency>
99+
<dependency>
100+
<groupId>org.eclipse</groupId>
101+
<artifactId>yasson</artifactId>
102+
<scope>runtime</scope>
103+
</dependency>
104+
<dependency>
105+
<groupId>io.helidon.webserver.testing.junit5</groupId>
106+
<artifactId>helidon-webserver-testing-junit5</artifactId>
107+
<scope>test</scope>
108+
</dependency>
109+
<dependency>
110+
<groupId>org.junit.jupiter</groupId>
111+
<artifactId>junit-jupiter-api</artifactId>
112+
<scope>test</scope>
113+
</dependency>
114+
<dependency>
115+
<groupId>org.hamcrest</groupId>
116+
<artifactId>hamcrest-all</artifactId>
117+
<scope>test</scope>
118+
</dependency>
119+
<dependency>
120+
<groupId>dev.langchain4j</groupId>
121+
<artifactId>langchain4j-mcp</artifactId>
122+
<scope>test</scope>
123+
</dependency>
124+
<dependency>
125+
<groupId>dev.langchain4j</groupId>
126+
<artifactId>langchain4j-core</artifactId>
127+
<scope>test</scope>
128+
</dependency>
129+
</dependencies>
130+
131+
<build>
132+
<finalName>helidon-mcp-coffee-shop-declarative</finalName>
133+
<plugins>
134+
<plugin>
135+
<groupId>org.apache.maven.plugins</groupId>
136+
<artifactId>maven-compiler-plugin</artifactId>
137+
<configuration>
138+
<annotationProcessorPaths>
139+
<path>
140+
<groupId>io.helidon.bundles</groupId>
141+
<artifactId>helidon-bundles-apt</artifactId>
142+
<version>${parent.version}</version>
143+
</path>
144+
<path>
145+
<groupId>io.helidon.json.schema</groupId>
146+
<artifactId>helidon-json-schema-codegen</artifactId>
147+
<version>${parent.version}</version>
148+
</path>
149+
<path>
150+
<groupId>io.helidon.data.jakarta.persistence</groupId>
151+
<artifactId>helidon-data-jakarta-persistence-codegen</artifactId>
152+
<version>${parent.version}</version>
153+
</path>
154+
<path>
155+
<groupId>io.helidon.extensions.mcp</groupId>
156+
<artifactId>helidon4-extensions-mcp-codegen</artifactId>
157+
<version>${version.lib.mcp}</version>
158+
</path>
159+
</annotationProcessorPaths>
160+
</configuration>
161+
</plugin>
162+
<plugin>
163+
<groupId>org.apache.maven.plugins</groupId>
164+
<artifactId>maven-dependency-plugin</artifactId>
165+
<executions>
166+
<execution>
167+
<id>copy-libs</id>
168+
</execution>
169+
</executions>
170+
</plugin>
171+
<plugin>
172+
<!-- Maven plugin that generates the application binding -->
173+
<groupId>io.helidon.service</groupId>
174+
<artifactId>helidon-service-maven-plugin</artifactId>
175+
<version>${parent.version}</version>
176+
<executions>
177+
<execution>
178+
<id>create-application</id>
179+
<goals>
180+
<goal>create-application</goal>
181+
</goals>
182+
</execution>
183+
</executions>
184+
</plugin>
185+
</plugins>
186+
</build>
187+
</project>

0 commit comments

Comments
 (0)