Files
google__adk-docs/docs/integrations/mcp-toolbox-for-databases.md
Anubhav Dhawan 95410605f0 docs: MCP Toolbox, Remove hooks documentation and simplify parameter binding section (#1277)
* docs: remove request hooks documentation, and simplify parameter binding section.

* docs: Consistently update Toolbox references to MCP Toolbox for clarity.

---------

Co-authored-by: Joe Fernandez <joefernandez@users.noreply.github.com>
2026-02-10 16:42:40 -08:00

11 KiB
Raw Permalink Blame History

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

MCP Toolbox for Databases tool for ADK

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 MCP Toolbox. For more information on getting started or configuring MCP Toolbox, see the documentation.

MCP Toolbox for Databases

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

MCP 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 MCP Toolbox. Install the
package before getting started:

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

### Loading MCP Toolbox Tools

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

```python
from google.adk 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 [MCP 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 MCP 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 and additional headers. See the [MCP Toolbox ADK documentation](https://github.com/googleapis/mcp-toolbox-sdk-python/tree/main/packages/toolbox-adk) for details. For example, you can bind values to tool parameters.

!!! Note
    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
    }
)
```

=== "Typescript"

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

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

### Loading MCP Toolbox Tools

Once your MCP 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 MCP Toolbox. Install the
module before getting started:

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

### Loading MCP Toolbox Tools

Once your MCP 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 MCP 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 MCP Toolbox Tool", err)
  }

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

Advanced MCP Toolbox Features

MCP 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