BlazeSQL MCP Server
Servidor MCP BlazeSQL
Este proyecto implementa un servidor de Protocolo de Contexto de Modelo (MCP) mediante @modelcontextprotocol/sdk que actúa como proxy para la API de Consultas en Lenguaje Natural de BlazeSQL. Permite que los clientes compatibles con MCP (como Cursor, Claude 3 con uso de herramientas, el Inspector de MCP, etc.) interactúen con BlazeSQL mediante lenguaje natural.
Características
Construido utilizando la clase auxiliar
McpServermoderna del SDK de MCP.Expone la API de consulta de lenguaje natural BlazeSQL como una herramienta MCP llamada
blazesql_query.Utiliza
zodpara una validación robusta de los parámetros de entrada de la herramienta.Maneja la autenticación de clave API de forma segura a través de variables de entorno.
Se comunica con los clientes utilizando el transporte stdio MCP estándar.
Related MCP server: MySQL MCP Server
Diagrama de flujo de trabajo
Este diagrama muestra la secuencia de interacciones cuando un cliente usa la herramienta blazesql_query (Nota: la lógica del servidor interno ahora usa McpServer , lo que simplifica el registro de la herramienta en comparación con los controladores de bajo nivel que se muestran en el diagrama):
sequenceDiagram
participant Client as MCP Client (e.g., Cursor)
participant Server as BlazeSQL MCP Server (index.ts)
participant Env as Environment (.env)
participant BlazeAPI as BlazeSQL API
Client->>Server: ListTools Request (via stdio)
Server-->>Client: ListTools Response (tools: [blazesql_query]) (via stdio)
Client->>Server: CallTool Request (blazesql_query, db_id, nl_request) (via stdio)
Server->>Env: Read BLAZE_API_KEY
Env-->>Server: BLAZE_API_KEY
Server->>BlazeAPI: POST /natural_language_query_api (apiKey, db_id, nl_request)
BlazeAPI->>BlazeAPI: Process Query (NL->SQL, Execute)
BlazeAPI-->>Server: HTTPS Response (JSON: agent_response, query, data_result OR error)
Server->>Server: Format Response (Agent response, SQL, and data into single text block)
Server-->>Client: CallTool Response (content: [{type: text, text: formattedMarkdown}]) (via stdio)
Prerrequisitos
Node.js (versión LTS recomendada)
Hilo (clásico o baya)
Una cuenta BlazeSQL con una clave API (se requiere suscripción a Team Advanced para la API).
Al menos una conexión de base de datos configurada en su cuenta BlazeSQL.
Documentación de la API de consulta en lenguaje natural de BlazeSQL: https://help.blazesql.com/en/article/natural-language-query-api-1fgx4au/
Configuración
Clonar el repositorio:
git clone <repository-url> cd blaze-sql-mcp-serverDependencias de instalación:
yarn installEsto instalará todas las dependencias necesarias, incluidas
@modelcontextprotocol/sdk,dotenvyzod.Configurar variables de entorno:
Copie el archivo de entorno de ejemplo:
cp .env.sample .envEdite el archivo
.env:# .env BLAZE_API_KEY=YOUR_BLAZESQL_API_KEY_HEREReemplace
YOUR_BLAZESQL_API_KEY_HEREcon su clave API real obtenida de la configuración de su cuenta BlazeSQL.
Ejecución del servidor
Construir el servidor: compilar el código TypeScript en JavaScript:
yarn buildEjecutar el servidor: Ejecute el código compilado:
node build/index.jsEl servidor se iniciará y registrará los mensajes en
stderr(podría ver "Clave API cargada correctamente...", etc.). Ahora está a la espera de una conexión de cliente MCP mediante la entrada/salida estándar (stdio).
Conexión de un cliente MCP
Este servidor utiliza el mecanismo de transporte stdio .
Uso del inspector MCP (recomendado para pruebas)
Asegúrese de que el servidor no esté ejecutándose por separado.
Ejecute el Inspector y dígale que inicie su servidor:
npx @modelcontextprotocol/inspector node build/index.jsSe iniciará la interfaz de usuario del Inspector y se conectará automáticamente a su servidor.
Vaya a la pestaña "Herramientas" para interactuar con la herramienta
blazesql_query.
Uso de clientes integrados (Cursor, Claude 3, etc.)
Inicie el servidor en una terminal:
node build/index.jsConfigurar el cliente: en la configuración de su cliente MCP, debe agregar una configuración de servidor personalizada.
Transporte: Seleccionar
stdio.Comando: Especifique el comando exacto para ejecutar el servidor. Debe proporcionar la ruta absoluta al nodo y la ruta absoluta al archivo
build/index.js.Ejemplo (macOS/Linux - ajuste las rutas según sea necesario):
/usr/local/bin/node /Users/your_username/path/to/blaze-sql-mcp-server/build/index.jsPuedes encontrar la ruta al nodo usando
which nodeen tu terminal.Puede encontrar la ruta al proyecto usando
pwddentro del directorio del proyecto.
Guardar la configuración.
El cliente ahora debería poder conectarse a su servidor local y enumerar/utilizar sus herramientas.
Uso de la herramienta blazesql_query
Una vez conectado, el cliente puede llamar a la herramienta blazesql_query .
Nombre de la herramienta:
blazesql_queryArgumentos:
db_id(cadena, obligatoria): El ID de la conexión a la base de datos de destino en su cuenta de BlazeSQL. Puede encontrar este ID en la aplicación web de BlazeSQL al administrar sus conexiones a la base de datos.natural_language_request(string, required): La consulta que desea ejecutar, escrita en inglés simple (p. ej., "muéstrame el número total de usuarios"). (La entrada se valida conzod).
Ejemplo de llamada (utilizando la sintaxis
mcp testpara ilustración):call-tool blazesql_query --db_id "db_your_actual_db_id" --natural_language_request "What were the total sales last month?"Salida: si tiene éxito, la herramienta devuelve un solo bloque de contenido
textque contiene:La respuesta en lenguaje natural del agente BlazeSQL.
La consulta SQL generada dentro de una valla de código Markdown (
sql ...).Los datos resultan formateados como JSON dentro de un límite de código Markdown (
json ...).
Ejemplo de estructura dentro del bloque
text:**Agent Response:** The total sales last month were $12345.67. **Generated SQL:** ```sql SELECT sum(sales_amount) FROM sales WHERE sale_date >= date('now', '-1 month');Resultado de los datos (JSON):
[ { "sum(sales_amount)": 12345.67 } ]If unsuccessful, it returns a `text` content block containing the error message from the BlazeSQL API and marks the response as an error (`isError: true`).
Available Tools
1 toolblazesql_queryB
Executes a natural language query against a specified BlazeSQL database.
| Name | Required | Description | Default |
|---|---|---|---|
| db_id | Yes | The ID of the BlazeSQL database connection to query. | |
| natural_language_request | Yes | The query expressed in natural language (e.g., 'show me total users per city'). |
Output Schema
| Name | Required | Description |
|---|---|---|
| query | Yes | The SQL query generated and executed by BlazeSQL. |
| data_result | Yes | The structured data returned by the query, as a map of column names to value arrays. |
| agent_response | Yes | Natural language explanation of the results from BlazeSQL. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool executes queries but doesn't describe traits like error handling, performance implications, authentication needs, or rate limits. For a query execution tool with zero annotation coverage, this is a significant gap in transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and appropriately sized, making it easy to understand quickly. Every part of the sentence contributes to clarifying the tool's function.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool has an output schema (which handles return values), 100% schema coverage, and no annotations, the description is minimally complete. It covers the basic purpose but lacks behavioral context and usage guidelines. For a query tool with no annotations, it should do more to compensate, but the output schema mitigates some gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 100%, so the schema already documents both parameters (db_id and natural_language_request) with clear descriptions. The description adds no additional meaning beyond what the schema provides, such as examples or constraints. Baseline 3 is appropriate when the schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with a specific verb ('executes') and resource ('natural language query against a specified BlazeSQL database'). It distinguishes what it does (execute natural language queries) from potential alternatives (like SQL queries), though without sibling tools, differentiation isn't needed. However, it could be more specific about the type of queries or results.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives, prerequisites, or exclusions. It mentions the tool's function but lacks context on appropriate scenarios, such as when natural language queries are supported or if there are limitations. With no sibling tools, this gap is less critical but still present.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
v1.0.0- First observed
blazesql_query
TDQS
Scored across 1 tool
With only one tool, there is no possibility of ambiguity or overlap between tools. The single tool has a clearly defined purpose that cannot be confused with any other tool in the set.
A single tool inherently has perfect naming consistency as there are no other tools to compare it against. The tool name follows a clear verb_noun pattern (blazesql_query) which would be consistent if more tools existed.
A single tool is generally too few for a database query server, as it lacks basic operations like listing databases, describing schemas, or managing connections. This minimal set limits functionality and forces all interactions through one interface.
The tool surface is severely incomplete for a SQL database server. While the query tool covers execution, there are obvious gaps such as no tools for schema exploration, database listing, transaction management, or data manipulation beyond queries, which will cause agent failures in many workflows.
Maintenance
Related MCP Connectors
A Model Context Protocol server for Wix AI tools
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
The Mercado Pago MCP Server implements the Model Context Protocol to provide AI agents and LLMs with access to Mercado Pago's APIs and tools within compatible development environments. It acts as an intermediary that translates Mercado Pago resources into executable functions (tools) that AI applications can invoke to perform actions and automate flows. The server simplifies integration, enables using documentation to implement or improve code, and optimizes operations through natural language interactions without manual implementations.
Related MCP Servers
FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables Large Language Models to access and interact with database connections, including viewing schemas and performing CRUD operations on connected databases.-- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables AI models to interact with MySQL databases through natural language, supporting SQL queries, table creation, and schema exploration.3-
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables LLMs like Claude to interact with SQLite and SQL Server databases, allowing for schema inspection and SQL query execution.693 npm386MIT
- AlicenseNot gradedqualityDmaintenanceA server that implements the Model Context Protocol, providing a standardized way to connect AI models to different data sources and tools.7 npm11MIT