Skip to content

Documentation, MCP server non-reference #8493

Description

@TheoGkoumas

Feature epic details

Operating systems

Does the documentation apply to all operating systems?

  • Yes

Summary

Provide the ability for Open Liberty to act as an MCP Server, giving developers the ability to define Tools, Resources, Prompts for use by AI Apps.

Model Context Protocol (MCP) is an open standard that enables AI applications to interact with and utilise external systems. The mcp-1.0 feature for Open Liberty allows developers to expose the business logic of their applications, making it discoverable, understandable, and invocable by AI applications.

Configuration

The mcp-1.0 feature uses the https://github.com/mcp-java/java-mcp-annotations[`mcp-java` API] (org.mcpjava:mcp-server-api), which is available on Maven Central.

Add the following dependency to your pom.xml:

<!-- MCP Server API -->
<dependency>
    <groupId>org.mcpjava</groupId>
    <artifactId>mcp-server-api</artifactId>
    <version>1.0.0</version>
    <scope>provided</scope>
</dependency>

Some features - such as @Schema, DefaultValueConverter, ToolManager, and ToolResponseEncoder - are provided by the io.openliberty.mcp jar that ships with Liberty. To make these available on the build path, you need to add a system-scoped dependency in your pom.xml that points to this jar.

First, locate the io.openliberty.mcp_*.jar in <wlp>/dev/api/ibm/ and note the version suffix (e.g. 1.0.106). Then define the following properties in your pom.xml:

<properties>
    <wlp-dir-path>replace-with-path-to-wlp-dir</wlp-dir-path>
    <mcp-jar-version>replace-with-version-number</mcp-jar-version>
</properties>

Then add the dependency:

<!-- Liberty MCP extensions (io.openliberty.mcp) -->
<dependency>
    <groupId>io.openliberty.mcp</groupId>
    <artifactId>mcp-core</artifactId>
    <version>${mcp-jar-version}</version>
    <scope>system</scope>
    <systemPath>${wlp-dir-path}/dev/api/ibm/io.openliberty.mcp_${mcp-jar-version}.jar</systemPath>
</dependency>

=== Enable the feature

Add mcp-1.0 to your server.xml:

<featureManager>
    <feature>servlet-6.0</feature>
    <feature>cdi-4.0</feature>
    <feature>mcp-1.0</feature>
</featureManager> 

Updates to existing topics

It should not update any existing topics.

Create a new topic

This documentation should act as a concise tutorial for the MCP feature.
We should discuss with the docs team to identify what documentation is expected for liberty features.
As a starting point, we should have a step-by-step guide to getting started and registering a tool, which we can then build on to explain more advanced features.

In principle, the list of actions/functionalities that need to be cover is the following:

  • registering tools
  • providing tool arguments
  • using structured content
  • registering encoders
  • throwing exceptions
  • handling cancellation
  • writing asynchronous tools
  • programmatically registering tools
  • stateless mode
  • endpoint configuration

Each entry should also note whether there are any restrictions (e.g. cancellation does not work in stateless mode, structured content only works for clients which support version 2025-06-18 or later)

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions