The Model Context Protocol (MCP) has rapidly gained adoption in 2025 as a foundational technology for AI agents. While MCP's official Java SDK provides implementation capabilities, servlet-based development can present a learning curve for developers. Open Liberty addresses this challenge with a new beta feature that enables MCP server creation using familiar JAX-RS-style annotations.
MCP is a protocol that allows AI agents to interact with external tools and data sources. Instead of building custom integrations for each AI platform, developers can create MCP servers that expose tools through a standardized interface.
Open Liberty's mcpServer-1.0 beta feature introduces annotation-based MCP server development.
@Tool(
name = "get-user",
title = "Get User Information",
description = "Retrieve name and role for specified user ID")
public String getUser(
@ToolArg(
name = "userid",
description = "Target user's ID"
) String userId) {
return service.getUser(userId).toString();
}
Using the official MCP Java SDK would require an understanding of several complex components:
* Creating and configuring TransportProvider instances
* Defining server capabilities and metadata
* Implementing tool specifications manually
* Managing CallToolResult objects
This complexity adds development overhead, especially when scaling to enterprise applications.
Liberty's declarative style mirrors JAX-RS REST API development, making it immediately familiar to Java developers.
Sample Application: Library Management
To demonstrate Open Liberty's MCP capabilities, I've created a library management application that exposes the following tools through MCP:
- Retrieve library rules
- Get user information
- Search book catalog
- Check borrowing history
- Process book loans
- Handle book returns
- Add new users
- Reset database
The application uses MariaDB for data persistence and implements business rules through AI agent logic rather than hard-coded validation.
Getting Started
Downloading Open Liberty Beta
You can download the beta version from the official Open Liberty website. On this page, scroll down to the "Download package" section and select the latest beta from the Betas tab. At the time of writing, 26.0.0.1-beta is the latest version.
Once downloaded, extract the archive and place it in a directory of your choice. For this guide, we'll assume it's placed at c:\Projects\wlp.
Downloading the Sample Application
Download the sample application using the following Git command:
git clone https://github.com/tatsuya-ibm/library-mcp
Modifying the Sample Application
Update the following section in pom.xml:
<properties>
(omitted)
<wlp-dir-path>C:\projects\wlp</wlp-dir-path>
<mcp-jar-version>1.0.108</mcp-jar-version>
</properties>
| Property |
Value |
| wlp-dir-path |
Change to the directory where you extracted Open Liberty |
| mcp-jar-version |
Update to match the library version included in the extracted folder (differs by beta version). The version is XXX in the JAR file: (extracted_folder)\dev\api\ibm\io.openliberty.mcp_XXX.jar
|
Starting MariaDB
Start the MariaDB container:
podman run -d --name maria01 -e MYSQL_ROOT_PASSWORD=rootpwd -e MYSQL_DATABASE=db01 -e MYSQL_USER=usr01 -e MYSQL_PASSWORD=pwd01 -p 3306:3306 mariadb:latest
Starting the MCP Server
In the directory where you extracted the sample application, execute the startup command in PowerShell. Table definitions and test data insertion into the database occur automatically at startup.
./mvnw liberty:dev
Connecting to AI Agents
Register this MCP server in your available local AI agent tools. Here is a configuration example using Goose:
- Navigate to Extensions > Add Custom extension
- Configure with the following values
- Type: Streamable HTTP
- Endpoint: http://localhost:9080/librarymcp/mcp
AI Agent Interaction with the Library Application
Once connected, the AI agent can operate the library application autonomously. The following examples demonstrate how the agent interprets natural language requests and orchestrates tool calls without explicit programming.
Understanding Library Rules
The AI agent selects the appropriate tool based on the instruction and retrieves the library rules without being told which specific tool to use.