MCP Toolbox for Databases

ทางการ

เซิร์ฟเวอร์ MCP โอเพนซอร์สที่เชี่ยวชาญด้านเครื่องมือที่ง่าย รวดเร็ว และปลอดภัยสำหรับฐานข้อมูล

คุณทำอะไรได้บ้างด้วย Toolbox For Databases MCP?

  • สำรวจสคีมาฐานข้อมูล — ขอให้ผู้ช่วย AI แสดงรายการตารางและตรวจสอบรายละเอียดสคีมาโดยใช้เครื่องมือที่สร้างไว้ล่วงหน้า เช่น list_tables
  • เรียกใช้คิวรี SQL ด้วยภาษาธรรมดา — คิวรีข้อมูลของคุณด้วยภาษาสนทนาผ่าน execute_sql โดยไม่ต้องออกจาก IDE หรือ CLI
  • เชื่อมต่อกับฐานข้อมูลได้หลากหลาย — ใช้เครื่องมือที่สร้างไว้ล่วงหน้าสำหรับ PostgreSQL, MySQL, BigQuery, Spanner, AlloyDB, Cloud SQL, MongoDB, Redis และอื่น ๆ
  • กำหนดเครื่องมือแบบกำหนดเอง — กำหนดค่าแหล่งข้อมูล เครื่องมือ ชุดเครื่องมือ และพรอมป์ต์ในไฟล์ tools.yaml เพื่อสร้างเครื่องมือฐานข้อมูลที่จำกัดสิทธิ์และพร้อมใช้งานจริง
  • โหลดเครื่องมือเข้าสู่เอเจนต์ — ผสานรวมเครื่องมือเข้ากับ ADK, LangChain, LlamaIndex หรือเอเจนต์แบบกำหนดเองผ่าน SDK สำหรับ Python, JS/TS, Go และ Java

เอกสาร

logo

MCP Toolbox for Databases

googleapis%2Fmcp-toolbox | Trendshift

License: Apache
2.0 Docs Discord Medium

Python SDK JS/TS SDK Go SDK Java SDK

MCP Toolbox for Databases เป็นเซิร์ฟเวอร์ Model Context Protocol (MCP) แบบโอเพนซอร์สที่เชื่อมต่อเอเจนต์ AI, IDE และแอปพลิเคชันของคุณเข้ากับฐานข้อมูลองค์กรโดยตรง

architecture

มี วัตถุประสงค์สองประการ:

  1. เซิร์ฟเวอร์ MCP พร้อมใช้งาน (ขณะสร้าง): เชื่อมต่อ Gemini CLI, Google Antigravity, Claude Code, Codex หรือไคลเอ็นต์ MCP อื่นๆ เข้ากับฐานข้อมูลของคุณได้ทันทีโดยใช้ เครื่องมือทั่วไปที่สร้างไว้ล่วงหน้า พูดคุยกับข้อมูล สำรวจสคีมา และสร้างโค้ดได้โดยไม่ต้องเขียนโค้ดส่วนที่ซ้ำซ้อน
  2. เฟรมเวิร์กเครื่องมือแบบกำหนดเอง (ขณะรัน): เฟรมเวิร์กที่แข็งแกร่งสำหรับสร้างเครื่องมือ AI เฉพาะทางที่ปลอดภัยสูงสำหรับเอเจนต์ใช้งานจริง กำหนดคิวรีแบบมีโครงสร้าง การค้นหาเชิงความหมาย และความสามารถ NL2SQL ได้อย่างปลอดภัยและง่ายดาย

README นี้ให้ภาพรวมโดยย่อ หากต้องการรายละเอียดครบถ้วน โปรดดูเอกสารฉบับเต็ม

[!IMPORTANT]
อัปเดตชื่อรีโพซิทอรี: รีโพซิทอรี genai-toolbox ได้เปลี่ยนชื่ออย่างเป็นทางการเป็น mcp-toolbox หากต้องการให้สภาพแวดล้อมในเครื่องของคุณใช้ชื่อใหม่ คุณสามารถอัปเดตรีโมตได้ดังนี้: git remote set-url origin https://github.com/googleapis/mcp-toolbox.git

