@hunt-labs/bytekit-mcp 0.1.1 → 0.1.3
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.
- package/CHANGELOG.md +65 -0
- package/LICENSE +21 -0
- package/README.md +117 -0
- package/dist/cli.d.ts +18 -2
- package/dist/cli.js +21 -4
- package/dist/client.d.ts +7 -29
- package/dist/client.js +1 -6
- package/dist/docs-bundle/docs-bundle.json +53 -63
- package/dist/docs-bundle/helpers.d.ts +0 -1
- package/dist/docs-bundle/helpers.js +0 -1
- package/dist/docs-bundle/load-bundle.d.ts +0 -1
- package/dist/docs-bundle/load-bundle.js +0 -1
- package/dist/http.d.ts +0 -1
- package/dist/http.js +0 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +12 -2
- package/dist/lib/truncate.d.ts +0 -1
- package/dist/lib/truncate.js +0 -1
- package/dist/prompts/extract-structured-data.d.ts +0 -1
- package/dist/prompts/extract-structured-data.js +0 -1
- package/dist/prompts/research-topic.d.ts +0 -1
- package/dist/prompts/research-topic.js +0 -1
- package/dist/prompts/summarize-webpage.d.ts +0 -1
- package/dist/prompts/summarize-webpage.js +0 -1
- package/dist/resources/account.d.ts +0 -1
- package/dist/resources/account.js +0 -1
- package/dist/resources/screenshot.d.ts +0 -1
- package/dist/resources/screenshot.js +0 -1
- package/dist/scrape-contract.generated.d.ts +166 -0
- package/dist/scrape-contract.generated.js +9 -0
- package/dist/tools/get-account.d.ts +0 -1
- package/dist/tools/get-account.js +0 -1
- package/dist/tools/get-doc.d.ts +0 -1
- package/dist/tools/get-doc.js +0 -1
- package/dist/tools/get-result.d.ts +0 -1
- package/dist/tools/get-result.js +0 -1
- package/dist/tools/list-docs.d.ts +0 -1
- package/dist/tools/list-docs.js +0 -1
- package/dist/tools/scrape-url.d.ts +0 -1
- package/dist/tools/scrape-url.js +48 -8
- package/dist/tools/screenshot-url.d.ts +0 -1
- package/dist/tools/screenshot-url.js +0 -1
- package/dist/tools/search-docs.d.ts +0 -1
- package/dist/tools/search-docs.js +0 -1
- package/dist/tools/web-search.d.ts +1 -2
- package/dist/tools/web-search.js +2 -3
- package/package.json +37 -17
- package/dist/__tests__/build-docs-bundle.test.d.ts +0 -2
- package/dist/__tests__/build-docs-bundle.test.d.ts.map +0 -1
- package/dist/__tests__/build-docs-bundle.test.js +0 -133
- package/dist/__tests__/build-docs-bundle.test.js.map +0 -1
- package/dist/__tests__/cli.test.d.ts +0 -2
- package/dist/__tests__/cli.test.d.ts.map +0 -1
- package/dist/__tests__/cli.test.js +0 -73
- package/dist/__tests__/cli.test.js.map +0 -1
- package/dist/__tests__/client.test.d.ts +0 -2
- package/dist/__tests__/client.test.d.ts.map +0 -1
- package/dist/__tests__/client.test.js +0 -248
- package/dist/__tests__/client.test.js.map +0 -1
- package/dist/__tests__/integration.test.d.ts +0 -2
- package/dist/__tests__/integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration.test.js +0 -116
- package/dist/__tests__/integration.test.js.map +0 -1
- package/dist/__tests__/package-manifest.test.d.ts +0 -2
- package/dist/__tests__/package-manifest.test.d.ts.map +0 -1
- package/dist/__tests__/package-manifest.test.js +0 -71
- package/dist/__tests__/package-manifest.test.js.map +0 -1
- package/dist/__tests__/prompts.test.d.ts +0 -2
- package/dist/__tests__/prompts.test.d.ts.map +0 -1
- package/dist/__tests__/prompts.test.js +0 -92
- package/dist/__tests__/prompts.test.js.map +0 -1
- package/dist/__tests__/resources.test.d.ts +0 -2
- package/dist/__tests__/resources.test.d.ts.map +0 -1
- package/dist/__tests__/resources.test.js +0 -67
- package/dist/__tests__/resources.test.js.map +0 -1
- package/dist/__tests__/server-info.test.d.ts +0 -2
- package/dist/__tests__/server-info.test.d.ts.map +0 -1
- package/dist/__tests__/server-info.test.js +0 -14
- package/dist/__tests__/server-info.test.js.map +0 -1
- package/dist/__tests__/tools.test.d.ts +0 -2
- package/dist/__tests__/tools.test.d.ts.map +0 -1
- package/dist/__tests__/tools.test.js +0 -452
- package/dist/__tests__/tools.test.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/docs-bundle/helpers.d.ts.map +0 -1
- package/dist/docs-bundle/helpers.js.map +0 -1
- package/dist/docs-bundle/load-bundle.d.ts.map +0 -1
- package/dist/docs-bundle/load-bundle.js.map +0 -1
- package/dist/http.d.ts.map +0 -1
- package/dist/http.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/truncate.d.ts.map +0 -1
- package/dist/lib/truncate.js.map +0 -1
- package/dist/prompts/extract-structured-data.d.ts.map +0 -1
- package/dist/prompts/extract-structured-data.js.map +0 -1
- package/dist/prompts/research-topic.d.ts.map +0 -1
- package/dist/prompts/research-topic.js.map +0 -1
- package/dist/prompts/summarize-webpage.d.ts.map +0 -1
- package/dist/prompts/summarize-webpage.js.map +0 -1
- package/dist/resources/account.d.ts.map +0 -1
- package/dist/resources/account.js.map +0 -1
- package/dist/resources/screenshot.d.ts.map +0 -1
- package/dist/resources/screenshot.js.map +0 -1
- package/dist/tools/__tests__/docs-tools.test.d.ts +0 -8
- package/dist/tools/__tests__/docs-tools.test.d.ts.map +0 -1
- package/dist/tools/__tests__/docs-tools.test.js +0 -194
- package/dist/tools/__tests__/docs-tools.test.js.map +0 -1
- package/dist/tools/__tests__/fixture-bundle.json +0 -27
- package/dist/tools/get-account.d.ts.map +0 -1
- package/dist/tools/get-account.js.map +0 -1
- package/dist/tools/get-doc.d.ts.map +0 -1
- package/dist/tools/get-doc.js.map +0 -1
- package/dist/tools/get-result.d.ts.map +0 -1
- package/dist/tools/get-result.js.map +0 -1
- package/dist/tools/list-docs.d.ts.map +0 -1
- package/dist/tools/list-docs.js.map +0 -1
- package/dist/tools/scrape-url.d.ts.map +0 -1
- package/dist/tools/scrape-url.js.map +0 -1
- package/dist/tools/screenshot-url.d.ts.map +0 -1
- package/dist/tools/screenshot-url.js.map +0 -1
- package/dist/tools/search-docs.d.ts.map +0 -1
- package/dist/tools/search-docs.js.map +0 -1
- package/dist/tools/web-search.d.ts.map +0 -1
- package/dist/tools/web-search.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@hunt-labs/bytekit-mcp` are documented here.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
This file records only the delta between versions. For how to use the package
|
|
9
|
+
today, see [README.md](./README.md), which remains the authoritative usage guide.
|
|
10
|
+
|
|
11
|
+
## [0.1.3] - 2026-07-16
|
|
12
|
+
|
|
13
|
+
### Changed (**BREAKING**)
|
|
14
|
+
|
|
15
|
+
- The MCP tool `web-search` is renamed to `web_search` (snake_case, consistent
|
|
16
|
+
with every other tool). MCP clients bound to the old `web-search` name must
|
|
17
|
+
update. (#2421)
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- The 401 error message now references `BYTEKIT_API_KEY`; `--base-url` now falls
|
|
22
|
+
back to the `BYTEKIT_BASE_URL` environment variable when no flag is passed. (#2421)
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- The bundled offline docs (`get_doc`/`list_docs`/`search_docs`) now teach the
|
|
27
|
+
correct `@hunt-labs/bytekit-sdk` install/import name instead of the dead
|
|
28
|
+
`@bytekit/sdk` scope. (#2449)
|
|
29
|
+
|
|
30
|
+
## [0.1.2] - 2026-07-15
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- `scrape_url` now reads the snake_case envelope fields the API actually returns
|
|
35
|
+
(`id`, `final_url`, `status_code`); the published 0.1.1 tarball read the old
|
|
36
|
+
camelCase fields (`scrapeId`, `finalUrl`, `statusCode`), so every metadata line
|
|
37
|
+
rendered `undefined` (#2419).
|
|
38
|
+
- The MCP handshake `serverInfo.version` is now derived from `package.json` instead
|
|
39
|
+
of a hardcoded literal, so it can never drift from the published version (#2419).
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
|
|
43
|
+
- Compiled test code and fixtures are excluded from the published tarball — only
|
|
44
|
+
runtime `dist/**` (plus `README.md`, `LICENSE`, and now `CHANGELOG.md`) ships (#2419).
|
|
45
|
+
|
|
46
|
+
## [0.1.1] - 2026-07 [DEPRECATED]
|
|
47
|
+
|
|
48
|
+
### Note
|
|
49
|
+
|
|
50
|
+
- Superseded by 0.1.2. This release shipped stale `scrape_url` metadata rendering
|
|
51
|
+
(camelCase fields the API no longer returned) and included compiled test code in
|
|
52
|
+
the tarball. Upgrade to 0.1.2 or later.
|
|
53
|
+
|
|
54
|
+
## [0.1.0] - 2026-07
|
|
55
|
+
|
|
56
|
+
### Added
|
|
57
|
+
|
|
58
|
+
- Initial release of the ByteKit MCP server, exposing ByteKit web-data tools
|
|
59
|
+
(scrape, screenshot, search, docs) to AI agents over the Model Context Protocol,
|
|
60
|
+
as a local stdio server or hosted.
|
|
61
|
+
|
|
62
|
+
[0.1.3]: https://github.com/Hunt-Labs-Inc/ByteKit/tree/main/packages/mcp-server
|
|
63
|
+
[0.1.2]: https://github.com/Hunt-Labs-Inc/ByteKit/tree/main/packages/mcp-server
|
|
64
|
+
[0.1.1]: https://github.com/Hunt-Labs-Inc/ByteKit/tree/main/packages/mcp-server
|
|
65
|
+
[0.1.0]: https://github.com/Hunt-Labs-Inc/ByteKit/tree/main/packages/mcp-server
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Hunt Labs, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# @hunt-labs/bytekit-mcp
|
|
2
|
+
|
|
3
|
+
The [ByteKit](https://bytekit.com) **MCP server** exposes scraping, search,
|
|
4
|
+
screenshots, and account lookups as
|
|
5
|
+
[Model Context Protocol](https://modelcontextprotocol.io) tools. Your agent calls
|
|
6
|
+
`scrape_url` or `screenshot_url` the same way it calls any other tool — no
|
|
7
|
+
wrapper to write, no headless browser to manage.
|
|
8
|
+
|
|
9
|
+
There are two ways to connect: a **hosted HTTP endpoint** (nothing to install)
|
|
10
|
+
and a **local stdio server** (`npx @hunt-labs/bytekit-mcp`).
|
|
11
|
+
|
|
12
|
+
## Authentication
|
|
13
|
+
|
|
14
|
+
Both paths authenticate with a ByteKit API key. Sign up at
|
|
15
|
+
[app.bytekit.com](https://app.bytekit.com) and create a key (prefixed
|
|
16
|
+
`sk_live_`). The local server reads it from the `BYTEKIT_API_KEY` environment
|
|
17
|
+
variable (or the `--api-key` flag); the hosted endpoint takes it as a bearer
|
|
18
|
+
token.
|
|
19
|
+
|
|
20
|
+
## Option 1 — Hosted HTTP (no install)
|
|
21
|
+
|
|
22
|
+
Point any MCP client that speaks the Streamable HTTP transport at:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
https://api.bytekit.com/mcp
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Send your API key as a bearer token. Example client config (Claude Desktop,
|
|
29
|
+
Cursor, and most hosts accept this shape):
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"mcpServers": {
|
|
34
|
+
"bytekit": {
|
|
35
|
+
"url": "https://api.bytekit.com/mcp",
|
|
36
|
+
"headers": {
|
|
37
|
+
"Authorization": "Bearer $BYTEKIT_API_KEY"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Option 2 — Local stdio (`npx`)
|
|
45
|
+
|
|
46
|
+
Run the server as a local subprocess over stdio. Nothing to install globally —
|
|
47
|
+
`npx` fetches it on demand:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npx @hunt-labs/bytekit-mcp --api-key $BYTEKIT_API_KEY
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Or set the key in your environment and omit the flag:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
export BYTEKIT_API_KEY=sk_live_xxx
|
|
57
|
+
npx @hunt-labs/bytekit-mcp
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Client config for a stdio server (`claude_desktop_config.json` and equivalents):
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"mcpServers": {
|
|
65
|
+
"bytekit": {
|
|
66
|
+
"command": "npx",
|
|
67
|
+
"args": ["-y", "@hunt-labs/bytekit-mcp"],
|
|
68
|
+
"env": {
|
|
69
|
+
"BYTEKIT_API_KEY": "sk_live_xxx"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### CLI flags
|
|
77
|
+
|
|
78
|
+
| Flag | Purpose |
|
|
79
|
+
| ------------------ | --------------------------------------------------------------------------------------- |
|
|
80
|
+
| `--api-key <key>` | ByteKit API key. |
|
|
81
|
+
| `--base-url <url>` | API base URL (default `https://api.bytekit.com`) — point at staging or a local gateway. |
|
|
82
|
+
| `--verbose` | Log requests to stderr. |
|
|
83
|
+
| `--help` | Show usage. |
|
|
84
|
+
|
|
85
|
+
### API-key resolution order
|
|
86
|
+
|
|
87
|
+
The local server resolves the key in this order, so a legacy setup keeps
|
|
88
|
+
working:
|
|
89
|
+
|
|
90
|
+
1. `--api-key <key>` flag
|
|
91
|
+
2. `BYTEKIT_API_KEY` environment variable
|
|
92
|
+
3. `RAPIDCRAWL_API_KEY` environment variable (legacy fallback)
|
|
93
|
+
|
|
94
|
+
## Tool inventory
|
|
95
|
+
|
|
96
|
+
| Tool | What it does |
|
|
97
|
+
| ---------------- | -------------------------------------------------------------- |
|
|
98
|
+
| `scrape_url` | Fetch a URL and return HTML, clean markdown, links, or images. |
|
|
99
|
+
| `web-search` | Run a web search and return ranked organic results. |
|
|
100
|
+
| `screenshot_url` | Capture a screenshot of a page (desktop/mobile, PNG/JPEG). |
|
|
101
|
+
| `get_result` | Fetch a previously created screenshot by id. |
|
|
102
|
+
| `get_account` | Return account details, plan, and current usage/quota. |
|
|
103
|
+
| `list_docs` | List every page in the bundled ByteKit documentation. |
|
|
104
|
+
| `search_docs` | Search the bundled documentation. |
|
|
105
|
+
| `get_doc` | Fetch the full markdown of one documentation page. |
|
|
106
|
+
|
|
107
|
+
The server also exposes **resources** (`bytekit://account`,
|
|
108
|
+
`bytekit://screenshot/{id}`) and **prompts** (`summarize_webpage`,
|
|
109
|
+
`extract_structured_data`, `research_topic`) that MCP hosts can surface directly.
|
|
110
|
+
|
|
111
|
+
## Documentation
|
|
112
|
+
|
|
113
|
+
Full MCP guide: [bytekit.com/docs/mcp](https://bytekit.com/docs/mcp).
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
MIT — see [LICENSE](./LICENSE).
|
package/dist/cli.d.ts
CHANGED
|
@@ -24,10 +24,26 @@ export declare function resolveApiKey(opts: {
|
|
|
24
24
|
env: Record<string, string | undefined>;
|
|
25
25
|
}): string | undefined;
|
|
26
26
|
export declare const API_KEY_REQUIRED_MESSAGE = "Error: API key required. Use --api-key or set the BYTEKIT_API_KEY environment variable.\n";
|
|
27
|
-
|
|
27
|
+
/** The API host the server defaults to when no flag and no env var resolve a base URL. */
|
|
28
|
+
export declare const DEFAULT_BASE_URL = "https://api.bytekit.com";
|
|
29
|
+
/**
|
|
30
|
+
* Resolve the API base URL from, in precedence order:
|
|
31
|
+
* 1. the `--base-url` flag
|
|
32
|
+
* 2. the `BYTEKIT_BASE_URL` env var
|
|
33
|
+
* 3. the built-in {@link DEFAULT_BASE_URL}
|
|
34
|
+
*
|
|
35
|
+
* Mirrors {@link resolveApiKey}'s shape (empty/absent flag falls through). This is the single
|
|
36
|
+
* base-URL resolution site for the binary; the `parseArgs` option deliberately carries NO
|
|
37
|
+
* `default:` so an absent flag yields `undefined` here rather than shadowing the env fallback.
|
|
38
|
+
* The MCP server never had a legacy `RAPIDCRAWL_BASE_URL` var, so none is honored.
|
|
39
|
+
*/
|
|
40
|
+
export declare function resolveBaseUrl(opts: {
|
|
41
|
+
flag?: string | undefined;
|
|
42
|
+
env: Record<string, string | undefined>;
|
|
43
|
+
}): string;
|
|
44
|
+
export declare const HELP_TEXT = "ByteKit MCP Server\n\nUsage:\n bytekit-mcp --api-key <key> [--base-url <url>] [--verbose]\n\nOptions:\n --api-key ByteKit API key. Resolution order: --api-key flag, then\n BYTEKIT_API_KEY, then RAPIDCRAWL_API_KEY (legacy fallback).\n --base-url API base URL. Resolution order: --base-url flag, then\n BYTEKIT_BASE_URL (default: https://api.bytekit.com)\n --verbose Log requests to stderr\n --help Show this help message\n";
|
|
28
45
|
/**
|
|
29
46
|
* True when this module is the process entrypoint (run directly or via its bin),
|
|
30
47
|
* false when it is merely imported (e.g. the test suite exercising resolveApiKey).
|
|
31
48
|
*/
|
|
32
49
|
export declare function isEntrypoint(argv1: string | undefined, moduleUrl: string): boolean;
|
|
33
|
-
//# sourceMappingURL=cli.d.ts.map
|
package/dist/cli.js
CHANGED
|
@@ -29,6 +29,23 @@ export function resolveApiKey(opts) {
|
|
|
29
29
|
return flag ?? opts.env['BYTEKIT_API_KEY'] ?? opts.env['RAPIDCRAWL_API_KEY'];
|
|
30
30
|
}
|
|
31
31
|
export const API_KEY_REQUIRED_MESSAGE = 'Error: API key required. Use --api-key or set the BYTEKIT_API_KEY environment variable.\n';
|
|
32
|
+
/** The API host the server defaults to when no flag and no env var resolve a base URL. */
|
|
33
|
+
export const DEFAULT_BASE_URL = 'https://api.bytekit.com';
|
|
34
|
+
/**
|
|
35
|
+
* Resolve the API base URL from, in precedence order:
|
|
36
|
+
* 1. the `--base-url` flag
|
|
37
|
+
* 2. the `BYTEKIT_BASE_URL` env var
|
|
38
|
+
* 3. the built-in {@link DEFAULT_BASE_URL}
|
|
39
|
+
*
|
|
40
|
+
* Mirrors {@link resolveApiKey}'s shape (empty/absent flag falls through). This is the single
|
|
41
|
+
* base-URL resolution site for the binary; the `parseArgs` option deliberately carries NO
|
|
42
|
+
* `default:` so an absent flag yields `undefined` here rather than shadowing the env fallback.
|
|
43
|
+
* The MCP server never had a legacy `RAPIDCRAWL_BASE_URL` var, so none is honored.
|
|
44
|
+
*/
|
|
45
|
+
export function resolveBaseUrl(opts) {
|
|
46
|
+
const flag = opts.flag && opts.flag.length > 0 ? opts.flag : undefined;
|
|
47
|
+
return flag ?? opts.env['BYTEKIT_BASE_URL'] ?? DEFAULT_BASE_URL;
|
|
48
|
+
}
|
|
32
49
|
export const HELP_TEXT = `ByteKit MCP Server
|
|
33
50
|
|
|
34
51
|
Usage:
|
|
@@ -37,7 +54,8 @@ Usage:
|
|
|
37
54
|
Options:
|
|
38
55
|
--api-key ByteKit API key. Resolution order: --api-key flag, then
|
|
39
56
|
BYTEKIT_API_KEY, then RAPIDCRAWL_API_KEY (legacy fallback).
|
|
40
|
-
--base-url API base URL
|
|
57
|
+
--base-url API base URL. Resolution order: --base-url flag, then
|
|
58
|
+
BYTEKIT_BASE_URL (default: https://api.bytekit.com)
|
|
41
59
|
--verbose Log requests to stderr
|
|
42
60
|
--help Show this help message
|
|
43
61
|
`;
|
|
@@ -45,7 +63,7 @@ async function main() {
|
|
|
45
63
|
const { values } = parseArgs({
|
|
46
64
|
options: {
|
|
47
65
|
'api-key': { type: 'string' },
|
|
48
|
-
'base-url': { type: 'string'
|
|
66
|
+
'base-url': { type: 'string' },
|
|
49
67
|
verbose: { type: 'boolean', default: false },
|
|
50
68
|
help: { type: 'boolean', default: false },
|
|
51
69
|
},
|
|
@@ -62,7 +80,7 @@ async function main() {
|
|
|
62
80
|
}
|
|
63
81
|
const client = new BytekitClient({
|
|
64
82
|
apiKey,
|
|
65
|
-
baseUrl: values['base-url'],
|
|
83
|
+
baseUrl: resolveBaseUrl({ flag: values['base-url'], env: process.env }),
|
|
66
84
|
verbose: values.verbose,
|
|
67
85
|
});
|
|
68
86
|
const server = createServer(client);
|
|
@@ -99,4 +117,3 @@ export function isEntrypoint(argv1, moduleUrl) {
|
|
|
99
117
|
if (isEntrypoint(process.argv[1], import.meta.url)) {
|
|
100
118
|
await main();
|
|
101
119
|
}
|
|
102
|
-
//# sourceMappingURL=cli.js.map
|
package/dist/client.d.ts
CHANGED
|
@@ -1,39 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ByteKit API client -- thin fetch wrapper used by all MCP tools.
|
|
3
|
-
* Uses native fetch (Node
|
|
3
|
+
* Uses native fetch (Node 18+). No external HTTP dependencies.
|
|
4
|
+
*
|
|
5
|
+
* The package's declared floor is Node >=18.3 (see package.json `engines`), set by
|
|
6
|
+
* `parseArgs` from node:util in src/cli.ts -- not by fetch, and not by anything requiring Node 22.
|
|
4
7
|
*/
|
|
5
|
-
|
|
8
|
+
import type { Format, ScrapeEnvelope } from './scrape-contract.generated.js';
|
|
9
|
+
export type ScrapeFormat = Format;
|
|
6
10
|
export interface ScrapeParams {
|
|
7
11
|
url: string;
|
|
8
12
|
formats?: ScrapeFormat[] | undefined;
|
|
9
13
|
country?: string | undefined;
|
|
10
14
|
}
|
|
11
|
-
export
|
|
12
|
-
status: 'success';
|
|
13
|
-
scrapeId: string;
|
|
14
|
-
url: string;
|
|
15
|
-
finalUrl: string;
|
|
16
|
-
contentType: string;
|
|
17
|
-
contentLength: number;
|
|
18
|
-
statusCode: number | null;
|
|
19
|
-
retrievedAt: string;
|
|
20
|
-
formats: {
|
|
21
|
-
rawHtml?: string | undefined;
|
|
22
|
-
html?: string | undefined;
|
|
23
|
-
markdown?: string | undefined;
|
|
24
|
-
links?: string[] | undefined;
|
|
25
|
-
images?: string[] | undefined;
|
|
26
|
-
};
|
|
27
|
-
metadata: {
|
|
28
|
-
title: string | null;
|
|
29
|
-
description: string | null;
|
|
30
|
-
language: string | null;
|
|
31
|
-
canonicalUrl: string | null;
|
|
32
|
-
ogTitle: string | null;
|
|
33
|
-
ogDescription: string | null;
|
|
34
|
-
ogImage: string | null;
|
|
35
|
-
};
|
|
36
|
-
}
|
|
15
|
+
export type ScrapeResult = ScrapeEnvelope;
|
|
37
16
|
/** Which search index to query. `web` (default), `news`, or `images`. */
|
|
38
17
|
export type SearchType = 'web' | 'news' | 'images';
|
|
39
18
|
/** Recency window for search results (maps to the upstream time filter). */
|
|
@@ -156,4 +135,3 @@ export declare class BytekitClient {
|
|
|
156
135
|
private get;
|
|
157
136
|
private handleErrorResponse;
|
|
158
137
|
}
|
|
159
|
-
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ByteKit API client -- thin fetch wrapper used by all MCP tools.
|
|
3
|
-
* Uses native fetch (Node 22+). No external HTTP dependencies.
|
|
4
|
-
*/
|
|
5
1
|
// ============================================================
|
|
6
2
|
// Error
|
|
7
3
|
// ============================================================
|
|
@@ -137,7 +133,7 @@ export class BytekitClient {
|
|
|
137
133
|
async handleErrorResponse(response) {
|
|
138
134
|
const status = response.status;
|
|
139
135
|
if (status === 401) {
|
|
140
|
-
throw new BytekitApiError('Invalid API key. Check your
|
|
136
|
+
throw new BytekitApiError('Invalid API key. Check your BYTEKIT_API_KEY.', 401, 'invalid_api_key');
|
|
141
137
|
}
|
|
142
138
|
if (status === 402) {
|
|
143
139
|
throw new BytekitApiError('Bandwidth quota exhausted. Check usage with get_account.', 402, 'quota_exceeded');
|
|
@@ -164,4 +160,3 @@ export class BytekitClient {
|
|
|
164
160
|
throw new BytekitApiError(`Unexpected API error (HTTP ${status}).`, status, 'unknown_error');
|
|
165
161
|
}
|
|
166
162
|
}
|
|
167
|
-
//# sourceMappingURL=client.js.map
|