> ## Documentation Index
> Fetch the complete documentation index at: https://docs.keenable.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Keenable search and fetch work without an API key. To add them to code, use the official SDK for the project's language: https://docs.keenable.ai/sdks.md
> Read an API key from the KEENABLE_API_KEY environment variable. Never ask a user to paste a key into chat; send them to https://docs.keenable.ai/api-keys.md
> On 402 with an API key (code insufficient_credits), stop and ask a human to add credits; don't retry. On 429, wait the number of seconds in Retry-After, then retry.
> Every error, with its cause and fix: https://docs.keenable.ai/errors.md

# SELECT

> Ask a question in plain language and get a table back: your agent writes one read-only SQL SELECT over live web search results, and the SELECT MCP server runs it

Ask your agent a question in plain language and get back a table built from live web search results. The agent writes one read-only `SELECT` in the DuckDB dialect, following the guide that ships with the tool. The server runs the searches, fetches the pages, extracts the fields the query asks for with an LLM, removes duplicates and returns a table.

One tool call covers many pages and returns structured rows. Your agent doesn't have to read results one at a time and assemble them by hand.

SELECT is a separate MCP server from the [Keenable MCP server](https://docs.keenable.ai/mcp-server.md), with its own URL. Adding it doesn't change the `search_web_pages` and `fetch_page_content` server, and you can run both side by side:

```text theme={"system"}
https://select.keenable.ai/mcp
```

The server also answers on `https://webql.keenable.ai/mcp`, its first address. Neither
address redirects to the other, because a redirect ends an MCP session. A client set up on
the old address keeps working. Set up new clients with `select.keenable.ai`.

Any Keenable account can connect. It's the same account you use for the console and API keys. If you don't have one, sign up at [app.keenable.ai/signup](https://app.keenable.ai/signup). The account also gives you the SELECT playground at [app.keenable.ai/select/start](https://app.keenable.ai/select/start).

## Connect

You can connect with a browser sign-in or with an API key in a header. Which one you can use
depends on the client:

> [card] [Claude Code](#claude-code)
>
> Browser sign-in, or your own key in a header

> [card] [Claude](#claude-desktop-claude-ai-and-mobile)
>
> Desktop, claude.ai and mobile, from the connector directory

> [card] [ChatGPT](#chatgpt)
>
> From the Plugins Directory, or by URL in developer mode

> [card] [Codex, Cursor](#codex-cursor-and-other-clients)
>
> Any client that takes a URL and a header

### One click

Cursor and VS Code add the server from a link, without a key. The client asks you to sign in
to Keenable the first time you use the server.

[Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=keenable-select\&config=eyJ1cmwiOiJodHRwczovL3NlbGVjdC5rZWVuYWJsZS5haS9tY3AifQ==)

[Add to VS Code](vscode:mcp/install?%7B%22name%22%3A%22keenable-select%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fselect.keenable.ai%2Fmcp%22%7D)

[Add to VS Code Insiders](vscode-insiders:mcp/install?%7B%22name%22%3A%22keenable-select%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fselect.keenable.ai%2Fmcp%22%7D)

### Claude Code

Sign in through the browser, with no key to paste:

```bash theme={"system"}
claude mcp add keenable-select \
  --transport http https://select.keenable.ai/mcp \
  --scope user
```

Then run `/mcp` in a session, pick **keenable-select**, and choose **Authenticate**. Your browser opens a Keenable sign-in; approve it and the tools appear.

To use an API key instead, add the header and skip the sign-in. Create the key in the [console](https://app.keenable.ai/console):

```bash theme={"system"}
claude mcp add keenable-select \
  --transport http https://select.keenable.ai/mcp \
  --scope user \
  --header "X-API-Key: keen_<your_key>"
```

`--scope user` makes the server available in every project. Without it the entry is written for the current directory only.

### Claude Desktop, claude.ai and mobile

**Keenable SELECT** is listed in Claude's connector directory, next to the Keenable search
connector. The connector signs you in and doesn't take a key. If you need a specific API key
applied, use Claude Code or another client that sends headers.

**1. Add the connector**

Open **Customize → Connectors**, click **+**, and search for **Keenable SELECT**. There is nothing to paste.

If it isn't listed in your account yet, add it by URL instead: **Customize → Connectors → + Add → Add custom connector**. Under **Authentication** choose **Sign in now**, and under **OAuth client** choose **Register automatically**. Name it **Keenable SELECT** so you can tell it apart from the Keenable search connector, which is a separate server with different tools. Use this URL:

```text theme={"system"}
https://select.keenable.ai/mcp
```

**2. Connect**

Click **Connect**. Your browser opens a Keenable sign-in; approve it and the tools appear.

**3. Enable it in a chat**

Click **+** in the lower left of the message box, hover **Connectors**, and toggle it on for the conversation.

### ChatGPT

**Keenable SELECT** is a published plugin in OpenAI's Plugins Directory, the catalog ChatGPT
shares with Codex. It is a second listing next to the [Keenable search plugin](https://docs.keenable.ai/integrations/chatgpt.md),
because the two are different servers with different tools.

**1. Install the plugin**

Open the [listing](https://chatgpt.com/plugins/plugin_asdk_app_6a91a85bf4a08191af8367df88e7f0c8), or find **Keenable SELECT** in the directory, and install it. There is no config file, no developer mode, and no URL to paste.

**2. Sign in**

The plugin signs in to your Keenable account through OAuth. Click through the sign-in prompt the first time you use it. Usage is metered against the organization of the account you connect.

**3. Use it in a chat**

Pick the plugin from the composer's tools menu before you ask your question. A query can take seconds to minutes; see [What to expect](#what-to-expect).

> [accordion] By URL, in developer mode
>
> If the plugin isn't in the directory for your account yet, add the server by URL.
>
> 1. **Settings → Connectors → Advanced settings → Developer mode**. Without it, ChatGPT offers no way to add a server by URL.
> 2. **Settings → Connectors → Create**, paste `https://select.keenable.ai/mcp`, and choose **OAuth** as the authentication. Sign in when the browser opens; there is no client ID or secret to fill in.

> [!NOTE]
>
> Deep research in ChatGPT accepts only connectors that expose `search` and `fetch` tools. This server exposes `select` instead, so use it as an ordinary plugin, and the [Keenable search plugin](https://docs.keenable.ai/integrations/chatgpt.md) for deep research.

### Codex, Cursor and other clients

Codex can also install **Keenable SELECT** from the Plugins Directory it shares with ChatGPT, with an OAuth sign-in. To use your own API key instead, add the server to `config.toml` as shown below.

Any client that takes a remote MCP URL and a header works. Create a key in the [console](https://app.keenable.ai/console) first.

For Codex, add this to `~/.codex/config.toml`:

```toml theme={"system"}
[mcp_servers.keenable-select]
url = "https://select.keenable.ai/mcp"
http_headers = { "X-API-Key" = "keen_<your_key>" }
```

For Cursor, Devin Desktop (formerly Windsurf) and similar clients, use this shape:

```json theme={"system"}
{
  "mcpServers": {
    "keenable-select": {
      "url": "https://select.keenable.ai/mcp",
      "headers": {
        "X-API-Key": "keen_<your_key>"
      }
    }
  }
}
```

If your client offers only an `Authorization` header field, send `Bearer keen_<your_key>` in it instead.

### Over HTTP, without an account

An agent with no Keenable account can run a SELECT query over plain HTTP and pay for it per query: \$0.10 in USDC on Base with x402 at `POST https://api.keenable.ai/v1/x402/select`, or from prepaid credit through ZeroClick. If a query fails, you aren't charged. The request body, response fields and payment flow are on [Pay per request](https://docs.keenable.ai/pay-per-request.md#select-over-x402).

With an account, use the MCP server above: SELECT has no REST endpoint that takes an API key.

## The tools

The main tool is `select`. Your agent fills in its parameters. They're listed here so you can read a transcript and see what ran.

**query** `string` *required*

A single read-only `SELECT` in DuckDB dialect. Web pages enter the query through the `WEB_SEARCH(...)` and `WEB_FETCH(...)` table functions; the `SEM_*` functions extract, filter, rank and normalise values with an LLM.

**show\_preview** `boolean`

Return a small sample of rows instead of the full table. Defaults to `false`.

You don't need to learn this dialect or teach it to your agent. The `select` tool's description is its full usage guide, with the syntax, the semantic functions and worked examples. Your agent reads it as soon as you enable the connector. To debug a query or steer your agent, see the [function reference](#function-reference).

Two more tools publish what a query found as a web page: `generate_html_report` builds a document from a brief plus the result sets you name and returns its link, and `revoke_html_report` takes that link back down.

When a `select` call returns rows, the result can end with one extra line of text after the table. It names the result set and tells the agent it can call `generate_html_report` to get a link to share. The link is unlisted by default, and `revoke_html_report` turns it off. The line never changes the table or the result set. Organizations on zero data retention never get it.

You ask *"which electric cars sold in Europe come up most often, and what are their range and starting price?"*, and the agent turns that into a query like this:

```sql theme={"system"}
SELECT SEM_NORM(model, 'merge trim levels and battery variants into one model') AS model,
       COUNT(DISTINCT url) AS sources,
       MODE(range_km) AS range_km,
       MODE(price_eur) AS price_eur
FROM (
  SELECT url, UNNEST(
    SEM_EXTRACT_ALL(
      content,
      'an electric car model sold in Europe',
      model := 'brand and model name, e.g. "Renault 5 E-Tech"',
      range_km := 'WLTP range in km, number only',
      price_eur := 'starting price in EUR, number only'
    ),
    recursive := true
  )
  FROM WEB_SEARCH(
    'best electric cars Europe 2026 WLTP range price',
    'affordable EV Europe comparison starting price',
    'new electric car launches Europe 2026',
    'EV buyers guide range price Germany',
    'site:reddit.com which EV should I buy Europe',
    'electric car WLTP range comparison table',
    'cheapest electric cars Europe list'
  )
)
GROUP BY SEM_NORM(model, 'merge trim levels and battery variants into one model')
ORDER BY sources DESC
LIMIT 15
```

That is one tool call. It ran seven searches, merged 1,400 results into 1,125 unique pages, extracted three fields from each and grouped them, and came back with this (first 8 of 15 rows):

| model | sources | range\_km | price\_eur |
| - | - | - | - |
| Tesla Model Y | 119 | 455 | 39990 |
| Tesla Model 3 | 118 | 580 | 44990 |
| Renault 5 E-Tech | 113 | 400 | 25000 |
| Dacia Spring | 91 | 225 | 16900 |
| Citroen e-C3 | 81 | 320 | 23300 |
| BMW iX3 | 78 | 805 | 70900 |
| Leapmotor T03 | 77 | 265 | 18900 |
| Volkswagen ID.3 | 65 | 420 | 35000 |

This is a real run. The figures are whatever the pages said: the server reports its sources but doesn't check them. See [What to expect](#what-to-expect).

The guide tells the agent to search with different phrasings, not variations of one. The server merges the returned pages and removes duplicate URLs before the rest of the query runs. The rows arrive in a compact tabular encoding instead of JSON, so a table this size takes up little of your agent's context.

## Result sets

Every call stores its output and returns a **result set id**, such as `ra84968f0532` for the query above. A later query reads the stored rows when it puts that id in `FROM`, so a follow-up question needs no new searches.

Ask *"now only the ones under €30,000, longest range first"* and the agent queries the stored table instead of going back to the web:

```sql theme={"system"}
SELECT model, range_km, price_eur
FROM ra84968f0532
WHERE TRY_CAST(price_eur AS INTEGER) < 30000
ORDER BY TRY_CAST(range_km AS INTEGER) DESC
```

| model | range\_km | price\_eur |
| - | - | - |
| Renault 5 E-Tech | 400 | 25000 |
| Citroen e-C3 | 320 | 23300 |
| Leapmotor T03 | 265 | 18900 |
| Dacia Spring | 225 | 16900 |
| BYD Dolphin Surf | 220 | 18990 |

This query returned in seconds, because it searched and fetched no pages. The server also stores the searched pages as their own result set. Your agent can ask a different question of the same 1,125 pages without paying to search and fetch them again.

Result sets are kept for **30 days**.

## Function reference

Use this table to read a query your agent wrote, or to tell the agent which function to use. Two table functions bring pages into a query, and five semantic functions work on each row:

| Function | What it does |
| - | - |
| `WEB_SEARCH('q1', 'q2', ..., published_after := '1d')` | Runs every query and merges the results into one row per unique URL. Columns: `url`, `title`, `content`, `snippet`, `published_at`, `query`. |
| `WEB_FETCH('https://example.com/page', ...)` | Fetches the URLs you name, one row per page. Columns: `url`, `title`, `content`, `published_at`. |
| `SEM_EXTRACT(column, 'field description')` | Extracts one value per row with an LLM, or `NULL` if the text doesn't state it. Named arguments such as `price := 'price in USD'` return one object per row. |
| `SEM_EXTRACT_ALL(column, 'what one value is')` | Takes the same arguments as `SEM_EXTRACT` and returns every match as a list. Wrap it in `UNNEST` to get one row per match. |
| `SEM_MATCH(column, 'predicate')` | Returns true or false per row from an LLM. Use it in `WHERE`. |
| `SEM_SCORE(column, 'query')` | Scores how relevant each row is to the query. Use it in `ORDER BY`. |
| `SEM_NORM(column, 'guidance')` | Returns one key for values that mean the same thing, such as `Google LLC` and `GOOGL`. Use it in `GROUP BY`. The guidance is optional. |

`published_after` and `published_before` take an offset such as `2h`, `1d`, `2w` or `1mo`, or a date such as `2026-07-01`. A date filter drops pages that have no publish date. On `SEM_EXTRACT` and `SEM_EXTRACT_ALL`, `evidence := true` adds the verbatim quotes that each value came from.

The rest of the syntax is DuckDB SQL. Every query reads `FROM` a `WEB_SEARCH(...)` call, a `WEB_FETCH(...)` call or a result set id. A query can't return the full `content` column: extract from it, or take a bounded part such as `substr(content, 1, 10000)`. The full guide your agent reads is at [select.keenable.ai/guide.md](https://select.keenable.ai/guide.md).

### Recipes

This query counts how many pages mention each restaurant:

```sql theme={"system"}
SELECT SEM_EXTRACT(content, 'restaurant name') AS restaurant,
       ANY_VALUE(SEM_EXTRACT(content, 'street address')) AS address,
       COUNT(*) AS mentions
FROM WEB_SEARCH('michelin three star restaurants 2026 list',
                'site:guide.michelin.com three stars',
                'best restaurants world ranking chefs')
WHERE regexp_matches(content, '(?i)michelin|three.star')
  AND restaurant IS NOT NULL
GROUP BY restaurant
ORDER BY mentions DESC
```

You get one row per restaurant with an address and the number of pages that name it, most-mentioned first.

This query enriches a stored result set. `WEB_SEARCH` takes a column as its argument, so it runs one search for each `jacket` in the result set `ra1b2c3d4e5f`:

```sql theme={"system"}
SELECT jacket, price, price_evidence, url
FROM (
  SELECT jacket, url,
    SEM_EXTRACT(content, 'current retail price in USD, number only; NULL unless stated in USD',
      evidence := true) AS price
  FROM (
    SELECT jacket, UNNEST(WEB_SEARCH(jacket || ' current price'), recursive := true)
    FROM ra1b2c3d4e5f
  )
)
WHERE price IS NOT NULL
ORDER BY jacket, price
```

You get one row per page that states a price, with the quote the price came from in `price_evidence` and the page's URL.

## What to expect

* A query takes seconds to minutes, because it runs real searches, fetches pages and calls an LLM for each row. A long wait doesn't mean the call is stuck.
* If a table is larger than about 50,000 characters, the response contains only a few sample rows, with long strings clipped. The full table stays available through the result set id.
* A report takes minutes to build, and a client that gives up on a slow tool call cancels it. To make the report finish before the client stops waiting, build it from aggregated result sets, not from a raw table of hundreds of rows.
* Extraction doesn't fact-check its sources. A single page can be outdated or describe the wrong edition, so cross-check precise numbers across independent pages.

## Errors

* `401`: no credential reached the server, or the credential is invalid. Check the header name and the key.
* `403`: this deployment runs an allowlist and your account isn't on it. Production doesn't run an allowlist, so you shouldn't see this. If you do, email [support@keenable.ai](mailto:support@keenable.ai) with the address you signed in with. Signing in again doesn't clear it.
* `429`: too many queries are running at once, across the cluster or on your account. Retry shortly.
* `503`: the server couldn't check your credential. Retry shortly.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.