[!NOTE] เดิมโซลูชันนี้มีชื่อว่า “Gen AI Toolbox for Databases” (github.com/googleapis/genai-toolbox) เนื่องจากเริ่มพัฒนาก่อน MCP แต่ได้เปลี่ยนชื่อเพื่อให้สอดคล้องกับความเข้ากันได้กับ MCP

สารบัญ


ทำไมต้องใช้ MCP Toolbox?

  • เข้าถึงฐานข้อมูลได้ทันที: เครื่องมือทั่วไปที่สร้างไว้ล่วงหน้าสำหรับสำรวจข้อมูลได้ทันที (เช่น list_tables, execute_sql) โดยตรงจาก IDE หรือ CLI ของคุณ
  • เฟรมเวิร์กเครื่องมือแบบกำหนดเอง: สร้างเครื่องมือพร้อมใช้งานจริงด้วยตรรกะที่กำหนดไว้ล่วงหน้าของคุณเอง พร้อมรับรองความปลอดภัยด้วยการจำกัดสิทธิ์การเข้าถึง คิวรีแบบมีโครงสร้าง และการค้นหาเชิงความหมาย
  • พัฒนาได้ง่ายขึ้น: ผสานรวมเครื่องมือเข้ากับ Agent Development Kit (ADK), LangChain, LlamaIndex หรือเอเจนต์ที่กำหนดเองได้ด้วยโค้ดไม่ถึง 10 บรรทัด
  • ประสิทธิภาพดียิ่งขึ้น: รองรับการรวมการเชื่อมต่อ การตรวจสอบสิทธิ์แบบผสานรวม (IAM) และการสังเกตการณ์แบบครบวงจร (OpenTelemetry) ได้ทันที
  • ความปลอดภัยที่ดียิ่งขึ้น: การตรวจสอบสิทธิ์แบบผสานรวมเพื่อให้เข้าถึงข้อมูลของคุณได้อย่างปลอดภัยยิ่งขึ้น
  • การสังเกตการณ์แบบครบวงจร: เมตริกและการติดตามพร้อมใช้งานทันที โดยมีการรองรับ OpenTelemetry ในตัว

เริ่มต้นอย่างรวดเร็ว: เครื่องมือที่สร้างไว้ล่วงหน้า

เลิกสลับบริบทไปมา แล้วให้ผู้ช่วย AI ของคุณเป็นผู้ร่วมพัฒนาอย่างแท้จริง เมื่อเชื่อมต่อ IDE เข้ากับฐานข้อมูลด้วย MCP Toolbox คุณจะคิวรีข้อมูลด้วยภาษาธรรมดา ทำให้การค้นหาและจัดการสคีมาเป็นแบบอัตโนมัติ และสร้างโค้ดที่เข้าใจฐานข้อมูลได้

คุณสามารถใช้ Toolbox ใน IDE หรือไคลเอ็นต์ใดก็ได้ที่รองรับ MCP (เช่น Gemini CLI, Google Antigravity, Claude Code, Codex เป็นต้น) โดยกำหนดค่าเซิร์ฟเวอร์ MCP

เครื่องมือที่สร้างไว้ล่วงหน้ายังพร้อมใช้งานอย่างสะดวกผ่าน Google Antigravity MCP Store ซึ่งติดตั้งได้ง่ายๆ เพียงคลิก

  1. เพิ่มรายการต่อไปนี้ลงในไฟล์กำหนดค่า MCP ของไคลเอ็นต์ (โดยปกติคือ mcp.json หรือ claude_desktop_config.json):

    {
      "mcpServers": {
        "toolbox-postgres": {
          "command": "npx",
          "args": [
            "-y",
            "@toolbox-sdk/server",
            "--prebuilt=postgres",
            "--stdio"
          ]
        }
      }
    }
    
  2. ตั้งค่าตัวแปรสภาพแวดล้อมที่เหมาะสมเพื่อเชื่อมต่อ โปรดดูข้อมูลอ้างอิงเครื่องมือที่สร้างไว้ล่วงหน้า

เมื่อเรียกใช้ Toolbox พร้อมแฟล็ก --prebuilt=<database> คุณจะเข้าถึงเครื่องมือมาตรฐานสำหรับโต้ตอบกับฐานข้อมูลนั้นได้ทันที นอกจากนี้ยังระบุชุดเครื่องมือเฉพาะได้โดยใช้ไวยากรณ์ --prebuilt=<database>/<toolset> (เช่น --prebuilt=postgres/data เพื่อโหลดเฉพาะเครื่องมือ SQL)

