alterlab-mcp-server 1.7.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/README.md +75 -33
  2. package/dist/auth.d.ts +30 -0
  3. package/dist/auth.d.ts.map +1 -0
  4. package/dist/auth.js +423 -0
  5. package/dist/auth.js.map +1 -0
  6. package/dist/client.d.ts +23 -1
  7. package/dist/client.d.ts.map +1 -1
  8. package/dist/client.js +61 -3
  9. package/dist/client.js.map +1 -1
  10. package/dist/config.d.ts +21 -1
  11. package/dist/config.d.ts.map +1 -1
  12. package/dist/config.js +85 -8
  13. package/dist/config.js.map +1 -1
  14. package/dist/errors.d.ts.map +1 -1
  15. package/dist/errors.js +6 -4
  16. package/dist/errors.js.map +1 -1
  17. package/dist/format.d.ts +20 -2
  18. package/dist/format.d.ts.map +1 -1
  19. package/dist/format.js +187 -9
  20. package/dist/format.js.map +1 -1
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +66 -2
  23. package/dist/index.js.map +1 -1
  24. package/dist/tools/balance.d.ts.map +1 -1
  25. package/dist/tools/balance.js +4 -2
  26. package/dist/tools/balance.js.map +1 -1
  27. package/dist/tools/batch.d.ts +1221 -25
  28. package/dist/tools/batch.d.ts.map +1 -1
  29. package/dist/tools/batch.js +123 -34
  30. package/dist/tools/batch.js.map +1 -1
  31. package/dist/tools/common.d.ts +313 -0
  32. package/dist/tools/common.d.ts.map +1 -0
  33. package/dist/tools/common.js +336 -0
  34. package/dist/tools/common.js.map +1 -0
  35. package/dist/tools/crawl.d.ts +165 -10
  36. package/dist/tools/crawl.d.ts.map +1 -1
  37. package/dist/tools/crawl.js +191 -43
  38. package/dist/tools/crawl.js.map +1 -1
  39. package/dist/tools/estimate.d.ts +21 -6
  40. package/dist/tools/estimate.d.ts.map +1 -1
  41. package/dist/tools/estimate.js +28 -35
  42. package/dist/tools/estimate.js.map +1 -1
  43. package/dist/tools/extract.d.ts +5 -5
  44. package/dist/tools/extract.d.ts.map +1 -1
  45. package/dist/tools/extract.js +16 -12
  46. package/dist/tools/extract.js.map +1 -1
  47. package/dist/tools/job.d.ts +13 -0
  48. package/dist/tools/job.d.ts.map +1 -0
  49. package/dist/tools/job.js +62 -0
  50. package/dist/tools/job.js.map +1 -0
  51. package/dist/tools/map.d.ts +5 -2
  52. package/dist/tools/map.d.ts.map +1 -1
  53. package/dist/tools/map.js +16 -5
  54. package/dist/tools/map.js.map +1 -1
  55. package/dist/tools/scrape.d.ts +431 -49
  56. package/dist/tools/scrape.d.ts.map +1 -1
  57. package/dist/tools/scrape.js +267 -135
  58. package/dist/tools/scrape.js.map +1 -1
  59. package/dist/tools/screenshot.d.ts +33 -0
  60. package/dist/tools/screenshot.d.ts.map +1 -1
  61. package/dist/tools/screenshot.js +60 -10
  62. package/dist/tools/screenshot.js.map +1 -1
  63. package/dist/tools/search.d.ts +11 -5
  64. package/dist/tools/search.d.ts.map +1 -1
  65. package/dist/tools/search.js +22 -6
  66. package/dist/tools/search.js.map +1 -1
  67. package/dist/tools/sessions.d.ts +180 -12
  68. package/dist/tools/sessions.d.ts.map +1 -1
  69. package/dist/tools/sessions.js +75 -21
  70. package/dist/tools/sessions.js.map +1 -1
  71. package/dist/tools/simple_batch.d.ts +28 -0
  72. package/dist/tools/simple_batch.d.ts.map +1 -0
  73. package/dist/tools/simple_batch.js +142 -0
  74. package/dist/tools/simple_batch.js.map +1 -0
  75. package/dist/tools/usage.d.ts +7 -0
  76. package/dist/tools/usage.d.ts.map +1 -0
  77. package/dist/tools/usage.js +42 -0
  78. package/dist/tools/usage.js.map +1 -0
  79. package/dist/types.d.ts +219 -21
  80. package/dist/types.d.ts.map +1 -1
  81. package/dist/types.js.map +1 -1
  82. package/package.json +5 -3
  83. package/server.json +40 -4
