@mrscraper/mcp 0.1.0 → 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.
@@ -0,0 +1,61 @@
1
+ import { WIDGET_BUNDLES, WIDGET_STYLES } from "./bundles.generated.js";
2
+ export const WIDGET_MIME_TYPE = "text/html;profile=mcp-app";
3
+ export const WIDGETS = {
4
+ serp: {
5
+ bundle: "serp",
6
+ uri: "ui://mrscraper/serp/v1.html",
7
+ title: "Google results",
8
+ description: "Google search results with titles, links, and snippets.",
9
+ },
10
+ records: {
11
+ bundle: "records",
12
+ uri: "ui://mrscraper/records/v1.html",
13
+ title: "Extracted data",
14
+ description: "Extracted records and stored scrape results as a table.",
15
+ },
16
+ status: {
17
+ bundle: "status",
18
+ uri: "ui://mrscraper/status/v1.html",
19
+ title: "Account status",
20
+ description: "MrScraper subscription plan and token usage.",
21
+ },
22
+ };
23
+ export function widgetHtml(name) {
24
+ const bundle = WIDGET_BUNDLES[WIDGETS[name].bundle] ?? "";
25
+ return (`<style>${WIDGET_STYLES}</style>` +
26
+ `<div id="mrscraper-root"></div>` +
27
+ `<script type="module">${bundle.replace(/<\/script/gi, "<\\/script")}</script>`);
28
+ }
29
+ export function widgetMeta(name, invoking, invoked) {
30
+ const { uri } = WIDGETS[name];
31
+ return {
32
+ ui: { resourceUri: uri },
33
+ "openai/outputTemplate": uri,
34
+ "openai/toolInvocation/invoking": invoking,
35
+ "openai/toolInvocation/invoked": invoked,
36
+ };
37
+ }
38
+ export function registerWidgets(server) {
39
+ for (const [name, definition] of Object.entries(WIDGETS)) {
40
+ server.registerResource(definition.bundle, definition.uri, {
41
+ title: definition.title,
42
+ description: definition.description,
43
+ mimeType: WIDGET_MIME_TYPE,
44
+ }, async (uri) => ({
45
+ contents: [
46
+ {
47
+ uri: uri.href,
48
+ mimeType: WIDGET_MIME_TYPE,
49
+ text: widgetHtml(name),
50
+ _meta: {
51
+ ui: {
52
+ prefersBorder: true,
53
+ csp: { connectDomains: [], resourceDomains: [] },
54
+ },
55
+ },
56
+ },
57
+ ],
58
+ }));
59
+ }
60
+ }
61
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/widgets/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvE,MAAM,CAAC,MAAM,gBAAgB,GAAG,2BAA2B,CAAC;AAU5D,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM;QACd,GAAG,EAAE,6BAA6B;QAClC,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,yDAAyD;KACvE;IACD,OAAO,EAAE;QACP,MAAM,EAAE,SAAS;QACjB,GAAG,EAAE,gCAAgC;QACrC,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,yDAAyD;KACvE;IACD,MAAM,EAAE;QACN,MAAM,EAAE,QAAQ;QAChB,GAAG,EAAE,+BAA+B;QACpC,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,8CAA8C;KAC5D;CACyC,CAAC;AAI7C,MAAM,UAAU,UAAU,CAAC,IAAgB;IACzC,MAAM,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IAC1D,OAAO,CACL,UAAU,aAAa,UAAU;QACjC,iCAAiC;QACjC,yBAAyB,MAAM,CAAC,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC,WAAW,CAChF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,IAAgB,EAChB,QAAgB,EAChB,OAAe;IAEf,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,OAAO;QACL,EAAE,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE;QACxB,uBAAuB,EAAE,GAAG;QAC5B,gCAAgC,EAAE,QAAQ;QAC1C,+BAA+B,EAAE,OAAO;KACzC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,KAAK,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACzD,MAAM,CAAC,gBAAgB,CACrB,UAAU,CAAC,MAAM,EACjB,UAAU,CAAC,GAAG,EACd;YACE,KAAK,EAAE,UAAU,CAAC,KAAK;YACvB,WAAW,EAAE,UAAU,CAAC,WAAW;YACnC,QAAQ,EAAE,gBAAgB;SAC3B,EACD,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;YACd,QAAQ,EAAE;gBACR;oBACE,GAAG,EAAE,GAAG,CAAC,IAAI;oBACb,QAAQ,EAAE,gBAAgB;oBAC1B,IAAI,EAAE,UAAU,CAAC,IAAkB,CAAC;oBACpC,KAAK,EAAE;wBACL,EAAE,EAAE;4BACF,aAAa,EAAE,IAAI;4BAEnB,GAAG,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE;yBACjD;qBACF;iBACF;aACF;SACF,CAAC,CACH,CAAC;IACJ,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrscraper/mcp",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "MrScraper MCP server for web fetching, extraction, Google SERPs, saved scraper reruns, results, and account status.",
5
5
  "license": "MIT",
6
6
  "author": "MrScraper",
@@ -41,7 +41,9 @@
41
41
  },
42
42
  "scripts": {
43
43
  "clean": "node --eval \"import('node:fs').then(({ rmSync }) => rmSync('dist', { recursive: true, force: true }))\"",
44
- "build": "npm run clean && tsc -p tsconfig.build.json",
44
+ "build:widgets": "tsx scripts/build-widgets.ts",
45
+ "preview:widgets": "tsx scripts/preview-widgets.ts",
46
+ "build": "npm run clean && npm run build:widgets && tsc -p tsconfig.build.json",
45
47
  "dev": "tsx src/bin.ts",
46
48
  "start": "node dist/bin.js",
47
49
  "format": "prettier --write .",
@@ -51,6 +53,7 @@
51
53
  "test:watch": "vitest",
52
54
  "test:e2e": "tsx scripts/test-e2e.ts",
53
55
  "test:mcp": "tsx scripts/test-mcp.ts",
56
+ "test:oauth": "tsx scripts/test-oauth.ts",
54
57
  "test:serp": "tsx scripts/test-serp.ts",
55
58
  "prepack": "npm run build"
56
59
  },
@@ -60,12 +63,14 @@
60
63
  "@modelcontextprotocol/server": "2.0.0",
61
64
  "dotenv": "17.4.2",
62
65
  "express": "5.2.1",
66
+ "jose": "^6.2.9",
63
67
  "zod": "4.4.3"
64
68
  },
65
69
  "devDependencies": {
66
70
  "@modelcontextprotocol/client": "2.0.0",
67
71
  "@types/express": "5.0.6",
68
72
  "@types/node": "26.2.0",
73
+ "esbuild": "^0.27.7",
69
74
  "prettier": "3.9.6",
70
75
  "tsx": "4.23.12",
71
76
  "typescript": "7.0.2",