ฐานข้อมูลที่รองรับในปัจจุบัน ได้แก่:

  • Google Cloud: AlloyDB, BigQuery, Cloud SQL (PostgreSQL, MySQL, SQL Server), Spanner, Firestore, Knowledge Catalog (เดิมชื่อ Dataplex)
  • ฐานข้อมูลอื่นๆ: PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, MongoDB, Redis, Elasticsearch, CockroachDB, ClickHouse, Couchbase, Neo4j, Snowflake, Trino และอื่นๆ

ดูรายการเครื่องมือที่พร้อมใช้งานทั้งหมดและความสามารถของเครื่องมือในฐานข้อมูลที่รองรับได้ที่ข้อมูลอ้างอิงเครื่องมือที่สร้างไว้ล่วงหน้า

ดูหัวข้อติดตั้งและเรียกใช้เซิร์ฟเวอร์ Toolbox สำหรับวิธีเรียกใช้แบบต่างๆ เช่น Docker หรือไบนารี

[!TIP] สำหรับผู้ที่ต้องการโซลูชันแบบมีการจัดการ Google Cloud MCP Servers มอบประสบการณ์ MCP แบบมีการจัดการพร้อมเครื่องมือที่สร้างไว้ล่วงหน้า คุณสามารถดูข้อมูลเพิ่มเติมเกี่ยวกับความแตกต่างได้ที่นี่


เริ่มต้นอย่างรวดเร็ว: เครื่องมือแบบกำหนดเอง

นอกจากนี้ยังใช้ Toolbox เป็นเฟรมเวิร์กสำหรับเครื่องมือที่ปรับแต่งได้ วิธีหลักในการกำหนดค่า Toolbox คือใช้ไฟล์ tools.yaml หากคุณ มีหลายไฟล์ คุณสามารถระบุไฟล์ที่ต้องการโหลดให้ Toolbox ได้ด้วยแฟล็ก --config tools.yaml

ดูเอกสารอ้างอิงโดยละเอียดเพิ่มเติมเกี่ยวกับทรัพยากรแต่ละประเภทได้ที่ ทรัพยากร

แหล่งข้อมูล

ส่วน sources ใน tools.yaml ใช้กำหนดแหล่งข้อมูลที่ Toolbox เข้าถึงได้ เครื่องมือส่วนใหญ่จะมีแหล่งข้อมูลอย่างน้อยหนึ่งแหล่งสำหรับ ดำเนินการ

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

ดูรายละเอียดเพิ่มเติมเกี่ยวกับการกำหนดค่าแหล่งข้อมูลประเภทต่างๆ ได้ที่ แหล่งข้อมูล

เครื่องมือ

ส่วน tools ของ tools.yaml ใช้กำหนดการดำเนินการที่เอเจนต์ทำได้ ได้แก่ ประเภทของเครื่องมือ แหล่งข้อมูลที่เครื่องมือมีผล และพารามิเตอร์ที่ใช้ เป็นต้น

kind: tool
name: search-hotels-by-name
type: 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 ใน tools.yaml ช่วยให้คุณกำหนดกลุ่มเครื่องมือ ที่ต้องการโหลดพร้อมกันได้ ซึ่งมีประโยชน์สำหรับการกำหนดกลุ่มต่างๆ ตามเอเจนต์หรือแอปพลิเคชัน

kind: toolset
name: my_first_toolset
tools:
    - my_first_tool
    - my_second_tool
---
kind: toolset
name: my_second_toolset
tools:
    - my_second_tool
    - my_third_tool

พรอมป์ต์

ส่วน prompts ของ tools.yaml ใช้กำหนดพรอมป์ต์ที่นำไปใช้ โต้ตอบกับ LLM ได้

kind: prompt
name: code_review
description: "Asks the LLM to analyze code quality and suggest improvements."
messages:
  - content: >
         Please review the following code for quality, correctness,
         and potential improvements: \n\n{{.code}}
arguments:
  - name: "code"
    description: "The code to review"

ดูรายละเอียดเพิ่มเติมเกี่ยวกับการกำหนดค่าพรอมป์ต์ได้ที่ พรอมป์ต์

