Toolbox for Databases MCP server

Provides a secure, configurable interface for executing pre-defined queries against multiple database systems including PostgreSQL, MySQL, SQL Server, Neo4j, Dgraph, and Spanner through a YAML-based configuration system.
Back to servers
Provider
Google
Release date
Apr 09, 2025
Language
Go
Stats
1.1K stars

MCP Toolbox for Databases is an open source MCP server that simplifies development of tools for database access. It handles complexities like connection pooling, authentication, and security, allowing you to integrate database tools with your AI agents more efficiently.

Getting Started

Installing the Server

Choose one of the following installation methods:

Binary Installation

# see releases page for other versions
export VERSION=0.5.0
curl -O https://storage.googleapis.com/genai-toolbox/v$VERSION/linux/amd64/toolbox
chmod +x toolbox

Container Image

# see releases page for other versions
export VERSION=0.5.0
docker pull us-central1-docker.pkg.dev/database-toolbox/toolbox/toolbox:$VERSION

Running the Server

Configure a tools.yaml file to define your tools, then start the server:

./toolbox --tools-file "tools.yaml"

Use toolbox help to see all available options. To stop the server, press ctrl+c.

Integrating Your Application

Once your server is running, you can connect to it using one of the client SDKs:

Core SDK

  1. Install the SDK:

    pip install toolbox-core
    
  2. Load your tools:

    from toolbox_core import ToolboxClient
    
    # update the url to point to your server
    client = ToolboxClient("http://127.0.0.1:5000")
    
    # these tools can be passed to your application!
    tools = await client.load_toolset("toolset_name")
    

LangChain / LangGraph

  1. Install the SDK:

    pip install toolbox-langchain
    
  2. Load your tools:

    from toolbox_langchain import ToolboxClient
    
    # update the url to point to your server
    client = ToolboxClient("http://127.0.0.1:5000")
    
    # these tools can be passed to your application!
    tools = client.load_toolset()
    

LlamaIndex

  1. Install the SDK:

    pip install toolbox-llamaindex
    
  2. Load your tools:

    from toolbox_llamaindex import ToolboxClient
    
    # update the url to point to your server
    client = ToolboxClient("http://127.0.0.1:5000")
    
    # these tools can be passed to your application!
    tools = client.load_toolset()
    

Configuration

The primary configuration method is through the tools.yaml file, which you can specify with the --tools-file tools.yaml flag.

Sources

Define your data sources in the sources section:

sources:
  my-pg-source:
    kind: postgres
    host: 127.0.0.1
    port: 5432
    database: toolbox_db
    user: toolbox_user
    password: my-password

Tools

Define the actions your agent can take in the tools section:

tools:
  search-hotels-by-name:
    kind: postgres-sql
    source: my-pg-source
    description: Search for hotels based on name.
    parameters:
      - name: name
        type: string
        description: The name of the hotel.
    statement: SELECT * FROM hotels WHERE name ILIKE '%' || $1 || '%';

Toolsets

Group tools together for easier loading with the toolsets section:

toolsets:
    my_first_toolset:
        - my_first_tool
        - my_second_tool
    my_second_toolset:
        - my_second_tool
        - my_third_tool

You can then load specific toolsets in your application:

# This will load all tools
all_tools = client.load_toolset()

# This will only load the tools listed in 'my_second_toolset'
my_second_toolset = client.load_toolset("my_second_toolset")

For comprehensive documentation, visit the full documentation site.

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later