Files
google__adk-docs/docs/tools/google-cloud/mcp-toolbox-for-databases.md
Joe Fernandez 7c8ffc080e docs: add infrastructure for integrations catalog (#1210)
* docs: single source extensions listings

* docs: add infrastructure and updates for catalog

* updates: feedback responses, third party and gemini

* fix: update Python code
2026-02-02 08:59:26 -08:00

11 KiB
Raw Permalink Blame History

catalog_title, catalog_description, catalog_icon
catalog_title catalog_description catalog_icon
MCP Toolbox for Databases Connect over 30 different data sources to your agents /adk-docs/assets/tools-mcp-toolbox-for-databases.png

MCP Toolbox for Databases

Supported in ADKPythonTypescriptGo

MCP Toolbox for Databases is an open source MCP server for databases. It was designed with enterprise-grade and production-quality in mind. It enables you to develop tools easier, faster, and more securely by handling the complexities such as connection pooling, authentication, and more.

Google’s Agent Development Kit (ADK) has built in support for Toolbox. For more information on getting started or configuring Toolbox, see the documentation.

GenAI Toolbox

Supported Data Sources

MCP Toolbox provides out-of-the-box toolsets for the following databases and data platforms:

Google Cloud

Relational & SQL Databases

NoSQL & Key-Value Stores

Graph Databases

  • Neo4j (with tools for Cypher queries and schema inspection)
  • Dgraph

Data Platforms & Federation

  • Looker (for running Looks, queries, and building dashboards via the Looker API)
  • Trino (for running federated queries across multiple sources)

Other

Configure and deploy

Toolbox is an open source server that you deploy and manage yourself. For more instructions on deploying and configuring, see the official Toolbox documentation:

Install Client SDK for ADK

=== "Python"

ADK relies on the `toolbox-adk` python package to use Toolbox. Install the
package before getting started:

```shell
pip install google-adk[toolbox]
```

### Loading Toolbox Tools

Once your Toolbox server is configured, up and running, you can load tools
from your server using ADK:

```python
from google.adk.agents import Agent
from google.adk.tools.toolbox_toolset import ToolboxToolset

toolset = ToolboxToolset(
    server_url="http://127.0.0.1:5000"
)

root_agent = Agent(
    ...,
    tools=[toolset] # Provide the toolset to the Agent
)
```

### Authentication

The `ToolboxToolset` supports various authentication strategies including Workload Identity (ADC), User Identity (OAuth2), and API Keys. For full documentation, see the [Toolbox ADK Authentication Guide](https://github.com/googleapis/mcp-toolbox-sdk-python/tree/main/packages/toolbox-adk#authentication).

**Example: Workload Identity (ADC)**

Recommended for Cloud Run, GKE, or local development with `gcloud auth login`.

```python
from google.adk.tools.toolbox_toolset import ToolboxToolset
from toolbox_adk import CredentialStrategy

# target_audience: The URL of your Toolbox server
creds = CredentialStrategy.workload_identity(target_audience="<TOOLBOX_URL>")

toolset = ToolboxToolset(
    server_url="<TOOLBOX_URL>",
    credentials=creds
)
```

### Advanced Configuration

You can configure parameter binding, request hooks, and additional headers. See the [Toolbox ADK documentation](https://github.com/googleapis/mcp-toolbox-sdk-python/tree/main/packages/toolbox-adk) for details.

#### Parameter Binding

Bind values to tool parameters globally. These values are hidden from the model.

```python
toolset = ToolboxToolset(
    server_url="...",
    bound_params={
        "region": "us-central1",
        "api_key": lambda: get_api_key() # Can be a callable
    }
)
```

#### Usage with Hooks

Attach `pre_hook` and `post_hook` functions to execute logic before and after tool invocation.

```python
async def log_start(context, args):
    print(f"Starting tool with args: {args}")

toolset = ToolboxToolset(
    server_url="...",
    pre_hook=log_start
)
```

=== "Typescript"

ADK relies on the `@toolbox-sdk/adk` TS package to use Toolbox. Install the
package before getting started:

```shell
npm install @toolbox-sdk/adk
```

### Loading Toolbox Tools

Once you’re Toolbox server is configured and up and running, you can load tools
from your server using ADK:

```typescript
import {InMemoryRunner, LlmAgent} from '@google/adk';
import {Content} from '@google/genai';
import {ToolboxClient} from '@toolbox-sdk/adk'

const toolboxClient = new ToolboxClient("http://127.0.0.1:5000");
const loadedTools = await toolboxClient.loadToolset();

export const rootAgent = new LlmAgent({
  name: 'weather_time_agent',
  model: 'gemini-2.5-flash',
  description:
    'Agent to answer questions about the time and weather in a city.',
  instruction:
    'You are a helpful agent who can answer user questions about the time and weather in a city.',
  tools: loadedTools,
});

async function main() {
  const userId = 'test_user';
  const appName = rootAgent.name;
  const runner = new InMemoryRunner({agent: rootAgent, appName});
  const session = await runner.sessionService.createSession({
    appName,
    userId,
  });

  const prompt = 'What is the weather in New York? And the time?';
  const content: Content = {
    role: 'user',
    parts: [{text: prompt}],
  };
  console.log(content);
  for await (const e of runner.runAsync({
    userId,
    sessionId: session.id,
    newMessage: content,
  })) {
    if (e.content?.parts?.[0]?.text) {
      console.log(`${e.author}: ${JSON.stringify(e.content, null, 2)}`);
    }
  }
}

main().catch(console.error);
```

=== "Go"

ADK relies on the `mcp-toolbox-sdk-go` go module to use Toolbox. Install the
module before getting started:

```shell
go get github.com/googleapis/mcp-toolbox-sdk-go
```

### Loading Toolbox Tools

Once you’re Toolbox server is configured and up and running, you can load tools
from your server using ADK:

```go
package main

import (
	"context"
	"fmt"

	"github.com/googleapis/mcp-toolbox-sdk-go/tbadk"
	"google.golang.org/adk/agent/llmagent"
)

func main() {

  toolboxClient, err := tbadk.NewToolboxClient("https://127.0.0.1:5000")
	if err != nil {
		log.Fatalf("Failed to create MCP Toolbox client: %v", err)
	}

  // Load a specific set of tools
  toolboxtools, err := toolboxClient.LoadToolset("my-toolset-name", ctx)
  if err != nil {
    return fmt.Sprintln("Could not load Toolbox Toolset", err)
  }

  toolsList := make([]tool.Tool, len(toolboxtools))
    for i := range toolboxtools {
      toolsList[i] = &toolboxtools[i]
    }

  llmagent, err := llmagent.New(llmagent.Config{
    ...,
    Tools:       toolsList,
  })

  // Load a single tool
  tool, err := client.LoadTool("my-tool-name", ctx)
  if err != nil {
    return fmt.Sprintln("Could not load Toolbox Tool", err)
  }

  llmagent, err := llmagent.New(llmagent.Config{
    ...,
    Tools:       []tool.Tool{&toolboxtool},
  })
}
```

Advanced Toolbox Features

Toolbox has a variety of features to make developing Gen AI tools for databases. For more information, read more about the following features:

  • Authenticated Parameters: bind tool inputs to values from OIDC tokens automatically, making it easy to run sensitive queries without potentially leaking data
  • Authorized Invocations: restrict access to use a tool based on the users Auth token
  • OpenTelemetry: get metrics and tracing from Toolbox with OpenTelemetry