Skip to main content
Glama
factql-mcp

factql-mcp

Official

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 SQL 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 as a remote (Streamable HTTP) MCP server in Claude (Settings → Connectors → Add custom connector; works on web, desktop and mobile), Claude Code (claude mcp add --transport http factql https://api.factql.ai/mcp), Cursor, VS Code, or any app that supports remote MCP. 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.

Related MCP server: Footnote

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, and has_data: whether anything is connected yet.

  • ask(question, workspace_id?, locale?) — the answer, the SQL that ran, and up to 50 rows. A needs_clarification result means the question was too vague; ask the user and call again with the detail. A declined result means FactQL couldn't verify an answer and gave none rather than guess; the reason says why. An error result is a real failure, also with a reason. locale is en-GB or en-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.

Available Tools

2 tools
askAInspect

Ask a plain-English question about the connected data.

Returns the answer, the SQL that was run (when any), and up to 50 rows. workspace_id scopes the question when the tenant uses workspaces (see whoami); locale is "en-GB" or "en-US" for the answer's wording. A needs_clarification result means the question was too vague: ask the user, then call again with the detail.

Inputs: question (required), locale, workspace_id. Returns: object

whoamiAInspect

What this API key can see: tenant, plan, and the workspaces it may query.

Use it to find a workspace_id before calling ask on a tenant that uses workspaces.

Inputs: no named parameters. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools are clearly distinct: `whoami` retrieves tenant/plan/workspace context, while `ask` runs a natural-language query. The description of `ask` even points to `whoami` for discovering workspace_id, reinforcing the division of labor.

    Naming Consistency4/5

    Both names are single lowercase words in a consistent informal, command-style convention (whoami, ask), with no mixing of snake_case/camelCase. There is no verb_noun pattern, but across only two tools the style is predictable and readable.

    Tool Count3/5

    Two tools is on the thin side, though the server's narrow purpose (context discovery + one NL query entry point) means each tool does earn its place. It sits at the borderline rather than being over- or under-scoped badly.

    Completeness3/5

    The surface covers identity and querying but has no schema/table introspection helper and no pagination or continuation mechanism beyond the fixed 50-row cap. Agents can often work around these limits via `whoami` and re-asking, but they are notable gaps for a data-query server.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      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. Read-only by default, with an embedded SQLite + sqlite-vec metadata store and no external infra required.
      25
      3
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      This MCP server gives AI assistants over business data a provenance layer: every number in an answer traces back to specific records, auditable and tamper-evident. It enforces that the model never generates figures—only selects operations whose results are computed deterministically in SQL.
      6
      133 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables natural language queries to be converted into policy-verified SQL, vector search, and knowledge graph plans, with evidence-backed answers and an audit log.
      1
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to query governed data warehouses through plain language, returning grounded answers with SQL, confidence grades, and signed receipts while enforcing access, testing, and audit controls.
      37 PyPI
      18
      Apache 2.0