MCP 协议
模型上下文协议(Model Context Protocol, MCP) 让 DB-GPT Agent 能够通过标准化接口连接外部工具与服务。
什么是 MCP?
MCP 是一个开放协议,为 AI 应用连接外部数据源和工具提供统一标准。DB-GPT 同时支持作为 客户端(消费 MCP 工具)和 服务端(将 DB-GPT 能力暴露为 MCP 工具)。
架构
在 Agent 中使用 MCP 工具
第一步:配置 MCP Server
你可以在 TOML 配置文件中配置 MCP Server,也可以在 Web UI 的 Agent 配置中完成配置。
TOML 配置示例:
[[agent.mcp_servers]]
name = "filesystem"
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/directory"]
[[agent.mcp_servers]]
name = "web-search"
command = "npx"
args = ["-y", "@modelcontextprotocol/server-brave-search"]
env = { BRAVE_API_KEY = "${env:BRAVE_API_KEY}" }