package/README.md CHANGED
@@ -26,7 +26,7 @@
26
26
  ### Claude Code
27
27
 
28
28
  ```bash
29
- claude mcp add alterlab -- npx -y alterlab-mcp-server
29
+ claude mcp add alterlab -- npx -y alterlab-mcp-server@latest
30
30
  ```
31
31
 
32
32
  Then set your API key: `export ALTERLAB_API_KEY=sk_live_...` or add it to `.claude.json` (see [full setup](#install-in-claude-desktop--claude-code) below).
@@ -68,9 +68,9 @@ AlterLab uses a multi-tier scraping architecture. It automatically selects the c
68
68
 
69
69
  1. **Curl** ($0.0002/req) — Direct HTTP for static pages, RSS feeds, public APIs
70
70
  2. **HTTP** ($0.0003/req) — TLS fingerprint rotation for moderately protected sites
71
- 3. **Stealth** ($0.0005/req) — Browser impersonation for Cloudflare/DataDome-protected sites
72
- 4. **Light JS** ($0.0007/req) — Lightweight JS extraction from server-rendered HTML
73
- 5. **Browser** ($0.001/req) — Full headless Chromium for JavaScript-heavy SPAs
71
+ 3. **Stealth** ($0.002/req) — Browser impersonation for Cloudflare/DataDome-protected sites
72
+ 4. **Light JS** ($0.0025/req) — Lightweight JS extraction from server-rendered HTML
73
+ 5. **Browser** ($0.004/req) — Full headless Chromium for JavaScript-heavy SPAs
74
74
 
75
75
  Auto mode starts at Tier 1 and escalates only when blocked. Most websites resolve at Tiers 1-2, so **$1 gets you 1,000 to 5,000 scrapes** depending on the sites you target.
76
76
 
@@ -87,7 +87,7 @@ Add to your Claude config file (`~/.claude.json` for Claude Code, or Settings fo
87
87
  "mcpServers": {
88
88
  "alterlab": {
89
89
  "command": "npx",
90
- "args": ["-y", "alterlab-mcp-server"],
90
+ "args": ["-y", "alterlab-mcp-server@latest"],
91
91
  "env": {
92
92
  "ALTERLAB_API_KEY": "sk_live_your_key_here"
93
93
  }
@@ -105,7 +105,7 @@ Add to `.cursor/mcp.json` in your project root:
105
105
  "mcpServers": {
106
106
  "alterlab": {
107
107
  "command": "npx",
108
- "args": ["-y", "alterlab-mcp-server"],
108
+ "args": ["-y", "alterlab-mcp-server@latest"],
109
109
  "env": {
110
110
  "ALTERLAB_API_KEY": "sk_live_your_key_here"
111
111
  }
@@ -123,7 +123,7 @@ Add to Windsurf MCP settings (`~/.codeium/windsurf/mcp_config.json`):
123
123
  "mcpServers": {
124
124
  "alterlab": {
125
125
  "command": "npx",
126
- "args": ["-y", "alterlab-mcp-server"],
126
+ "args": ["-y", "alterlab-mcp-server@latest"],
127
127
  "env": {
128
128
  "ALTERLAB_API_KEY": "sk_live_your_key_here"
129
129
  }
@@ -160,19 +160,37 @@ Scrape a URL and return its content as markdown, text, HTML, or JSON. Automatica
160
160
  |---|---|---|---|
161
161
  | `url` | string | required | URL to scrape |
162
162
  | `mode` | `auto` \| `html` \| `js` \| `pdf` \| `ocr` | `auto` | Scraping mode |
163
- | `formats` | `(text\|json\|html\|markdown)[]` | `["markdown"]` | Output formats |
164
- | `render_js` | boolean | `false` | Use headless browser (+3 credits) |
165
- | `use_proxy` | boolean | `false` | Premium proxy (+1 credit) |
166
- | `proxy_country` | string | — | ISO country code for geo-targeting (e.g., `US`, `DE`) |
167
- | `wait_for` | string | — | CSS selector to wait for before extraction |
168
- | `timeout` | number | `90` | Timeout in seconds (1-300) |
169
- | `include_raw_html` | boolean | `false` | Include raw HTML alongside formatted content |
170
- | `session_id` | string (UUID) | — | Stored session ID for authenticated scraping |
171
- | `cookies` | `Record<string, string>` | &mdash; | Inline cookies for one-off authenticated requests |
163
+ | `method` / `body` / `content_type` / `headers` | enum / string / enum / object | `GET` | POST support (1.5x cost) and custom target headers |
164
+ | `formats` | `(text\|json\|json_v2\|html\|markdown\|rag\|content\|raw)[]` | `["markdown"]` | Output formats |
165
+ | `extraction_schema` / `extraction_prompt` | object / string | &mdash; | LLM extraction (+$0.001) |
166
+ | `extraction_profile` / `extraction_template` | enum | &mdash; | `auto`, `product`, `article`, `job_posting`, `faq`, `recipe`, `event`, `ecommerce_homepage`, `directory_listing` (`template` is a deprecated alias) |
167
+ | `extraction_provider` / `extraction_model` | enum / string | &mdash; | BYOK LLM selection |
168
+ | `evidence`, `promote_schema_org`, `filter_content` | boolean | &mdash; | Extraction behaviour |
169
+ | `cache`, `cache_ttl`, `force_refresh` | boolean / number / boolean | &mdash; | Response caching (`cache_ttl` 60-86400) |
170
+ | `render_js` | boolean \| `"auto"` | API default | Headless browser (forces Browser tier, $0.004) |
171
+ | `use_proxy`, `proxy_country` | boolean, string | &mdash; | Premium proxy (+$0.0002) and geo-targeting |
172
+ | `use_own_proxy`, `use_system_proxy`, `proxy_integration_id` | boolean, boolean, string | &mdash; | Bring-your-own-proxy selection |
173
+ | `skip_tls_verification` | boolean | &mdash; | Omit (recommended) = verify, fall back on invalid certs; `true` skip, `false` require valid cert |
174
+ | `wait_for`, `wait_until`, `wait_condition` | string | &mdash; | Selector / load-event waits |
175
+ | `actions` | object[] (max 20) | &mdash; | Browser actions: `wait`, `wait_for`, `click`, `fill`, `press`, `scroll`, `infinite_scroll`, `screenshot`, `evaluate` |
176
+ | `screenshot`, `generate_pdf`, `ocr` | boolean | &mdash; | Add-ons (+$0.0002 / +$0.0004 / +$0.001) |
177
+ | `scroll_to_load`, `scroll_count`, `enable_scroll` | boolean / 1-10 / boolean | &mdash; | Lazy-load handling |
178
+ | `include_iframes`, `flatten_shadow_dom`, `block_images`, `remove_cookie_banners` | boolean | &mdash; | Rendering options |
179
+ | `section_filter` | object | &mdash; | Filter for `json_v2` sections |
180
+ | `session_id`, `cookies`, `session_headers` | UUID, object, object | &mdash; | Authenticated scraping |
181
+ | `sticky_session`, `sticky_session_ttl` | string, 300-7200 | &mdash; | Reuse cookies and exit IP across calls (paid plans) |
182
+ | `location` | `{country, language}` | &mdash; | Geo-targeting |
183
+ | `cost_controls` | object | &mdash; | `force_tier`, `max_tier`, `max_credits`, `prefer_cost`, `prefer_speed`, `fail_fast`, `time_budget` (`prefer_cost`, `prefer_speed`, `fail_fast` also accepted at top level) |
184
+ | `embeddings` | object | &mdash; | `enabled`, `model`, `chunk_size`, `chunk_overlap` (+$0.001/page) |
185
+ | `sync_policy` | `auto` \| `wait_until_deadline` | `auto` | Wait behaviour for long scrapes |
186
+ | `timeout`, `max_response_bytes`, `include_raw_html` | number, number, boolean | `90`, 5 MB, `false` | Limits and raw output |
187
+ | `estimate_first` | boolean | `false` | Run a free cost estimate first |
188
+
189
+ Not exposed: `source` (dashboard tracking tag), `sync` (the tool is always synchronous), `webhook_url` (use `alterlab_batch`/`alterlab_crawl` webhooks). If a scrape outlives the ~85s synchronous window the tool returns a `job_id`; fetch it with `alterlab_get_job`.
172
190
 
173
191
  ### `alterlab_extract` &mdash; Extract Structured Data
174
192
 
175
- Extract structured fields from any webpage using pre-built profiles or custom JSON Schema. Returns clean JSON &mdash; ready for databases, spreadsheets, or downstream processing.
193
+ Extract structured fields from HTML, text or markdown content using pre-built profiles or custom JSON Schema. Returns clean JSON &mdash; ready for databases, spreadsheets, or downstream processing.
176
194
 
177
195
  ```
178
196
  "Extract the product name, price, and rating from this Amazon page"
@@ -180,12 +198,17 @@ Extract structured fields from any webpage using pre-built profiles or custom JS
180
198
 
181
199
  | Parameter | Type | Default | Description |
182
200
  |---|---|---|---|
183
- | `url` | string | required | URL to extract from |
184
- | `extraction_profile` | enum | `auto` | Profile: `product`, `article`, `job_posting`, `faq`, `recipe`, `event` |
201
+ | `content` | string (max 500,000) | required | HTML, text or markdown you already have (this tool does not fetch a URL) |
202
+ | `content_type` | `html` \| `text` \| `markdown` | `html` | Type of `content` |
203
+ | `extraction_profile` / `extraction_template` | enum | &mdash; | Profile: `auto`, `product`, `article`, `job_posting`, `faq`, `recipe`, `event`, `ecommerce_homepage`, `directory_listing` |
185
204
  | `extraction_schema` | object | &mdash; | Custom JSON Schema for structured output |
186
205
  | `extraction_prompt` | string | &mdash; | Natural language extraction instructions |
187
- | `render_js` | boolean | `false` | Use headless browser |
188
- | `use_proxy` | boolean | `false` | Premium proxy |
206
+ | `extraction_provider` / `extraction_model` | enum / string | &mdash; | BYOK LLM selection |
207
+ | `formats` | enum[] | `["json"]` | Output formats |
208
+ | `source_url`, `evidence` | string, boolean | &mdash; | Context URL and provenance |
209
+ | `cache`, `cache_ttl` | `auto` \| `skip` \| `only`, number | `auto` | Extraction result cache |
210
+
211
+ To scrape and extract in one step, use `alterlab_scrape` with `extraction_schema`.
189
212
 
190
213
  **Extraction profiles:**
191
214
 
@@ -209,6 +232,10 @@ Take a full-page screenshot of any URL. Returns a PNG image directly in the conv
209
232
  | `url` | string | required | URL to screenshot |
210
233
  | `wait_for` | string | &mdash; | CSS selector to wait for before capture |
211
234
  | `wait_until` | enum | `networkidle` | `networkidle`, `domcontentloaded`, or `load` |
235
+ | `timeout` | number | `90` | Timeout in seconds (1-300) |
236
+ | `use_proxy`, `proxy_country` | boolean, string | &mdash; | Premium proxy and geo-targeting |
237
+ | `session_id`, `cookies` | UUID, object | &mdash; | Screenshot pages behind a login |
238
+ | `location` | `{country, language}` | &mdash; | Geo-targeting |
212
239
 
213
240
  ### `alterlab_estimate_cost` &mdash; Estimate Before You Scrape
214
241
 
@@ -222,8 +249,14 @@ Check how much a scrape will cost before running it. Returns the predicted tier,
222
249
  |---|---|---|---|
223
250
  | `url` | string | required | URL to estimate |
224
251
  | `mode` | enum | `auto` | Scraping mode |
225
- | `render_js` | boolean | `false` | Include JS rendering cost |
226
- | `use_proxy` | boolean | `false` | Include proxy cost |
252
+ | `method` | `GET` \| `POST` | `GET` | POST costs 1.5x |
253
+ | `render_js` | boolean \| `"auto"` | `false` | Include JS rendering cost |
254
+ | `use_proxy`, `use_own_proxy` | boolean | `false` | Include proxy cost / BYOP discount |
255
+ | `screenshot`, `generate_pdf`, `ocr` | boolean | &mdash; | Include add-on cost |
256
+
257
+ ### `alterlab_get_job` &mdash; Fetch an Async Job
258
+
259
+ Fetch the status and result of a scrape that returned a `job_id` (a scrape that outlived the synchronous wait window). Parameter: `job_id` (string, required).
227
260
 
228
261
  ### `alterlab_check_balance` &mdash; Check Your Credits
229
262
 
@@ -253,8 +286,12 @@ Create a new stored session with cookies from a logged-in browser. The session i
253
286
  |---|---|---|---|
254
287
  | `name` | string | required | Human-readable name (e.g., "My Amazon Account") |
255
288
  | `domain` | string | required | Domain (e.g., "amazon.com") |
256
- | `cookies` | `Record<string, string>` | required | Cookie key-value pairs |
257
- | `user_agent` | string | &mdash; | Browser User-Agent to use with this session |
289
+ | `consent` | boolean | required | Must be `true`: explicit GDPR consent to store the cookies (the API rejects creation otherwise) |
290
+ | `cookies` | `Record<string,string>` \| cookie objects[] | &mdash; | Cookies as key-value pairs or `{name, value, domain, path, ...}` objects |
291
+ | `headers` | `Record<string,string>` | &mdash; | Custom headers (e.g. a User-Agent) |
292
+ | `expires_at`, `notes` | string | &mdash; | Expiry (ISO 8601) and notes |
293
+ | `auto_refresh_enabled`, `notify_before_expiry`, `notify_on_failure` | boolean | `true` | Health checks and notifications |
294
+ | `organization_id`, `shared` | UUID, boolean | &mdash; | Organization sharing |
258
295
 
259
296
  ### `alterlab_validate_session` &mdash; Validate a Session
260
297
 
@@ -355,15 +392,20 @@ No subscriptions. No monthly minimums. Add balance and use it whenever you need
355
392
  |---|---|---|---|
356
393
  | Curl | Direct HTTP | $0.0002 | Static pages, RSS feeds, public APIs |
357
394
  | HTTP | TLS fingerprinting | $0.0003 | Sites with basic bot detection |
358
- | Stealth | Browser impersonation | $0.0005 | Cloudflare, DataDome, PerimeterX protected sites |
359
- | Light JS | JSON extraction | $0.0007 | Server-rendered pages needing structured data |
360
- | Browser | Headless Chromium | $0.001 | Full JavaScript SPAs (React, Angular, Vue) |
395
+ | Stealth | Browser impersonation | $0.002 | Cloudflare, DataDome, PerimeterX protected sites |
396
+ | Light JS | JSON extraction | $0.0025 | Server-rendered pages needing structured data |
397
+ | Browser | Headless Chromium | $0.004 | Full JavaScript SPAs (React, Angular, Vue) |
361
398
 
362
399
  ### Optional Add-Ons
363
400
 
364
401
  | Add-On | Extra Cost | Description |
365
402
  |---|---|---|
366
- | JavaScript Rendering | +$0.0006 | Headless Chromium for dynamic content |
403
+ | JavaScript Rendering | forces Browser tier | No separate add-on: `render_js` bills the Browser tier ($0.004) |
404
+ | PDF Generation | +$0.0004 | PDF of the rendered page |
405
+ | LLM Extraction / Embeddings | +$0.001 | `extraction_schema` / `extraction_prompt`, `embeddings` |
406
+ | POST requests | x1.5 | `method: "POST"` costs 1.5x the tier price |
407
+ | Own proxy (BYOP) | -20% | `use_own_proxy` discount on the tier price |
408
+ | Search | $0.001 / $0.004 | duckduckgo / google and bing engines |
367
409
  | Screenshot Capture | +$0.0002 | Full-page PNG screenshot |
368
410
  | Premium Proxy | +$0.0002 | Geo-targeted residential proxy (195+ countries) |
369
411
  | OCR Text Extraction | +$0.001 | Extract text from images on the page |
@@ -385,7 +427,7 @@ No subscriptions. No monthly minimums. Add balance and use it whenever you need
385
427
 
386
428
  ### How do I add web scraping to Claude, Cursor, or Windsurf?
387
429
 
388
- Install the AlterLab MCP server. For Claude Code, run `claude mcp add alterlab -- npx -y alterlab-mcp-server` and set your `ALTERLAB_API_KEY`. For Claude Desktop, Cursor, or Windsurf, add the JSON config block to your MCP settings file. Once configured, your AI assistant can scrape any URL, extract structured data, and take screenshots directly in conversation.
430
+ Install the AlterLab MCP server. For Claude Code, run `claude mcp add alterlab -- npx -y alterlab-mcp-server@latest` and set your `ALTERLAB_API_KEY`. For Claude Desktop, Cursor, or Windsurf, add the JSON config block to your MCP settings file. Once configured, your AI assistant can scrape any URL, extract structured data, and take screenshots directly in conversation.
389
431
 
390
432
  ### Can Claude scrape websites that are behind Cloudflare or anti-bot protection?
391
433
 
@@ -393,11 +435,11 @@ Yes. AlterLab automatically handles Cloudflare, DataDome, PerimeterX, Akamai, an
393
435
 
394
436
  ### What is an MCP server and how does it work with Claude?
395
437
 
396
- MCP (Model Context Protocol) is Anthropic's open standard for connecting AI assistants to external tools and data sources. An MCP server is a small program that exposes tools &mdash; like web scraping &mdash; that Claude, Cursor, or Windsurf can call during a conversation. The AlterLab MCP server gives your AI assistant 5 tools: scrape, extract, screenshot, estimate cost, and check balance.
438
+ MCP (Model Context Protocol) is Anthropic's open standard for connecting AI assistants to external tools and data sources. An MCP server is a small program that exposes tools &mdash; like web scraping &mdash; that Claude, Cursor, or Windsurf can call during a conversation. The AlterLab MCP server gives your AI assistant 23 tools: scrape, extract, screenshot, crawl, search, map, batch scraping, session management, beta features, and more.
397
439
 
398
440
  ### How is AlterLab different from Firecrawl, ScrapingBee, or Apify MCP servers?
399
441
 
400
- AlterLab starts at $0.0002 per request &mdash; 5-20x cheaper than most scraping APIs &mdash; because it only uses expensive browser rendering when a site actually requires it. Smart tier escalation means you pay for what each site needs, not the maximum. AlterLab also includes built-in structured data extraction with pre-built profiles (product, article, job posting, etc.) at no extra cost.
442
+ AlterLab starts at $0.0002 per request &mdash; 5-20x cheaper than most scraping APIs &mdash; because it only uses expensive browser rendering when a site actually requires it. Smart tier escalation means you pay for what each site needs, not the maximum. AlterLab also includes built-in structured data extraction with pre-built profiles (product, article, job posting, etc.).
401
443
 
402
444
  ### Can I scrape Amazon, Walmart, and other e-commerce sites from Claude?
403
445
 
@@ -421,7 +463,7 @@ Free-tier accounts have rate limits. Adding any balance removes rate limits. The
421
463
 
422
464
  ### Can I use this MCP server for large-scale scraping?
423
465
 
424
- Yes. The MCP server processes one request at a time through the conversation interface, but you can build agentic workflows that scrape many URLs sequentially. For batch processing, use the AlterLab API directly or the [n8n integration](https://www.npmjs.com/package/n8n-nodes-alterlab).
466
+ Yes. For parallel scraping, use `alterlab_batch` to scrape up to 100 URLs in a single request — much faster than sequential calls. For crawling entire domains, use `alterlab_crawl`. You can also build agentic workflows that scrape many URLs sequentially, or use the [n8n integration](https://www.npmjs.com/package/n8n-nodes-alterlab) for workflow automation.
425
467
 
426
468
  ---
427
469
 
package/dist/auth.d.ts ADDED
@@ -0,0 +1,30 @@
1
+ /**
2
+ * OAuth 2.0 Device Authorization Grant (RFC 8628) client-side flow.
3
+ *
4
+ * Authentication priority chain:
5
+ * 1. ALTERLAB_API_KEY environment variable
6
+ * 2. ~/.alterlab/config.json
7
+ * 3. Interactive auth (TTY only):
8
+ * a. 5-second countdown — press any key to switch to manual paste
9
+ * b. Device flow (POST /auth/device → open browser → poll /auth/token)
10
+ * c. Fallback: manual API key paste
11
+ *
12
+ * All user-facing output goes to stderr — stdout is reserved for MCP protocol.
13
+ */
14
+ import { type Config } from "./config.js";
15
+ /**
16
+ * Ensure a valid AlterLab API key is available and return a Config object.
17
+ *
18
+ * Resolution order:
19
+ * 1. ALTERLAB_API_KEY environment variable
20
+ * 2. ~/.alterlab/config.json
21
+ * 3. Interactive auth (only when running in a TTY):
22
+ * a. 5-second countdown — press any key to switch to manual paste
23
+ * b. OAuth 2.0 Device Authorization Grant flow (if countdown expires)
24
+ * c. Manual API key paste (if keypress during countdown, or device flow fails)
25
+ *
26
+ * When not running in a TTY (e.g., as an MCP server subprocess), emits a
27
+ * helpful error on stderr and exits with code 1 if no key is found.
28
+ */
29
+ export declare function ensureAuth(): Promise<Config>;
30
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,OAAO,EACL,KAAK,MAAM,EAKZ,MAAM,aAAa,CAAC;AAuXrB;;;;;;;;;;;;;GAaG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CA0FlD"}