Integrations
Handles API key authentication securely via environment variables for connecting to the BlazeSQL service.
Provides integration with BlazeSQL Natural Language Query API, allowing users to query databases using natural language requests and receive SQL queries and formatted results.
Used to implement the MCP server that connects to BlazeSQL's API, enabling natural language database querying capabilities.
BlazeSQL MCP 服务器
该项目实现了一个模型上下文协议 (MCP) 服务器,作为 BlazeSQL 自然语言查询 API 的代理。它允许兼容 MCP 的客户端(例如 Cursor、附带工具的 Claude 3、MCP Inspector 等)使用自然语言与 BlazeSQL 进行交互。
特征
- 将 BlazeSQL 自然语言查询 API 作为名为
blazesql_query
的 MCP 工具公开。 - 通过环境变量安全地处理 API 密钥认证。
- 使用标准 MCP stdio 传输与客户端通信。
工作流程图
这张图展示了客户端使用blazesql_query
工具时的交互顺序:
先决条件
- Node.js (推荐 LTS 版本)
- 纱线(经典或浆果)
- 具有 API 密钥的 BlazeSQL 帐户(API 需要 Team Advanced 订阅)。
- 您的 BlazeSQL 帐户中至少配置了一个数据库连接。
- BlazeSQL 自然语言查询 API 文档: https://help.blazesql.com/en/article/natural-language-query-api-1fgx4au/
设置
- 克隆存储库:Copy
- 安装依赖项:Copy
- 配置环境变量:
- 复制示例环境文件:Copy
- 编辑
.env
文件:将CopyYOUR_BLAZESQL_API_KEY_HERE
替换为从 BlazeSQL 帐户设置中获取的实际 API 密钥。
- 复制示例环境文件:
运行服务器
- **构建服务器:**将 TypeScript 代码编译为 JavaScript:Copy
- **运行服务器:**执行编译后的代码:服务器将启动并将消息记录到Copy
stderr
(您可能会看到“API 密钥已成功加载……”等信息)。现在,服务器正在通过标准输入/输出 (stdio) 监听 MCP 客户端连接。
连接 MCP 客户端
该服务器使用stdio传输机制。
使用 MCP 检查器(推荐用于测试)
- 确保服务器尚未单独运行。
- 运行检查器,告诉它启动你的服务器:Copy
- Inspector UI 将启动并自动连接到您的服务器。
- 导航到“工具”选项卡以与
blazesql_query
工具进行交互。
使用集成客户端(Cursor、Claude 3 等)
- 在终端中启动服务器:Copy
- **配置客户端:**在您的 MCP 客户端设置中,您需要添加自定义服务器配置。
- **传输:**选择
stdio
。 - 命令:指定用于运行服务器的具体命令。您需要提供 node 的绝对路径以及
build/index.js
文件的绝对路径。- 示例(macOS/Linux - 根据需要调整路径):
/usr/local/bin/node /Users/your_username/path/to/blaze-sql-mcp-server/build/index.js
- 您可以使用终端中的
which node
找到节点的路径。 - 您可以在项目目录中使用
pwd
找到项目的路径。
- 示例(macOS/Linux - 根据需要调整路径):
- 保存配置。
- **传输:**选择
- 客户端现在应该能够连接到您本地运行的服务器并列出/使用其工具。
使用blazesql_query
工具
一旦连接,客户端就可以调用blazesql_query
工具。
- 工具名称:
blazesql_query
- 参数:
db_id
(字符串,必需):BlazeSQL 帐户中目标数据库连接的 ID。您可以在 BlazeSQL Web 应用程序管理数据库连接时找到此 ID。natural_language_request
(字符串,必需):您想要执行的查询,用简单的英语编写(例如,“显示用户总数”)。
- 示例调用(使用
mcp test
语法进行说明):Copy - **输出:**如果成功,该工具将返回:
- 包含来自 BlazeSQL 代理的自然语言响应的
text
块。 - 包含由 BlazeSQL 生成和执行的 SQL 查询的
code
块(语言sql
)。 - 包含查询实际数据的
json
块。如果查询失败,则返回 MCP 错误消息。
- 包含来自 BlazeSQL 代理的自然语言响应的
You must be authenticated.
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Tools
模型上下文协议服务器使 AI 客户端能够与 BlazeSQL 的自然语言查询 API 进行交互,从而允许对 SQL 数据库进行自然语言查询。
Related MCP Servers
- -securityAlicense-qualityA Model Context Protocol server enabling AI agents to access and manipulate ServiceNow data through natural language interactions, allowing users to search for records, update them, and manage scripts.Last updated -9PythonMIT License
XiYan MCP Serverofficial
-securityAlicense-qualityA Model Context Protocol server that enables natural language queries to MySQL databases, powered by XiYanSQL text-to-SQL technology.Last updated -94PythonApache 2.0- -securityAlicense-qualityA Model Context Protocol server that enables AI agents to query Erick Wendel's talks, blog posts, and videos across different platforms using natural language.Last updated -55TypeScriptMIT License
- -securityFlicense-qualityA Model Context Protocol server that enables AI models to interact with MySQL databases through natural language, supporting SQL queries, table creation, and schema exploration.Last updated -1Python