# kosminus/querywise-mcp [Health: Active]

**Category:** 🗄️ Databases  
**Repository:** https://github.com/kosminus/querywise-mcp  
**GitHub Stars:** 3  
**Views:** 6  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/kosminus-querywise-mcp

## Description
Query SQL databases (SQLite, PostgreSQL, BigQuery, Databricks) in natural language through a business semantic layer — glossary, metrics, and a data dictionary grounded against your real schema.

## Claude Desktop Quick Installation
No generated config for this server: it installs through its own setup steps.

The project's own setup steps (from https://github.com/kosminus/querywise-mcp), copied verbatim. Follow them in order; they are not an mcpServers config.

1. Install:

```sh
python3 -m venv .venv && source .venv/bin/activate
```

2. Install:

```sh
pip install -e .                 # core (SQLite store, sqlite-vec, Postgres + SQLite targets)
```

3. Install:

```sh
pip install -e ".[bigquery,databricks]"   # + extra target connectors
```

4. Configure:

```sh
querywise init                                   # create ~/.querywise/querywise.db
```

5. Configure:

```sh
querywise connections add shop \
    --connector-type sqlite -c /path/to/app.db   # introspects + embeds
```

6. Start the server:

```sh
querywise serve            # stdio (for Claude Desktop / Claude Code / Cursor)
```

## Documentation

## What kosminus/querywise-mcp does

The kosminus/querywise-mcp MCP server gives an MCP client a structured way to query supported SQL databases using business terminology rather than schema details alone. It connects to SQLite, PostgreSQL, BigQuery, and Databricks, then uses the target schema together with maintained semantic metadata to assemble relevant context for a question.

The metadata layer can contain glossary definitions, metric formulas, dictionary value mappings, example queries, and knowledge excerpts. These records can be added, reviewed, and removed through MCP management tools. A bundled sample command can also populate an IFRS 9 banking example.

## How it works

The recommended MCP workflow separates grounding, SQL generation, and execution. First call `get_semantic_context` with a connection and question. The client model then writes a read-only `SELECT`, which can be sent to `run_sql`. This path does not require a server-side LLM key.

`generate_sql` asks the server to write SQL but does not execute it, allowing the client or developer to review the statement before calling `run_sql`. `ask` performs the complete server-side sequence: retrieve context, generate SQL, execute it, and return a Markdown interpretation. The latter two paths require an LLM provider or local Ollama.

Context selection uses vector similarity, keyword matching, and foreign-key expansion. When embeddings are unavailable, matching falls back to keywords. The embedded metadata database uses SQLite and sqlite-vec, with an in-process cosine search fallback if the extension cannot load.

## Setup and configuration

Install the core package in a Python virtual environment for SQLite and PostgreSQL support. Optional dependency groups add the LLM providers and the BigQuery or Databricks connectors. Run `querywise init` to create the local metadata store, then add a named connection with `querywise connections add`. Adding a connection introspects the target and prepares its metadata for search.

Run `querywise serve` for stdio or `querywise serve --http` for Streamable HTTP. HTTP listens on `MCP_HOST` and `MCP_PORT`, defaulting to `127.0.0.1:8077`. MCP client configurations should use an absolute path to the virtual-environment entry point and pass the database URL in the client environment. The server does not automatically read the repository's `.env` when launched by a client.

Set `DEFAULT_LLM_PROVIDER` to `ollama`, `anthropic`, or `openai` when embeddings or server-side generation are needed. Matching provider keys are needed for the cloud providers. Omitting the provider leaves keyword-only semantic matching available.

## Tools and capabilities

The MCP surface includes connection creation, testing, introspection, listing, and deletion; table listing and description; semantic context retrieval; SQL execution; SQL generation; the full `ask` pipeline; and query history. Additional tools manage glossary terms, metrics, dictionary entries, sample queries, and knowledge records, including knowledge URLs.

The server exposes the cached schema through `querywise://{connection}/schema` and provides a `text_to_sql(connection, question)` prompt for the grounding-to-query workflow. Connection arguments accept either a connection name or its ID. The CLI offers corresponding initialization, connection, context, SQL, and natural-language query commands.

## Limitations and notes

All query execution is read-only. SQL is checked with a static blocklist for DDL, DML, administrative statements, and injection patterns, while connectors add their own read-only enforcement. SQLite connections use read-only mode, and PostgreSQL queries use a read-only transaction.

BigQuery and Databricks support require their optional installation extras. The `ask` and `generate_sql` tools depend on a configured LLM provider, while the client-controlled context and execution loop does not. The server has no web interface and does not require PostgreSQL for its metadata store. The metadata schema is initialized at startup rather than managed through a migration tool.

_Full upstream README: https://allmcps.com/mcp/kosminus-querywise-mcp/readme_

