Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Before `1.0.0`, breaking changes may still ship in minor releases.
### Added

- Added `kagi_extract` to the built-in MCP server tool list, matching the existing paid Extract API command behavior.
- `kagi extract` and MCP `kagi_extract` now reject session-only Extract on Kagi accounts whose API portal disallows Extract API access, avoiding legacy token regeneration loops.

## [0.6.1]

Expand Down
25 changes: 25 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ clap_complete = "4.6.5"
cliclack = "0.5.4"
console = "0.16.3"
ctrlc = "3.5.2"
reqwest = { version = "0.12.15", default-features = false, features = ["brotli", "deflate", "gzip", "json", "multipart", "rustls-tls"] }
reqwest = { version = "0.12.15", default-features = false, features = ["brotli", "deflate", "gzip", "json", "multipart", "rustls-tls", "stream"] }
futures-util = "0.3.31"
scraper = "0.27.0"
serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0.150"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export KAGI_API_KEY='...'

| credential | what it unlocks |
| --- | --- |
| `KAGI_SESSION_TOKEN` | base search fallback, `search --lens`, filtered search, `quick`, `ask-page`, `assistant`, `translate`, `summarize --subscriber`, and Extract eligibility checks through the authenticated API portal |
| `KAGI_SESSION_TOKEN` | base search fallback, `search --lens`, filtered search, `quick`, `ask-page`, `assistant`, `translate`, and `summarize --subscriber` |
| `KAGI_API_KEY` | current `/api/v1` Search API and Extract API with `Bearer` auth |
| `KAGI_API_TOKEN` | legacy `/api/v0` public `summarize`, `fastgpt`, `enrich web`, and `enrich news` with `Bot` auth |
| none | `news`, `smallweb`, `auth status`, `--help` |
Expand Down Expand Up @@ -170,7 +170,7 @@ for the full command-to-token matrix, use the [`auth-matrix`](https://kagi.micr.
| `kagi batch` | run multiple searches in parallel with JSON, TOON, compact, pretty, markdown, or csv output and shared filters |
| `kagi auth` | launch the auth wizard, or inspect, validate, and save credentials |
| `kagi summarize` | use the paid public summarizer API or the subscriber summarizer with `--subscriber` |
| `kagi extract` | extract a page's full content as markdown through the current paid API, using `KAGI_API_KEY` directly; session-only auth is rejected when Kagi's API portal does not allow Extract access |
| `kagi extract` | extract a page's full content as markdown through the current paid API, using `KAGI_API_KEY` directly |
| `kagi watch` | rerun a search on an interval and emit added/removed result URLs |
| `kagi notify` | send search or news output to a webhook |
| `kagi history` | inspect local command history and aggregate query stats |
Expand Down
2 changes: 1 addition & 1 deletion docs/commands/mcp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ kagi mcp

- `kagi_search` - search Kagi
- `kagi_summarize` - summarize a URL or text through the public API
- `kagi_extract` - extract a page's full content as markdown through the current `/api/v1` Extract API. Uses `KAGI_API_KEY` directly and rejects session-only auth when Kagi's API portal does not allow Extract access. Accepts `url`.
- `kagi_extract` - extract a page's full content as markdown through the current `/api/v1` Extract API. Uses `KAGI_API_KEY` directly. Accepts `url`.
- `kagi_quick` - get a Kagi Quick Answer
- `kagi_news` - fetch Kagi News stories (no auth required). Accepts `category` (default `world`), `limit` (default `12`), and `lang` (default `default`).
- `kagi_news_search` - search the News tab of kagi.com and return story clusters (session token required). Accepts `query`, optional `region`, `freshness` (`day`/`week`/`month`), `order` (`default`/`recency`/`website`), and `limit`.
Expand Down
6 changes: 4 additions & 2 deletions docs/reference/auth-matrix.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This reference provides a complete mapping of which commands require which authe
| `auth set` | None | None | Saves credentials |
| `summarize` | `KAGI_API_TOKEN` | None | Legacy `/api/v0` public API |
| `summarize --subscriber` | `KAGI_SESSION_TOKEN` | None | Subscriber web product |
| `extract` | `KAGI_API_KEY` | Session-derived key when API portal allows it | Current `/api/v1` Extract API |
| `extract` | `KAGI_API_KEY` | None | Current `/api/v1` Extract API |
| `news` | None | None | Public endpoint |
| `quick` | `KAGI_SESSION_TOKEN` | None | Quick Answer web product |
| `ask-page` | `KAGI_SESSION_TOKEN` | None | Subscriber feature |
Expand Down Expand Up @@ -294,6 +294,7 @@ kagi auth set --session-token 'https://kagi.com/search?token=...'
- ❌ `kagi fastgpt` - requires API token
- ❌ `kagi summarize --url ...` (without --subscriber) - requires API token
- ❌ `kagi enrich web` - requires API token
- ❌ `kagi extract` - requires API key

### Legacy API Token Only

Expand Down Expand Up @@ -322,6 +323,7 @@ kagi auth set --api-token 'your_api_token'
- ❌ `kagi bang custom list` - requires session token
- ❌ `kagi redirect list` - requires session token
- ❌ `kagi summarize --subscriber` - requires session token
- ❌ `kagi extract` - requires API key

### Session Token, API Key, and Legacy API Token

Expand All @@ -335,7 +337,7 @@ kagi auth set --session-token '...' --api-key '...' --api-token '...'

**Smart behavior:**
- `search`: Uses session (default), or API key if `[auth.preferred_auth = "api"]` is set
- `extract`: Uses API key directly, or session only when Kagi's API portal allows Extract access
- `extract`: Uses API key directly
- `summarize` without `--subscriber`: Uses legacy API token
- `summarize --subscriber`: Uses session
- `quick`: Uses session
Expand Down
Loading