googleapis/genai-toolbox
MCP Toolbox for Databases
[!NOTE] MCP Toolbox for Databases is currently in beta, and may see breaking changes until the first stable release (v1.0).
MCP Toolbox for Databases is an open source MCP server for databases. It enables you to develop tools easier, faster, and more securely by handling the complexities such as connection pooling, authentication, and more.
This README provides a brief overview. For comprehensive details, see the full documentation.
[!NOTE] This solution was originally named “Gen AI Toolbox for Databases” as its initial development predated MCP, but was renamed to align with recently added MCP compatibility.
Table of Contents
Why Toolbox?
Toolbox helps you build Gen AI tools that let your agents access data in your database. Toolbox provides:
- Simplified development: Integrate tools to your agent in less than 10 lines of code, reuse tools between multiple agents or frameworks, and deploy new versions of tools more easily.
- Better performance: Best practices such as connection pooling, authentication, and more.
- Enhanced security: Integrated auth for more secure access to your data
- End-to-end observability: Out of the box metrics and tracing with built-in support for OpenTelemetry.
⚡ Supercharge Your Workflow with an AI Database Assistant ⚡
Stop context-switching and let your AI assistant become a true co-developer. By connecting your IDE to your databases with MCP Toolbox, you can delegate complex and time-consuming database tasks, allowing you to build faster and focus on what matters. This isn’t just about code completion; it’s about giving your AI the context it needs to handle the entire development lifecycle.
Here’s how it will save you time:
- Query in Plain English: Interact with your data using natural language right from your IDE. Ask complex questions like, “How many orders were delivered in 2024, and what items were in them?” without writing any SQL.
- Automate Database Management: Simply describe your data needs, and let the AI assistant manage your database for you. It can handle generating queries, creating tables, adding indexes, and more.
- Generate Context-Aware Code: Empower your AI assistant to generate application code and tests with a deep understanding of your real-time database schema. This accelerates the development cycle by ensuring the generated code is directly usable.
- Slash Development Overhead: Radically reduce the time spent on manual setup and boilerplate. MCP Toolbox helps streamline lengthy database configurations, repetitive code, and error-prone schema migrations.
Learn how to connect your AI tools (IDEs) to Toolbox using MCP.
General Architecture
Toolbox sits between your application’s orchestration framework and your database, providing a control plane that is used to modify, distribute, or invoke tools. It simplifies the management of your tools by providing you with a centralized location to store and update tools, allowing you to share tools between agents and applications and update those tools without necessarily redeploying your application.
Getting Started
Installing the server
For the latest version, check the releases page and use the following instructions for your OS and CPU architecture.
Binary
To install Toolbox as a binary:
|
|
Container image
You can also install Toolbox as a container:
|
|
Compile from source
To install from source, ensure you have the latest version of Go installed, and then run the following command:
|
|
Running the server
Configure a tools.yaml
to define your tools, and then
execute toolbox
to start the server:
|
|
[!NOTE] Toolbox enables dynamic reloading by default. To disable, use the
--disable-reload
flag.
You can use toolbox help
for a full list of flags! To stop the server, send a
terminate signal (ctrl+c
on most platforms).
For more detailed documentation on deploying to different environments, check out the resources in the How-to section
Integrating your application
Once your server is up and running, you can load the tools into your application. See below the list of Client SDKs for using various frameworks:
Python (Github)
Core
Install Toolbox Core SDK:
1
pip install toolbox-core
Load tools:
1 2 3 4 5 6 7
from toolbox_core import ToolboxClient # update the url to point to your server async with ToolboxClient("http://127.0.0.1:5000") as client: # these tools can be passed to your application! tools = await client.load_toolset("toolset_name")
For more detailed instructions on using the Toolbox Core SDK, see the project’s README.
LangChain / LangGraph
Install Toolbox LangChain SDK:
1
pip install toolbox-langchain
Load tools:
1 2 3 4 5 6 7
from toolbox_langchain import ToolboxClient # update the url to point to your server async with ToolboxClient("http://127.0.0.1:5000") as client: # these tools can be passed to your application! tools = client.load_toolset()
For more detailed instructions on using the Toolbox LangChain SDK, see the project’s README.
LlamaIndex
Install Toolbox Llamaindex SDK:
1
pip install toolbox-llamaindex
Load tools:
1 2 3 4 5 6 7
from toolbox_llamaindex import ToolboxClient # update the url to point to your server async with ToolboxClient("http://127.0.0.1:5000") as client: # these tools can be passed to your application! tools = client.load_toolset()
For more detailed instructions on using the Toolbox Llamaindex SDK, see the project’s README.
Javascript/Typescript (Github)
Core
Install Toolbox Core SDK:
1
npm install @toolbox-sdk/core
Load tools:
1 2 3 4 5 6 7 8
import { ToolboxClient } from '@toolbox-sdk/core'; // update the url to point to your server const URL = 'http://127.0.0.1:5000'; let client = new ToolboxClient(URL); // these tools can be passed to your application! const tools = await client.loadToolset('toolsetName');
For more detailed instructions on using the Toolbox Core SDK, see the project’s README.
LangChain / LangGraph
Install Toolbox Core SDK:
1
npm install @toolbox-sdk/core
Load tools:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
import { ToolboxClient } from '@toolbox-sdk/core'; // update the url to point to your server const URL = 'http://127.0.0.1:5000'; let client = new ToolboxClient(URL); // these tools can be passed to your application! const toolboxTools = await client.loadToolset('toolsetName'); // Define the basics of the tool: name, description, schema and core logic const getTool = (toolboxTool) => tool(currTool, { name: toolboxTool.getName(), description: toolboxTool.getDescription(), schema: toolboxTool.getParamSchema() }); // Use these tools in your Langchain/Langraph applications const tools = toolboxTools.map(getTool);
Genkit
Install Toolbox Core SDK:
1
npm install @toolbox-sdk/core
Load tools:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
import { ToolboxClient } from '@toolbox-sdk/core'; import { genkit } from 'genkit'; // Initialise genkit const ai = genkit({ plugins: [ googleAI({ apiKey: process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY }) ], model: googleAI.model('gemini-2.0-flash'), }); // update the url to point to your server const URL = 'http://127.0.0.1:5000'; let client = new ToolboxClient(URL); // these tools can be passed to your application! const toolboxTools = await client.loadToolset('toolsetName'); // Define the basics of the tool: name, description, schema and core logic const getTool = (toolboxTool) => ai.defineTool({ name: toolboxTool.getName(), description: toolboxTool.getDescription(), schema: toolboxTool.getParamSchema() }, toolboxTool) // Use these tools in your Genkit applications const tools = toolboxTools.map(getTool);
Go (Github)
Core
Install Toolbox Go SDK:
1
go get github.com/googleapis/mcp-toolbox-sdk-go
Load tools:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
package main import ( "github.com/googleapis/mcp-toolbox-sdk-go/core" "context" ) func main() { // Make sure to add the error checks // update the url to point to your server URL := "http://127.0.0.1:5000"; ctx := context.Background() client, err := core.NewToolboxClient(URL) // Framework agnostic tools tools, err := client.LoadToolset("toolsetName", ctx) }
For more detailed instructions on using the Toolbox Go SDK, see the project’s README.
LangChain Go
Install Toolbox Go SDK:
1
go get github.com/googleapis/mcp-toolbox-sdk-go
Load tools:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
package main import ( "context" "encoding/json" "github.com/googleapis/mcp-toolbox-sdk-go/core" "github.com/tmc/langchaingo/llms" ) func main() { // Make sure to add the error checks // update the url to point to your server URL := "http://127.0.0.1:5000" ctx := context.Background() client, err := core.NewToolboxClient(URL) // Framework agnostic tool tool, err := client.LoadTool("toolName", ctx) // Fetch the tool's input schema inputschema, err := tool.InputSchema() var paramsSchema map[string]any _ = json.Unmarshal(inputschema, ¶msSchema) // Use this tool with LangChainGo langChainTool := llms.Tool{ Type: "function", Function: &llms.FunctionDefinition{ Name: tool.Name(), Description: tool.Description(), Parameters: paramsSchema, }, } }
Genkit
Install Toolbox Go SDK:
1
go get github.com/googleapis/mcp-toolbox-sdk-go
Load tools:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
package main import ( "context" "encoding/json" "github.com/firebase/genkit/go/ai" "github.com/firebase/genkit/go/genkit" "github.com/googleapis/mcp-toolbox-sdk-go/core" "github.com/invopop/jsonschema" ) func main() { // Make sure to add the error checks // Update the url to point to your server URL := "http://127.0.0.1:5000" ctx := context.Background() g, err := genkit.Init(ctx) client, err := core.NewToolboxClient(URL) // Framework agnostic tool tool, err := client.LoadTool("toolName", ctx) // Fetch the tool's input schema inputschema, err := tool.InputSchema() var schema *jsonschema.Schema _ = json.Unmarshal(inputschema, &schema) executeFn := func(ctx *ai.ToolContext, input any) (string, error) { result, err := tool.Invoke(ctx, input.(map[string]any)) if err != nil { // Propagate errors from the tool invocation. return "", err } return result.(string), nil } // Use this tool with Genkit Go genkitTool := genkit.DefineToolWithInputSchema( g, tool.Name(), tool.Description(), schema, executeFn, ) }
Go GenAI
Install Toolbox Go SDK:
1
go get github.com/googleapis/mcp-toolbox-sdk-go
Load tools:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
package main import ( "context" "encoding/json" "github.com/googleapis/mcp-toolbox-sdk-go/core" "google.golang.org/genai" ) func main() { // Make sure to add the error checks // Update the url to point to your server URL := "http://127.0.0.1:5000" ctx := context.Background() client, err := core.NewToolboxClient(URL) // Framework agnostic tool tool, err := client.LoadTool("toolName", ctx) // Fetch the tool's input schema inputschema, err := tool.InputSchema() var schema *genai.Schema _ = json.Unmarshal(inputschema, &schema) funcDeclaration := &genai.FunctionDeclaration{ Name: tool.Name(), Description: tool.Description(), Parameters: schema, } // Use this tool with Go GenAI genAITool := &genai.Tool{ FunctionDeclarations: []*genai.FunctionDeclaration{funcDeclaration}, } }
OpenAI Go
Install Toolbox Go SDK:
1
go get github.com/googleapis/mcp-toolbox-sdk-go
Load tools:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
package main import ( "context" "encoding/json" "github.com/googleapis/mcp-toolbox-sdk-go/core" openai "github.com/openai/openai-go" ) func main() { // Make sure to add the error checks // Update the url to point to your server URL := "http://127.0.0.1:5000" ctx := context.Background() client, err := core.NewToolboxClient(URL) // Framework agnostic tool tool, err := client.LoadTool("toolName", ctx) // Fetch the tool's input schema inputschema, err := tool.InputSchema() var paramsSchema openai.FunctionParameters _ = json.Unmarshal(inputschema, ¶msSchema) // Use this tool with OpenAI Go openAITool := openai.ChatCompletionToolParam{ Function: openai.FunctionDefinitionParam{ Name: tool.Name(), Description: openai.String(tool.Description()), Parameters: paramsSchema, }, } }
Configuration
The primary way to configure Toolbox is through the tools.yaml
file. If you
have multiple files, you can tell toolbox which to load with the --tools-file tools.yaml
flag.
You can find more detailed reference documentation to all resource types in the Resources.
Sources
The sources
section of your tools.yaml
defines what data sources your
Toolbox should have access to. Most tools will have at least one source to
execute against.
|
|
For more details on configuring different types of sources, see the Sources.
Tools
The tools
section of a tools.yaml
define the actions an agent can take: what
kind of tool it is, which source(s) it affects, what parameters it uses, etc.
|
|
For more details on configuring different types of tools, see the Tools.
Toolsets
The toolsets
section of your tools.yaml
allows you to define groups of tools
that you want to be able to load together. This can be useful for defining
different groups based on agent or application.
|
|
You can load toolsets by name:
|
|
Versioning
This project uses semantic versioning, including a
MAJOR.MINOR.PATCH
version number that increments with:
- MAJOR version when we make incompatible API changes
- MINOR version when we add functionality in a backward compatible manner
- PATCH version when we make backward compatible bug fixes
The public API that this applies to is the CLI associated with Toolbox, the
interactions with official SDKs, and the definitions in the tools.yaml
file.
Contributing
Contributions are welcome. Please, see the CONTRIBUTING to get started.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See Contributor Code of Conduct for more information.
Community
Join our discord community to connect with our developers!