@agishub/mcp 2.1.1 → 2.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.
Files changed (3) hide show
  1. package/README.md +8 -2
  2. package/dist/stdio.js +183 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -4,6 +4,8 @@
4
4
 
5
5
  **Pay-per-call tools for AI agents — no signup, no API keys, just USDC.**
6
6
 
7
+ ### ▶ [Try any tool live in your browser — no install](https://api.agishub.com/try)
8
+
7
9
  Live data & utilities over [x402](https://x402.org) micropayments on **Base**. Your agent
8
10
  pays a few tenths of a cent per call from its own wallet; no accounts, no monthly plans.
9
11
 
@@ -53,7 +55,7 @@ Discovery: https://api.agishub.com/openapi.json
53
55
 
54
56
  ## Tools
55
57
 
56
- **30 tools across 12 services.** Prices are per call in USDC on Base. Tools marked
58
+ **34 tools across 12 services.** Prices are per call in USDC on Base. Tools marked
57
59
  **MCP · HTTP** are **free via MCP** and pay‑per‑call via **HTTP x402**; tools marked **HTTP**
58
60
  are paid‑only (they touch metered infrastructure, so they run exclusively on the x402 endpoint).
59
61
 
@@ -71,11 +73,15 @@ are paid‑only (they touch metered infrastructure, so they run exclusively on t
71
73
  | `is_holiday` | Is a date a public holiday in a country (ISO 3166‑1)? Authoritative public‑holiday data. | MCP · HTTP | $0.001 |
72
74
  | `list_timezones` | List or search valid IANA timezone names. | MCP | free |
73
75
 
74
- ### 🕸️ Web — read any web page as clean markdown
76
+ ### 🕸️ Web — read, scrape & extract from any page
75
77
 
76
78
  | Tool | What it does | Channels | Cost (x402) |
77
79
  |------|--------------|:--------:|:-----------:|
78
80
  | `extract` | Fetch any public URL and return its main content as clean, token‑efficient markdown (title, headings, links, lists). Optional `render:true` runs a headless browser for JS‑heavy pages / SPAs. Built for RAG. | MCP · HTTP | **$0.004** |
81
+ | `scrape` | Extract specific elements from a JS‑rendered page by CSS selector — text and attributes of every match. Backed by a headless browser, so it works on SPAs. | HTTP | $0.004 |
82
+ | `structured` | AI‑powered structured extraction: give a URL plus a prompt and/or a JSON Schema and get back clean structured JSON (e.g. product name, price, rating). | HTTP | $0.006 |
83
+ | `snapshot` | Capture several representations in one call — rendered HTML, a PNG screenshot, and optional markdown & accessibility tree. | HTTP | $0.008 |
84
+ | `links` | Return every hyperlink on a JS‑rendered page as absolute URLs, with visible‑only and same‑site filters. | HTTP | $0.002 |
79
85
 
80
86
  ### 🤖 AI — NLP & generation (no external API key)
81
87
 
package/dist/stdio.js CHANGED
@@ -36083,6 +36083,27 @@ var extract = external_exports.object({
36083
36083
  include_images: external_exports.boolean().optional().describe("Keep images as markdown (default false)."),
36084
36084
  max_chars: external_exports.number().int().positive().optional().describe("Truncate the markdown to at most this many characters (sets truncated:true).")
36085
36085
  });
36086
+ var scrape = external_exports.object({
36087
+ url: external_exports.string().url().describe("Full http/https URL of the page to scrape."),
36088
+ selectors: external_exports.array(external_exports.string().min(1)).min(1).max(20).describe("CSS selectors to extract, e.g. ['h1', 'a.product', '.price']. Returns the text and attributes of every match per selector.")
36089
+ });
36090
+ var links = external_exports.object({
36091
+ url: external_exports.string().url().describe("Full http/https URL of the page to read links from."),
36092
+ visible_only: external_exports.boolean().optional().describe("Return only links visible in the rendered layout (default false)."),
36093
+ exclude_external: external_exports.boolean().optional().describe("Drop links pointing to other domains, keeping only same-site links (default false).")
36094
+ });
36095
+ var structured = external_exports.object({
36096
+ url: external_exports.string().url().describe("Full http/https URL of the page to extract data from."),
36097
+ prompt: external_exports.string().optional().describe("Natural-language instruction of what to extract, e.g. 'the product name, price and rating'. Provide this and/or a schema."),
36098
+ schema: external_exports.record(external_exports.any()).optional().describe("Optional JSON Schema object describing the exact shape of the data to return. When given, the output is constrained to it.")
36099
+ });
36100
+ var snapshot = external_exports.object({
36101
+ url: external_exports.string().url().describe("Full http/https URL to capture."),
36102
+ formats: external_exports.array(external_exports.enum(["html", "screenshot", "markdown", "accessibilityTree"])).optional().describe("Which representations to return (default ['html','screenshot']). Add 'markdown' and/or 'accessibilityTree' as needed."),
36103
+ full_page: external_exports.boolean().optional().describe("Capture the full scrollable page in the screenshot instead of just the viewport (default false)."),
36104
+ width: external_exports.number().int().positive().optional().describe("Viewport width in pixels (default 1280)."),
36105
+ height: external_exports.number().int().positive().optional().describe("Viewport height in pixels (default 800).")
36106
+ });
36086
36107
 
36087
36108
  // src/services/web/core/extract.ts
36088
36109
  var import_node_html_parser = __toESM(require_dist2(), 1);
@@ -36416,6 +36437,117 @@ async function extract2(opts, env2) {
36416
36437
  };
36417
36438
  }
36418
36439
 
36440
+ // src/services/web/core/quickactions.ts
36441
+ var TIMEOUT_MS = 3e4;
36442
+ var QuickActionError = class extends Error {
36443
+ };
36444
+ function assertPublicHttpUrl2(raw) {
36445
+ let u;
36446
+ try {
36447
+ u = new URL(raw);
36448
+ } catch {
36449
+ throw new QuickActionError("URL inv\xE1lida.");
36450
+ }
36451
+ if (u.protocol !== "http:" && u.protocol !== "https:") {
36452
+ throw new QuickActionError("Solo se admiten URLs http/https.");
36453
+ }
36454
+ const host = u.hostname.toLowerCase().replace(/^\[|\]$/g, "");
36455
+ const isPrivate = host === "localhost" || host.endsWith(".localhost") || host.endsWith(".internal") || host === "::1" || /^(0\.|127\.|10\.|192\.168\.|169\.254\.)/.test(host) || /^172\.(1[6-9]|2\d|3[01])\./.test(host);
36456
+ if (isPrivate) throw new QuickActionError("Host no permitido (red interna).");
36457
+ return u.toString();
36458
+ }
36459
+ async function callJson(env2, endpoint, body) {
36460
+ const token = env2?.CF_API_TOKEN;
36461
+ const acct = env2?.CF_ACCOUNT_ID;
36462
+ if (!token || !acct) {
36463
+ throw new QuickActionError(
36464
+ "Browser Rendering is not configured (missing CF_API_TOKEN / CF_ACCOUNT_ID)."
36465
+ );
36466
+ }
36467
+ const ctrl = new AbortController();
36468
+ const timer2 = setTimeout(() => ctrl.abort(), TIMEOUT_MS);
36469
+ try {
36470
+ const res = await fetch(
36471
+ `https://api.cloudflare.com/client/v4/accounts/${acct}/browser-rendering/${endpoint}`,
36472
+ {
36473
+ method: "POST",
36474
+ signal: ctrl.signal,
36475
+ headers: { authorization: `Bearer ${token}`, "content-type": "application/json" },
36476
+ body: JSON.stringify(body)
36477
+ }
36478
+ );
36479
+ const data = await res.json().catch(() => null);
36480
+ if (!res.ok || !data || data.success === false) {
36481
+ const detail = data?.errors ? JSON.stringify(data.errors).slice(0, 240) : `HTTP ${res.status}`;
36482
+ throw new QuickActionError(`Browser Rendering ${endpoint} failed: ${detail}`);
36483
+ }
36484
+ return data.result;
36485
+ } catch (e) {
36486
+ if (e instanceof QuickActionError) throw e;
36487
+ throw new QuickActionError(
36488
+ `Browser Rendering ${endpoint} error: ${e instanceof Error ? e.message : String(e)}`
36489
+ );
36490
+ } finally {
36491
+ clearTimeout(timer2);
36492
+ }
36493
+ }
36494
+ async function scrape2(o, env2) {
36495
+ const url = assertPublicHttpUrl2(o.url);
36496
+ const groups = await callJson(env2, "scrape", {
36497
+ url,
36498
+ elements: o.selectors.map((selector) => ({ selector }))
36499
+ });
36500
+ const elements = (groups || []).map((g) => ({
36501
+ selector: g.selector,
36502
+ count: g.results?.length ?? 0,
36503
+ matches: (g.results || []).map((m) => ({
36504
+ text: (m.text || "").trim(),
36505
+ attributes: Object.fromEntries((m.attributes || []).map((a) => [a.name, a.value]))
36506
+ }))
36507
+ }));
36508
+ return { url, elements, scraped_at: (/* @__PURE__ */ new Date()).toISOString() };
36509
+ }
36510
+ async function links2(o, env2) {
36511
+ const url = assertPublicHttpUrl2(o.url);
36512
+ const result = await callJson(env2, "links", {
36513
+ url,
36514
+ visibleLinksOnly: !!o.visible_only,
36515
+ excludeExternalLinks: !!o.exclude_external
36516
+ });
36517
+ const list = Array.isArray(result) ? result : [];
36518
+ return { url, count: list.length, links: list, fetched_at: (/* @__PURE__ */ new Date()).toISOString() };
36519
+ }
36520
+ async function structured2(o, env2) {
36521
+ const url = assertPublicHttpUrl2(o.url);
36522
+ if (!o.prompt && !o.schema) {
36523
+ throw new QuickActionError("Provide a 'prompt' and/or a JSON 'schema' describing what to extract.");
36524
+ }
36525
+ const body = { url };
36526
+ if (o.prompt) body.prompt = o.prompt;
36527
+ if (o.schema) body.response_format = { type: "json_schema", json_schema: o.schema };
36528
+ const data = await callJson(env2, "json", body);
36529
+ return { url, data, extracted_at: (/* @__PURE__ */ new Date()).toISOString() };
36530
+ }
36531
+ async function snapshot2(o, env2) {
36532
+ const url = assertPublicHttpUrl2(o.url);
36533
+ const formats = o.formats && o.formats.length ? o.formats : ["html", "screenshot"];
36534
+ const body = {
36535
+ url,
36536
+ formats,
36537
+ viewport: { width: o.width || 1280, height: o.height || 800 },
36538
+ screenshotOptions: { fullPage: !!o.full_page, type: "png" }
36539
+ };
36540
+ const r = await callJson(env2, "snapshot", body);
36541
+ const out = { url, formats, captured_at: (/* @__PURE__ */ new Date()).toISOString() };
36542
+ if (r.content != null) out.html = r.content;
36543
+ if (r.markdown != null) out.markdown = r.markdown;
36544
+ if (r.accessibilityTree != null) out.accessibility_tree = r.accessibilityTree;
36545
+ if (r.screenshot) {
36546
+ out.screenshot = { mime: "image/png", base64: r.screenshot, data_uri: `data:image/png;base64,${r.screenshot}` };
36547
+ }
36548
+ return out;
36549
+ }
36550
+
36419
36551
  // src/services/web/handlers.ts
36420
36552
  async function extract3(ctx) {
36421
36553
  const { url, render, include_links, include_images, max_chars } = ctx.input;
@@ -36432,10 +36564,26 @@ async function extract3(ctx) {
36432
36564
  }
36433
36565
  return result;
36434
36566
  }
36567
+ function scrape3(ctx) {
36568
+ return scrape2(ctx.input, ctx.env);
36569
+ }
36570
+ function links3(ctx) {
36571
+ return links2(ctx.input, ctx.env);
36572
+ }
36573
+ function structured3(ctx) {
36574
+ return structured2(ctx.input, ctx.env);
36575
+ }
36576
+ function snapshot3(ctx) {
36577
+ return snapshot2(ctx.input, ctx.env);
36578
+ }
36435
36579
 
36436
36580
  // src/services/web/operations.ts
36437
36581
  var operations2 = {
36438
- extract: defineOperation(extract, extract3)
36582
+ extract: defineOperation(extract, extract3),
36583
+ scrape: defineOperation(scrape, scrape3),
36584
+ links: defineOperation(links, links3),
36585
+ structured: defineOperation(structured, structured3),
36586
+ snapshot: defineOperation(snapshot, snapshot3)
36439
36587
  };
36440
36588
 
36441
36589
  // src/services/web/index.ts
@@ -36460,7 +36608,7 @@ var screenshot = external_exports.object({
36460
36608
  });
36461
36609
 
36462
36610
  // src/services/render/core/browser.ts
36463
- var TIMEOUT_MS = 3e4;
36611
+ var TIMEOUT_MS2 = 3e4;
36464
36612
  var RenderError = class extends Error {
36465
36613
  };
36466
36614
  async function callBinary(env2, endpoint, body) {
@@ -36470,7 +36618,7 @@ async function callBinary(env2, endpoint, body) {
36470
36618
  throw new RenderError("Browser Rendering is not configured (missing CF_API_TOKEN / CF_ACCOUNT_ID).");
36471
36619
  }
36472
36620
  const ctrl = new AbortController();
36473
- const timer2 = setTimeout(() => ctrl.abort(), TIMEOUT_MS);
36621
+ const timer2 = setTimeout(() => ctrl.abort(), TIMEOUT_MS2);
36474
36622
  try {
36475
36623
  const res = await fetch(
36476
36624
  `https://api.cloudflare.com/client/v4/accounts/${acct}/browser-rendering/${endpoint}`,
@@ -57687,6 +57835,38 @@ var catalog = {
57687
57835
  httpPath: "web-scraper",
57688
57836
  tags: ["web", "scrape", "markdown", "rag", "reader"],
57689
57837
  description: "Fetch any public web page and return its main content as clean, token-efficient Markdown (title, description, headings, links, lists). Set render:true to execute JavaScript first for single-page apps or JS-heavy pages that would otherwise come back empty. Built for RAG and for agents that need to read the contents of a URL."
57838
+ },
57839
+ scrape: {
57840
+ channels: ["http"],
57841
+ pricing: { x402: "$0.004" },
57842
+ visibility: "public",
57843
+ httpPath: "scrape",
57844
+ tags: ["web", "scrape", "selectors", "extract", "html"],
57845
+ description: "Extract specific elements from a JavaScript-rendered page by CSS selector. Give a list of selectors (e.g. 'h1', '.price', 'a.product') and get back the text and attributes of every match. Backed by a headless browser, so it works on SPAs and JS-heavy pages."
57846
+ },
57847
+ links: {
57848
+ channels: ["http"],
57849
+ pricing: { x402: "$0.002" },
57850
+ visibility: "public",
57851
+ httpPath: "links",
57852
+ tags: ["web", "links", "crawl", "urls"],
57853
+ description: "Return every hyperlink on a JavaScript-rendered page as a list of absolute URLs, with options to keep only visible links or only same-site links. Backed by a headless browser. Use it to map a site or seed a crawler."
57854
+ },
57855
+ structured: {
57856
+ channels: ["http"],
57857
+ pricing: { x402: "$0.006" },
57858
+ visibility: "public",
57859
+ httpPath: "extract-json",
57860
+ tags: ["web", "ai", "extract", "structured", "json"],
57861
+ description: "AI-powered structured extraction: give a URL plus a natural-language prompt and/or a JSON Schema, and get back clean structured JSON (e.g. product name, price, rating). Renders the page in a headless browser first, so it works on SPAs."
57862
+ },
57863
+ snapshot: {
57864
+ channels: ["http"],
57865
+ pricing: { x402: "$0.008" },
57866
+ visibility: "public",
57867
+ httpPath: "snapshot",
57868
+ tags: ["web", "snapshot", "html", "screenshot", "markdown"],
57869
+ description: "Capture several representations of a page in one call \u2014 rendered HTML plus a PNG screenshot by default, and optionally Markdown and the accessibility tree. Backed by a headless browser. Saves round-trips when an agent needs both the content and a visual of a page."
57690
57870
  }
57691
57871
  },
57692
57872
  render: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agishub/mcp",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "mcpName": "com.agishub/mcp",
5
5
  "description": "AgisHub MCP — pay-per-call tools for AI agents (x402, USDC on Base). Timezone, world clock, date math & scheduling; free via MCP, paid via HTTP. No API key.",
6
6
  "keywords": [