robot-resources 1.3.8 → 1.4.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/README.md CHANGED
@@ -11,7 +11,7 @@ npx robot-resources
11
11
  1. **GitHub OAuth** — authenticates via PKCE, saves API key to `~/.robot-resources/config.json`
12
12
  2. **Router install** — detects Python 3.10+, creates venv, pip installs `robot-resources-router`
13
13
  3. **Service registration** — registers router as launchd (macOS) or systemd (Linux) service
14
- 4. **MCP auto-config** — detects Claude Desktop and Cursor, injects scraper MCP entry
14
+ 4. **Scraper** — installs @robot-resources/scraper for token-efficient web compression
15
15
 
16
16
  ## Adding a new tool
17
17
 
@@ -43,6 +43,43 @@ function activateRouterModel() {
43
43
  }
44
44
  }
45
45
 
46
+ /**
47
+ * Register scraper-mcp as an MCP server in openclaw.json.
48
+ *
49
+ * This makes scraper_compress_url and scraper_crawl_url available
50
+ * as native tools in OpenClaw. The plugin's before_tool_call hook
51
+ * then intercepts web_fetch to route through the scraper by default.
52
+ *
53
+ * Returns true if the config was updated, false otherwise.
54
+ */
55
+ function registerScraperMcp() {
56
+ const configPath = join(homedir(), '.openclaw', 'openclaw.json');
57
+
58
+ try {
59
+ const raw = readFileSync(configPath, 'utf-8');
60
+ const config = JSON.parse(stripJson5(raw));
61
+
62
+ if (!config.mcp) config.mcp = {};
63
+ if (!config.mcp.servers) config.mcp.servers = {};
64
+
65
+ // Already registered
66
+ if (config.mcp.servers['robot-resources-scraper']) {
67
+ return false;
68
+ }
69
+
70
+ config.mcp.servers['robot-resources-scraper'] = {
71
+ command: 'npx',
72
+ args: ['-y', '@robot-resources/scraper-mcp'],
73
+ };
74
+
75
+ writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n', 'utf-8');
76
+ return true;
77
+ } catch {
78
+ // Config missing or malformed — non-fatal
79
+ return false;
80
+ }
81
+ }
82
+
46
83
  /**
47
84
  * Configure OpenClaw to route through Robot Resources Router.
48
85
  *
@@ -77,6 +114,10 @@ function configureOpenClaw() {
77
114
  // before_model_resolve hook actually fires for every request.
78
115
  const configActivated = activateRouterModel();
79
116
 
117
+ // Register scraper-mcp so the agent gets scraper_compress_url
118
+ // as a native tool, and the plugin can intercept web_fetch.
119
+ const scraperRegistered = registerScraperMcp();
120
+
80
121
  // Restart the gateway so it picks up the new plugin + config.
81
122
  let gatewayRestarted = false;
82
123
  try {
@@ -94,6 +135,7 @@ function configureOpenClaw() {
94
135
  action: 'installed',
95
136
  authMode,
96
137
  configActivated,
138
+ scraperRegistered,
97
139
  gatewayRestarted,
98
140
  note: authMode === 'subscription'
99
141
  ? 'Plugin required — subscription OAuth tokens are rejected by Anthropic when proxied via third-party clients.'
package/lib/wizard.js CHANGED
@@ -103,7 +103,7 @@ export async function runWizard({ nonInteractive = false } = {}) {
103
103
  if (!python) {
104
104
  warn('Python 3.10+ not found — skipping Router installation');
105
105
  info('Install Python from https://python.org and re-run this wizard');
106
- info('Scraper and MCP tools work without Python');
106
+ info('Scraper works without Python');
107
107
  } else {
108
108
  info(`Found Python ${python.version} (${python.bin})`);
109
109
  step('Installing Router (this may take a moment)...');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "robot-resources",
3
- "version": "1.3.8",
3
+ "version": "1.4.0",
4
4
  "description": "Robot Resources — AI agent runtime tools. One command to install everything.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -18,7 +18,7 @@
18
18
  ],
19
19
  "dependencies": {
20
20
  "@robot-resources/cli-core": "*",
21
- "@robot-resources/scraper": "*"
21
+ "@robot-resources/scraper": "^0.1.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "vitest": "^1.2.0"