ทรัพยากร

ส่วน resources และ resourceTemplates ใน tools.yaml ใช้กำหนด เนื้อหา ไฟล์ หรือโครงสร้างไดเรกทอรีแบบกำหนดพารามิเตอร์ที่อ่านได้อย่างเดียว ซึ่งไคลเอ็นต์ MCP สามารถค้นพบและเรียกดูได้:

kind: resource
name: database_schema_ddl
type: text
description: "Core table definitions and constraints."
mimeType: text/x-sql
text: |
  CREATE TABLE customers (
    id SERIAL PRIMARY KEY,
    name VARCHAR(255) NOT NULL,
    email VARCHAR(255) UNIQUE NOT NULL
  );
---
kind: resource
name: database_schema
type: file
description: "PostgreSQL schema definition."
path: "./schema.sql"
---
kind: resourceTemplate
name: server_logs
type: file
description: "Application log files."
uriTemplate: "file:///var/log/{path}"
allowedPaths:
  - "/var/log"

ดูรายละเอียดเพิ่มเติมเกี่ยวกับการกำหนดค่าทรัพยากรและเทมเพลตทรัพยากรได้ที่ ทรัพยากร


ติดตั้งและเรียกใช้เซิร์ฟเวอร์ Toolbox

คุณสามารถเรียกใช้ Toolbox ได้โดยตรงด้วยไฟล์กำหนดค่า:

npx @toolbox-sdk/server --config tools.yaml

คำสั่งนี้จะเรียกใช้เซิร์ฟเวอร์ Toolbox เวอร์ชันล่าสุดพร้อมไฟล์กำหนดค่าของคุณ

[!NOTE] วิธีนี้เน้นความสะดวกมากกว่าประสิทธิภาพ หากต้องการการติดตั้งที่เป็นมาตรฐานและเชื่อถือได้มากขึ้น โปรดใช้ไบนารี หรืออิมเมจคอนเทนเนอร์ตามที่อธิบายไว้ในหัวข้อติดตั้งและเรียกใช้เซิร์ฟเวอร์ Toolbox

ติดตั้ง Toolbox

ตรวจสอบเวอร์ชันล่าสุดได้ที่หน้ารุ่นที่เผยแพร่ แล้วทำตาม คำแนะนำต่อไปนี้สำหรับระบบปฏิบัติการและสถาปัตยกรรม CPU ของคุณ

Binary

ติดตั้ง Toolbox เป็นไบนารี:

Linux (AMD64)

ติดตั้ง Toolbox เป็นไบนารีบน Linux (AMD64):

# see releases page for other versions
export VERSION=1.17.0
curl -L -o toolbox https://storage.googleapis.com/mcp-toolbox-for-databases/v$VERSION/linux/amd64/toolbox
chmod +x toolbox
macOS (Apple Silicon)

ติดตั้ง Toolbox เป็นไบนารีบน macOS (Apple Silicon):

# see releases page for other versions
export VERSION=1.17.0
curl -L -o toolbox https://storage.googleapis.com/mcp-toolbox-for-databases/v$VERSION/darwin/arm64/toolbox
chmod +x toolbox
macOS (Intel)

ติดตั้ง Toolbox เป็นไบนารีบน macOS (Intel):

# see releases page for other versions
export VERSION=1.17.0
curl -L -o toolbox https://storage.googleapis.com/mcp-toolbox-for-databases/v$VERSION/darwin/amd64/toolbox
chmod +x toolbox
Windows (Command Prompt)

ติดตั้ง Toolbox เป็นไบนารีบน Windows (Command Prompt):

:: see releases page for other versions
set VERSION=1.17.0
curl -o toolbox.exe "https://storage.googleapis.com/mcp-toolbox-for-databases/v%VERSION%/windows/amd64/toolbox.exe"
Windows (PowerShell)

ติดตั้ง Toolbox เป็นไบนารีบน Windows (PowerShell):

# see releases page for other versions
$VERSION = "1.17.0"
curl.exe -o toolbox.exe "https://storage.googleapis.com/mcp-toolbox-for-databases/v$VERSION/windows/amd64/toolbox.exe"
Windows ARM64 (Command Prompt)

