@nikeandocean/carbon-factor-matcher 0.2.1 → 0.3.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.
Files changed (2) hide show
  1. package/index.js +47 -47
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,47 +1,47 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Carbon Factor Matcher - MCP Server
5
- *
6
- * npm wrapper that launches the Python MCP server.
7
- * Auto-installs from PyPI if not already present.
8
- */
9
-
10
- const { execSync, spawn } = require('child_process');
11
-
12
- // Check if Python is available
13
- try {
14
- execSync('python --version', { stdio: 'ignore' });
15
- } catch (e) {
16
- console.error('Error: Python 3.11+ is required to run carbon-factor-matcher');
17
- console.error('Install from https://www.python.org/downloads/');
18
- process.exit(1);
19
- }
20
-
21
- // Ensure the Python package is installed (upgrade if outdated)
22
- try {
23
- execSync('python -c "import carbon_factor_matcher"', { stdio: 'ignore' });
24
- // Package exists, try to upgrade silently
25
- try {
26
- execSync('pip install --upgrade carbon-factor-matcher', { stdio: 'ignore' });
27
- } catch (_) {
28
- // Ignore upgrade failures (offline, permission, etc.)
29
- }
30
- } catch (_) {
31
- console.error('Installing carbon-factor-matcher from PyPI...');
32
- try {
33
- execSync('pip install carbon-factor-matcher', { stdio: 'inherit' });
34
- } catch (e) {
35
- console.error('Failed to install. Run manually: pip install carbon-factor-matcher');
36
- process.exit(1);
37
- }
38
- }
39
-
40
- // Launch the MCP server
41
- const child = spawn('python', ['-m', 'carbon_factor_matcher'], {
42
- stdio: 'inherit',
43
- });
44
-
45
- child.on('exit', (code) => {
46
- process.exit(code || 0);
47
- });
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Carbon Factor Matcher - MCP Server
5
+ *
6
+ * npm wrapper that launches the Python MCP server.
7
+ * Auto-installs from PyPI if not already present.
8
+ */
9
+
10
+ const { execSync, spawn } = require('child_process');
11
+
12
+ // Check if Python is available
13
+ try {
14
+ execSync('python --version', { stdio: 'ignore' });
15
+ } catch (e) {
16
+ console.error('Error: Python 3.11+ is required to run carbon-factor-matcher');
17
+ console.error('Install from https://www.python.org/downloads/');
18
+ process.exit(1);
19
+ }
20
+
21
+ // Ensure the Python package is installed (upgrade if outdated)
22
+ try {
23
+ execSync('python -c "import carbon_factor_matcher"', { stdio: 'ignore' });
24
+ // Package exists, try to upgrade silently
25
+ try {
26
+ execSync('pip install --upgrade carbon-factor-matcher', { stdio: 'ignore' });
27
+ } catch (_) {
28
+ // Ignore upgrade failures (offline, permission, etc.)
29
+ }
30
+ } catch (_) {
31
+ console.error('Installing carbon-factor-matcher from PyPI...');
32
+ try {
33
+ execSync('pip install carbon-factor-matcher', { stdio: 'inherit' });
34
+ } catch (e) {
35
+ console.error('Failed to install. Run manually: pip install carbon-factor-matcher');
36
+ process.exit(1);
37
+ }
38
+ }
39
+
40
+ // Launch the MCP server
41
+ const child = spawn('python', ['-m', 'carbon_factor_matcher'], {
42
+ stdio: 'inherit',
43
+ });
44
+
45
+ child.on('exit', (code) => {
46
+ process.exit(code || 0);
47
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nikeandocean/carbon-factor-matcher",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "MCP server for intelligent emission factor matching — connects LLMs with carbon emission factor databases (ELCD, ecoinvent)",
5
5
  "main": "index.js",
6
6
  "bin": {