Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ These are examples of Helidon applications that are more complex than what is ty

* [Chat Room using SSE](chatroom-sse/README.md)
* [Helidon Data examples](data/README.md)
* [Todo app - Helidon + Coherence](../apps/todo)
* [Helidon MCP Applications](mcp/README.md)
* [Todo app - Helidon + Coherence](todo/README.md)
5 changes: 5 additions & 0 deletions apps/mcp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Helidon MCP Applications
----

* [Coffee shop application](mcp-coffee-shop/README.md)
* [Coffee shop declarative application](mcp-coffee-shop-declarative/README.md)
80 changes: 80 additions & 0 deletions apps/mcp/mcp-coffee-shop-declarative/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Helidon MCP Coffee Shop Declarative

This application demonstrates a Helidon Model Context Protocol (MCP) server for a coffee shop. The server provides tools that
allow MCP clients to interact with a coffee shop's menu and order management system.

The coffee shop MCP server exposes three main tools:

1. **getMenu** - Provides the complete coffee shop menu including drinks and food items
with their descriptions, prices, categories, tags, and available add-ons.

2. **listOrders** - Returns a list of all current orders in the system, showing customer
names, order contents, and total prices.

3. **takeOrder** - Allows taking new orders by specifying a customer name and a list of
menu items they want to order.

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

## Build And Run The Application

```bash
mvn clean package
java -jar target/helidon-mcp-coffee-shop-declarative.jar
```

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

## Exercise The Application

### Using MCP Client

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

1. **List Available Tools**: The MCP client can discover the three available tools (`getMenu`, `listOrders`, `takeOrder`)

2. **Get Menu**: Call the `getMenu` tool to retrieve the complete menu as JSON objects

3. **List Orders**: Call the `listOrders` tool to see current orders

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

Example order request:
```json
{
"name": "John Doe",
"content": ["Latte", "Avocado Toast"]
}
```

### Using Claude Desktop

1. [Install Claude desktop](https://claude.ai/download)
2. Update Claude desktop configuration to register your MCP server. Edit the `claude_desktop_config.json` file located under
`Settings -> Developer -> Edit Config` with the following content:
```json
{
"mcpServers": {
"helidon-coffee-shop": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"http://localhost:8081/mcp-coffee-shop"
]
}
}
}
```
3. Open claude desktop application. Claude automatically connects to the coffee shop server at startup.
4. Ask the following question:
1. `What is on the menu today?`
2. `Can I order a hot chocolate?`
3. `What are the current orders?`

Note: Any application similar to Claude that support MCP can be used instead.
187 changes: 187 additions & 0 deletions apps/mcp/mcp-coffee-shop-declarative/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2025 Oracle and/or its affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.helidon.applications</groupId>
<artifactId>helidon-se</artifactId>
<version>4.3.1</version>
<relativePath/>
</parent>

<groupId>io.helidon.labs.apps</groupId>
<artifactId>helidon-labs-mcp-coffee-shop-declarative</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>Helidon MCP Coffee Shop Declarative</name>

<properties>
<mainClass>io.helidon.labs.apps.mcp.coffee.shop.declarative.Main</mainClass>
<version.lib.mcp>1.0.2</version.lib.mcp>
</properties>

<dependencies>
<dependency>
<groupId>io.helidon.extensions.mcp</groupId>
<artifactId>helidon4-extensions-mcp-server</artifactId>
<version>${version.lib.mcp}</version>
</dependency>
<dependency>
<groupId>io.helidon.json.schema</groupId>
<artifactId>helidon-json-schema</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.config</groupId>
<artifactId>helidon-config-yaml</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.data</groupId>
<artifactId>helidon-data</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.data.jakarta.persistence</groupId>
<artifactId>helidon-data-jakarta-persistence</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.integrations.db</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.logging</groupId>
<artifactId>helidon-logging-jul</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.helidon.data.sql.datasource</groupId>
<artifactId>helidon-data-sql-datasource-ucp</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.core</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.eclipse.parsson</groupId>
<artifactId>parsson</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>yasson</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.helidon.webserver.testing.junit5</groupId>
<artifactId>helidon-webserver-testing-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-mcp</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<finalName>helidon-mcp-coffee-shop-declarative</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.helidon.bundles</groupId>
<artifactId>helidon-bundles-apt</artifactId>
<version>${parent.version}</version>
</path>
<path>
<groupId>io.helidon.json.schema</groupId>
<artifactId>helidon-json-schema-codegen</artifactId>
<version>${parent.version}</version>
</path>
<path>
<groupId>io.helidon.data.jakarta.persistence</groupId>
<artifactId>helidon-data-jakarta-persistence-codegen</artifactId>
<version>${parent.version}</version>
</path>
<path>
<groupId>io.helidon.extensions.mcp</groupId>
<artifactId>helidon4-extensions-mcp-codegen</artifactId>
<version>${version.lib.mcp}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-libs</id>
</execution>
</executions>
</plugin>
<plugin>
<!-- Maven plugin that generates the application binding -->
<groupId>io.helidon.service</groupId>
<artifactId>helidon-service-maven-plugin</artifactId>
<version>${parent.version}</version>
<executions>
<execution>
<id>create-application</id>
<goals>
<goal>create-application</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Loading
Loading