ติดตั้ง Toolbox เป็นไบนารีบน Windows ARM64 (Command Prompt):

:: see releases page for other versions
set VERSION=1.17.0
curl -o toolbox.exe "https://storage.googleapis.com/mcp-toolbox-for-databases/v%VERSION%/windows/arm64/toolbox.exe"
Windows ARM64 (PowerShell)

ติดตั้ง Toolbox เป็นไบนารีบน Windows ARM64 (PowerShell):

# see releases page for other versions
$VERSION = "1.17.0"
curl.exe -o toolbox.exe "https://storage.googleapis.com/mcp-toolbox-for-databases/v$VERSION/windows/arm64/toolbox.exe"
Container image นอกจากนี้ คุณยังติดตั้ง Toolbox เป็นคอนเทนเนอร์ได้ด้วย:
# see releases page for other versions
export VERSION=1.17.0
docker pull us-central1-docker.pkg.dev/database-toolbox/toolbox/toolbox:$VERSION
Homebrew

ติดตั้ง Toolbox โดยใช้ Homebrew บน macOS หรือ Linux:

brew install mcp-toolbox
Compile from source

หากต้องการติดตั้งจากซอร์ส ให้ตรวจสอบว่าคุณติดตั้ง Go เวอร์ชันล่าสุด แล้ว จากนั้นเรียกใช้คำสั่งต่อไปนี้:

