blitzscout 0.0.0-stage → 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Blitzscout
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 CHANGED
@@ -1,3 +1,21 @@
1
- # Temporary Holding Version
1
+ # blitzscout (JavaScript)
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Client for the [Blitzscout API](https://www.blitzscout.io/developers): which MCP servers for online commerce are reachable, how reliable they have been, and what changed. No dependencies, Node 18+.
4
+
5
+ ```js
6
+ import { Blitzscout } from 'blitzscout';
7
+
8
+ const bs = new Blitzscout(process.env.BLITZSCOUT_KEY); // free key: https://www.blitzscout.io/account/api
9
+
10
+ // The most reliable Shopify servers
11
+ const { items } = await bs.servers({ platform: 'shopify', reliable: true, sort: 'score', limit: 5 });
12
+
13
+ // Before connecting an agent to a server
14
+ const [s] = (await bs.statusBatch(['some-server'])).items;
15
+ if (s.found && s.reliable) { /* connect */ }
16
+
17
+ // What went down in the last day among the servers you depend on
18
+ const { items: events } = await bs.changes({ since: new Date(Date.now() - 864e5), slugs: ['a', 'b'], type: 'down' });
19
+ ```
20
+
21
+ A 429 is retried after the wait the API asks for (`retries` option). `bs.remaining` holds the calls left today. Errors are `BlitzscoutError` with `status` and `code`.
package/index.d.ts ADDED
@@ -0,0 +1,35 @@
1
+ export class BlitzscoutError extends Error {
2
+ status: number;
3
+ code: string;
4
+ }
5
+
6
+ export interface ServerListParams {
7
+ q?: string; platform?: string; capability?: string; category?: string;
8
+ auth?: 'oauth' | 'token' | 'unknown' | 'none';
9
+ install_only?: boolean; min_readiness?: number; min_score?: number; reliable?: boolean;
10
+ sort?: 'name' | 'score'; tasks?: 'passing'; include?: 'tool_names'; page?: number; limit?: number;
11
+ }
12
+
13
+ export interface ServerStatus {
14
+ slug: string; found: boolean; state: 'online' | 'auth' | 'offline' | null; reachable: boolean | null;
15
+ checked_at: string | null; latency_ms: number | null; uptime_30d: number | null;
16
+ score: number | null; reliable: boolean; tools_count: number | null; tools_changed_at: string | null;
17
+ }
18
+
19
+ export type Json = Record<string, any>;
20
+
21
+ export class Blitzscout {
22
+ constructor(apiKey: string, options?: { baseUrl?: string; retries?: number; fetch?: typeof fetch });
23
+ remaining: number | null;
24
+ servers(params?: ServerListParams): Promise<{ total: number; page: number; limit: number; items: Json[] }>;
25
+ server(slug: string): Promise<Json>;
26
+ tools(slug: string): Promise<Json>;
27
+ health(slug: string, days?: number): Promise<Json>;
28
+ status(slug: string): Promise<Json>;
29
+ statusBatch(slugs: string[]): Promise<{ items: ServerStatus[] }>;
30
+ changes(opts?: { since?: string | Date; limit?: number; slugs?: string[]; type?: 'down' | 'up' | 'tools_changed' }): Promise<Json>;
31
+ platforms(): Promise<Json>;
32
+ allServers(params?: ServerListParams): AsyncGenerator<Json>;
33
+ reliableAmong(slugs: string[]): Promise<string[]>;
34
+ }
35
+ export default Blitzscout;
package/index.js ADDED
@@ -0,0 +1,88 @@
1
+ // Blitzscout API client. No dependencies; needs fetch (Node 18+, browsers, Deno, Bun).
2
+ // Docs: https://www.blitzscout.io/developers
3
+
4
+ export class BlitzscoutError extends Error {
5
+ constructor(status, code, message) {
6
+ super(message);
7
+ this.name = 'BlitzscoutError';
8
+ this.status = status;
9
+ this.code = code;
10
+ }
11
+ }
12
+
13
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
14
+
15
+ export class Blitzscout {
16
+ /**
17
+ * @param {string} apiKey your key, "bsk_..." (free at https://www.blitzscout.io/account/api)
18
+ * @param {{ baseUrl?: string, retries?: number, fetch?: typeof fetch }} [options]
19
+ * retries: how many times to wait and retry after a 429 (default 2, never more than 60 s each)
20
+ */
21
+ constructor(apiKey, options = {}) {
22
+ if (!apiKey) throw new Error('Blitzscout: an API key is needed');
23
+ this.apiKey = apiKey;
24
+ this.baseUrl = (options.baseUrl ?? 'https://www.blitzscout.io/api/v1').replace(/\/$/, '');
25
+ this.retries = options.retries ?? 2;
26
+ this._fetch = options.fetch ?? globalThis.fetch;
27
+ /** Calls left today, from the last answer. */
28
+ this.remaining = null;
29
+ }
30
+
31
+ async _get(path, params = {}) {
32
+ const url = new URL(this.baseUrl + path);
33
+ for (const [k, v] of Object.entries(params)) {
34
+ if (v === undefined || v === null) continue;
35
+ url.searchParams.set(k, Array.isArray(v) ? v.join(',') : String(v));
36
+ }
37
+ for (let attempt = 0; ; attempt++) {
38
+ const res = await this._fetch(url, { headers: { Authorization: `Bearer ${this.apiKey}`, Accept: 'application/json' } });
39
+ const left = res.headers.get('x-ratelimit-remaining');
40
+ if (left !== null) this.remaining = Number(left);
41
+ if (res.status === 429 && attempt < this.retries) {
42
+ const wait = Math.min(Number(res.headers.get('retry-after')) || 5, 60);
43
+ await res.body?.cancel?.();
44
+ await sleep(wait * 1000);
45
+ continue;
46
+ }
47
+ const body = await res.json().catch(() => null);
48
+ if (!res.ok) throw new BlitzscoutError(res.status, body?.error?.code ?? 'error', body?.error?.message ?? `HTTP ${res.status}`);
49
+ return body.data;
50
+ }
51
+ }
52
+
53
+ /** Search the catalogue. Params: q, platform, capability, category, auth, install_only, min_readiness, min_score, reliable, sort, tasks, include, page, limit. */
54
+ servers(params) { return this._get('/servers', params); }
55
+ server(slug) { return this._get(`/servers/${encodeURIComponent(slug)}`); }
56
+ tools(slug) { return this._get(`/servers/${encodeURIComponent(slug)}/tools`); }
57
+ health(slug, days) { return this._get(`/servers/${encodeURIComponent(slug)}/health`, { days }); }
58
+ /** Reachable now? availability, latency, score, whether it counts as reliable. */
59
+ status(slug) { return this._get(`/servers/${encodeURIComponent(slug)}/status`); }
60
+ /** The short status of up to 50 servers in one call. */
61
+ statusBatch(slugs) { return this._get('/status', { slugs }); }
62
+ /** What changed since a time (ISO string or Date): servers down or back, tool changes. */
63
+ changes({ since, limit, slugs, type } = {}) {
64
+ return this._get('/changes', { since: since instanceof Date ? since.toISOString() : since, limit, slugs, type });
65
+ }
66
+ platforms() { return this._get('/platforms'); }
67
+
68
+ /** Walks every page of a search. */
69
+ async *allServers(params = {}) {
70
+ for (let page = 1; ; page++) {
71
+ const data = await this.servers({ ...params, page, limit: 100 });
72
+ yield* data.items;
73
+ if (page * data.limit >= data.total) return;
74
+ }
75
+ }
76
+
77
+ /** Among these slugs, the ones that are reliable right now. */
78
+ async reliableAmong(slugs) {
79
+ const out = [];
80
+ for (let i = 0; i < slugs.length; i += 50) {
81
+ const { items } = await this.statusBatch(slugs.slice(i, i + 50));
82
+ out.push(...items.filter((s) => s.found && s.reliable).map((s) => s.slug));
83
+ }
84
+ return out;
85
+ }
86
+ }
87
+
88
+ export default Blitzscout;
package/package.json CHANGED
@@ -1,6 +1,14 @@
1
1
  {
2
2
  "name": "blitzscout",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Client for the Blitzscout API: which MCP servers for online commerce are reachable, how reliable they have been, and what changed.",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "types": "index.d.ts",
8
+ "exports": { ".": { "types": "./index.d.ts", "default": "./index.js" } },
9
+ "files": ["index.js", "index.d.ts", "README.md", "LICENSE"],
10
+ "engines": { "node": ">=18" },
11
+ "license": "MIT",
12
+ "homepage": "https://www.blitzscout.io/developers",
13
+ "keywords": ["mcp", "model-context-protocol", "ecommerce", "agents", "uptime"]
14
+ }