# nlqueries

> nlqueries is an open-source MCP server for databases. Self-hosted natural language to SQL with schema validation and an MCP server. It is available on API, CLI, Self-hosted and Web.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** API, CLI, Self-hosted, Web
- **Website:** https://nlqueries.com
- **Repository:** https://github.com/nlqueries/nlqueries
- **GitHub stars:** 5
- **Categories:** [databases](https://ai-powered.com/categories/databases)
- **Listing updated:** 2026-12-01

## About

Ask a database a question in plain English and get back SQL that has been checked against the live schema before anything runs. Queries are parsed and verified column by column, and you can preview the generated statement without touching the database, or execute it read-only with a timeout.

The knowledge base is a YAML file built from your schema and past query history, so it picks up the joins and naming your team actually uses. It can also ingest PDFs, Word and Excel files, Notion and Confluence, and answer questions that combine those documents with database results, with citations.

It runs as a CLI, a Python library, or an MCP server that Claude Desktop, Cursor and other MCP clients can call as a tool. It suits data teams and developers who want to keep their database and LLM setup on their own infrastructure.

## Features

- **Schema-checked SQL generation:** Generated statements are parsed and checked against the live schema before they execute.
- **Preview without execution:** The ask command produces and validates SQL without touching the database, while query runs it.
- **Learning knowledge base:** A YAML file built from schema, relationships and query history that can be edited by hand.
- **Document and database answers:** Combines PDF, Word, Excel, Notion and Confluence content with database results in one answer.
- **MCP server:** Exposes query and schema lookup as tools for MCP-compatible AI assistants.
- **Semantic answer cache:** Replays stored answers for questions with very similar meaning, re-running the stored SQL for current rows.

## Good for

- Letting analysts query a Postgres or Snowflake warehouse in plain English without writing SQL
- Asking an AI assistant in Cursor or Claude Desktop questions about company data
- Answering questions that need both database figures and policy or report documents
- Reviewing generated SQL before deciding whether to run it against production

## FAQ

### Which databases are supported?

Dedicated connectors cover PostgreSQL, MySQL, Snowflake, BigQuery, Amazon Redshift, SQL Server and Azure SQL, DuckDB and SQLite. A generic SQLAlchemy connector works with other databases reachable by connection URL.

### Can nlqueries be used with Claude Desktop or Cursor?

Yes. Running the MCP server lets any Model Context Protocol client send questions and receive validated SQL results as tool calls. Network transports support OIDC authentication.

### Does nlqueries send my data to an LLM?

The question and a relevant slice of the knowledge base are sent to the LLM you configure, including schema, column descriptions and a few sample values. Columns marked as personal data are excluded. Result rows can be turned off with an environment variable.

### What does the license allow?

The core is under the Business Source License 1.1, which permits production and self-hosted use but not offering it to third parties as a hosted or managed service. It converts to Apache 2.0 no later than June 4, 2030.

### Is nlqueries free?

Yes. nlqueries is open source, so you can use and self-host it for free.

### What are the best alternatives to nlqueries?

The closest alternatives to nlqueries are PlainQuery | MCP DB Agent, text2sql, xiyan_mcp_server, mnemiq and pgmcp.

## Where this comes from

- Description: written from the project's README and the project's website.

## Alternatives

- [PlainQuery | MCP DB Agent](https://ai-powered.com/mcp/plainquery-mcp-db-agent): PlainQuery | MCP DB Agent is a freemium MCP server for databases.
- [text2sql](https://ai-powered.com/mcp/text2sql-2): text2sql is an open-source MCP server for databases.
- [xiyan_mcp_server](https://ai-powered.com/mcp/xiyan-mcp-server): xiyan_mcp_server is an open-source MCP server for databases.
- [mnemiq](https://ai-powered.com/mcp/mnemiq): mnemiq is an open-source MCP server for databases.
- [pgmcp](https://ai-powered.com/mcp/pgmcp-2): pgmcp is an open-source MCP server for databases.
- [querywise-mcp](https://ai-powered.com/mcp/querywise-mcp): querywise-mcp is an open-source MCP server for databases.
- [mcp-alchemy](https://ai-powered.com/mcp/mcp-alchemy): mcp-alchemy is an open-source MCP server for databases.
- [anyquery](https://ai-powered.com/mcp/anyquery): anyquery is an open-source MCP server for databases.

---
Source: https://ai-powered.com/mcp/nlqueries
