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
* feat!: transition Java SDK to native MCP JSON-RPC transport
This PR updates the SDK to achieve transport parity with the Python, JS, and Go SDKs by seamlessly adopting the MCP standard and removing legacy REST mappings.
* Fix 405 error and debug test assertions
* Fix file formatting
* Refactor ToolResult text extraction and update tests
* Fix parsing of unauthorized error into ToolResult
* Fix string assertion in testRunToolWrongAuth
* Fix string assertion case sensitivity in auth test
* chore: format test file
* docs: update endpoint URLs to include /mcp path
* doc: Simplify urls in README
* fix(java): parse toolbox/authInvoke from _meta in list tools
* refactor: Remove `ToolResult.text()` helper method, update text content extraction to stream-based collection.
* chore: Revert /mcp auto-append and update docs to explicitly require /mcp
* docs: add release-please version annotations
* chore: revert example directory changes
* build: upgrade libraries-bom to 26.48.0 and google-auth-library to 1.23.0
* doc: Remove the optional step of deploying to a specific target
* doc: Revert to simplified README examples with comments
* doc: Improve README doc formatting and rendering and typos
@@ -221,7 +228,7 @@ ToolResult result = client.invokeTool("tool-name", args).join();
221
228
222
229
## Authentication
223
230
224
-
## Client to Server Authentication
231
+
###Client to Server Authentication
225
232
226
233
This section describes how to authenticate the `ToolboxClient` itself when connecting to a Toolbox server instance that requires authentication. This is crucial for securing your Toolbox server endpoint, especially when deployed on platforms like Cloud Run, GKE, or any environment where unauthenticated access is restricted.
227
234
@@ -241,7 +248,7 @@ The Java SDK handles the generation of **Authorization headers** (Bearer tokens)
241
248
242
249
You need to set up [ADC](https://cloud.google.com/docs/authentication/set-up-adc-local-dev-environment).
243
250
244
-
### Authenticating with GoogleCloudServers (CloudRun
251
+
### Authenticating with Google Cloud Servers (Cloud Run)
245
252
246
253
For Toolbox servers hosted on Google Cloud (e.g., Cloud Run), the SDK provides seamless OIDC authentication.
|**Cloud Run**| Uses Service Account |**None.** (Automatic) |
277
284
|**CI/CD**| Uses Service Account Key | Set GOOGLE\_APPLICATION\_CREDENTIALS=/path/to/key.json |
278
285
279
-
*Note: If you provide an .apiKey() in the builder, it overrides the automatic ADC mechanism.*
286
+
*Note: If you provide an `.apiKey()` in the builder, it overrides the automatic ADC mechanism.*
280
287
281
-
## Authenticating the Tools
288
+
###Authenticating the Tools
282
289
283
290
Tools can be configured within the Toolbox service to require authentication, ensuring only authorized users or applications can invoke them, especially when accessing sensitive data.
284
291
285
-
#### Warning
286
-
287
-
Always use HTTPS to connect your application with the Toolbox service, especially in production environments or whenever the communication involves sensitive data (including scenarios where tools require authentication tokens). Using plain HTTP lacks encryption and exposes your application and data to significant security risks, such as eavesdropping and tampering.
292
+
> [!WARNING]
293
+
> Always use HTTPS to connect your application with the Toolbox service, especially in production environments or whenever the communication involves sensitive data (including scenarios where tools require authentication tokens). Using plain HTTP lacks encryption and exposes your application and data to significant security risks, such as eavesdropping and tampering.
288
294
289
295
290
296
### When is Authentication Needed?
@@ -309,7 +315,7 @@ You must provide the SDK with an `AuthTokenGetter` (a function that returns a `C
309
315
310
316
**Important:** The **Service Name** (or Auth Source) used when adding the getter (e.g., `"salesforce_auth"`) must exactly match the name of the corresponding auth source defined in the tool's configuration.
@@ -376,19 +383,17 @@ The SDK allows you to pre-set, or "bind", values for specific tool parameters be
376
383
* Enforcing consistency: Ensuring specific values for certain parameters.
377
384
* Pre-filling known data: Providing defaults or context.
378
385
379
-
##### Important
380
-
381
-
The parameter names used for binding (e.g., `"api_key"`) must exactly match the parameter names defined in the tool's configuration within the Toolbox service.
382
-
383
-
##### Note
386
+
> [!IMPORTANT]
387
+
> The parameter names used for binding (e.g., `"api_key"`) must exactly match the parameter names defined in the tool's configuration within the Toolbox service.
384
388
385
-
You do not need to modify the tool's configuration in the Toolbox service to bind parameter values using the SDK.
389
+
> [!NOTE]
390
+
> You do not need to modify the tool's configuration in the Toolbox service to bind parameter values using the SDK.
Instead of a static value, you can bind a parameter to a synchronous or asynchronous function (`Supplier`). This function will be called **each time** the tool is invoked to dynamically determine the parameter's value at runtime.
We welcome contributions\! Please see [CONTRIBUTING.md](https://www.google.com/search?q=CONTRIBUTING.md) for details on how to submit pull requests, report bugs, or request features.
443
+
We welcome contributions\! Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for details on how to submit pull requests, report bugs, or request features.
439
444
440
445
## License
441
446
442
-
This project is licensed under the Apache 2.0 License \- see the [LICENSE](https://www.google.com/search?q=LICENSE) file for details.
447
+
This project is licensed under the Apache 2.0 License \- see the [LICENSE](https://github.com/googleapis/mcp-toolbox-sdk-java/blob/main/LICENSE) file for details.
Copy file name to clipboardExpand all lines: demo-applications/cymbal-transit/README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -120,6 +120,6 @@ or
120
120
To directly deploy your agent to Cloud Run and test there:
121
121
122
122
```bash
123
-
gcloud run deploy cymbal-transit --source . --set-env-vars GCP_PROJECT_ID=<<YOUR_PROJECT_ID>>,GCP_REGION=us-central1,GEMINI_MODEL_NAME=gemini-2.5-flash,MCP_TOOLBOX_URL=<<YOUR_MCP_TOOLBOX_URL>> --allow-unauthenticated
123
+
gcloud run deploy cymbal-transit --source . --set-env-vars GCP_PROJECT_ID=<<YOUR_PROJECT_ID>>,GCP_REGION=us-central1,GEMINI_MODEL_NAME=gemini-2.5-flash,MCP_TOOLBOX_URL=<<YOUR_MCP_TOOLBOX_URL_ENDING_IN_/mcp>> --allow-unauthenticated
124
124
```
125
-
Replace the placeholder variables enclosed within <<>>.
125
+
Replace the placeholder variables enclosed within <<>>. Ensure that your `MCP_TOOLBOX_URL` explicitly ends with `/mcp` (e.g., `https://my-toolbox-service.a.run.app/mcp`).
Copy file name to clipboardExpand all lines: example/README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,9 @@ These sample Java files allow you to test the features supported in the Java ver
4
4
5
5
1. First set up database (AlloyDB in this case) and ingest data for the tools referenced in this example. In order to demonstrate the use of tools across applications, we have considered a RETAIL STORE and TOY STORE application data together. In order to install cluster, instance and setup data, for this sample use case, follow the first 4 steps of the first codelab (hybrid search) and the 5th step of the second codelab (toystore app) below:
0 commit comments