go install github.com/googleapis/mcp-toolbox@v1.17.0
Gemini CLI ดู[ส่วนขยาย Gemini CLI](https://geminicli.com/extensions/) เพื่อติดตั้งเครื่องมือที่สร้างไว้ล่วงหน้าสำหรับฐานข้อมูลเฉพาะ เช่น AlloyDB, BigQuery และ Cloud SQL ลงใน Gemini CLI โดยตรง
# Install Gemini CLI
npm install -g @google/gemini-cli
# Install the extension
gemini extensions install https://github.com/gemini-cli-extensions/cloud-sql-postgres
# Run Gemini CLI
gemini

โต้ตอบกับเครื่องมือแบบกำหนดเองด้วยภาษาธรรมชาติผ่าน Gemini CLI

# Install the extension
gemini extensions install https://github.com/gemini-cli-extensions/mcp-toolbox

เรียกใช้ Toolbox

กำหนดค่า tools.yaml เพื่อกำหนดเครื่องมือของคุณ จากนั้น เรียกใช้ toolbox เพื่อเริ่มเซิร์ฟเวอร์:

Binary

เรียกใช้ Toolbox จากไบนารี:

./toolbox --config "tools.yaml"

ⓘ หมายเหตุ
Toolbox เปิดใช้การโหลดซ้ำแบบไดนามิกเป็นค่าเริ่มต้น หากต้องการปิดใช้งาน ให้ใช้แฟล็ก --disable-reload

Container image

เรียกใช้เซิร์ฟเวอร์หลังจากดึง อิมเมจคอนเทนเนอร์ แล้ว:

export VERSION=0.24.0 # Use the version you pulled
docker run -p 5000:5000 \
-v $(pwd)/tools.yaml:/app/tools.yaml \
us-central1-docker.pkg.dev/database-toolbox/toolbox/toolbox:$VERSION \
--config "/app/tools.yaml"

ⓘ หมายเหตุ
แฟล็ก -v เมานต์ tools.yaml ในเครื่องของคุณเข้าไปในคอนเทนเนอร์ และ -p แมป พอร์ต 5000 ของคอนเทนเนอร์กับพอร์ต 5000 บนโฮสต์ของคุณ

Source

หากต้องการเรียกใช้เซิร์ฟเวอร์จากซอร์สโดยตรง ให้ไปยังไดเรกทอรีรากของโปรเจ็กต์ แล้วเรียกใช้:

go run .

ⓘ หมายเหตุ
คำสั่งนี้เรียกใช้โปรเจ็กต์จากซอร์ส จึงเหมาะสำหรับการพัฒนา และการทดสอบมากกว่า โดยจะ ไม่ คอมไพล์ไบนารีลงใน $GOPATH ของคุณ หากต้องการ คอมไพล์ไบนารีแทน โปรดดูเอกสารสำหรับนักพัฒนา

Homebrew

หากคุณติดตั้ง Toolbox โดยใช้ Homebrew ไฟล์ไบนารี toolbox จะพร้อมใช้งานในพาธระบบของคุณ คุณสามารถเริ่มเซิร์ฟเวอร์ด้วยคำสั่งเดิมได้ดังนี้:

toolbox --config "tools.yaml"
NPM

เรียกใช้ Toolbox ได้โดยตรงโดยไม่ต้องดาวน์โหลดไฟล์ไบนารีด้วยตนเอง (ต้องใช้ Node.js):

npx @toolbox-sdk/server --config tools.yaml
Gemini CLI หลังจากติดตั้ง [Gemini CLI extensions](https://geminicli.com/extensions/) แล้ว เครื่องมือที่สร้างไว้ล่วงหน้าจะพร้อมใช้งาน
# Run Gemini CLI
gemini

# List extensions
/extensions list
# List MCP servers
/mcp list

คุณสามารถใช้ toolbox help เพื่อดูรายการแฟล็กทั้งหมดได้! หากต้องการหยุดเซิร์ฟเวอร์ ให้ส่ง สัญญาณยุติการทำงาน (ctrl+c ในแพลตฟอร์มส่วนใหญ่)

ดูข้อมูลเพิ่มเติมเกี่ยวกับการติดตั้งใช้งานในสภาพแวดล้อมต่าง ๆ ได้จากแหล่งข้อมูลใน ส่วน Deploy Toolbox section


เชื่อมต่อกับ Toolbox

เมื่อเซิร์ฟเวอร์ Toolbox เริ่มทำงานแล้ว คุณสามารถโหลดเครื่องมือลงในไคลเอ็นต์หรือ แอปพลิเคชันที่รองรับ MCP ได้

ไคลเอ็นต์ MCP

เพิ่มการกำหนดค่าต่อไปนี้ลงในการกำหนดค่าไคลเอ็นต์ MCP ของคุณ:

{
  "mcpServers": {
    "toolbox": {
      "type": "http",
      "url": "http://127.0.0.1:5000/mcp",
    }
  }
}

หากต้องการเชื่อมต่อกับชุดเครื่องมือที่ระบุ ให้แทนที่ url ด้วย "http://127.0.0.1:5000/mcp/{toolset_name}"

Toolbox SDK: ผสานรวมกับแอปพลิเคชันของคุณ

Toolbox Client SDK มีองค์ประกอบพื้นฐานที่ใช้งานง่ายและฟีเจอร์ขั้นสูงสำหรับเชื่อมต่อแอปพลิเคชันที่คุณพัฒนาขึ้นเองกับเซิร์ฟเวอร์ MCP Toolbox ดูรายการ Client SDK สำหรับการใช้งานกับเฟรมเวิร์กต่าง ๆ ได้ด้านล่าง:

Python (Github)
Core
  1. ติดตั้ง Toolbox Core SDK:

    pip install toolbox-core
    
  2. โหลดเครื่องมือ:

    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")
    

ดูคำแนะนำโดยละเอียดเพิ่มเติมเกี่ยวกับการใช้ Toolbox Core SDK ได้ที่ README ของโปรเจ็กต์

LangChain / LangGraph
  1. ติดตั้ง Toolbox LangChain SDK:

    pip install toolbox-langchain
    
  2. โหลดเครื่องมือ:

    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()
    

    ดูคำแนะนำโดยละเอียดเพิ่มเติมเกี่ยวกับการใช้ Toolbox LangChain SDK ได้ที่ README ของโปรเจ็กต์

LlamaIndex
  1. ติดตั้ง Toolbox Llamaindex SDK:

    pip install toolbox-llamaindex
    
  2. โหลดเครื่องมือ:

    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()
    

    ดูคำแนะนำโดยละเอียดเพิ่มเติมเกี่ยวกับการใช้ Toolbox Llamaindex SDK ได้ที่ README ของโปรเจ็กต์

Javascript/Typescript (Github)
Core
  1. ติดตั้ง Toolbox Core SDK:

    npm install @toolbox-sdk/core
    
  2. โหลดเครื่องมือ:

    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');
    

    ดูคำแนะนำโดยละเอียดเพิ่มเติมเกี่ยวกับการใช้ Toolbox Core SDK ได้ที่ README ของโปรเจ็กต์

LangChain / LangGraph
  1. ติดตั้ง Toolbox Core SDK:

    npm install @toolbox-sdk/core
    
  2. โหลดเครื่องมือ:

    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
  1. ติดตั้ง Toolbox Core SDK:

    npm install @toolbox-sdk/core
    
  2. โหลดเครื่องมือ:

    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);
    
ADK
  1. ติดตั้ง Toolbox ADK SDK:

    npm install @toolbox-sdk/adk
    
  2. โหลดเครื่องมือ:

    import { ToolboxClient } from '@toolbox-sdk/adk';
    
    // 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');
    

    ดูคำแนะนำโดยละเอียดเพิ่มเติมเกี่ยวกับการใช้ Toolbox ADK SDK ได้ที่ README ของโปรเจ็กต์

Go (Github)
Core
  1. ติดตั้ง Toolbox Go SDK:

    go get github.com/googleapis/mcp-toolbox-sdk-go
    
  2. โหลดเครื่องมือ:

    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)
    }
    

    ดูคำแนะนำโดยละเอียดเพิ่มเติมเกี่ยวกับการใช้ Toolbox Go SDK ได้ที่ README ของโปรเจ็กต์

