@nikeandocean/carbon-factor-matcher 2.3.0 → 2.3.3

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 +7 -9
  2. package/index.js +19 -8
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -14,8 +14,10 @@ The calling AI agent selects the best match from the ranked candidates.
14
14
 
15
15
  ### Supported Databases
16
16
 
17
- - **ELCD** — European Reference Life Cycle Database (~600 factors, included in Free tier)
18
- - **ecoinvent 3.10** — Swiss Centre for Life Cycle Inventories (~6,000+ factors, Pro license required)
17
+ - **ELCD** — European Reference Life Cycle Database (493 factors, included in Free tier)
18
+ - **US LCI** — US Life Cycle Inventory Database (532 factors, included in Free tier)
19
+ - **USDA LCA Commons** — USDA agricultural life cycle data (1,550 factors, included in Free tier)
20
+ - **ecoinvent 3.10** — Swiss Centre for Life Cycle Inventories (5,829 factors, Pro license required)
19
21
 
20
22
  ### Key Features
21
23
 
@@ -127,12 +129,12 @@ The Free tier works immediately after installation (300 queries/day, ELCD databa
127
129
 
128
130
  | Plan | Price | Features |
129
131
  |------|-------|----------|
130
- | **Free** | $0 | ELCD database (~600 factors), keyword search, 300 queries/day |
131
- | **Pro** | $5 (one-time) | ELCD + ecoinvent (~6,000+ factors), hybrid keyword + embedding matching, unlimited queries |
132
+ | **Free** | $0 | ELCD + US LCI + USDA (2,575 factors), keyword search, 300 queries/day |
133
+ | **Pro** | $5 (one-time) | All 4 databases (8,404 factors), hybrid keyword + embedding matching, unlimited queries |
132
134
 
133
135
  ### Purchase License Key
134
136
 
135
- 👉 **[Buy Pro License](https://nikeandocean.github.io/carbon-factor-matcher)**
137
+ 👉 **[Buy Pro License](https://zerocarbonlogic.com)**
136
138
 
137
139
  After purchase, you'll receive a license key via email. Set it as an environment variable in your MCP config:
138
140
 
@@ -214,10 +216,6 @@ Get full metadata for a specific factor.
214
216
  }
215
217
  ```
216
218
 
217
- ## Demo
218
-
219
- 👉 **[Try the Live Demo](https://nikeandocean.github.io/carbon-factor-matcher/demo.html)** — Search 30+ emission factors directly in your browser (no installation needed).
220
-
221
219
  ## System Requirements
222
220
 
223
221
  - Node.js 18+ (for `npx`)
package/index.js CHANGED
@@ -9,28 +9,39 @@
9
9
 
10
10
  const { execSync, spawn } = require('child_process');
11
11
 
12
- // Check if Python is available
13
- try {
14
- execSync('python --version', { stdio: 'ignore' });
15
- } catch (e) {
12
+ // Find a working Python command (try python3 first, then python).
13
+ // macOS only ships python3; Windows typically has python.
14
+ let pythonCmd;
15
+ for (const cmd of ['python3', 'python']) {
16
+ try {
17
+ execSync(`${cmd} --version`, { stdio: 'ignore' });
18
+ pythonCmd = cmd;
19
+ break;
20
+ } catch (_) {
21
+ // not found, try next
22
+ }
23
+ }
24
+ if (!pythonCmd) {
16
25
  console.error('Error: Python 3.11+ is required to run carbon-factor-matcher');
17
26
  console.error('Install from https://www.python.org/downloads/');
18
27
  process.exit(1);
19
28
  }
20
29
 
30
+ const pipCmd = pythonCmd === 'python3' ? 'pip3' : 'pip';
31
+
21
32
  // Ensure the Python package is installed (upgrade if outdated)
22
33
  try {
23
- execSync('python -c "import carbon_factor_matcher"', { stdio: 'ignore' });
34
+ execSync(`${pythonCmd} -c "import carbon_factor_matcher"`, { stdio: 'ignore' });
24
35
  // Package exists, try to upgrade silently
25
36
  try {
26
- execSync('pip install --upgrade carbon-factor-matcher', { stdio: 'ignore' });
37
+ execSync(`${pipCmd} install --upgrade carbon-factor-matcher`, { stdio: 'ignore' });
27
38
  } catch (_) {
28
39
  // Ignore upgrade failures (offline, permission, etc.)
29
40
  }
30
41
  } catch (_) {
31
42
  console.error('Installing carbon-factor-matcher from PyPI...');
32
43
  try {
33
- execSync('pip install carbon-factor-matcher', { stdio: 'inherit' });
44
+ execSync(`${pipCmd} install carbon-factor-matcher`, { stdio: 'inherit' });
34
45
  } catch (e) {
35
46
  console.error('Failed to install. Run manually: pip install carbon-factor-matcher');
36
47
  process.exit(1);
@@ -38,7 +49,7 @@ try {
38
49
  }
39
50
 
40
51
  // Launch the MCP server
41
- const child = spawn('python', ['-m', 'carbon_factor_matcher'], {
52
+ const child = spawn(pythonCmd, ['-m', 'carbon_factor_matcher'], {
42
53
  stdio: 'inherit',
43
54
  });
44
55
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nikeandocean/carbon-factor-matcher",
3
- "version": "2.3.0",
3
+ "version": "2.3.3",
4
4
  "description": "MCP server for intelligent emission factor matching — connects AI agents with carbon emission factor databases (ELCD, ecoinvent)",
5
5
  "main": "index.js",
6
6
  "bin": {