MCP Toolbox for Databases
ทางการเซิร์ฟเวอร์ MCP โอเพนซอร์สที่เชี่ยวชาญด้านเครื่องมือที่ง่าย รวดเร็ว และปลอดภัยสำหรับฐานข้อมูล
คุณทำอะไรได้บ้างด้วย Toolbox For Databases MCP?
- สำรวจ schema และรัน SQL — ขอให้ผู้ช่วยของคุณแสดงรายการตารางหรือรันคิวรีโดยใช้เครื่องมือที่สร้างไว้ล่วงหน้า เช่น
list_tablesและexecute_sqlครอบคลุมฐานข้อมูลที่รองรับ - กำหนดเครื่องมือ SQL แบบกำหนดเอง — กำหนดค่าคิวรีแบบมีพารามิเตอร์ใน
tools.yamlเพื่อให้เอเจนต์ของคุณสามารถรันคำสั่งที่มีโครงสร้างและปลอดภัย เช่นsearch-hotels-by-name - จัดระเบียบเครื่องมือเป็น toolsets — จัดกลุ่มเครื่องมือที่เกี่ยวข้องเป็น toolsets ที่มีชื่อใน
tools.yamlและโหลดเฉพาะที่คุณต้องการต่อเอเจนต์หรือแอปพลิเคชัน - เพิ่ม prompts ที่ใช้ซ้ำได้ — กำหนด prompts ใน
tools.yaml(เช่นcode_review) เพื่อสร้างมาตรฐานการโต้ตอบกับ LLMs - ผสานรวมกับแอปของคุณผ่าน SDK — โหลดเครื่องมือเข้าสู่ LangChain, LlamaIndex หรือเอเจนต์แบบกำหนดเองโดยใช้
ToolboxClient.load_toolset()ใน Python, JS หรือ Go
เอกสาร
MCP Toolbox for Databases เป็นเซิร์ฟเวอร์ Model Context Protocol (MCP) แบบโอเพนซอร์สที่เชื่อมต่อ AI agents, IDEs และแอปพลิเคชันของคุณเข้ากับฐานข้อมูลระดับองค์กรได้โดยตรง
มันให้บริการ วัตถุประสงค์สองประการ:
- MCP Server พร้อมใช้งาน (Build-Time): เชื่อมต่อ Gemini CLI, Google Antigravity, Claude Code, Codex หรือ MCP clients อื่น ๆ เข้ากับฐานข้อมูลของคุณได้ทันทีด้วย เครื่องมือทั่วไปที่สร้างไว้ล่วงหน้า ของเรา พูดคุยกับข้อมูลของคุณ สำรวจ schema และสร้างโค้ดโดยไม่ต้องเขียน boilerplate
- Custom Tools Framework (Run-Time): เฟรมเวิร์กที่แข็งแกร่งสำหรับสร้างเครื่องมือ AI เฉพาะทางและปลอดภัยสูงสำหรับ agents ในการผลิตของคุณ กำหนด structured queries, semantic search และความสามารถ NL2SQL ได้อย่างปลอดภัยและง่ายดาย
README นี้ให้ภาพรวมโดยย่อ สำหรับรายละเอียดที่ครอบคลุม โปรดดู เอกสารฉบับเต็ม
[!IMPORTANT]
อัปเดตชื่อ Repository: Repositorygenai-toolboxได้ถูกเปลี่ยนชื่ออย่างเป็นทางการเป็นmcp-toolboxเพื่อให้สภาพแวดล้อมในเครื่องของคุณสะท้อนชื่อใหม่ คุณอาจอัปเดต remote ของคุณ: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?
- เริ่มต้นอย่างรวดเร็ว: เครื่องมือที่สร้างไว้ล่วงหน้า
- เริ่มต้นอย่างรวดเร็ว: เครื่องมือที่กำหนดเอง
- ติดตั้งและรันเซิร์ฟเวอร์ Toolbox
- เชื่อมต่อกับ Toolbox
- คุณสมบัติเพิ่มเติม
- การกำหนดเวอร์ชัน
- การมีส่วนร่วม
- ชุมชน
ทำไมต้อง MCP Toolbox?
- การเข้าถึงฐานข้อมูลพร้อมใช้งานทันที: เครื่องมือทั่วไปที่สร้างไว้ล่วงหน้าสำหรับการสำรวจข้อมูลทันที (เช่น
list_tables,execute_sql) โดยตรงจาก IDE หรือ CLI ของคุณ - Custom Tools Framework: สร้างเครื่องมือที่พร้อมสำหรับการผลิตด้วยตรรกะที่กำหนดไว้ล่วงหน้าของคุณเอง รับประกันความปลอดภัยผ่าน Restricted Access, Structured Queries และ Semantic Search
- การพัฒนาที่ง่ายขึ้น: ผสานรวมเครื่องมือเข้ากับ Agent Development Kit (ADK), LangChain, LlamaIndex หรือ agents ที่กำหนดเองได้ในโค้ดน้อยกว่า 10 บรรทัด
- ประสิทธิภาพที่ดีขึ้น: จัดการ connection pooling, integrated auth (IAM) และ end-to-end observability (OpenTelemetry) ได้ทันที
- ความปลอดภัยที่เพิ่มขึ้น: การรับรองความถูกต้องแบบผสานรวมเพื่อการเข้าถึงข้อมูลของคุณอย่างปลอดภัยยิ่งขึ้น
- การสังเกตการณ์แบบ End-to-end: metrics และ tracing พร้อมใช้งานทันทีพร้อมการสนับสนุน OpenTelemetry ในตัว
เริ่มต้นอย่างรวดเร็ว: เครื่องมือที่สร้างไว้ล่วงหน้า
หยุดการสลับบริบทและให้ผู้ช่วย AI ของคุณกลายเป็นผู้ร่วมพัฒนาที่แท้จริง ด้วยการเชื่อมต่อ IDE ของคุณกับฐานข้อมูลผ่าน MCP Toolbox คุณสามารถสอบถามข้อมูลเป็นภาษาธรรมชาติ ทำให้การค้นพบและการจัดการ schema เป็นอัตโนมัติ และสร้างโค้ดที่คำนึงถึงฐานข้อมูลได้
คุณสามารถใช้ Toolbox ใน IDE หรือ client ที่เข้ากันได้กับ MCP ใด ๆ (เช่น Gemini CLI, Google Antigravity, Claude Code, Codex ฯลฯ) โดยการกำหนดค่า MCP server
เครื่องมือที่สร้างไว้ล่วงหน้ายังพร้อมใช้งานผ่าน Google Antigravity MCP Store ด้วยประสบการณ์คลิกเพื่อติดตั้งที่ง่ายดาย
-
เพิ่มสิ่งต่อไปนี้ลงในไฟล์กำหนดค่า MCP ของ client ของคุณ (โดยปกติคือ
mcp.jsonหรือclaude_desktop_config.json):{ "mcpServers": { "toolbox-postgres": { "command": "npx", "args": [ "-y", "@toolbox-sdk/server", "--prebuilt=postgres", "--stdio" ] } } } -
ตั้งค่าตัวแปรสภาพแวดล้อมที่เหมาะสมเพื่อเชื่อมต่อ ดู Prebuilt Tools Reference
เมื่อคุณรัน 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 และอื่น ๆ
สำหรับรายการเครื่องมือทั้งหมดและความสามารถในฐานข้อมูลที่รองรับทั้งหมด โปรดดู Prebuilt Tools Reference
ดูส่วน ติดตั้งและรันเซิร์ฟเวอร์ Toolbox สำหรับวิธีการรันที่แตกต่างกัน เช่น Docker หรือ binaries
[!TIP] สำหรับผู้ใช้ที่ต้องการโซลูชันแบบจัดการ Google Cloud MCP Servers ให้ประสบการณ์ MCP แบบจัดการพร้อมเครื่องมือที่สร้างไว้ล่วงหน้า คุณสามารถ เรียนรู้เพิ่มเติมเกี่ยวกับความแตกต่างได้ที่นี่
เริ่มต้นอย่างรวดเร็ว: เครื่องมือที่กำหนดเอง
Toolbox ยังสามารถใช้เป็นเฟรมเวิร์กสำหรับเครื่องมือที่ปรับแต่งได้
วิธีหลักในการกำหนดค่า Toolbox คือผ่านไฟล์ tools.yaml หากคุณ
มีหลายไฟล์ คุณสามารถบอก Toolbox ว่าจะโหลดไฟล์ใดด้วยแฟล็ก --config tools.yaml
คุณสามารถดูเอกสารอ้างอิงโดยละเอียดเพิ่มเติมสำหรับทรัพยากรทุกประเภทได้ใน Resources
Sources
ส่วน sources ของ tools.yaml ของคุณกำหนดว่า Toolbox ของคุณ
ควรเข้าถึงแหล่งข้อมูลใด เครื่องมือส่วนใหญ่จะมีอย่างน้อยหนึ่ง source เพื่อ
ดำเนินการกับ
kind: source
name: my-pg-source
type: postgres
host: 127.0.0.1
port: 5432
database: toolbox_db
user: toolbox_user
password: my-password
สำหรับรายละเอียดเพิ่มเติมเกี่ยวกับการกำหนดค่า sources ประเภทต่าง ๆ โปรดดู Sources
Tools
ส่วน tools ของ tools.yaml กำหนดการกระทำที่ agent สามารถทำได้: ประเภท
ของเครื่องมือคืออะไร, source(s) ใดที่มันส่งผล, พารามิเตอร์ใดที่มันใช้ ฯลฯ
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 || '%';
สำหรับรายละเอียดเพิ่มเติมเกี่ยวกับการกำหนดค่า tools ประเภทต่าง ๆ โปรดดู Tools
Toolsets
ส่วน toolsets ของ tools.yaml ของคุณอนุญาตให้คุณกำหนดกลุ่มของเครื่องมือ
ที่คุณต้องการโหลดร่วมกัน สิ่งนี้มีประโยชน์สำหรับการกำหนด
กลุ่มต่าง ๆ ตาม agent หรือแอปพลิเคชัน
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
ส่วน prompts ของ tools.yaml กำหนด prompts ที่สามารถใช้สำหรับ
การโต้ตอบกับ LLMs
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"
สำหรับรายละเอียดเพิ่มเติมเกี่ยวกับการกำหนดค่า prompts โปรดดู Prompts
ติดตั้งและรันเซิร์ฟเวอร์ Toolbox
คุณสามารถรัน Toolbox ได้โดยตรงด้วย ไฟล์กำหนดค่า:
npx @toolbox-sdk/server --config tools.yaml
คำสั่งนี้รันเซิร์ฟเวอร์ Toolbox เวอร์ชันล่าสุดด้วยไฟล์กำหนดค่าของคุณ
[!NOTE] วิธีนี้ถูกปรับให้เหมาะสมเพื่อความสะดวกมากกว่าประสิทธิภาพ สำหรับการติดตั้งที่ได้มาตรฐานและเชื่อถือได้มากขึ้น โปรดใช้ binary หรือ container image ตามที่อธิบายไว้ใน ติดตั้งและรันเซิร์ฟเวอร์ Toolbox
ติดตั้ง Toolbox
สำหรับเวอร์ชันล่าสุด โปรดตรวจสอบ หน้า releases และใช้ คำแนะนำต่อไปนี้สำหรับระบบปฏิบัติการและสถาปัตยกรรม CPU ของคุณ
Binary
ในการติดตั้ง Toolbox เป็น binary:
Linux (AMD64)
ในการติดตั้ง Toolbox เป็น binary บน Linux (AMD64):
# see releases page for other versions export VERSION=1.8.0 curl -L -o toolbox https://storage.googleapis.com/mcp-toolbox-for-databases/v$VERSION/linux/amd64/toolbox chmod +x toolboxmacOS (Apple Silicon)
ในการติดตั้ง Toolbox เป็น binary บน macOS (Apple Silicon):
# see releases page for other versions export VERSION=1.8.0 curl -L -o toolbox https://storage.googleapis.com/mcp-toolbox-for-databases/v$VERSION/darwin/arm64/toolbox chmod +x toolboxmacOS (Intel)
ในการติดตั้ง Toolbox เป็น binary บน macOS (Intel):
# see releases page for other versions export VERSION=1.8.0 curl -L -o toolbox https://storage.googleapis.com/mcp-toolbox-for-databases/v$VERSION/darwin/amd64/toolbox chmod +x toolboxWindows (Command Prompt)
ในการติดตั้ง Toolbox เป็น binary บน Windows (Command Prompt):
:: see releases page for other versions set VERSION=1.8.0 curl -o toolbox.exe "https://storage.googleapis.com/mcp-toolbox-for-databases/v%VERSION%/windows/amd64/toolbox.exe"Windows (PowerShell)
ในการติดตั้ง Toolbox เป็น binary บน Windows (PowerShell):
# see releases page for other versions $VERSION = "1.8.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 เป็น binary บน Windows ARM64 (Command Prompt):
:: see releases page for other versions set VERSION=1.8.0 curl -o toolbox.exe "https://storage.googleapis.com/mcp-toolbox-for-databases/v%VERSION%/windows/arm64/toolbox.exe"Windows ARM64 (PowerShell)
ในการติดตั้ง Toolbox เป็น binary บน Windows ARM64 (PowerShell):
# see releases page for other versions $VERSION = "1.8.0" curl.exe -o toolbox.exe "https://storage.googleapis.com/mcp-toolbox-for-databases/v$VERSION/windows/arm64/toolbox.exe"
Container image
คุณยังสามารถติดตั้ง Toolbox เป็น container:# see releases page for other versions
export VERSION=1.8.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
ในการติดตั้งจาก source ตรวจสอบให้แน่ใจว่าคุณมีเวอร์ชันล่าสุดของ Go installed จากนั้นรันคำสั่งต่อไปนี้:
go install github.com/googleapis/mcp-toolbox@v1.8.0
Gemini CLI
ตรวจสอบ [Gemini CLI extensions](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 จาก binary:
./toolbox --config "tools.yaml"
ⓘ หมายเหตุ
Toolbox เปิดใช้งาน dynamic reloading โดยค่าเริ่มต้น หากต้องการปิดใช้งาน ให้ใช้ แฟล็ก--disable-reload
Container image
ในการรันเซิร์ฟเวอร์หลังจากดึง 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ในเครื่องของคุณเข้ากับ container และ-pแมป พอร์ต5000ของ container กับพอร์ต5000ของโฮสต์ของคุณ
Source
ในการรันเซิร์ฟเวอร์โดยตรงจาก source ไปยังไดเรกทอรีรากของโปรเจกต์ แล้วรัน:
go run .
ⓘ หมายเหตุ
คำสั่งนี้รันโปรเจกต์จาก source และเหมาะสำหรับการพัฒนา และการทดสอบมากกว่า มัน ไม่ คอมไพล์ binary ลงใน$GOPATHของคุณ หากคุณต้องการ คอมไพล์ binary แทน โปรดดู Developer Documentation
Homebrew
หากคุณติดตั้ง Toolbox โดยใช้ Homebrew binary toolbox
จะพร้อมใช้งานใน path ของระบบของคุณ คุณสามารถเริ่มเซิร์ฟเวอร์ด้วยคำสั่ง
เดียวกัน:
toolbox --config "tools.yaml"
NPM
เพื่อเรียกใช้ Toolbox โดยตรงโดยไม่ต้องดาวน์โหลดไบนารีด้วยตนเอง (ต้องใช้ Node.js): ```sh npx @toolbox-sdk/server --config tools.yaml ```Gemini CLI
หลังจากติดตั้ง [ส่วนขยาย Gemini CLI](https://geminicli.com/extensions/) แล้ว เครื่องมือที่สร้างไว้ล่วงหน้าจะพร้อมใช้งานระหว่างการใช้งาน# Run Gemini CLI
gemini
# List extensions
/extensions list
# List MCP servers
/mcp list
คุณสามารถใช้ toolbox help เพื่อดูรายการแฟล็กทั้งหมด! หากต้องการหยุดเซิร์ฟเวอร์ ให้ส่งสัญญาณ terminate (ctrl+c บนแพลตฟอร์มส่วนใหญ่)
สำหรับเอกสารรายละเอียดเพิ่มเติมเกี่ยวกับการปรับใช้ในสภาพแวดล้อมต่าง ๆ โปรดดูทรัพยากรใน https://mcp-toolbox.dev/documentation/deploy-to/
เชื่อมต่อกับ 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 SDKs: ผสานรวมกับแอปพลิเคชันของคุณ
Toolbox Client SDKs มอบบล็อกการสร้างที่ใช้งานง่ายและฟีเจอร์ขั้นสูงสำหรับเชื่อมต่อแอปพลิเคชันที่กำหนดเองของคุณกับเซิร์ฟเวอร์ MCP Toolbox ดูรายการ Client SDKs ด้านล่างสำหรับการใช้เฟรมเวิร์กต่าง ๆ:
Python (Github)
Core
ติดตั้ง Toolbox Core SDK:
pip install toolbox-coreโหลดเครื่องมือ:
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
ติดตั้ง Toolbox LangChain SDK:
pip install toolbox-langchainโหลดเครื่องมือ:
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
ติดตั้ง Toolbox Llamaindex SDK:
pip install toolbox-llamaindexโหลดเครื่องมือ:
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
ติดตั้ง Toolbox Core SDK:
npm install @toolbox-sdk/coreโหลดเครื่องมือ:
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
ติดตั้ง Toolbox Core SDK:
npm install @toolbox-sdk/coreโหลดเครื่องมือ:
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
ติดตั้ง Toolbox Core SDK:
npm install @toolbox-sdk/coreโหลดเครื่องมือ:
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
ติดตั้ง Toolbox ADK SDK:
npm install @toolbox-sdk/adkโหลดเครื่องมือ:
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
ติดตั้ง Toolbox Go SDK:
go get github.com/googleapis/mcp-toolbox-sdk-goโหลดเครื่องมือ:
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
ติดตั้ง Toolbox Go SDK:
go get github.com/googleapis/mcp-toolbox-sdk-goโหลดเครื่องมือ:
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
ติดตั้ง Toolbox Go SDK:
go get github.com/googleapis/mcp-toolbox-sdk-goโหลดเครื่องมือ:
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
ติดตั้ง Toolbox Go SDK:
go get github.com/googleapis/mcp-toolbox-sdk-goโหลดเครื่องมือ:
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
ติดตั้ง Toolbox Go SDK:
go get github.com/googleapis/mcp-toolbox-sdk-goโหลดเครื่องมือ:
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, }, } }ADK Go
ติดตั้ง Toolbox Go SDK:
go get github.com/googleapis/mcp-toolbox-sdk-goโหลดเครื่องมือ:
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 ของโปรเจกต์
ฟีเจอร์เพิ่มเติม
ทดสอบเครื่องมือด้วย Toolbox UI
หากต้องการเปิด UI แบบโต้ตอบของ Toolbox ให้ใช้แฟล็ก --ui ซึ่งช่วยให้คุณทดสอบเครื่องมือและชุดเครื่องมือด้วยฟีเจอร์ต่าง ๆ เช่น พารามิเตอร์ที่ได้รับอนุญาต หากต้องการเรียนรู้เพิ่มเติม โปรดไปที่ Toolbox UI
./toolbox --ui
เทเลเมทรี
Toolbox ส่ง traces และ metrics ผ่าน OpenTelemetry ใช้ --telemetry-otlp=<endpoint> เพื่อส่งออกไปยังแบ็กเอนด์ที่รองรับ OTLP เช่น Google Cloud Monitoring, Agnost AI หรืออื่น ๆ ดู เอกสารเทเลเมทรี สำหรับรายละเอียด
สร้าง Agent Skills
คำสั่ง skills-generate ช่วยให้คุณแปลง toolset เป็น 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
สำหรับรายละเอียดเพิ่มเติม โปรดดู คู่มือการสร้าง Agent Skills
พื้นที่เก็บข้อมูลยังมาพร้อมกับ Agent Skills ที่พร้อมใช้งาน (เช่น เวิร์กโฟลว์ผู้ดูแล) ดู skills/ สำหรับแคตตาล็อกและคำแนะนำการติดตั้ง
การกำหนดเวอร์ชัน
MCP Toolbox for Databases ปฏิบัติตาม Semantic Versioning
Public API ประกอบด้วย Toolbox Server (CLI, configuration manifests และชุดเครื่องมือที่สร้างไว้ล่วงหน้า) และ Client SDKs
- เวอร์ชันหลัก จะเพิ่มขึ้นสำหรับการเปลี่ยนแปลงที่ทำลายความเข้ากันได้ เช่น การเปลี่ยนแปลง CLI หรือ manifest ที่ไม่เข้ากัน
- เวอร์ชันรอง จะเพิ่มขึ้นสำหรับฟีเจอร์ใหม่ รวมถึงการปรับเปลี่ยนชุดเครื่องมือที่สร้างไว้ล่วงหน้าหรือฟีเจอร์เบต้า
- เวอร์ชันแพตช์ จะเพิ่มขึ้นสำหรับการแก้ไขข้อบกพร่องที่เข้ากันได้ย้อนหลัง
สำหรับรายละเอียดเพิ่มเติม โปรดดู นโยบายการกำหนดเวอร์ชันฉบับเต็ม
การมีส่วนร่วม
ยินดีต้อนรับการมีส่วนร่วม โปรดดูคู่มือ CONTRIBUTING เพื่อเริ่มต้น
สำหรับรายละเอียดทางเทคนิคเกี่ยวกับการตั้งค่าสภาพแวดล้อมสำหรับการพัฒนาบน Toolbox เอง โปรดดูคู่มือ DEVELOPER
โปรดทราบว่าโปรเจกต์นี้เผยแพร่พร้อมกับ Contributor Code of Conduct การเข้าร่วมในโปรเจกต์นี้ถือว่าคุณยอมรับปฏิบัติตามข้อกำหนด ดู Contributor Code of Conduct สำหรับข้อมูลเพิ่มเติม
ชุมชน
เข้าร่วม ชุมชน Discord ของเราเพื่อเชื่อมต่อกับนักพัฒนาของเรา!