LangChain Go
  1. ติดตั้ง Toolbox Go SDK:

    go get github.com/googleapis/mcp-toolbox-sdk-go
    
  2. โหลดเครื่องมือ:

    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, &paramsSchema)
    
      // Use this tool with LangChainGo
      langChainTool := llms.Tool{
        Type: "function",
        Function: &llms.FunctionDefinition{
          Name:        tool.Name(),
          Description: tool.Description(),
          Parameters:  paramsSchema,
        },
      }
    }
    
    
Genkit
  1. ติดตั้ง Toolbox Go SDK:

    go get github.com/googleapis/mcp-toolbox-sdk-go
    
  2. โหลดเครื่องมือ:

    package main
    import (
      "context"
      "log"
    
      "github.com/firebase/genkit/go/genkit"
      "github.com/googleapis/mcp-toolbox-sdk-go/core"
      "github.com/googleapis/mcp-toolbox-sdk-go/tbgenkit"
    )
    
    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 := genkit.Init(ctx)
    
      client, err := core.NewToolboxClient(URL)
    
      // Framework agnostic tool
      tool, err := client.LoadTool("toolName", ctx)
    
      // Convert the tool using the tbgenkit package
      // Use this tool with Genkit Go
      genkitTool, err := tbgenkit.ToGenkitTool(tool, g)
      if err != nil {
        log.Fatalf("Failed to convert tool: %v\n", err)
      }
      log.Printf("Successfully converted tool: %s", genkitTool.Name())
    }
    
Go GenAI
  1. ติดตั้ง Toolbox Go SDK:

    go get github.com/googleapis/mcp-toolbox-sdk-go
    
  2. โหลดเครื่องมือ:

    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
  1. ติดตั้ง Toolbox Go SDK:

    go get github.com/googleapis/mcp-toolbox-sdk-go
    
  2. โหลดเครื่องมือ:

    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, &paramsSchema)
    
      // Use this tool with OpenAI Go
      openAITool := openai.ChatCompletionToolParam{
        Function: openai.FunctionDefinitionParam{
          Name:        tool.Name(),
          Description: openai.String(tool.Description()),
          Parameters:  paramsSchema,
        },
      }
    
    }
    
ADK Go
  1. ติดตั้ง Toolbox Go SDK:

    go get github.com/googleapis/mcp-toolbox-sdk-go
    
  2. โหลดเครื่องมือ:

    package main
    
    import (
      "github.com/googleapis/mcp-toolbox-sdk-go/tbadk"
      "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 := tbadk.NewToolboxClient(URL)
      if err != nil {
        return fmt.Sprintln("Could not start Toolbox Client", err)
      }
    
      // Use this tool with ADK Go
      tool, err := client.LoadTool("toolName", ctx)
      if err != nil {
        return fmt.Sprintln("Could not load Toolbox Tool", err)
      }
    }
    

    ดูคำแนะนำโดยละเอียดเพิ่มเติมเกี่ยวกับการใช้ Toolbox Go SDK ได้ที่ README ของโปรเจ็กต์


ฟีเจอร์เพิ่มเติม

