factql-mcp
Ask your database questions in plain English from Claude, Claude Code, Cursor, VS Code or any MCP client.
Each answer comes with the query that ran and the rows it returned, so you can check the number. Works with Postgres, MySQL, DuckDB, uploaded CSV and XLSX files, and PDFs.
Built for developers putting AI near real data: AI apps, agents and internal tools that can't afford a confident wrong number.
This package is FactQL's MCP server: it brings those answers into Claude Desktop, Claude Code, Cursor, or any MCP client. Learn more at factql.ai.
Hosted server (no install)
FactQL also runs this server for you at:
https://api.factql.ai/mcp
Add it to Cursor or VS Code in one click:
In Claude Code, run this, then /mcp to sign in:
claude mcp add --transport http factql https://api.factql.ai/mcp
In Claude (Settings → Connectors → Add custom connector; works on web, desktop and mobile) or any other app that supports remote (Streamable HTTP) MCP servers, add the address above.
The app opens a FactQL sign-in page; click Allow and its questions run as you. Disconnect under Settings → Connected apps on factql.ai. Apps that can't sign in can send an API key as Authorization: Bearer fl_live_... instead.
Setup for each app: docs.factql.ai/guides/mcp.
The rest of this README is for running the server yourself.
Get a key
Sign up free at factql.ai/signup, connect your data, and create an API key. An ask-only key is enough for this server.
Install
uvx factql-mcp
or pip install factql-mcp.
Configure
| Variable | Required | Default |
|---|---|---|
FACTQL_API_KEY |
yes | — your FactQL API key (an ask-only key is enough) |
FACTQL_BASE_URL |
no | https://api.factql.ai |
FACTQL_WORKSPACE_ID |
no | default workspace, for tenants that use workspaces |
FACTQL_END_USER_ID |
no | mcp:<os user> |
Claude Desktop / Cursor (mcpServers)
{
"mcpServers": {
"factql": {
"command": "uvx",
"args": ["factql-mcp"],
"env": { "FACTQL_API_KEY": "fl_live_..." }
}
}
}
Claude Code
claude mcp add factql -e FACTQL_API_KEY=fl_live_... -- uvx factql-mcp
Tools
whoami()— the tenant, plan, and workspaces this key can query, andhas_data: whether anything is connected yet.ask(question, workspace_id?, locale?)— the answer, the query that ran, and up to 50 rows. Aneeds_clarificationresult means the question was too vague; ask the user and call again with the detail. Adeclinedresult means FactQL couldn't verify an answer and gave none rather than guess; thereasonsays why. Anerrorresult is a real failure, also with areason.localeisen-GBoren-US.
When FactQL can't answer yet, ask returns one of these, with a message saying what to do next:
result |
message |
|---|---|
no_data |
No data is connected to this FactQL workspace yet. Add a database or upload a CSV or Excel file at https://factql.ai, then ask again. |
schema_not_ready |
Your data is still being prepared. Try again in a minute or two. |
email_unverified |
Verify your email to start asking. Check your inbox for the link from FactQL. |
limit_reached |
The plan-limit message from FactQL, unchanged. |
Each ask is stateless: the MCP client carries the conversation, so a follow-up should restate what it refers to.
Safety
FactQL only runs read-only SELECT queries, under a statement timeout, and only against the tables your admin has described to it (inside a workspace, only that workspace's tables). The key's permissions decide what it can see; this server adds nothing on top.
Development
uv run --with pytest pytest -q
License
MIT
Questions and feedback
Ask in Discussions or email ask@factql.ai. Bugs go in Issues.
Metadata
Release files for factql-mcp 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| factql_mcp-0.1.6.tar.gz | 9.9 kB | Without provenance | Details for factql_mcp-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| factql_mcp-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for factql_mcp-0.1.6-py3-none-any.whl |
Total release size: 18.3 kB
Release files / factql_mcp-0.1.6.tar.gz
| Download URL | factql_mcp-0.1.6.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
820c33d6fb538851e495583f38ec1ad27b752a363dc4f05c47bada417ef90ccb
|
|
BLAKE2b-256 checksum How to use checksums |
e1e68ca67499f730754e7c64e2aaf4aa6cec27a194d3640560bf081db7703780
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / factql_mcp-0.1.6-py3-none-any.whl
| Download URL | factql_mcp-0.1.6-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bed2b80fb3a419f3f9137f9acdda496c57cd415a760a4b4096ee9fde9faf3e7b
|
|
BLAKE2b-256 checksum How to use checksums |
8d1a09cf2dcdcbd154b6d6d6e714642b185bb7e5246ed5a4626508882301f034
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for factql-mcp 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.