• RSS

    Natural Language Queries With Hydrolix

    Learn about using model context protocol and the Hydrolix MCP Server for writing natural language queries.

    Alok Aggarwal

    Published:

    May 20, 2025

    5 minute read
    ,
    Text overlay reads "Natural language queries with MCP"

Natural language queries are becoming increasingly popular, and platforms ranging from Snowflake to Splunk now have AI capabilities that allow users to write queries without needing a deep understanding of SQL and other query languages. By allowing greater access and a lower barrier to entry, natural language queries can help democratize data, making it available for more use cases.

Here at Hydrolix, we’re using model context protocol (MCP) to develop natural language capabilities for querying Hydrolix clusters. Model context protocol is an open protocol initially developed at Anthropic that allows AI applications to integrate with data sources and tools in a standardized way.

Recently, Hydrolix released the Hydrolix MCP server. Before talking about that offering, let’s first go over some of the basics of model context protocol.

What is Model Context Protocol (MCP)?

Model context protocol is a universal protocol that allows AI applications to connect with a wide range of data sources. Large language models (LLMs) need context in order to provide useful information. Model context protocol allows LLMs to obtain that context using an open protocol. With MCP, you no longer need custom integrations for each source, which makes it much easier to develop AI tools and build out ecosystems for AI tools.

MCP servers are lightweight programs that provide a set of tools to interact with an external system. An external system can be a data source, API gateway, or other system. These systems may have their own APIs, so the MCP server acts as a bridge between the API and the client. The client no longer needs to know about the backend API. Instead, the MCP server acts as an abstraction layer on top of the API. This is the most important property of model context protocol: it frees up the AI application/client from needing to know anything about the external system it is connecting to.

Model Context Protocol Key Concepts

There are four main concepts relevant to a model context protocol server.

  • Resources represent data that a server can expose to a client. Examples include database records or file contents. Resources are a core primitive of the protocol.
  • Prompts are reusable templates and workflows that clients can send to the AI model. Servers can suggest shortcut names (typically slash-commands) for these longer template/workflow prompts which clients can make available to users. 
  • Tools represent a set of functions that the client can invoke to execute actions on a server. Servers implement the tools depending on the actions that they want to allow. While users choose which resources are sent to the AI model, the AI model chooses which tools to use to answer a user’s prompt, with clients acting as an intermediary. 
  • Sampling is a feature to allow servers to request completions through the client. Few clients implement it today, but as MCP matures, sampling will enable more complex agent-like behaviors.

Using the Hydrolix MCP Server

The Hydrolix MCP Server is an open source project. Before walking through how it works, let’s take a look at how it’s configured.

Diagram shows MCP client on left communicating through MCP protocol with Hydrolix MCP server, which in turns communicates with the Hydrolix cluster.

An engineer can use a tool like Claude desktop or an IDE like VSCode and Cursor that has a built-in MCP client. The AI application can then be configured with one or more MCP servers that provide context. MCP servers can be local to the host where the AI application is running or they can be remote. As of this writing, local MCP servers are the most common.

In order to try the Hydrolix MCP Server, we configure a supported AI application such as an AI-enabled IDE with this configuration snippet.

Add the mcp-hydrolix block to the mcpServers block:

{
  "mcpServers": {
    "mcp-hydrolix": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "mcp-hydrolix",
        "--python",
        "3.13",
        "mcp-hydrolix"
      ],
      "env": {
        "HYDROLIX_HOST": "<hydrolix-host>",
        "HYDROLIX_USER": "<hydrolix-user>",
        "HYDROLIX_PASSWORD": "<hydrolix-password>"
      }
    }
  }
}

This stanza installs the MCP server along with all the dependencies using the uv python package manager. Once that is installed, you can start querying Hydrolix with AI.

Since the Cursor IDE has a built-in MCP client and it can also talk to an LLM, you can configure it with the MCP server pointed at a Hydrolix cluster. The example Cursor chat shows how you can ask a simple question like: “What is the total number of rows in the hydro logs table from yesterday?”

Querying the Hydrolix MCP server in Cursor. User enters prompt on total number of rows in natural language and gets an answer in natural language.

As part of reasoning its way to an answer, Cursor first enumerates all the tools furnished by the configured MCP server(s). The Hydrolix MCP server provides three tools: list_databases, list_tables, and run_select_query.

list_databases is generally the first tool that Cursor invokes, unless the user prompt is explicit about the existence of the database. It is a simple tool that runs SHOW DATABASES. list_tables lists the tables in the database and also retrieves the table schema with DESCRIBE TABLE and SHOW CREATE TABLE.

run_select_query allows for client queries to be run against Hydrolix. This tool includes a description that provides the AI model with guidance on how to create queries. For example, it provides context on the primary key being the timestamp and advice on constructing the queries such as using a LIMIT clause or a filter based on the primary key. See the full description in the Hydrolix repo.

The tool descriptions are sent as context to the user’s prompt. The LLM responds with a request to use the tool as part of its reasoning. We see that it starts out with calling list_databases. The following dropdown shows the input parameters as well as the response.

Screenshot shows MCP parameters

Since the user question was about hydro logs, it finds the hydro database as a potential candidate.

The next step in the LLM’s reasoning is to verify that the logs table exists within the hydro database. It uses the list_tables tool for this.

List table checks the "hydro" database and gets a result that shows the table metadata.

With hydro.logs verified as a valid table, the final reasoning step is to craft a SQL query for the question, “what is the total number of rows in the hydro logs table from yesterday?”


Query parameters now show a query that has the total count of hydro.logs.

Here’s the SQL query:

SELECT count(*) as total_rows 
FROM hydro.logs 
WHERE timestamp >= toStartOfDay(now() - INTERVAL 1 DAY) 
AND timestamp < toStartOfDay(now())

The MCP server executes the query with the run_select_query tool and the LLM converts the result into text. It’s a fairly simple workflow from start to finish. Prior to every tool execution, the user is asked explicitly for permission.

Based on how the user question is phrased, the LLM can reason through to an answer more quickly. For example, let’s say that the previous prompt is changed to: “what is the total number of rows in the hydro logs table from yesterday? Assume that the hydro logs table exists.” The LLM will then arrive at the answer much faster by using only run_select_query.

The server can also generate other types of simple queries like this one.

Query returns average rows per minute during a 1-hour timeframe.

The query generates the following SQL:

WITH toDateTime(toStartOfDay(now() - INTERVAL 1 DAY) + INTERVAL 17 HOUR) AS start_hour,toDateTime(toStartOfDay(now() - INTERVAL 1 DAY) + INTERVAL 18 HOUR) AS end_hour
SELECT count(*) / 60 AS avg_rows_per_minute
FROM   hydro.logs
WHERE  timestamp >= start_hour
AND    timestamp < end_hour

The query works, though it could use tuning to make it more performant. Try it out for yourself. We’re excited to hear feedback!

Next Steps

Interested in trying out Hydrolix? Contact us about a managed trial or demo.

Share This Post…

Intelligence Report

Download the AI Bot Readiness Report for Enterprises

View all FAQs

Ready to start?