ทดสอบเครื่องมือด้วย UI ของ Toolbox

หากต้องการเปิด UI แบบโต้ตอบของ Toolbox ให้ใช้แฟล็ก --ui ซึ่งช่วยให้คุณทดสอบ เครื่องมือและชุดเครื่องมือด้วยฟีเจอร์ต่าง ๆ เช่น พารามิเตอร์ที่ได้รับอนุญาต ดูข้อมูลเพิ่มเติมได้ที่ Toolbox UI

./toolbox --ui

Telemetry

Toolbox ส่ง traces และ metrics ผ่าน OpenTelemetry ใช้ --telemetry-otlp=<endpoint> เพื่อส่งออกไปยังแบ็กเอนด์ที่รองรับ OTLP เช่น Google Cloud Monitoring, Agnost AI หรือ บริการอื่น ๆ ดูรายละเอียดได้ที่ เอกสาร telemetry

สร้าง Agent Skills

คำสั่ง skills-generate ช่วยให้คุณแปลง ชุดเครื่องมือ เป็น Agent Skill ที่เข้ากันได้กับ ข้อกำหนด Agent Skill ซึ่งมีประโยชน์สำหรับเผยแพร่เครื่องมือในรูปแบบแพ็กเกจสกิลแบบพกพา

toolbox --config tools.yaml skills-generate \
  --name "my-skill" \
  --toolset "my_toolset" \
  --description "A skill containing multiple tools"

เมื่อสร้างแล้ว คุณสามารถติดตั้งสกิลใน Gemini CLI ได้ดังนี้:

gemini skills install ./skills/my-skill

ดูรายละเอียดเพิ่มเติมได้ที่ คู่มือการสร้าง Skills หากต้องการให้บริการสกิลที่มีอยู่แล้วผ่าน MCP โปรดดู การให้บริการ Skills ผ่าน MCP

ที่เก็บนี้ยังมี Agent Skills ที่พร้อมใช้งาน (เช่น เวิร์กโฟลว์สำหรับผู้ดูแล) ดูแค็ตตาล็อกและวิธีติดตั้งได้ที่ skills/


การกำหนดเวอร์ชัน

MCP Toolbox for Databases ใช้ Semantic Versioning

Public API ประกอบด้วย Toolbox Server (CLI, ไฟล์ manifest สำหรับการกำหนดค่า และชุดเครื่องมือที่สร้างไว้ล่วงหน้า) รวมถึง Client SDK

  • เวอร์ชันหลัก จะเพิ่มขึ้นเมื่อมีการเปลี่ยนแปลงที่ทำให้ใช้งานร่วมกันไม่ได้ เช่น การเปลี่ยนแปลง CLI หรือ manifest ที่ไม่เข้ากัน
  • เวอร์ชันรอง จะเพิ่มขึ้นเมื่อมีฟีเจอร์ใหม่ รวมถึงการปรับเปลี่ยนชุดเครื่องมือที่สร้างไว้ล่วงหน้าหรือฟีเจอร์เบต้า
  • เวอร์ชันแพตช์ จะเพิ่มขึ้นเมื่อมีการแก้ไขข้อบกพร่องที่ยังเข้ากันได้กับเวอร์ชันก่อนหน้า

ดูรายละเอียดเพิ่มเติม รวมถึง นโยบายการติดแท็ก Container ได้ที่ นโยบายการกำหนดเวอร์ชันฉบับเต็ม


การมีส่วนร่วม

ยินดีรับการมีส่วนร่วม โปรดดูคู่มือ CONTRIBUTING เพื่อเริ่มต้น

ดูรายละเอียดทางเทคนิคเกี่ยวกับการตั้งค่าสภาพแวดล้อมสำหรับพัฒนา Toolbox ได้ที่คู่มือ DEVELOPER

โปรดทราบว่าโปรเจ็กต์นี้เผยแพร่ภายใต้ Contributor Code of Conduct การเข้าร่วมโปรเจ็กต์นี้ถือว่าคุณตกลงปฏิบัติตามข้อกำหนด โปรดดูข้อมูลเพิ่มเติมที่ Contributor Code of Conduct


ชุมชน

เข้าร่วม ชุมชน Discord ของเราเพื่อพูดคุยกับนักพัฒนา!