From 295031cf8178507e18f71c860a8f9130a0f2c04e Mon Sep 17 00:00:00 2001 From: Cosmin Petrescu Date: Thu, 21 Aug 2025 11:50:47 +0300 Subject: [PATCH 1/4] fix: debug emissions call --- package-lock.json | 113 ++++++++++++++++++++++++++++++ package.json | 1 + src/__e2e__/emissions.e2e.spec.ts | 25 +++++++ 3 files changed, 139 insertions(+) diff --git a/package-lock.json b/package-lock.json index 0de51ff..a90ea49 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,6 +41,7 @@ "@types/jest": "^30.0.0", "@types/node": "^24.2.1", "@types/ws": "^8.18.1", + "axios": "^1.11.0", "babel-loader": "^10.0.0", "eslint-plugin-oxlint": "^1.12.0", "husky": "^9.1.7", @@ -4871,6 +4872,58 @@ "dev": true, "license": "MIT" }, + "node_modules/axios": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.11.0.tgz", + "integrity": "sha512-1Lx3WLFQWm3ooKDYZD1eXmoGO9fxYQjrycfHFC8P0sCfQVXyROp0p9PFWBehewBOdCwHc+f/b8I0fMto5eSfwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.4", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/axios/node_modules/form-data": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz", + "integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==", + "dev": true, + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/axios/node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/axios/node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/b4a": { "version": "1.6.7", "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.7.tgz", @@ -7662,6 +7715,22 @@ "node": ">= 0.4" } }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/es6-promise": { "version": "4.2.8", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", @@ -8322,6 +8391,27 @@ "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==", "license": "MIT" }, + "node_modules/follow-redirects": { + "version": "1.15.11", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz", + "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/foreground-child": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", @@ -9111,6 +9201,22 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-unicode": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", @@ -16136,6 +16242,13 @@ "node": ">= 0.10" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true, + "license": "MIT" + }, "node_modules/pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", diff --git a/package.json b/package.json index c4502c6..6f9cc52 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "@types/jest": "^30.0.0", "@types/node": "^24.2.1", "@types/ws": "^8.18.1", + "axios": "^1.11.0", "babel-loader": "^10.0.0", "eslint-plugin-oxlint": "^1.12.0", "husky": "^9.1.7", diff --git a/src/__e2e__/emissions.e2e.spec.ts b/src/__e2e__/emissions.e2e.spec.ts index d18aea9..8fcdd47 100644 --- a/src/__e2e__/emissions.e2e.spec.ts +++ b/src/__e2e__/emissions.e2e.spec.ts @@ -1,5 +1,6 @@ import { Client } from '@modelcontextprotocol/sdk/client/index.js'; import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'; +import axios from 'axios'; import { getMcpClient } from './client'; describe('Chargetrip MCP -> emissions', () => { @@ -18,6 +19,30 @@ describe('Chargetrip MCP -> emissions', () => { }); it('should return all emissions data for route with id `e4568f10-7da1-11f0-880d-28eb7d82c15b` and details id `e5918010-7da1-11f0-9504-6371214e66f0`', async () => { + const response = await axios.post('http://localhost:8800/graphql', { + query: ` + query { + emission_by_route_id(routeId: "e4568f10-7da1-11f0-880d-28eb7d82c15b", routeDetailsId: "e5918010-7da1-11f0-9504-6371214e66f0") { + co2e_saved + gasoline_vehicle { + total + iso_14083_2023 + } + diesel_vehicle { + total + iso_14083_2023 + } + route_vehicle { + total + iso_14083_2023 + } + } + } + `, + variables: {}, + }); + console.log(response.data); + expect( await client.callTool({ name: 'emission_by_route_id', From fd846bec372d39d9195033f6b2737abb54c84b1c Mon Sep 17 00:00:00 2001 From: Cosmin Petrescu Date: Thu, 21 Aug 2025 11:53:43 +0300 Subject: [PATCH 2/4] fix: debug emissions e2e --- src/__e2e__/emissions.e2e.spec.ts | 62 +++++++++++++++++++------------ 1 file changed, 39 insertions(+), 23 deletions(-) diff --git a/src/__e2e__/emissions.e2e.spec.ts b/src/__e2e__/emissions.e2e.spec.ts index 8fcdd47..73f3e3c 100644 --- a/src/__e2e__/emissions.e2e.spec.ts +++ b/src/__e2e__/emissions.e2e.spec.ts @@ -1,6 +1,6 @@ import { Client } from '@modelcontextprotocol/sdk/client/index.js'; import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'; -import axios from 'axios'; +import axios, { AxiosError } from 'axios'; import { getMcpClient } from './client'; describe('Chargetrip MCP -> emissions', () => { @@ -19,29 +19,45 @@ describe('Chargetrip MCP -> emissions', () => { }); it('should return all emissions data for route with id `e4568f10-7da1-11f0-880d-28eb7d82c15b` and details id `e5918010-7da1-11f0-9504-6371214e66f0`', async () => { - const response = await axios.post('http://localhost:8800/graphql', { - query: ` - query { - emission_by_route_id(routeId: "e4568f10-7da1-11f0-880d-28eb7d82c15b", routeDetailsId: "e5918010-7da1-11f0-9504-6371214e66f0") { - co2e_saved - gasoline_vehicle { - total - iso_14083_2023 - } - diesel_vehicle { - total - iso_14083_2023 - } - route_vehicle { - total - iso_14083_2023 - } - } - } + try { + const response = await axios.post('http://localhost:8800/graphql', { + query: ` + query EmissionsById( + $routeId: ID! + $routeDetailsId: ID! + $emissionUnit: EmissionUnit +) { + item: getRouteEmissions(route_id: $routeId route_details_id: $routeDetailsId) { + co2e_saved(unit: $emissionUnit) + gasoline_vehicle: internal_combustion_vehicle(fuel_type: gasoline) { + total(unit: $emissionUnit) + iso_14083_2023(unit: $emissionUnit) + } + diesel_vehicle: internal_combustion_vehicle(fuel_type: diesel) { + total(unit: $emissionUnit) + iso_14083_2023(unit: $emissionUnit) + } + route_vehicle { + total(unit: $emissionUnit) + iso_14083_2023(unit: $emissionUnit) + } + } +} `, - variables: {}, - }); - console.log(response.data); + variables: { + routeId: 'e4568f10-7da1-11f0-880d-28eb7d82c15b', + routeDetailsId: 'e5918010-7da1-11f0-9504-6371214e66f0', + emissionUnit: 'gram', + }, + }); + console.log(response.data); + } catch (e) { + if (e instanceof AxiosError) { + console.log(e.response?.data); + } else { + console.error(e); + } + } expect( await client.callTool({ From df0acd1ea558626804bd7636f357d3838db0a7c4 Mon Sep 17 00:00:00 2001 From: Cosmin Petrescu Date: Thu, 21 Aug 2025 12:16:14 +0300 Subject: [PATCH 3/4] fix: debug emissions e2e --- src/__e2e__/emissions.e2e.spec.ts | 44 +++++++++---------- .../__tests__/emissions-by-id.spec.ts | 2 + src/server/tools/emissions/emissions-by-id.ts | 1 + test/wiremock/mappings/create-route.json | 2 +- test/wiremock/mappings/emissions-by-id.json | 2 +- test/wiremock/mappings/operator-by-id.json | 2 +- test/wiremock/mappings/operator-list.json | 2 +- test/wiremock/mappings/route-by-id.json | 2 +- test/wiremock/mappings/station-around.json | 2 +- test/wiremock/mappings/station-by-id.json | 2 +- test/wiremock/mappings/station-list.json | 2 +- test/wiremock/mappings/vehicle-by-id.json | 2 +- test/wiremock/mappings/vehicle-list.json | 2 +- 13 files changed, 35 insertions(+), 32 deletions(-) diff --git a/src/__e2e__/emissions.e2e.spec.ts b/src/__e2e__/emissions.e2e.spec.ts index 73f3e3c..fc76f0b 100644 --- a/src/__e2e__/emissions.e2e.spec.ts +++ b/src/__e2e__/emissions.e2e.spec.ts @@ -22,35 +22,35 @@ describe('Chargetrip MCP -> emissions', () => { try { const response = await axios.post('http://localhost:8800/graphql', { query: ` - query EmissionsById( - $routeId: ID! - $routeDetailsId: ID! - $emissionUnit: EmissionUnit -) { - item: getRouteEmissions(route_id: $routeId route_details_id: $routeDetailsId) { - co2e_saved(unit: $emissionUnit) - gasoline_vehicle: internal_combustion_vehicle(fuel_type: gasoline) { - total(unit: $emissionUnit) - iso_14083_2023(unit: $emissionUnit) - } - diesel_vehicle: internal_combustion_vehicle(fuel_type: diesel) { - total(unit: $emissionUnit) - iso_14083_2023(unit: $emissionUnit) - } - route_vehicle { - total(unit: $emissionUnit) - iso_14083_2023(unit: $emissionUnit) + query EmissionsById( + $routeId: ID! + $routeDetailsId: ID! + $emissionUnit: EmissionUnit + ) { + item: getRouteEmissions(route_id: $routeId route_details_id: $routeDetailsId) { + co2e_saved(unit: $emissionUnit) + gasoline_vehicle: internal_combustion_vehicle(fuel_type: gasoline) { + total(unit: $emissionUnit) + iso_14083_2023(unit: $emissionUnit) + } + diesel_vehicle: internal_combustion_vehicle(fuel_type: diesel) { + total(unit: $emissionUnit) + iso_14083_2023(unit: $emissionUnit) + } + route_vehicle { + total(unit: $emissionUnit) + iso_14083_2023(unit: $emissionUnit) + } + } } - } -} - `, + `, variables: { routeId: 'e4568f10-7da1-11f0-880d-28eb7d82c15b', routeDetailsId: 'e5918010-7da1-11f0-9504-6371214e66f0', emissionUnit: 'gram', }, }); - console.log(response.data); + console.log(JSON.stringify(response.data, null, 2)); } catch (e) { if (e instanceof AxiosError) { console.log(e.response?.data); diff --git a/src/server/tools/emissions/__tests__/emissions-by-id.spec.ts b/src/server/tools/emissions/__tests__/emissions-by-id.spec.ts index db59288..07ed103 100644 --- a/src/server/tools/emissions/__tests__/emissions-by-id.spec.ts +++ b/src/server/tools/emissions/__tests__/emissions-by-id.spec.ts @@ -64,6 +64,7 @@ describe('registerEmissionsById', () => { expect(FetchAndProcessUtil.getItem).toHaveBeenCalledWith({ itemName: 'emissions', query: emissionsQuery, + operationType: 'query', variables: { routeId: 'route123', routeDetailsId: 'details456', @@ -87,6 +88,7 @@ describe('registerEmissionsById', () => { expect(FetchAndProcessUtil.getItem).toHaveBeenCalledWith({ itemName: 'emissions', query: emissionsQuery, + operationType: 'query', variables: { routeId: 'route789', routeDetailsId: 'details101', diff --git a/src/server/tools/emissions/emissions-by-id.ts b/src/server/tools/emissions/emissions-by-id.ts index 2fc4331..5c14a80 100644 --- a/src/server/tools/emissions/emissions-by-id.ts +++ b/src/server/tools/emissions/emissions-by-id.ts @@ -43,6 +43,7 @@ export function registerEmissionsById(server: McpServer): void { itemName: 'emissions', query: emissionsQuery, variables, + operationType: 'query', mapFunction: emissions => MappingEmissionsUtil.mapEmissions({ routeId: input.routeId, diff --git a/test/wiremock/mappings/create-route.json b/test/wiremock/mappings/create-route.json index a509086..0925830 100644 --- a/test/wiremock/mappings/create-route.json +++ b/test/wiremock/mappings/create-route.json @@ -2,7 +2,7 @@ "request": { "method": "POST", "url": "/graphql", - "bodyPatterns": [{ "contains": "createRoute(" }] + "bodyPatterns": [{ "contains": "item: createRoute(" }] }, "response": { "status": 200, diff --git a/test/wiremock/mappings/emissions-by-id.json b/test/wiremock/mappings/emissions-by-id.json index d9245f5..aaf4fc9 100644 --- a/test/wiremock/mappings/emissions-by-id.json +++ b/test/wiremock/mappings/emissions-by-id.json @@ -2,7 +2,7 @@ "request": { "method": "POST", "url": "/graphql", - "bodyPatterns": [{ "contains": "getRouteEmissions(" }] + "bodyPatterns": [{ "contains": "item: getRouteEmissions(" }] }, "response": { "status": 200, diff --git a/test/wiremock/mappings/operator-by-id.json b/test/wiremock/mappings/operator-by-id.json index fd9546e..56cb370 100644 --- a/test/wiremock/mappings/operator-by-id.json +++ b/test/wiremock/mappings/operator-by-id.json @@ -2,7 +2,7 @@ "request": { "method": "POST", "url": "/graphql", - "bodyPatterns": [{ "contains": "operator(" }] + "bodyPatterns": [{ "contains": "item: operator(" }] }, "response": { "status": 200, diff --git a/test/wiremock/mappings/operator-list.json b/test/wiremock/mappings/operator-list.json index ecf33b9..0567a38 100644 --- a/test/wiremock/mappings/operator-list.json +++ b/test/wiremock/mappings/operator-list.json @@ -2,7 +2,7 @@ "request": { "method": "POST", "url": "/graphql", - "bodyPatterns": [{ "contains": "operatorList(" }] + "bodyPatterns": [{ "contains": "list: operatorList(" }] }, "response": { "status": 200, diff --git a/test/wiremock/mappings/route-by-id.json b/test/wiremock/mappings/route-by-id.json index 6ee6208..219cb3b 100644 --- a/test/wiremock/mappings/route-by-id.json +++ b/test/wiremock/mappings/route-by-id.json @@ -2,7 +2,7 @@ "request": { "method": "POST", "url": "/graphql", - "bodyPatterns": [{ "contains": "getRoute(" }] + "bodyPatterns": [{ "contains": "item: getRoute(" }] }, "response": { "status": 200, diff --git a/test/wiremock/mappings/station-around.json b/test/wiremock/mappings/station-around.json index c32c4fe..90c6a0c 100644 --- a/test/wiremock/mappings/station-around.json +++ b/test/wiremock/mappings/station-around.json @@ -2,7 +2,7 @@ "request": { "method": "POST", "url": "/graphql", - "bodyPatterns": [{ "contains": "stationAround(" }] + "bodyPatterns": [{ "contains": "list: stationAround(" }] }, "response": { "status": 200, diff --git a/test/wiremock/mappings/station-by-id.json b/test/wiremock/mappings/station-by-id.json index 26f5f29..5269165 100644 --- a/test/wiremock/mappings/station-by-id.json +++ b/test/wiremock/mappings/station-by-id.json @@ -2,7 +2,7 @@ "request": { "method": "POST", "url": "/graphql", - "bodyPatterns": [{ "contains": "station(" }] + "bodyPatterns": [{ "contains": "item: station(" }] }, "response": { "status": 200, diff --git a/test/wiremock/mappings/station-list.json b/test/wiremock/mappings/station-list.json index 6f21b6b..4c8fda0 100644 --- a/test/wiremock/mappings/station-list.json +++ b/test/wiremock/mappings/station-list.json @@ -2,7 +2,7 @@ "request": { "method": "POST", "url": "/graphql", - "bodyPatterns": [{ "contains": "stationList(" }] + "bodyPatterns": [{ "contains": "list: stationList(" }] }, "response": { "status": 200, diff --git a/test/wiremock/mappings/vehicle-by-id.json b/test/wiremock/mappings/vehicle-by-id.json index 8369839..8c3d2f1 100644 --- a/test/wiremock/mappings/vehicle-by-id.json +++ b/test/wiremock/mappings/vehicle-by-id.json @@ -2,7 +2,7 @@ "request": { "method": "POST", "url": "/graphql", - "bodyPatterns": [{ "contains": "vehicle(" }] + "bodyPatterns": [{ "contains": "item: vehicle(" }] }, "response": { "status": 200, diff --git a/test/wiremock/mappings/vehicle-list.json b/test/wiremock/mappings/vehicle-list.json index a9aea71..02d5907 100644 --- a/test/wiremock/mappings/vehicle-list.json +++ b/test/wiremock/mappings/vehicle-list.json @@ -2,7 +2,7 @@ "request": { "method": "POST", "url": "/graphql", - "bodyPatterns": [{ "contains": "vehicleList(" }] + "bodyPatterns": [{ "contains": "list: vehicleList(" }] }, "response": { "status": 200, From 8fbf2585976219989bf9c50ac1b70bc3ead93fee Mon Sep 17 00:00:00 2001 From: Cosmin Petrescu Date: Thu, 21 Aug 2025 12:20:44 +0300 Subject: [PATCH 4/4] fix: clean up after debug --- .github/workflows/test-workflow.yml | 3 + package-lock.json | 113 ---------------------------- package.json | 1 - src/__e2e__/emissions.e2e.spec.ts | 41 ---------- 4 files changed, 3 insertions(+), 155 deletions(-) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index 8b99204..dc6ce64 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -1,5 +1,8 @@ name: test on: + push: + branches: + - main pull_request: paths: - '**.js' diff --git a/package-lock.json b/package-lock.json index a90ea49..0de51ff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,7 +41,6 @@ "@types/jest": "^30.0.0", "@types/node": "^24.2.1", "@types/ws": "^8.18.1", - "axios": "^1.11.0", "babel-loader": "^10.0.0", "eslint-plugin-oxlint": "^1.12.0", "husky": "^9.1.7", @@ -4872,58 +4871,6 @@ "dev": true, "license": "MIT" }, - "node_modules/axios": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.11.0.tgz", - "integrity": "sha512-1Lx3WLFQWm3ooKDYZD1eXmoGO9fxYQjrycfHFC8P0sCfQVXyROp0p9PFWBehewBOdCwHc+f/b8I0fMto5eSfwA==", - "dev": true, - "license": "MIT", - "dependencies": { - "follow-redirects": "^1.15.6", - "form-data": "^4.0.4", - "proxy-from-env": "^1.1.0" - } - }, - "node_modules/axios/node_modules/form-data": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz", - "integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==", - "dev": true, - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "es-set-tostringtag": "^2.1.0", - "hasown": "^2.0.2", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/axios/node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/axios/node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dev": true, - "license": "MIT", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/b4a": { "version": "1.6.7", "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.7.tgz", @@ -7715,22 +7662,6 @@ "node": ">= 0.4" } }, - "node_modules/es-set-tostringtag": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", - "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", - "dev": true, - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.6", - "has-tostringtag": "^1.0.2", - "hasown": "^2.0.2" - }, - "engines": { - "node": ">= 0.4" - } - }, "node_modules/es6-promise": { "version": "4.2.8", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", @@ -8391,27 +8322,6 @@ "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==", "license": "MIT" }, - "node_modules/follow-redirects": { - "version": "1.15.11", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz", - "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "license": "MIT", - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, "node_modules/foreground-child": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", @@ -9201,22 +9111,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/has-tostringtag": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", - "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-symbols": "^1.0.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/has-unicode": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", @@ -16242,13 +16136,6 @@ "node": ">= 0.10" } }, - "node_modules/proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "dev": true, - "license": "MIT" - }, "node_modules/pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", diff --git a/package.json b/package.json index 6f9cc52..c4502c6 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,6 @@ "@types/jest": "^30.0.0", "@types/node": "^24.2.1", "@types/ws": "^8.18.1", - "axios": "^1.11.0", "babel-loader": "^10.0.0", "eslint-plugin-oxlint": "^1.12.0", "husky": "^9.1.7", diff --git a/src/__e2e__/emissions.e2e.spec.ts b/src/__e2e__/emissions.e2e.spec.ts index fc76f0b..d18aea9 100644 --- a/src/__e2e__/emissions.e2e.spec.ts +++ b/src/__e2e__/emissions.e2e.spec.ts @@ -1,6 +1,5 @@ import { Client } from '@modelcontextprotocol/sdk/client/index.js'; import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'; -import axios, { AxiosError } from 'axios'; import { getMcpClient } from './client'; describe('Chargetrip MCP -> emissions', () => { @@ -19,46 +18,6 @@ describe('Chargetrip MCP -> emissions', () => { }); it('should return all emissions data for route with id `e4568f10-7da1-11f0-880d-28eb7d82c15b` and details id `e5918010-7da1-11f0-9504-6371214e66f0`', async () => { - try { - const response = await axios.post('http://localhost:8800/graphql', { - query: ` - query EmissionsById( - $routeId: ID! - $routeDetailsId: ID! - $emissionUnit: EmissionUnit - ) { - item: getRouteEmissions(route_id: $routeId route_details_id: $routeDetailsId) { - co2e_saved(unit: $emissionUnit) - gasoline_vehicle: internal_combustion_vehicle(fuel_type: gasoline) { - total(unit: $emissionUnit) - iso_14083_2023(unit: $emissionUnit) - } - diesel_vehicle: internal_combustion_vehicle(fuel_type: diesel) { - total(unit: $emissionUnit) - iso_14083_2023(unit: $emissionUnit) - } - route_vehicle { - total(unit: $emissionUnit) - iso_14083_2023(unit: $emissionUnit) - } - } - } - `, - variables: { - routeId: 'e4568f10-7da1-11f0-880d-28eb7d82c15b', - routeDetailsId: 'e5918010-7da1-11f0-9504-6371214e66f0', - emissionUnit: 'gram', - }, - }); - console.log(JSON.stringify(response.data, null, 2)); - } catch (e) { - if (e instanceof AxiosError) { - console.log(e.response?.data); - } else { - console.error(e); - } - } - expect( await client.callTool({ name: 'emission_by_route_id',