You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
seo-title: "Model Context Protocol Server 1.0 updates and more in 26.0.0.2-beta- OpenLiberty.io"
9
-
seo-description: This beta release enhances the `mcpServer-1.0` feature with role-based authorization, request IDs, the new `_meta` field, and key bug fixes. It also adds documentation and tests for `displayCustomizedExceptionText`, allowing users to replace default Liberty error messages with clearer, custom text.
10
-
blog_description: This beta release enhances the `mcpServer-1.0` feature with role-based authorization, request IDs, the new `_meta` field, and key bug fixes. It also adds documentation and tests for `displayCustomizedExceptionText`, allowing users to replace default Liberty error messages with clearer, custom text.
9
+
seo-description: This beta release enhances the `mcpServer-1.0` feature with role-based authorization, the new `_meta` field, and key bug fixes. It also adds documentation and tests for `displayCustomizedExceptionText`, allowing users to replace default Liberty error messages with clearer, custom text.
10
+
blog_description: This beta release enhances the `mcpServer-1.0` feature with role-based authorization, the new `_meta` field, and key bug fixes. It also adds documentation and tests for `displayCustomizedExceptionText`, allowing users to replace default Liberty error messages with clearer, custom text.
@@ -18,7 +18,7 @@ Navaneeth S Nair <https://github.com/navaneethsnair1>
18
18
:url-about: /
19
19
//Blank line here is necessary before starting the body of the post.
20
20
21
-
This beta release enhances the `mcpServer-1.0` feature with role-based authorization, request IDs, the new `_meta` field, and key bug fixes. It also adds documentation and tests for `displayCustomizedExceptionText`, allowing users to replace default Liberty error messages with clearer, custom text.
21
+
This beta release enhances the `mcpServer-1.0` feature with role-based authorization, the new `_meta` field, and key bug fixes. It also adds documentation and tests for `displayCustomizedExceptionText`, allowing users to replace default Liberty error messages with clearer, custom text.
22
22
23
23
The link:{url-about}[Open Liberty] 26.0.0.2-beta includes the following beta features (along with link:{url-prefix}/docs/latest/reference/feature/feature-overview.html[all GA features]):
24
24
@@ -33,9 +33,9 @@ See also link:{url-prefix}/blog/?search=beta&key=tag[previous Open Liberty beta
33
33
// // // // // // // //
34
34
[#mcp]
35
35
== Model Context Protocol Server 1.0 updates
36
-
The link:https://modelcontextprotocol.io/docs/getting-started/intro[Model Context Protocol (MCP)] is an open standard that enables AI applications to access real-time information from external sources. The Liberty MCP Server feature `mcpServer-1.0` allows developers to expose the business logic of their applications, allowing it to be integrated into agentic AI workflows.
36
+
The link:https://modelcontextprotocol.io/docs/getting-started/intro[Model Context Protocol (MCP)] is an open standard that enables AI applications to access real-time information from external sources. The Liberty MCP Server feature (`mcpServer-1.0`) allows developers to expose the business logic of their applications, allowing it to be integrated into agentic AI workflows.
37
37
38
-
This beta release of Open Liberty includes important updates to the `mcpServer-1.0` feature including role-based authorization, request IDs, the `_meta` field, and a few bug fixes.
38
+
This beta release of Open Liberty includes important updates to the `mcpServer-1.0` feature including role-based authorization, the `_meta` field, and a few bug fixes.
39
39
40
40
=== Prerequisites
41
41
To use the `mcpServer-1.0` feature, Java 17 or later must be installed on the system.
@@ -55,13 +55,19 @@ These security annotations are declared on two levels:
55
55
56
56
For complete reference documentation, see the link:https://jakarta.ee/specifications/security/[Jakarta Security Annotations specification].
57
57
58
-
==== Basic Authorization policy
58
+
The `mcpServer-1.0` feature does not currently implement all of the link:https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization#authorization-server-metadata-discovery[authorization-server-metadata-discovery requirements] specified in the MCP specification. However, you can use any of Liberty's link:https://openliberty.io/docs/latest/authentication.html[authentication and authorization mechanisms] to authenticate users and assign roles. The `mcpServer-1.0` feature can then ensure that users can access only the tools that are permitted for their assigned roles.
59
+
60
+
==== Basic authorization example
61
+
62
+
The following example shows how to configure MCP tools to require authentication and to ensure that users have the appropriate roles to access specific tools. Users authenticate using Basic Authentication, and the list of users and their roles are configured in a basicRegistry in the `server.xml` file.
59
63
60
64
Consider an online bookshop that has different users each with different authorization levels:
61
65
62
-
* Users - Minimum Security clearance required
63
-
* Moderators - Medium Security clearance required
64
-
* Admins - High Security clearance required
66
+
* Users - can buy books and track prices
67
+
* Moderators - can manage the books available
68
+
* Admins - can manually ban users
69
+
70
+
Clients who connect without authenticating can only display the available books or register as a new user.
<!-- Required to define https port for TLS (Transport Layer Security) -->
160
-
<httpEndpoint id="defaultHttpEndpoint"
161
-
httpPort="-1"
162
-
httpsPort="9443">
163
-
</httpEndpoint>
163
+
<!-- Required to define https port for TLS (Transport Layer Security) -->
164
+
<httpEndpoint id="defaultHttpEndpoint"
165
+
httpPort="-1"
166
+
httpsPort="9443">
167
+
</httpEndpoint>
164
168
165
169
<basicRegistry id="basic" realm="BasicRealm">
166
170
@@ -204,50 +208,22 @@ The following additional configuration is required in the `server.xml` (also see
204
208
</server>
205
209
----
206
210
207
-
If a new role like `RoleDoesNotExistInServerConfig` were added to the code, any user (e.g., Sally) attempting to authenticate with a resource annotated with `@RolesAllowed("RoleDoesNotExistInServerConfig")` would be denied access to the resource. Access would only be granted after creating a corresponding group for that role in the server.xml file and mapping the user to that group.
208
-
209
-
In other situations we could also add multiple roles to tools: `@RolesAllowed("Admins, Moderators")`. This approach might make sense if the roles had no overlapping users.
210
-
211
-
**Authorization Configuration**
212
-
213
-
The `mcpServer-1.0` feature does not currently implement the MCP specification's authorization-server-metadata-discovery requirements. However, you can use any of Liberty's link:https://openliberty.io/docs/latest/authentication.html[standard authorization methods], including custom implementations.
214
-
215
-
216
-
=== MCP: Tools can now access the ID of the request that is sent by the client
217
-
218
-
Your tool can now have a new argument of type `io.openliberty.mcp.request.RequestID`.
219
-
220
-
As an example the requestID can be used for logging or audit purposes:
221
-
222
-
[source,java]
223
-
----
224
-
public class RequestIDLoggingExample {
225
-
226
-
private static final Logger logger = Logger.getLogger(McpToolExample.class.getName());
211
+
It is also possible to add multiple roles to tools: `@RolesAllowed("Admins, Moderators")`. Doing so grants access to users who have either role.
227
212
228
-
@Tool(name = "exampleTool")
229
-
public String exampleTool(RequestId requestId) {
230
-
// Log with request ID using asString() method
231
-
logger.info("Processing request [" + requestId.asString() + "] with input: ");
232
-
...
233
-
}
234
-
}
235
-
----
236
-
237
-
=== MCP: Tools can access metadata that is sent by the client in the `_meta` field
238
-
239
-
The link:https://modelcontextprotocol.io/specification/2025-06-18/basic/index#meta[MCP specification] specifies that the `_meta` property/parameter is reserved by MCP to allow clients and servers to attach additional metadata to their interactions.
213
+
If a role that is used in `@RolesAllowed` annotation is not mentioned in the `server.xml` file, that just means that no user has that role. If it is the only role that is allowed to call the tool, then no users can call the tool.
240
214
215
+
=== MCP: Tools can access metadata that the client sends in the _meta field.
216
+
The link:https://modelcontextprotocol.io/specification/2025-06-18/basic/index#meta[MCP specification] reserves the `_meta` property or parameter so clients and servers can attach additional metadata to their interactions.
241
217
Key name format: valid `_meta` key names have two segments:
242
218
243
-
* an optional prefix (e.g. "example.com/") and
244
-
* a name ("myKey")
219
+
* An optional prefix (e.g. "example.com/") and
220
+
* A name ("myKey")
245
221
246
222
The whole `_meta` key is seen as "example.com/myKey"
247
223
248
224
==== Adding a Tool Meta parameter
249
225
250
-
The following code shows an example metaKey used to retrieve the value of the metadata. In the example, the metakey is "api.ibmtest.org/location"
226
+
The following code shows an example metaKey used to retrieve the value of the metadata. In the example, the metakey is "example.org/location"
251
227
252
228
[source,java]
253
229
----
@@ -257,16 +233,16 @@ The following code shows an example metaKey used to retrieve the value of the me
* Metadata shows the remaining quota before each call for time window
307
-
* If limit is exceeded, error includes retry time in `_meta`
283
+
* If limit is exceeded, the error includes retry time in `_meta`
308
284
309
285
==== 3) Caching Hints Extension
310
286
Optimize performance through intelligent caching.
311
287
312
288
*How it works:*
313
289
314
-
* Server implements caching strategy
290
+
* Server includes caching information in the tool call result
315
291
* Client can implement client-side caching
316
292
317
293
==== 4) Bringing it all together
@@ -344,13 +320,12 @@ All three of the preceding extensions might be built into your MCP server as ext
344
320
345
321
==== 1) MCP Server feature used ISO-8859-1 and did not handle non-Latin characters
346
322
347
-
* Non-ASCII characters are now encoded correctly using UTF-8.
348
-
* When an asynchronous tool failed with a business exception, it was incorrectly treated as a non-business exception and the client might receive an "Internal server error" response. Now, the business exception message is correctly returned to the user in the same way that it is for synchronous tools.
323
+
* MCP requests and responses are now encoded correctly using UTF-8.
349
324
350
325
==== 2) Fix asynchronous MCP Tool error handling
351
326
352
-
* Previously, when an asynchronous tool returned a failed completion stage, the system did not verify if the exception was a business or technical error. This oversight resulted in all failures being reported as internal errors.
353
-
* The system now differentiates between exception types. This categorization ensures that business errors are returned to the client, while technical errors are directed to the technical team for resolution.
327
+
* Previously, when an asynchronous tool returned a failed completion stage, the system did not verify whether the exception was a business or technical error. This resulted in all failures being reported as internal errors.
328
+
* The system now differentiates between exception types. This categorization ensures that business errors are returned to the client, while technical errors are reported in the Liberty server log.
354
329
355
330
// DO NOT MODIFY THIS LINE. </GHA-BLOG-TOPIC>
356
331
@@ -361,7 +336,9 @@ All three of the preceding extensions might be built into your MCP server as ext
361
336
[#displayCustomizedExceptionText]
362
337
== displayCustomizedExceptionText property
363
338
This beta release adds documentation and tests for the `displayCustomizedExceptionText` configuration, which allows users to override Liberty’s default error messages (such as SRVE0218E: Forbidden and SRVE0232E: An exception occurred) with clearer, user-defined messages.
364
-
The feature is enabled through simple `server.xml` configuration, where custom messages can be mapped to specific HTTP status codes (403 and 500).
339
+
340
+
The feature is enabled through simple `server.xml` file configuration, where custom messages can be mapped to specific HTTP status codes (403 and 500).
341
+
365
342
Testing ensures that these custom messages correctly replace Liberty’s defaults across all supported platforms, confirming that the configured text is returned consistently in all scenarios.
366
343
367
344
[source,xml]
@@ -455,4 +432,4 @@ For more information on using a beta release, refer to the link:{url-prefix}docs
455
432
[#feedback]
456
433
== We welcome your feedback
457
434
458
-
Let us know what you think on link:https://groups.io/g/openliberty[our mailing list]. If you hit a problem, link:https://stackoverflow.com/questions/tagged/open-liberty[post a question on StackOverflow]. If you hit a bug, link:https://github.com/OpenLiberty/open-liberty/issues[please raise an issue].
435
+
Let us know what you think on link:https://groups.io/g/openliberty[our mailing list]. If you hit a problem, link:https://stackoverflow.com/questions/tagged/open-liberty[post a question on StackOverflow]. If you hit a bug, link:https://github.com/OpenLiberty/open-liberty/issues[please raise an issue].
0 commit comments