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
This package allows Google ADK agents to natively use tools from the MCP Toolbox.
5
+
This package allows Google ADK (Agent Development Kit) agents to natively use tools from the [MCP Toolbox](https://github.com/googleapis/genai-toolbox).
6
+
7
+
It provides a seamless bridge between the `toolbox-core` SDK and the ADK's `BaseTool` / `BaseToolset` interfaces, handling authentication propagation, header management, and tool wrapping automatically.
4
8
5
9
## Installation
6
10
@@ -10,18 +14,136 @@ pip install toolbox-adk
10
14
11
15
## Usage
12
16
17
+
The primary entry point is the `ToolboxToolset`, which loads tools from a remote Toolbox server and adapts them for use with ADK agents.
18
+
13
19
```python
14
20
from toolbox_adk import ToolboxToolset, CredentialStrategy
21
+
from google.adk.agents import Agent
15
22
16
-
# Configure auth (e.g., Use the agent's identity)
17
-
creds = CredentialStrategy.toolbox_identity()
23
+
# 1. Configure Authentication Strategy
24
+
# Use the agent's own identity (Workload Identity)
toolset_name="my-toolset", # Optional: Load specific toolset
31
+
credentials=creds
32
+
)
33
+
34
+
# 3. Use in your ADK Agent
35
+
agent = Agent(tools=toolset.get_tools())
36
+
```
37
+
38
+
## Authentication Strategies
39
+
40
+
The `toolbox-adk` package provides flexible authentication strategies to handle `Client-to-Server` authentication (securing the connection to the Toolbox server) and `User Identity` propagation (authenticating the user for specific tools).
41
+
42
+
Use the `CredentialStrategy` factory methods to create your configuration.
43
+
44
+
### Workload Identity (Recommended for Cloud Run / GKE)
45
+
46
+
Uses the agent's environment credentials (ADC) to generate an OIDC ID token. This is the standard way for one service to authenticate to another on Google Cloud.
47
+
48
+
```python
49
+
# target_audience should match the URL of your Toolbox server
Propagates the end-user's identity to the Toolbox. This is used when the tools themselves need to act on behalf of the user (e.g., accessing the user's Drive or Calendar).
61
+
62
+
```python
63
+
creds = CredentialStrategy.user_identity(
64
+
client_id="YOUR_CLIENT_ID",
65
+
client_secret="YOUR_CLIENT_SECRET",
66
+
scopes=["https://www.googleapis.com/auth/drive"]
67
+
)
68
+
```
69
+
70
+
### Manual Token (Development / Testing)
71
+
72
+
Manually supply a token (e.g., a static API key or a temporary token).
0 commit comments