@hunt-labs/bytekit-mcp 0.1.1 → 0.1.2
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/LICENSE +21 -0
- package/README.md +117 -0
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -1
- package/dist/client.d.ts +7 -29
- package/dist/client.js +0 -5
- package/dist/docs-bundle/docs-bundle.json +46 -46
- 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 +0 -1
- package/dist/tools/web-search.js +0 -1
- package/package.json +34 -9
- 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/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Creates an McpServer instance with all tools, resources, and prompts registered.
|
|
5
5
|
* Used by both the CLI (stdio transport) and the gateway (HTTP transport).
|
|
6
6
|
*/
|
|
7
|
+
import { createRequire } from 'node:module';
|
|
7
8
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
8
9
|
// Tools
|
|
9
10
|
import { scrapeUrlTool } from './tools/scrape-url.js';
|
|
@@ -21,6 +22,16 @@ import { screenshotResource } from './resources/screenshot.js';
|
|
|
21
22
|
import { summarizeWebpagePrompt } from './prompts/summarize-webpage.js';
|
|
22
23
|
import { extractStructuredDataPrompt } from './prompts/extract-structured-data.js';
|
|
23
24
|
import { researchTopicPrompt } from './prompts/research-topic.js';
|
|
25
|
+
// Resolve the version from package.json at runtime so the handshake can never drift
|
|
26
|
+
// from the published manifest (issue #2419 — 0.1.1 advertised "0.1.0" because the
|
|
27
|
+
// literal was bumped independently of package.json). `../package.json` resolves to the
|
|
28
|
+
// package root from BOTH src/index.ts (dev/vitest) and dist/index.js (published
|
|
29
|
+
// tarball), so no build-time codegen is needed. Same pattern as packages/cli.
|
|
30
|
+
const require = createRequire(import.meta.url);
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
32
|
+
const pkg = require('../package.json');
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
34
|
+
const packageVersion = typeof pkg.version === 'string' ? pkg.version : '0.0.0';
|
|
24
35
|
/**
|
|
25
36
|
* Server identity advertised over the MCP `initialize` handshake. Exported so
|
|
26
37
|
* the name/version contract is unit-testable without a live server (issue #2066;
|
|
@@ -28,7 +39,7 @@ import { researchTopicPrompt } from './prompts/research-topic.js';
|
|
|
28
39
|
*/
|
|
29
40
|
export const serverInfo = {
|
|
30
41
|
name: 'bytekit',
|
|
31
|
-
version:
|
|
42
|
+
version: packageVersion,
|
|
32
43
|
};
|
|
33
44
|
export function createServer(client) {
|
|
34
45
|
const server = new McpServer({
|
|
@@ -55,4 +66,3 @@ export function createServer(client) {
|
|
|
55
66
|
}
|
|
56
67
|
// Re-export client for convenience
|
|
57
68
|
export { BytekitClient } from './client.js';
|
|
58
|
-
//# sourceMappingURL=index.js.map
|
package/dist/lib/truncate.d.ts
CHANGED
package/dist/lib/truncate.js
CHANGED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
export type Format = 'rawHtml' | 'html' | 'markdown' | 'links' | 'images';
|
|
2
|
+
/**
|
|
3
|
+
* Contract generation emitted by every newly produced scrape envelope.
|
|
4
|
+
*
|
|
5
|
+
* This requirement applies to producer-created `ScrapeEnvelope` values. JSON
|
|
6
|
+
* persisted by an older deployment may omit `schema_version`; readers at
|
|
7
|
+
* cache and webhook-delivery boundaries must keep that data loosely typed and
|
|
8
|
+
* treat the missing marker as legacy v0 instead of coercing it to this union.
|
|
9
|
+
*/
|
|
10
|
+
export declare const SCRAPE_ENVELOPE_SCHEMA_VERSION = 1;
|
|
11
|
+
export type ScrapeEnvelopeSchemaVersion = typeof SCRAPE_ENVELOPE_SCHEMA_VERSION;
|
|
12
|
+
export interface ScrapeScoredLink {
|
|
13
|
+
url: string;
|
|
14
|
+
text: string;
|
|
15
|
+
isInternal: boolean;
|
|
16
|
+
rel: string | null;
|
|
17
|
+
}
|
|
18
|
+
export interface ScrapeScoredImage {
|
|
19
|
+
url: string;
|
|
20
|
+
alt: string | null;
|
|
21
|
+
width: number | null;
|
|
22
|
+
height: number | null;
|
|
23
|
+
format: string | null;
|
|
24
|
+
score: number;
|
|
25
|
+
}
|
|
26
|
+
export interface ScrapeTable {
|
|
27
|
+
kind: 'data' | 'layout-unwrapped' | 'lossy';
|
|
28
|
+
gfm: string | null;
|
|
29
|
+
rows: number;
|
|
30
|
+
cols: number;
|
|
31
|
+
}
|
|
32
|
+
export interface ScrapeWarning {
|
|
33
|
+
code: 'lossy_table' | 'complex_math' | 'unsupported_element' | 'extraction_fallback' | 'truncated' | 'query_no_match' | 'mode_disabled_fallback' | 'artifact_unavailable' | 'llm_clean_unavailable' | 'llm_clean_failed' | 'low_quality_extraction' | 'fragment_menu_stripped';
|
|
34
|
+
message: string;
|
|
35
|
+
element: string | null;
|
|
36
|
+
}
|
|
37
|
+
export interface ScrapeStats {
|
|
38
|
+
chars: number;
|
|
39
|
+
tokens: number;
|
|
40
|
+
blocks: number;
|
|
41
|
+
}
|
|
42
|
+
export type ScrapeEnvelopeErrorCode = 'validation_error' | 'request_too_large' | 'quota_exhausted' | 'payload_too_large' | 'unsupported_content_type' | 'rate_limited' | 'upstream_error' | 'timeout' | 'blocked' | 'internal_error';
|
|
43
|
+
export interface ScrapeFormats {
|
|
44
|
+
/** Raw HTML format (#1535: renamed from rawHtml in the response key). */
|
|
45
|
+
raw_html?: string;
|
|
46
|
+
html?: string;
|
|
47
|
+
markdown?: string;
|
|
48
|
+
links?: string[] | ScrapeScoredLink[];
|
|
49
|
+
images?: string[] | ScrapeScoredImage[];
|
|
50
|
+
}
|
|
51
|
+
export interface ScrapeMetadata {
|
|
52
|
+
title?: string | null;
|
|
53
|
+
description?: string | null;
|
|
54
|
+
language?: string | null;
|
|
55
|
+
canonicalUrl?: string | null;
|
|
56
|
+
ogTitle?: string | null;
|
|
57
|
+
ogDescription?: string | null;
|
|
58
|
+
ogImage?: string | null;
|
|
59
|
+
ogUrl?: string | null;
|
|
60
|
+
ogSiteName?: string | null;
|
|
61
|
+
robots?: string | null;
|
|
62
|
+
byline: string | null;
|
|
63
|
+
publishedAt: string | null;
|
|
64
|
+
}
|
|
65
|
+
export interface ScrapeSuccessEnvelope {
|
|
66
|
+
schema_version: ScrapeEnvelopeSchemaVersion;
|
|
67
|
+
status: 'success';
|
|
68
|
+
/**
|
|
69
|
+
* Stable job identifier (sc_… prefixed). Canonical field (#1232).
|
|
70
|
+
*/
|
|
71
|
+
id: string;
|
|
72
|
+
url: string;
|
|
73
|
+
/** Final URL after redirects (#1535: renamed from finalUrl). */
|
|
74
|
+
final_url: string;
|
|
75
|
+
/** Content-Type header value (#1535: renamed from contentType). */
|
|
76
|
+
content_type: string;
|
|
77
|
+
/** Compressed wire bytes — billing basis (#1535: renamed from contentLength). */
|
|
78
|
+
content_length: number;
|
|
79
|
+
/** Upstream HTTP status (#1535: renamed from statusCode). */
|
|
80
|
+
status_code: number | null;
|
|
81
|
+
/** ISO timestamp of retrieval (#1535: renamed from retrievedAt). */
|
|
82
|
+
retrieved_at: string;
|
|
83
|
+
formats: ScrapeFormats;
|
|
84
|
+
metadata: ScrapeMetadata;
|
|
85
|
+
tables?: ScrapeTable[];
|
|
86
|
+
warnings?: ScrapeWarning[];
|
|
87
|
+
stats?: ScrapeStats;
|
|
88
|
+
/**
|
|
89
|
+
* User-supplied passthrough payload (issue #129). Distinct from `metadata`,
|
|
90
|
+
* which is system-extracted from the HTML head. Emitted only when the
|
|
91
|
+
* caller passes a non-empty record — empty `{}` and undefined both omit.
|
|
92
|
+
*/
|
|
93
|
+
custom?: Record<string, unknown>;
|
|
94
|
+
/**
|
|
95
|
+
* Cache verdict for the request that produced this envelope (issue #830).
|
|
96
|
+
* `hit` — served from a prior cache entry (billed at 0.5×).
|
|
97
|
+
* `miss` — freshly fetched and written to cache.
|
|
98
|
+
* `bypass` — `cache_ttl: '0'` skipped the read (still written).
|
|
99
|
+
* Emitted only when the producing path threads a cache verdict; omitted
|
|
100
|
+
* otherwise so consumers that predate the field (and the bulk-rehydrate
|
|
101
|
+
* path, which has no cache verdict) see no new key.
|
|
102
|
+
*/
|
|
103
|
+
cache?: 'miss' | 'hit' | 'bypass';
|
|
104
|
+
/**
|
|
105
|
+
* Age in whole seconds of the cache entry replayed on a `hit` (issue #830).
|
|
106
|
+
* Clamped to ≥ 0 to absorb clock skew. Present only on `cache: 'hit'`.
|
|
107
|
+
*/
|
|
108
|
+
cache_age_s?: number;
|
|
109
|
+
/**
|
|
110
|
+
* Token-budget accounting (issue #872). Present only when `token_budget` was
|
|
111
|
+
* supplied in the request. Contains `kept` (tokens in the returned markdown),
|
|
112
|
+
* `total` (tokens in the full pre-truncation markdown), and `truncated`
|
|
113
|
+
* (whether the output was cut). Absent on uncapped requests to avoid noise.
|
|
114
|
+
*/
|
|
115
|
+
markdown_tokens?: {
|
|
116
|
+
kept: number;
|
|
117
|
+
total: number;
|
|
118
|
+
truncated: boolean;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Per-call billing multiplier for this scrape (1.0 base, +0.5/billable format).
|
|
122
|
+
* Matches the X-Billing-Multiplier header 1:1, and equals the
|
|
123
|
+
* X-Scrape-Credits-Charged header and the persisted credits_charged column.
|
|
124
|
+
* NOTE: pre-clean_markdown-multiplier; on clean_markdown:true the final billed
|
|
125
|
+
* usage is 3x this. Omitted on paths with no billing value (issue #1899).
|
|
126
|
+
*/
|
|
127
|
+
billing_multiplier?: number;
|
|
128
|
+
/**
|
|
129
|
+
* Metered wire bytes for this call = round(content_length x billing_multiplier).
|
|
130
|
+
* Same value as the X-Billable-Bytes header (pre-clean_markdown-multiplier, like
|
|
131
|
+
* the header). Omitted on paths with no billing value (issue #1899).
|
|
132
|
+
*/
|
|
133
|
+
billed_bytes?: number;
|
|
134
|
+
}
|
|
135
|
+
export interface ScrapeErrorEnvelope {
|
|
136
|
+
schema_version: ScrapeEnvelopeSchemaVersion;
|
|
137
|
+
status: 'failed';
|
|
138
|
+
/** Stable job identifier (sc_… prefixed). Canonical field (#1232; queued/error migrated #1971). */
|
|
139
|
+
id: string;
|
|
140
|
+
error: {
|
|
141
|
+
code: ScrapeEnvelopeErrorCode;
|
|
142
|
+
message: string;
|
|
143
|
+
/** Upstream HTTP status (#1971: renamed from httpStatus). Strict-optional — omitted when absent. */
|
|
144
|
+
http_status?: number;
|
|
145
|
+
/** ISO timestamp of failure (#1971: renamed from failedAt). */
|
|
146
|
+
failed_at: string;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
export interface ScrapeQueuedEnvelope {
|
|
150
|
+
schema_version: ScrapeEnvelopeSchemaVersion;
|
|
151
|
+
status: 'queued';
|
|
152
|
+
/** Stable job identifier (sc_… prefixed). Canonical field (#1232; queued/error migrated #1971). */
|
|
153
|
+
id: string;
|
|
154
|
+
url: string;
|
|
155
|
+
/** Status-poll URL (#1971: renamed from statusUrl). */
|
|
156
|
+
status_url: string;
|
|
157
|
+
/** ISO timestamp of enqueue (#1971: renamed from queuedAt). */
|
|
158
|
+
queued_at: string;
|
|
159
|
+
events: string[];
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Newly produced envelopes are v1 and use `status` as their shape
|
|
163
|
+
* discriminator. Stored JSON without `schema_version` is legacy v0 data and
|
|
164
|
+
* remains valid only at explicit read/delivery boundaries typed more loosely.
|
|
165
|
+
*/
|
|
166
|
+
export type ScrapeEnvelope = ScrapeSuccessEnvelope | ScrapeErrorEnvelope | ScrapeQueuedEnvelope;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract generation emitted by every newly produced scrape envelope.
|
|
3
|
+
*
|
|
4
|
+
* This requirement applies to producer-created `ScrapeEnvelope` values. JSON
|
|
5
|
+
* persisted by an older deployment may omit `schema_version`; readers at
|
|
6
|
+
* cache and webhook-delivery boundaries must keep that data loosely typed and
|
|
7
|
+
* treat the missing marker as legacy v0 instead of coercing it to this union.
|
|
8
|
+
*/
|
|
9
|
+
export const SCRAPE_ENVELOPE_SCHEMA_VERSION = 1;
|
package/dist/tools/get-doc.d.ts
CHANGED
package/dist/tools/get-doc.js
CHANGED
package/dist/tools/get-result.js
CHANGED
package/dist/tools/list-docs.js
CHANGED
package/dist/tools/scrape-url.js
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { truncateContent } from '../lib/truncate.js';
|
|
3
|
+
function renderLinks(links) {
|
|
4
|
+
return links
|
|
5
|
+
.map((link) => typeof link === 'string' ? link : `${link.url}${link.text ? ` — ${link.text}` : ''}`)
|
|
6
|
+
.join('\n');
|
|
7
|
+
}
|
|
8
|
+
function renderImages(images) {
|
|
9
|
+
return images
|
|
10
|
+
.map((image) => typeof image === 'string' ? image : `${image.url}${image.alt ? ` — ${image.alt}` : ''}`)
|
|
11
|
+
.join('\n');
|
|
12
|
+
}
|
|
3
13
|
export function scrapeUrlTool(server, client) {
|
|
4
14
|
server.tool('scrape_url', 'Scrape a webpage and return its content. Returns markdown by default. Use the formats parameter to request additional representations (rawHtml, html, links, images).', {
|
|
5
15
|
url: z.string().url().describe('The URL to scrape'),
|
|
@@ -16,15 +26,46 @@ export function scrapeUrlTool(server, client) {
|
|
|
16
26
|
formats,
|
|
17
27
|
...(params.country !== undefined && { country: params.country }),
|
|
18
28
|
});
|
|
29
|
+
if (result.status === 'queued') {
|
|
30
|
+
return {
|
|
31
|
+
content: [
|
|
32
|
+
{
|
|
33
|
+
type: 'text',
|
|
34
|
+
text: [
|
|
35
|
+
`ID: ${result.id}`,
|
|
36
|
+
'Status: queued',
|
|
37
|
+
`URL: ${result.url}`,
|
|
38
|
+
`Status URL: ${result.status_url}`,
|
|
39
|
+
].join('\n'),
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (result.status === 'failed') {
|
|
45
|
+
return {
|
|
46
|
+
isError: true,
|
|
47
|
+
content: [
|
|
48
|
+
{
|
|
49
|
+
type: 'text',
|
|
50
|
+
text: [
|
|
51
|
+
`ID: ${result.id}`,
|
|
52
|
+
'Status: failed',
|
|
53
|
+
`Error: ${result.error.code}`,
|
|
54
|
+
result.error.message,
|
|
55
|
+
].join('\n'),
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
}
|
|
19
60
|
// Primary content for display: prefer markdown → html → rawHtml
|
|
20
|
-
const content = result.formats.markdown ?? result.formats.html ?? result.formats.
|
|
61
|
+
const content = result.formats.markdown ?? result.formats.html ?? result.formats.raw_html ?? '';
|
|
21
62
|
const { text, truncated } = truncateContent(content);
|
|
22
63
|
const metaLines = [
|
|
23
|
-
`ID: ${result.
|
|
64
|
+
`ID: ${result.id}`,
|
|
24
65
|
`URL: ${result.url}`,
|
|
25
|
-
result.
|
|
26
|
-
result.
|
|
27
|
-
result.
|
|
66
|
+
result.final_url !== result.url ? `Final URL: ${result.final_url}` : null,
|
|
67
|
+
result.status_code !== null ? `Status Code: ${result.status_code}` : null,
|
|
68
|
+
result.content_type ? `Content-Type: ${result.content_type}` : null,
|
|
28
69
|
result.metadata.title ? `Title: ${result.metadata.title}` : null,
|
|
29
70
|
truncated ? 'Note: Content was truncated to 100KB' : null,
|
|
30
71
|
]
|
|
@@ -33,12 +74,12 @@ export function scrapeUrlTool(server, client) {
|
|
|
33
74
|
let body = `${metaLines}\n\n---\n\n${text}`;
|
|
34
75
|
// Append links block when present
|
|
35
76
|
if (Array.isArray(result.formats.links) && result.formats.links.length > 0) {
|
|
36
|
-
const linkList = result.formats.links
|
|
77
|
+
const linkList = renderLinks(result.formats.links);
|
|
37
78
|
body += `\n\nLinks (${result.formats.links.length}):\n${linkList}`;
|
|
38
79
|
}
|
|
39
80
|
// Append images block when present
|
|
40
81
|
if (Array.isArray(result.formats.images) && result.formats.images.length > 0) {
|
|
41
|
-
const imgList = result.formats.images
|
|
82
|
+
const imgList = renderImages(result.formats.images);
|
|
42
83
|
body += `\n\nImages (${result.formats.images.length}):\n${imgList}`;
|
|
43
84
|
}
|
|
44
85
|
return {
|
|
@@ -54,4 +95,3 @@ export function scrapeUrlTool(server, client) {
|
|
|
54
95
|
}
|
|
55
96
|
});
|
|
56
97
|
}
|
|
57
|
-
//# sourceMappingURL=scrape-url.js.map
|
package/dist/tools/web-search.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hunt-labs/bytekit-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "ByteKit MCP server — exposes ByteKit web-data tools (scrape, screenshot, search, docs) to AI agents over the Model Context Protocol, hosted or as a local stdio server.",
|
|
5
|
+
"license": "MIT",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"publishConfig": {
|
|
7
8
|
"access": "public"
|
|
@@ -21,14 +22,35 @@
|
|
|
21
22
|
],
|
|
22
23
|
"exports": {
|
|
23
24
|
".": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"import": "./dist/index.js"
|
|
26
27
|
},
|
|
27
28
|
"./http": {
|
|
28
|
-
"
|
|
29
|
-
"
|
|
29
|
+
"types": "./dist/http.d.ts",
|
|
30
|
+
"import": "./dist/http.js"
|
|
30
31
|
}
|
|
31
32
|
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=18.3"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"bytekit",
|
|
38
|
+
"data-extraction",
|
|
39
|
+
"web-data",
|
|
40
|
+
"mcp",
|
|
41
|
+
"model-context-protocol",
|
|
42
|
+
"mcp-server",
|
|
43
|
+
"scraping",
|
|
44
|
+
"web-scraping",
|
|
45
|
+
"screenshot",
|
|
46
|
+
"llm",
|
|
47
|
+
"ai-agents",
|
|
48
|
+
"claude"
|
|
49
|
+
],
|
|
50
|
+
"homepage": "https://bytekit.com/mcp/",
|
|
51
|
+
"bugs": {
|
|
52
|
+
"email": "support@bytekit.com"
|
|
53
|
+
},
|
|
32
54
|
"dependencies": {
|
|
33
55
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
34
56
|
"zod": "^3.23.6"
|
|
@@ -41,9 +63,12 @@
|
|
|
41
63
|
"@bytekit/docs": "0.0.1"
|
|
42
64
|
},
|
|
43
65
|
"scripts": {
|
|
44
|
-
"prebuild": "tsx scripts/build-docs-bundle.ts",
|
|
45
|
-
"build": "tsc && mkdir -p dist/docs-bundle && cp src/docs-bundle/docs-bundle.json dist/docs-bundle/docs-bundle.json",
|
|
46
|
-
"typecheck": "tsc --noEmit",
|
|
47
|
-
"test": "vitest run"
|
|
66
|
+
"prebuild": "pnpm check:scrape-contract && tsx scripts/build-docs-bundle.ts",
|
|
67
|
+
"build": "rm -rf dist tsconfig.tsbuildinfo && tsc && mkdir -p dist/docs-bundle && cp src/docs-bundle/docs-bundle.json dist/docs-bundle/docs-bundle.json",
|
|
68
|
+
"typecheck": "pnpm check:scrape-contract && tsc --noEmit && tsc --noEmit -p tsconfig.scripts.json",
|
|
69
|
+
"test": "pnpm check:scrape-contract && vitest run && pnpm test:package",
|
|
70
|
+
"generate:scrape-contract": "tsx scripts/sync-scrape-contract.ts",
|
|
71
|
+
"check:scrape-contract": "tsx scripts/sync-scrape-contract.ts --check",
|
|
72
|
+
"test:package": "tsx scripts/test-package-boundary.ts"
|
|
48
73
|
}
|
|
49
74
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-docs-bundle.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/build-docs-bundle.test.ts"],"names":[],"mappings":""}
|