Querywise MCP logo

Querywise MCP

by kosminus

Grounds natural-language SQL with business metadata and runs read-only queries across SQLite, PostgreSQL, BigQuery, and Databricks.

Install Querywise MCP

Run the project’s own setup commands, in order.

Setup steps from the project

kosminus/querywise-mcp installs with its own steps rather than a config we can generate, so these are copied as-is. Follow them in order and run the commands in a terminal. Source: github.com

  1. 1. Install
    python3 -m venv .venv && source .venv/bin/activate
    
  2. 2. Install
    pip install -e .                 # core (SQLite store, sqlite-vec, Postgres + SQLite targets)
    
  3. 3. Install
    pip install -e ".[bigquery,databricks]"   # + extra target connectors
    
  4. 4. Configure
    querywise init                                   # create ~/.querywise/querywise.db
    
  5. 5. Configure
    querywise connections add shop \
        --connector-type sqlite -c /path/to/app.db   # introspects + embeds
    
  6. 6. Start the server
    querywise serve            # stdio (for Claude Desktop / Claude Code / Cursor)
    

Overview

kosminus/querywise-mcp MCP server connects MCP clients to SQLite, PostgreSQL, BigQuery, and Databricks through a business semantic layer. It combines schema introspection with glossary terms, metrics, dictionaries, knowledge, and sample queries to ground database questions. Use get_semantic_context with run_sql for client-controlled read-only querying, or use server-side generate_sql and ask when an LLM provider is configured. It runs over stdio or Streamable HTTP and also provides a CLI backed by an embedded SQLite and sqlite-vec metadata store.

Use cases

  • Ground business questions with glossary and metric definitions
  • Run reviewed read-only SQL against supported databases
  • Build a conversational semantic layer with MCP tools
  • Inspect cached schemas and table structure
  • Generate and interpret SQL through a configured LLM

Key features

  • Hybrid semantic context retrieval
  • Read-only SQL execution
  • SQLite, PostgreSQL, BigQuery, and Databricks connectors
  • Glossary, metric, dictionary, and knowledge management
  • stdio and Streamable HTTP MCP modes
  • CLI for initialization and natural-language queries

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

14/14 checks healthy over the last 116d

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars3Stargazers on the source repository.
Last commit6mo agoMost recent push to the default branch.
Directory activity6 viewsConfig copies, upvotes, and views on AllMCPs.

How Querywise MCP works

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.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Querywise MCP

kosminus/querywise-mcp is an MCP server that connects AI clients to SQLite, PostgreSQL, BigQuery, and Databricks databases through a business semantic layer. Its main tools retrieve grounded context, run read-only SQL, generate SQL for review, and execute a complete ask pipeline when an LLM provider is configured.

Install it from the repository in a Python virtual environment with `pip install -e .`. Add `.[llm]` for Anthropic or OpenAI support, or install the optional `bigquery` and `databricks` extras for those connectors.

Add the server's absolute virtual-environment entry-point path to Claude Desktop's `mcpServers` configuration and pass `DATABASE_URL` in its `env` block. Initialize the metadata store first, then fully quit and reopen Claude Desktop.

Yes, kosminus/querywise-mcp provides stdio mode for Cursor. Start it with `querywise serve` or configure Cursor to launch the absolute path to the installed `querywise-mcp` entry point.

No, database execution is read-only. The server applies a static SQL blocklist and connector-level read-only controls, and its documented query workflow uses `SELECT` statements.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewQuerywise MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/kosminus-querywise-mcp?style=directory)](https://allmcps.com/mcp/kosminus-querywise-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/kosminus-querywise-mcp"><img src="https://allmcps.com/api/badge/kosminus-querywise-mcp?style=directory" alt="Querywise MCP on AllMCPs" /></a>