crw-mcp 0.16.0 → 0.18.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/bin/crw-mcp.js CHANGED
@@ -1,10 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // Handle `init` subcommand before delegating to the Rust binary
3
+ // Handle install/init subcommands before delegating to the Rust binary.
4
+ // `init` = skill only; `install` = skill + MCP server.
4
5
  if (process.argv[2] === "init") {
5
6
  require("./init.js");
6
7
  process.exit(0);
7
8
  }
9
+ if (process.argv[2] === "install") {
10
+ require("./install.js");
11
+ process.exit(0);
12
+ }
8
13
 
9
14
  const { spawnSync } = require("child_process");
10
15
  const fs = require("fs");
package/bin/init.js CHANGED
@@ -1,137 +1,78 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const fs = require("fs");
4
- const path = require("path");
5
- const os = require("os");
3
+ // `crw-mcp init [--<agent>]` — installs the crw SKILL (SKILL.md) only.
4
+ // For the skill AND the MCP server in one shot, use `crw-mcp install`.
5
+
6
+ const {
7
+ AGENTS,
8
+ detectAgents,
9
+ getApiKey,
10
+ readSkill,
11
+ installSkill,
12
+ home,
13
+ } = require("./agents.js");
6
14
 
7
- const AGENTS = [
8
- { name: "Claude Code", dir: ".claude", flag: "--claude-code" },
9
- { name: "Cursor", dir: ".cursor", flag: "--cursor" },
10
- { name: "Gemini CLI", dir: ".gemini", flag: "--gemini-cli" },
11
- { name: "Codex", dir: ".codex", flag: "--codex" },
12
- { name: "OpenCode", dir: ".opencode", flag: "--opencode" },
13
- { name: "Windsurf", dir: ".windsurf", flag: "--windsurf" },
14
- ];
15
-
16
- const home = os.homedir();
17
15
  const args = process.argv.slice(2);
18
16
 
