REST API ยท MCP ยท Graph-powered
QueryWeaver is an open-source Text2SQL tool that converts plain-English questions into SQL using graph-powered schema understanding. It helps you ask databases natural-language questions and returns SQL and results.
Connect and ask questions:
Get Started
Docker
๐ก Recommended for evaluation purposes (Local Python or Node are not required)
Launch: http://localhost:5000
Use an .env file (Recommended)
Create a local .env by copying .env.example and passing it to Docker. This is the simplest way to provide all required configuration:
Alternative: Pass individual environment variables
If you prefer to pass variables on the command line, use -e flags (less convenient for many variables):
Note: To use OpenAI directly instead of Azure OpenAI, replace
AZURE_API_KEYwithOPENAI_API_KEYin the above command.
For a full list of configuration options, consult
.env.example.
MCP server: host or connect (optional)
QueryWeaver includes optional support for the Model Context Protocol (MCP). You can either have QueryWeaver expose an MCP-compatible HTTP surface (so other services can call QueryWeaver as an MCP server), or configure QueryWeaver to call an external MCP server for model/context services.
What QueryWeaver provides
The app registers MCP operations focused on Text2SQL flows:
list_databasesconnect_databasedatabase_schemaquery_database
To disable the built-in MCP endpoints set
DISABLE_MCP=truein your.envor environment (default: MCP enabled).Configuration
DISABLE_MCPโ disable QueryWeaver's built-in MCP HTTP surface. Set totrueto disable. Default:false(MCP enabled).
Examples
Disable the built-in MCP when running with Docker:
Calling the built-in MCP endpoints (example)
The MCP surface is exposed as HTTP endpoints.
Server Configuration
Below is a minimal example mcp.json client configuration that targets a local QueryWeaver instance exposing the MCP HTTP surface at /mcp.
REST API
API Documentation
Swagger UI: https://app.queryweaver.ai/docs
OpenAPI JSON: https://app.queryweaver.ai/openapi.json
Overview
QueryWeaver exposes a small REST API for managing graphs (database schemas) and running Text2SQL queries. All endpoints that modify or access user-scoped data require authentication via a bearer token. In the browser the app uses session cookies and OAuth flows; for CLI and scripts you can use an API token (see tokens routes or the web UI to create one).
Core endpoints
GET /graphs โ list available graphs for the authenticated user
GET /graphs/{graph_id}/data โ return nodes/links (tables, columns, foreign keys) for the graph
POST /graphs โ upload or create a graph (JSON payload or file upload)
POST /graphs/{graph_id} โ run a Text2SQL chat query against the named graph (streaming response)
Authentication
Add an Authorization header:
Authorization: Bearer <API_TOKEN>
Examples
List graphs (GET)
curl example:
Python example:
Get graph schema (GET)
curl example:
Python example:
Load a graph (POST) โ JSON payload
Or upload a file (multipart/form-data):
Query a graph (POST) โ run a chat-based Text2SQL request
The POST /graphs/{graph_id} endpoint accepts a JSON body with at least a chat field (an array of messages). The endpoint streams processing steps and the final SQL back as server-sent-message chunks delimited by a special boundary used by the frontend. For simple scripting you can call it and read the final JSON object from the streamed messages.
Example payload:
curl example (simple, collects whole response):
Python example (stream-aware):
If you prefer to set up manually or need a custom environment, use Pipenv:
Run the app locally
The server will be available at http://localhost:5000
Alternatively, the repository provides Make targets for running the app:
Frontend build (when needed)
The frontend is a TypeScript app in app/. Build before production runs or after frontend changes:
OAuth configuration
QueryWeaver supports Google and GitHub OAuth. Create OAuth credentials for each provider and paste the client IDs/secrets into your .env file.
Google: set authorized origin and callback
http://localhost:5000/login/google/authorizedGitHub: set homepage and callback
http://localhost:5000/login/github/authorized
Environment-specific OAuth settings
For production/staging deployments, set APP_ENV=production or APP_ENV=staging in your environment to enable secure session cookies (HTTPS-only). This prevents OAuth CSRF state mismatch errors.
Important: If you're getting "mismatching_state: CSRF Warning!" errors on staging/production, ensure APP_ENV is set to production or staging to enable secure session handling.
AI/LLM configuration
QueryWeaver uses AI models for Text2SQL conversion and supports both Azure OpenAI and OpenAI directly.
Default: Azure OpenAI
By default, QueryWeaver is configured to use Azure OpenAI. You need to set all three Azure credentials:
Alternative: OpenAI directly
To use OpenAI directly instead of Azure, simply set the OPENAI_API_KEY environment variable:
When OPENAI_API_KEY is provided, QueryWeaver automatically switches to use OpenAI's models:
Embedding model:
openai/text-embedding-ada-002Completion model:
openai/gpt-4.1
This configuration is handled automatically in api/config.py - you only need to provide the appropriate API key.
Docker examples with AI configuration
Using Azure OpenAI:
Using OpenAI directly:
Testing
Quick note: many tests require FalkorDB to be available. Use the included helper to run a test DB in Docker if needed.
Prerequisites
Install dev dependencies:
pipenv sync --devStart FalkorDB (see
make docker-falkordb)Install Playwright browsers:
pipenv run playwright install
Quick commands
Recommended: prepare the development/test environment using the Make helper (installs dependencies and Playwright browsers):
Alternatively, you can run the E2E-specific setup script and then run tests manually:
Test types
Unit tests: focus on individual modules and utilities. Run with
make test-unitorpipenv run pytest tests/ -k "not e2e".End-to-end (E2E) tests: run via Playwright and exercise UI flows, OAuth, file uploads, schema processing, chat queries, and API endpoints. Use
make test-e2e.
See tests/e2e/README.md for full E2E test instructions.
CI/CD
GitHub Actions run unit and E2E tests on pushes and pull requests. Failures capture screenshots and artifacts for debugging.
Troubleshooting
FalkorDB connection issues: start the DB helper
make docker-falkordbor check network/host settings.Playwright/browser failures: install browsers with
pipenv run playwright installand ensure system deps are present.Missing environment variables: copy
.env.exampleand fill required values.OAuth "mismatching_state: CSRF Warning!" errors: Set
APP_ENV=production(orstaging) in your environment for HTTPS deployments, orAPP_ENV=developmentfor HTTP development environments. This ensures session cookies are configured correctly for your deployment type.
Project layout (high level)
api/โ FastAPI backendapp/โ TypeScript frontendtests/โ unit and E2E tests
License
Licensed under the GNU Affero General Public License (AGPL). See LICENSE.
Copyright FalkorDB Ltd. 2025
This server cannot be installed