# querywise-mcp

> querywise-mcp is an open-source MCP server for databases. MCP server and CLI that lets LLMs query your SQL databases in plain language. It is available on CLI, Self-hosted and API.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, Self-hosted, API
- **Repository:** https://github.com/kosminus/querywise-mcp
- **GitHub stars:** 3
- **License:** MIT
- **Categories:** [databases](https://ai-powered.com/categories/databases)
- **Listing updated:** 2026-12-01

## About

Querywise exposes a database to an AI assistant through a business semantic layer: glossary terms, metric definitions, a data dictionary, knowledge documents and example queries, all matched against the live schema before any SQL is written. The assistant retrieves grounded context for a question, drafts a SELECT, and runs it through a read-only execution path.

The same engine also ships as a command-line tool that runs the full natural-language-to-SQL pipeline on the server side, which needs an LLM provider key or a local Ollama instance. Metadata is stored in an embedded SQLite database with sqlite-vec, so there is no separate Postgres to operate.

It suits analysts and developers who want Claude or another MCP client to answer questions against internal databases while keeping queries read-only and tied to documented business definitions.

## Features

- **Business semantic layer:** Stores glossary terms, metric definitions, value mappings and example queries that ground generated SQL in your own vocabulary.
- **Read-only SQL execution:** Combines a static blocklist of DDL, DML and admin statements with connector-level read-only enforcement.
- **Hybrid context retrieval:** Selects relevant tables and definitions using vector similarity, keyword matching and foreign-key expansion.
- **Multiple database connectors:** Connects to SQLite and PostgreSQL out of the box, with optional BigQuery and Databricks support.
- **Conversational metadata management:** Lets an MCP client add, list and delete glossary terms, metrics and knowledge entries without using the CLI.
- **Zero-infrastructure setup:** Runs from a single SQLite metadata file and works keyword-only without any embedding provider.

## Good for

- Letting Claude answer ad hoc revenue or customer questions against a company database
- Grounding an assistant's SQL in documented metric definitions and business glossary terms
- Running a quick local analysis on a SQLite file without standing up a web application
- Reviewing generated SQL before executing it with a separate read-only run step
- Seeding a banking reporting layer with the bundled IFRS 9 sample for testing

## Tools

From the tool list in its README, going by the names, 1 of 12 tools deletes data and 2 change data; 4 names don't say. From the server's own tool labels and tool names; not verified by us.

- `list_connections` (name suggests: reads): List configured database connections.
- `create_connection` (name suggests: changes): Create a database connection.
- `test_connection`: Test a database connection.
- `introspect_connection`: Introspect a connection's schema.
- `delete_connection` (name suggests: deletes): Delete a database connection.
- `list_tables` (name suggests: reads): List tables in a connection.
- `describe_table` (name suggests: reads): Describe a table's columns.
- `get_semantic_context` (name suggests: reads): Retrieve grounded semantic context for a question.
- `run_sql` (name suggests: changes): Run a read-only SQL SELECT.
- `generate_sql`: Generate SQL from a question without executing it.
- `ask`: Run the full question-to-answer pipeline.
- `query_history` (name suggests: reads): Show past queries.

## FAQ

### Can the server modify my database?

Execution is designed to be read-only: a static SQL blocklist blocks DDL, DML and admin statements, and connectors enforce read-only access where supported.

### Do I need an LLM API key to use querywise-mcp?

No. The MCP workflow lets the client model write the SQL, so the server needs no key. A provider key or Ollama is only required for embeddings and the server-side ask and generate_sql tools.

### Which databases are supported?

SQLite and PostgreSQL are included. BigQuery and Databricks are available as optional extras.

### How is querywise-mcp installed and started?

Install with pip in a virtual environment, initialise the metadata store with the init command, then run the serve command over stdio or Streamable HTTP.

### Is querywise-mcp free?

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

### What are the best alternatives to querywise-mcp?

The closest alternatives to querywise-mcp are sql-query-mcp, xiyan_mcp_server, nlqueries, mcp-server-mysql and mysql_mcp_server.

## Where this comes from

- Description: written from the project's README.

## Alternatives

- [sql-query-mcp](https://ai-powered.com/mcp/sql-query-mcp): sql-query-mcp 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.
- [nlqueries](https://ai-powered.com/mcp/nlqueries): nlqueries is an open-source MCP server for databases.
- [mcp-server-mysql](https://ai-powered.com/mcp/mcp-server-mysql): mcp-server-mysql is an open-source MCP server for databases.
- [mysql_mcp_server](https://ai-powered.com/mcp/mysql-mcp-server-4): mysql_mcp_server 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.
- [postgres_mcp](https://ai-powered.com/mcp/postgres-mcp-5): postgres_mcp is an open-source MCP server for databases.
- [legion-mcp](https://ai-powered.com/mcp/legion-mcp): legion-mcp is an open-source MCP server for databases.

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