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, 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.
@@ -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, 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.
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
@@ -38,28 +38,28 @@ The link:https://modelcontextprotocol.io/docs/getting-started/intro[Model Contex
38
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.
39
39
40
40
=== Prerequisites
41
-
To use the `mcpServer-1.0` feature, `Java 17` or later must be installed on the system.
41
+
To use the `mcpServer-1.0` feature, Java 17 or later must be installed on the system.
42
42
43
-
=== Implement Role-based authorization for MCP tools via annotations
43
+
=== Implement role-based authorization for MCP tools via annotations
44
44
45
45
The following new annotations allow you to restrict tool usage through authorization policies:
46
46
47
-
. `@DenyAll` - Resource is denied. This is the strictest policy.
48
-
. `@RolesAllowed` - Resource is allowed for pre-authorised users in a role (same as a group in liberty).
47
+
. `@DenyAll` - Resource is denied. This annotation is the strictest policy.
48
+
. `@RolesAllowed` - Resource is allowed for pre-authorised users in a role (the same as a group in Liberty).
49
49
. `@PermitAll` - Resource is allowed for anyone (even unauthenticated users).
50
50
51
51
These security annotations are declared on two levels:
52
52
53
-
. Class level - Every method in the class inherits this class level annotation
54
-
. Method level - Overrides any class level annotations
53
+
. Class level - Every method in the class inherits this class level annotation.
54
+
. Method level - Overrides any class level annotations.
55
55
56
56
For complete reference documentation, see the link:https://jakarta.ee/specifications/security/[Jakarta Security Annotations specification].
57
57
58
58
==== Basic Authorization policy
59
59
60
60
Consider an online bookshop that has different users each with different authorization levels:
61
61
62
-
* Users - Low Security clearance required
62
+
* Users - Minimum Security clearance required
63
63
* Moderators - Medium Security clearance required
64
64
* Admins - High Security clearance required
65
65
@@ -124,16 +124,16 @@ public class PublicTools {
124
124
==== Steps required
125
125
126
126
* Create an application with `@ApplicationScoped` and expose the tool with the required annotations.
127
-
* Create a `server.xml` with users
128
-
* Ensure that the groups map to the Roles created in the Tool
129
-
* Add users to the groups in the `server.xml`
130
-
* Create tests that test the expected functionality of the tools
127
+
* Create a `server.xml` file with the users.
128
+
* Ensure that the groups map to the roles created in the tool.
129
+
* Add users to the groups in the `server.xml` file.
130
+
* Create tests that validate the expected functionality of the tools.
131
131
132
132
133
133
The following additional configuration is required in the `server.xml` (also see comments in the xml below):
134
134
135
-
* additional: appSecurity feature
136
-
* additional: transportSecurity feature
135
+
* additional: `appSecurity` feature
136
+
* additional: `transportSecurity` feature
137
137
* additional: define a user registry
138
138
* additional: enable TLS (Transport Layer Security) for security
139
139
* additional: require TLS (Transport Layer Security) to ensure credentials aren't sent in cleartext
@@ -204,20 +204,20 @@ The following additional configuration is required in the `server.xml` (also see
204
204
</server>
205
205
----
206
206
207
-
If another role were added to the code, say `RoleDoesNotExistInServerConfig` then any user (for e.g. Sally) was trying to authenticate with `@RolesAllowed("RoleDoesNotExistInServerConfig")` would not be able to have access to the resource until that role had a group created for it in the `server.xml` file and that user was mapped to that group.
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
208
209
-
In other situations we could also add multiple roles to tools: `@RolesAllowed("Admins, Moderators")`. This could make sense if the roles would have no overlapping users.
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
210
211
-
_**Authorization Configuration**_
211
+
**Authorization Configuration**
212
212
213
-
The `mcpServer-1.0` feature does not currently implement the MCP specification's link:https://spec.modelcontextprotocol.io/specification/2025-06-18/server/authorization[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.
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
214
215
215
216
-
=== MCP: Tools can now access the ID of the request sent by the client
216
+
=== MCP: Tools can now access the ID of the request that is sent by the client
217
217
218
218
Your tool can now have a new argument of type `io.openliberty.mcp.request.RequestID`.
219
219
220
-
As an example the requestID may be used for logging or audit purposes:
220
+
As an example the requestID can be used for logging or audit purposes:
221
221
222
222
[source,java]
223
223
----
@@ -234,7 +234,7 @@ public class RequestIDLoggingExample {
234
234
}
235
235
----
236
236
237
-
=== MCP: Tools can access metadata sent by the client in the `_meta` field
237
+
=== MCP: Tools can access metadata that is sent by the client in the `_meta` field
238
238
239
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.
240
240
@@ -247,8 +247,7 @@ The whole `_meta` key is seen as "example.com/myKey"
247
247
248
248
==== Adding a Tool Meta parameter
249
249
250
-
The code below shows an example metaKey used to retrieve the value of the metadata.
251
-
In the example below, the metakey is "api.ibmtest.org/location"
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"
252
251
253
252
[source,java]
254
253
----
@@ -265,9 +264,9 @@ In the example below, the metakey is "api.ibmtest.org/location"
265
264
}
266
265
----
267
266
268
-
==== Returning meta data via a Tool Response
267
+
==== Returning metadata via a Tool Response
269
268
270
-
A method can return any meta data via the `ToolResponse` Object:
269
+
A method can return any metadata via the `ToolResponse` Object:
271
270
272
271
[source,java]
273
272
----
@@ -296,16 +295,16 @@ Track API costs for expensive operations.
296
295
297
296
*How it works:*
298
297
299
-
* Server adds costs to tool metadata
300
-
* Client tracks total spending across operations
298
+
* Server adds costs to tool metadata.
299
+
* Client tracks total spending across operations.
301
300
302
301
==== 2) Rate Limiting Extension
303
302
Prevent resource exhaustion and ensure fair access.
304
303
305
304
*How it works:*
306
305
307
-
* Metadata shows remaining quota before each call for time window
308
-
* If limit exceeded, error includes retry time in `_meta`
306
+
* Metadata shows the remaining quota before each call for time window
307
+
* If limit is exceeded, error includes retry time in `_meta`
309
308
310
309
==== 3) Caching Hints Extension
311
310
Optimize performance through intelligent caching.
@@ -317,7 +316,7 @@ Optimize performance through intelligent caching.
317
316
318
317
==== 4) Bringing it all together
319
318
320
-
All three of the above extensions could be built into your MCP server as extensions:
319
+
All three of the preceding extensions might be built into your MCP server as extensions:
321
320
322
321
[source,json]
323
322
----
@@ -343,16 +342,15 @@ All three of the above extensions could be built into your MCP server as extensi
343
342
344
343
=== Notable bug fixes in MCP 1.0
345
344
346
-
==== 1) MCP Server feature used ISO-8859-1 and did not handle non-latin characters
345
+
==== 1) MCP Server feature used ISO-8859-1 and did not handle non-Latin characters
347
346
348
347
* Non-ASCII characters are now encoded correctly using UTF-8.
349
-
* When an asynchronous tool failed with a business exception, it was incorrectly treated as a non-business exception and the client would 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.
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.
350
349
351
-
==== 2) Fix Async MCP Tool error handling
350
+
==== 2) Fix asynchronous MCP Tool error handling
352
351
353
-
* When an async tool returned a completion stage that failed, we were not checking whether the returned exception was a business exception or not, so we always reported an internal error.
354
-
* Now we are checking whether or not it is a business or technical error and returning the error.
355
-
* Business errors are returned to the client and technical errors are returned to the technical team to resolve.
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.
356
354
357
355
// DO NOT MODIFY THIS LINE. </GHA-BLOG-TOPIC>
358
356
@@ -362,7 +360,9 @@ All three of the above extensions could be built into your MCP server as extensi
362
360
// // // // // // // //
363
361
[#displayCustomizedExceptionText]
364
362
== displayCustomizedExceptionText property
365
-
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. The feature is enabled through simple `server.xml` configuration, where custom messages can be mapped to specific HTTP status codes (403 and 500). 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.
363
+
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).
365
+
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.
0 commit comments