@tiangong-lca/mcp-server 0.0.18 → 0.0.20

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.
@@ -4,6 +4,7 @@ import { regOpenLcaResources } from '../resources/lca_calculation.js';
4
4
  import { regBomCalculationTool } from '../tools/bom_calculation.js';
5
5
  import { regFlowSearchTool } from '../tools/flow_hybrid_search.js';
6
6
  import { regLcaCalculationGuidanceTool } from '../tools/lca_calculation_guidance.js';
7
+ import { regLifecycleModelSearchTool } from '../tools/life_cycle_model_hybrid_search.js';
7
8
  import { regOpenLcaLciaTool } from '../tools/openlca_ipc_lcia.js';
8
9
  import { regOpenLcaListLCIAMethodsTool } from '../tools/openlca_ipc_lcia_methods_list.js';
9
10
  import { regOpenLcaListProductSystemsTool } from '../tools/openlca_ipc_process_list.js';
@@ -15,6 +16,7 @@ export function initializeServer(bearerKey) {
15
16
  }, { capabilities: { prompts: {}, resources: {} } });
16
17
  regFlowSearchTool(server, bearerKey);
17
18
  regProcessSearchTool(server, bearerKey);
19
+ regLifecycleModelSearchTool(server, bearerKey);
18
20
  regBomCalculationTool(server);
19
21
  regOpenLcaLciaTool(server);
20
22
  regOpenLcaListProductSystemsTool(server);
@@ -2,6 +2,7 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import { regBomCalculationTool } from '../tools/bom_calculation.js';
3
3
  import { regCrudTool } from '../tools/db_crud.js';
4
4
  import { regFlowSearchTool } from '../tools/flow_hybrid_search.js';
5
+ import { regLifecycleModelSearchTool } from '../tools/life_cycle_model_hybrid_search.js';
5
6
  import { regProcessSearchTool } from '../tools/process_hybrid_search.js';
6
7
  export function initializeServer(bearerKey, supabaseSession) {
7
8
  const server = new McpServer({
@@ -10,6 +11,7 @@ export function initializeServer(bearerKey, supabaseSession) {
10
11
  });
11
12
  regFlowSearchTool(server, bearerKey);
12
13
  regProcessSearchTool(server, bearerKey);
14
+ regLifecycleModelSearchTool(server, bearerKey);
13
15
  regBomCalculationTool(server);
14
16
  regCrudTool(server, supabaseSession ?? bearerKey);
15
17
  return server;
@@ -0,0 +1,46 @@
1
+ import { z } from 'zod';
2
+ import cleanObject from '../_shared/clean_object.js';
3
+ import { supabase_base_url, x_region } from '../_shared/config.js';
4
+ const input_schema = {
5
+ query: z.string().min(1).describe('Queries from user'),
6
+ };
7
+ async function searchLifecycleModels({ query }, bearerKey) {
8
+ const url = `${supabase_base_url}/functions/v1/lifecyclemodel_hybrid_search`;
9
+ try {
10
+ const response = await fetch(url, {
11
+ method: 'POST',
12
+ headers: {
13
+ 'Content-Type': 'application/json',
14
+ Authorization: `Bearer ${bearerKey}`,
15
+ 'x-region': x_region,
16
+ },
17
+ body: JSON.stringify(cleanObject({
18
+ query,
19
+ })),
20
+ });
21
+ if (!response.ok) {
22
+ throw new Error(`HTTP error: ${response.status} ${response.statusText}`);
23
+ }
24
+ const data = await response.json();
25
+ return JSON.stringify(data);
26
+ }
27
+ catch (error) {
28
+ console.error('Error making the request:', error);
29
+ throw error;
30
+ }
31
+ }
32
+ export function regLifecycleModelSearchTool(server, bearerKey) {
33
+ server.tool('Search_life_cycle_models_Tool', 'Search LCA life cycle models data.', input_schema, async ({ query }) => {
34
+ const result = await searchLifecycleModels({
35
+ query,
36
+ }, bearerKey);
37
+ return {
38
+ content: [
39
+ {
40
+ type: 'text',
41
+ text: result,
42
+ },
43
+ ],
44
+ };
45
+ });
46
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiangong-lca/mcp-server",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "description": "TianGong LCA MCP Server",
5
5
  "license": "MIT",
6
6
  "author": "Nan LI",
@@ -27,17 +27,17 @@
27
27
  "ncu:update": "npx npm-check-updates -u"
28
28
  },
29
29
  "dependencies": {
30
- "@modelcontextprotocol/sdk": "^1.19.1",
31
- "@supabase/supabase-js": "^2.58.0",
30
+ "@modelcontextprotocol/sdk": "^1.20.0",
31
+ "@supabase/supabase-js": "^2.75.0",
32
32
  "@tiangong-lca/tidas-sdk": "^0.1.16",
33
33
  "@types/express": "^5.0.3",
34
- "@upstash/redis": "^1.35.4",
34
+ "@upstash/redis": "^1.35.5",
35
35
  "aws-jwt-verify": "^5.1.1",
36
36
  "olca-ipc": "^2.2.1",
37
37
  "zod": "^3.25.76"
38
38
  },
39
39
  "devDependencies": {
40
- "@modelcontextprotocol/inspector": "^0.16.8",
40
+ "@modelcontextprotocol/inspector": "0.16.8",
41
41
  "dotenv-cli": "^10.0.0",
42
42
  "npm-check-updates": "^19.0.0",
43
43
  "prettier": "^3.6.2",