19
- function hasFlag(flag) {
20
- return args.includes(flag);
21
- }
22
-
23
- function getApiKey() {
24
- const idx = args.indexOf("--api-key");
25
- return idx !== -1 && args[idx + 1] ? args[idx + 1] : null;
26
- }
27
-
28
- function readSkillFile() {
29
- const skillPath = path.join(__dirname, "..", "skills", "SKILL.md");
30
- return fs.readFileSync(skillPath, "utf-8");
31
- }
32
-
33
- function detectAgents() {
34
- const all = hasFlag("--all");
35
- const specificFlags = AGENTS.filter((a) => hasFlag(a.flag));
36
-
37
- if (!all && specificFlags.length === 0) {
38
- // Auto-detect: install to all agents whose config dirs exist
39
- return AGENTS.filter((a) =>
40
- fs.existsSync(path.join(home, a.dir))
41
- );
42
- }
43
-
44
- if (all) {
45
- return AGENTS.filter((a) =>
46
- fs.existsSync(path.join(home, a.dir))
47
- );
48
- }
49
-
50
- return specificFlags;
51
- }
52
-
53
- function deploy(agents, skillContent) {
54
- const installed = [];
55
-
56
- for (const agent of agents) {
57
- const targetDir = path.join(home, agent.dir, "skills", "crw");
58
- const targetFile = path.join(targetDir, "SKILL.md");
59
-
60
- try {
61
- fs.mkdirSync(targetDir, { recursive: true });
62
- fs.writeFileSync(targetFile, skillContent, "utf-8");
63
- installed.push({ name: agent.name, path: targetFile });
64
- } catch (err) {
65
- console.error(` Failed to install for ${agent.name}: ${err.message}`);
66
- }
67
- }
68
-
69
- return installed;
70
- }
71
-
72
- function main() {
73
- if (hasFlag("--help") || hasFlag("-h")) {
74
- console.log(`
75
- crw-mcp init — Install CRW agent skill to your AI coding agents
17
+ if (args.includes("--help") || args.includes("-h")) {
18
+ console.log(`
19
+ crw-mcp init — Install the CRW agent SKILL (skill only, no MCP server)
76
20
 
77
21
  Usage:
78
- npx crw-mcp@latest init [options]
22
+ npx crw-mcp@latest init [options] # skill only
23
+ npx crw-mcp@latest install [options] # skill + MCP server
79
24
 
80
25
  Options:
81
26
  --all Install to all detected agents
82
- --claude-code Install to Claude Code only
83
- --cursor Install to Cursor only
84
- --gemini-cli Install to Gemini CLI only
85
- --codex Install to Codex only
86
- --opencode Install to OpenCode only
87
- --windsurf Install to Windsurf only
88
- --api-key <key> Set your fastcrw.com API key
89
- -h, --help Show this help message
27
+ --claude-code Claude Code --codex Codex
28
+ --cursor Cursor --opencode OpenCode
29
+ --gemini-cli Gemini CLI --windsurf Windsurf
30
+ --api-key <key> Your fastcrw.com API key
31
+ -h, --help Show this help
90
32
 
91
- Without flags, auto-detects installed agents and installs to all of them.
33
+ Without flags, auto-detects installed agents.
92
34
  `);
93
- process.exit(0);
94
- }
95
-
96
- const skillContent = readSkillFile();
97
- const agents = detectAgents();
98
-
99
- if (agents.length === 0) {
100
- console.log("No supported AI agents detected.");
101
- console.log("Supported agents: " + AGENTS.map((a) => a.name).join(", "));
102
- console.log("\nManually install by copying the skill file to your agent's skills directory.");
103
- process.exit(1);
104
- }
105
-
106
- const installed = deploy(agents, skillContent);
35
+ process.exit(0);
36
+ }
107
37
 
108
- if (installed.length === 0) {
109
- console.log("Failed to install to any agent.");
110
- process.exit(1);
111
- }
38
+ const skill = readSkill();
39
+ const agents = detectAgents(args);
112
40
 
113
- console.log("crw skill installed:\n");
114
- const maxName = Math.max(...installed.map((i) => i.name.length));
115
- for (const i of installed) {
116
- console.log(` ${i.name.padEnd(maxName + 2)} ${i.path}`);
117
- }
41
+ if (agents.length === 0) {
42
+ console.log("No supported AI agents detected.");
43
+ console.log("Supported: " + AGENTS.map((a) => a.name).join(", "));
44
+ process.exit(1);
45
+ }
118
46
 
119
- const apiKey = getApiKey();
120
- if (apiKey) {
121
- console.log(`\nAPI key configured: ${apiKey.slice(0, 6)}...`);
122
- console.log("Set it in your environment:");
123
- console.log(` export CRW_API_KEY=${apiKey}`);
124
- } else {
125
- console.log("\nCloud mode (fastcrw.com):");
126
- console.log(" 500 free one-time credits, managed infra — https://fastcrw.com");
127
- console.log(" export CRW_API_KEY=fc-your-key");
128
- console.log(" export CRW_API_URL=https://api.fastcrw.com");
129
- console.log(" Terms of Service: https://fastcrw.com/terms");
47
+ const installed = [];
48
+ for (const agent of agents) {
49
+ try {
50
+ installed.push({ name: agent.name, path: installSkill(agent, skill) });
51
+ } catch (err) {
52
+ console.error(` Failed for ${agent.name}: ${err.message}`);
130
53
  }
54
+ }
55
+ if (installed.length === 0) {
56
+ console.log("Failed to install to any agent.");
57
+ process.exit(1);
58
+ }
131
59
 
132
- console.log("\nLocal mode (free, same binary, fully capable):");
133
- console.log(" npx crw-mcp");
134
- console.log("\nDocs: https://fastcrw.com/docs");
60
+ console.log("crw SKILL installed (skill only this does NOT add the MCP server):\n");
61
+ const maxName = Math.max(...installed.map((i) => i.name.length));
62
+ for (const i of installed) {
63
+ console.log(` ${i.name.padEnd(maxName + 2)} ${i.path.replace(home, "~")}`);
135
64
  }
136
65
 
137
- main();
66
+ console.log("\nWant the MCP tools (crw_scrape / crawl / map / search) too?");
67
+ console.log(" npx crw-mcp@latest install # same agents, skill + MCP server");
68
+
69
+ const apiKey = getApiKey(args);
70
+ if (apiKey) {
71
+ console.log(`\nAPI key set: ${apiKey.slice(0, 10)}… — export it for cloud mode:`);
72
+ console.log(` export CRW_API_KEY=${apiKey}`);
73
+ console.log(" export CRW_API_URL=https://api.fastcrw.com");
74
+ } else {
75
+ console.log("\nThe skill works in local mode out of the box (free, embedded).");
76
+ console.log("Cloud mode (managed, 500 free credits): https://fastcrw.com");
77
+ }
78
+ console.log("\nDocs: https://fastcrw.com/docs");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crw-mcp",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
4
4
  "description": "MCP server for CRW web scraper — scrape, crawl, map, search, and PDF-parse tools for AI agents",
5
5
  "license": "AGPL-3.0",
6
6
  "homepage": "https://github.com/us/crw",
@@ -30,9 +30,9 @@
30
30
  "skills/SKILL.md"
31
31
  ],
32
32
  "optionalDependencies": {
33
- "crw-mcp-darwin-x64": "0.16.0",
34
- "crw-mcp-darwin-arm64": "0.16.0",
35
- "crw-mcp-linux-x64": "0.16.0",
36
- "crw-mcp-linux-arm64": "0.16.0"
33
+ "crw-mcp-darwin-x64": "0.18.0",
34
+ "crw-mcp-darwin-arm64": "0.18.0",
35
+ "crw-mcp-linux-x64": "0.18.0",
36
+ "crw-mcp-linux-arm64": "0.18.0"
37
37
  }
38
38
  }
package/skills/SKILL.md CHANGED
@@ -32,7 +32,7 @@ This installs the CRW skill and MCP server to all detected AI agents (Claude Cod
32
32
  ## Authentication
33
33
 
34
34
  - **Embedded mode** (default): No key needed — the MCP server runs a self-contained scraper in ~6 MB RAM. No server required.
35
- - **Cloud mode** (fastcrw.com): Set `CRW_API_KEY=crw_live_...` and `CRW_API_URL=https://fastcrw.com/api`. Get a free key at https://fastcrw.com with 500 credits/month.
35
+ - **Cloud mode** (fastcrw.com): Set `CRW_API_KEY=crw_live_...` and `CRW_API_URL=https://api.fastcrw.com`. Get a free key at https://fastcrw.com with 500 one-time lifetime credits (never resets, not monthly).
36
36
 
37
37
  ## MCP Tools
38
38
 
@@ -76,7 +76,9 @@ Parameters:
76
76
  - `id` (required) — The crawl job ID from `crw_crawl`
77
77
  - `maxLength` — Truncate each page's content fields to this many chars. `0` = unbounded. Default: ~15 000
78
78
 
79
- Returns: `{ "status": "pending|running|completed|failed", "data": [...] }`
79
+ Returns: `{ "status": "scraping|completed|failed", "data": [...] }`
80
+
81
+ > **Browser Automation:** Full interactive browser control (JavaScript rendering, click, fill, etc.) requires the separate **crw-browse** MCP server binary (`command: crw-browse`). It exposes its own tools (`goto`, `tree`, and others) and is not part of this MCP server. Do not call `crw_browse` here — it is not a tool in crw-mcp and will return a JSON-RPC -32602 "Unknown tool" error.
80
82
 
81
83
  ### crw_search
82
84
 
@@ -86,7 +88,6 @@ Parameters:
86
88
  - `query` (required) — The search query
87
89
  - `limit` — Maximum number of results to return. Default: `5`
88
90
  - `lang` — Language code for results (e.g. `"en"`, `"tr"`)
89
- - `country` — Country code for results (e.g. `"us"`, `"tr"`)
90
91
  - `tbs` — Time filter: `qdr:h|qdr:d|qdr:w|qdr:m|qdr:y` (past hour/day/week/month/year)
91
92
  - `sources` — If set, group results by source: `web`, `news`, `images`
92
93
  - `categories` — Bias toward a category (e.g. `"pdf"`, `"github"`, `"research"`, or a native SearXNG category)
@@ -137,6 +138,18 @@ crw_check_crawl_status(id="...") → poll until completed
137
138
  crw_search(query="your search query", limit=5)
138
139
  ```
139
140
 
141
+ **Search from the CLI (one-shot LLM-ready output):**
142
+
143
+ When the `crw` binary is available, prefer the native field projection
144
+ over piping through `jq` — it's one call instead of two:
145
+
146
+ ```bash
147
+ crw search "renewable energy 2024" --json --fields title,url,snippet --limit 3
148
+ ```
149
+
150
+ Available fields: `title`, `url`, `description`, `snippet`, `position`,
151
+ `score`, `category`. `--json` is shorthand for `--format json`.
152
+
140
153
  ## Common Edge Cases
141
154
 
142
155
  - **JavaScript-heavy sites**: Set `renderJs: true` if the page is blank or returns a loading skeleton
@@ -146,7 +159,7 @@ crw_search(query="your search query", limit=5)
146
159
 
147
160
  ## Links
148
161
 
149
- - Cloud API: https://fastcrw.com — 500 free credits/month
162
+ - Cloud API: https://fastcrw.com — 500 one-time lifetime free credits (never resets, not monthly)
150
163
  - Docs: https://docs.fastcrw.com
151
164
  - GitHub: https://github.com/us/crw
152
165
  - Firecrawl-compatible: same REST endpoints at `/v1/scrape`, `/v1/crawl`, `/v1/map`, `/v1/search`