A collection of OpenLiberty demonstrations showcasing REST API development and MCP (Model Context Protocol) integration.
This repository contains two progressive demonstrations:
- Demo1 - Basic REST API with OpenLiberty
- Demo2 - REST API exposed as MCP tools using OpenLiberty's beta mcpServer-1.0 feature
- Building REST APIs with OpenLiberty and JAX-RS
- Implementing health checks with MicroProfile Health
- Exposing REST endpoints as MCP tools
- Working with OpenLiberty beta features
- Creating AI-accessible tools via MCP protocol
OpenLiberty-Work-Experience-Demos/
├── README.md # This file
├── Demo1/ # Basic REST API demo
│ ├── README.md # Demo1 documentation
│ ├── pom.xml # Maven configuration
│ └── src/ # Source code
│ └── main/
│ ├── java/ # Java source files
│ └── liberty/config/ # OpenLiberty configuration
│
└── Demo2/ # MCP Server demo
├── README.md # Demo2 documentation
├── QUICKSTART.md # Quick start guide
├── pom.xml # Maven with beta features
└── src/ # Source code
└── main/
├── java/ # Java source files
└── liberty/config/ # OpenLiberty + MCP configuration
- Java 11 or higher
- Maven 3.6 or higher
- Git (for cloning)
git clone https://github.com/YOUR_USERNAME/OpenLiberty-Work-Experience-Demos.git
cd OpenLiberty-Work-Experience-Demoscd Demo1
mvn liberty:devAccess at: http://localhost:9080
cd Demo2
mvn liberty:devAccess at:
- REST API: http://localhost:9080
- MCP Server: http://localhost:3000
A foundational OpenLiberty application demonstrating:
- ✅ JAX-RS REST endpoints
- ✅ JSON-B and JSON-P for data handling
- ✅ MicroProfile Health checks
- ✅ CDI (Contexts and Dependency Injection)
Endpoints:
GET /api/hello- Simple greetingGET /api/hello/{name}- Personalized greetingGET /api/info- Server informationGET /api/orders- List all ordersGET /api/orders/{orderId}- Get specific orderGET /api/orders/stats- Order statisticsGET /health- Health checks
Extends Demo1 with OpenLiberty's beta mcpServer-1.0 feature:
- ✅ All Demo1 features
- ✅ MCP Server on port 3000
- ✅ REST endpoints exposed as MCP tools
- ✅ Server-Sent Events (SSE) support
- ✅ AI assistant integration ready
MCP Tools (9 total):
hello- Simple greetinghello_name- Personalized greetingget_server_info- Server informationget_all_orders- List all ordersget_order_by_id- Get specific orderget_order_stats- Order statisticshealth_check- Overall healthhealth_check_liveness- Liveness probehealth_check_readiness- Readiness probe
📄 Full Demo2 Documentation | ⚡ Quick Start Guide
| Technology | Version | Purpose |
|---|---|---|
| OpenLiberty | Latest | Application server |
| Jakarta EE | 9.1 | Enterprise Java APIs |
| MicroProfile | 5.0 | Cloud-native features |
| JAX-RS | 3.0 | REST API framework |
| JSON-B | 2.0 | JSON binding |
| JSON-P | 2.0 | JSON processing |
| CDI | 3.0 | Dependency injection |
| Maven | 3.6+ | Build tool |
| Java | 11+ | Programming language |
| Technology | Version | Purpose |
|---|---|---|
| mcpServer-1.0 | Beta | MCP protocol support |
| OpenLiberty Beta | Latest | Beta features |
| Feature | Demo1 | Demo2 |
|---|---|---|
| REST Endpoints | ✅ | ✅ |
| Health Checks | ✅ | ✅ |
| Order Management | ✅ | ✅ |
| MCP Server | ❌ | ✅ |
| MCP Tools | ❌ | ✅ (9 tools) |
| AI Integration | ❌ | ✅ |
| SSE Support | ❌ | ✅ |
| Beta Features | ❌ | ✅ |
# Hello endpoint
curl http://localhost:9080/api/hello
# Personalized greeting
curl http://localhost:9080/api/hello/Developer
# Server info
curl http://localhost:9080/api/info
# All orders
curl http://localhost:9080/api/orders
# Specific order
curl http://localhost:9080/api/orders/ORD-001
# Order statistics
curl http://localhost:9080/api/orders/stats
# Health check
curl http://localhost:9080/health# List available tools
curl -X POST http://localhost:3000/tools/list \
-H "Content-Type: application/json" \
-d '{}'
# Call hello tool
curl -X POST http://localhost:3000/tools/call \
-H "Content-Type: application/json" \
-d '{"name": "hello", "arguments": {}}'
# Call get_all_orders tool
curl -X POST http://localhost:3000/tools/call \
-H "Content-Type: application/json" \
-d '{"name": "get_all_orders", "arguments": {}}'
# Call get_order_by_id tool
curl -X POST http://localhost:3000/tools/call \
-H "Content-Type: application/json" \
-d '{"name": "get_order_by_id", "arguments": {"orderId": "ORD-001"}}'Demo2 can be integrated with MCP-compatible AI assistants:
Add to your Claude Desktop config:
{
"mcpServers": {
"openliberty-demo": {
"url": "http://localhost:3000"
}
}
}Add to Cline MCP settings:
{
"servers": {
"openliberty-demo": {
"url": "http://localhost:3000"
}
}
}- Start with Demo1 - Understand basic REST API development with OpenLiberty
- Explore the code - Review the Java classes and configuration files
- Test the endpoints - Use curl or a browser to interact with the API
- Move to Demo2 - Learn about MCP integration
- Connect an AI client - Experience AI-powered tool usage
- Extend the demos - Add your own endpoints and tools
# Build Demo1
cd Demo1
mvn clean package
# Build Demo2
cd Demo2
mvn clean package# Demo1
cd Demo1
mvn liberty:dev
# Demo2
cd Demo2
mvn liberty:devPress Ctrl+C to stop the server.
# Start
mvn liberty:run
# Stop (in another terminal)
mvn liberty:stopIf port 9080 or 3000 is already in use:
Demo1/Demo2 HTTP Port:
Edit pom.xml:
<liberty.var.default.http.port>9081</liberty.var.default.http.port>Demo2 MCP Port:
Edit src/main/liberty/config/server.xml:
<mcpServer id="demo2McpServer" port="3001" ... />Ensure you have internet connection for Maven to download the beta runtime on first build:
mvn clean install -U- Verify Java version:
java -version(should be 11+) - Verify Maven version:
mvn -version(should be 3.6+) - Clean and rebuild:
mvn clean install
- Demo2 Beta Feature: The mcpServer-1.0 feature is a beta feature and may change in future releases. Do not use in production environments.
- Security: These demos run without authentication for simplicity. Always implement proper security in production.
- Fake Data: Order endpoints return fake/mock data for demonstration purposes.
This is a demonstration project for educational purposes. Feel free to:
- Fork the repository
- Create your own demos
- Submit issues for bugs or improvements
- Share your learning experience
This project is created for educational purposes as part of OpenLiberty work experience.
Created during OpenLiberty Work Experience program.
- OpenLiberty team for the excellent framework and beta features
- MicroProfile community for cloud-native specifications
- Model Context Protocol team for the MCP specification
Happy Learning! 🚀
For detailed documentation, see the README files in each demo directory.