cloud-cost-mcp 1.1.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 (48) hide show
  1. package/LICENSE +190 -0
  2. package/NOTICE +15 -0
  3. package/README.md +232 -0
  4. package/dist/data/bundled/aws-pricing.json +379 -0
  5. package/dist/data/bundled/azure-pricing.json +367 -0
  6. package/dist/data/bundled/gcp-pricing.json +383 -0
  7. package/dist/data/bundled/oci-pricing.json +290 -0
  8. package/dist/data/cache.d.ts +53 -0
  9. package/dist/data/cache.d.ts.map +1 -0
  10. package/dist/data/cache.js +95 -0
  11. package/dist/data/cache.js.map +1 -0
  12. package/dist/data/fetchers/aws.d.ts +65 -0
  13. package/dist/data/fetchers/aws.d.ts.map +1 -0
  14. package/dist/data/fetchers/aws.js +298 -0
  15. package/dist/data/fetchers/aws.js.map +1 -0
  16. package/dist/data/fetchers/azure.d.ts +83 -0
  17. package/dist/data/fetchers/azure.d.ts.map +1 -0
  18. package/dist/data/fetchers/azure.js +369 -0
  19. package/dist/data/fetchers/azure.js.map +1 -0
  20. package/dist/data/fetchers/gcp.d.ts +44 -0
  21. package/dist/data/fetchers/gcp.d.ts.map +1 -0
  22. package/dist/data/fetchers/gcp.js +182 -0
  23. package/dist/data/fetchers/gcp.js.map +1 -0
  24. package/dist/data/fetchers/oci.d.ts +65 -0
  25. package/dist/data/fetchers/oci.d.ts.map +1 -0
  26. package/dist/data/fetchers/oci.js +130 -0
  27. package/dist/data/fetchers/oci.js.map +1 -0
  28. package/dist/data/loader.d.ts +56 -0
  29. package/dist/data/loader.d.ts.map +1 -0
  30. package/dist/data/loader.js +149 -0
  31. package/dist/data/loader.js.map +1 -0
  32. package/dist/index.d.ts +21 -0
  33. package/dist/index.d.ts.map +1 -0
  34. package/dist/index.js +715 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/tools/calculator.d.ts +36 -0
  37. package/dist/tools/calculator.d.ts.map +1 -0
  38. package/dist/tools/calculator.js +271 -0
  39. package/dist/tools/calculator.js.map +1 -0
  40. package/dist/tools/compare.d.ts +64 -0
  41. package/dist/tools/compare.d.ts.map +1 -0
  42. package/dist/tools/compare.js +243 -0
  43. package/dist/tools/compare.js.map +1 -0
  44. package/dist/types.d.ts +171 -0
  45. package/dist/types.d.ts.map +1 -0
  46. package/dist/types.js +6 -0
  47. package/dist/types.js.map +1 -0
  48. package/package.json +57 -0
package/dist/index.js ADDED
@@ -0,0 +1,715 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Cloud Cost MCP Server
4
+ * Multi-cloud pricing comparison for AWS, Azure, GCP, and OCI
5
+ *
6
+ * Copyright 2026 Jason Wilbur
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */
20
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
21
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
22
+ import { CallToolRequestSchema, ListToolsRequestSchema, ErrorCode, McpError, } from '@modelcontextprotocol/sdk/types.js';
23
+ // Import comparison tools
24
+ import { compareCompute, compareStorage, compareEgress, compareKubernetes, findCheapestCompute, getStoragePricingSummary, } from './tools/compare.js';
25
+ // Import calculator tools
26
+ import { calculateWorkloadCost, quickEstimate, getAvailablePresets, estimateMigrationSavings, } from './tools/calculator.js';
27
+ // Import data functions
28
+ import { getDataFreshness, getProviderData, } from './data/loader.js';
29
+ // Import real-time fetchers
30
+ import { fetchAzureComputePricing, checkAzureAPIStatus, fetchAzureVantagePricing, getAzureVantageRegions, getAzureCategories, } from './data/fetchers/azure.js';
31
+ import { fetchGCPComputePricing, getGCPRegions, getGCPInstanceFamilies, checkGCPAPIStatus, } from './data/fetchers/gcp.js';
32
+ import { fetchOCIRealTimePricing, getOCICategories, checkOCIAPIStatus } from './data/fetchers/oci.js';
33
+ import { fetchAWSEC2Pricing, fetchAWSRDSPricing, getAWSLightsailPricing, getAWSRegions, getAWSInstanceFamilies, checkAWSAPIStatus, } from './data/fetchers/aws.js';
34
+ // Create server instance
35
+ const server = new Server({
36
+ name: 'cloud-cost-mcp',
37
+ version: '1.1.0',
38
+ }, {
39
+ capabilities: {
40
+ tools: {},
41
+ },
42
+ });
43
+ // Define available tools
44
+ const TOOLS = [
45
+ // Core comparison tools
46
+ {
47
+ name: 'compare_compute',
48
+ description: 'Compare VM/instance pricing across AWS, Azure, GCP, and OCI. Finds instances matching your vCPU and memory requirements.',
49
+ inputSchema: {
50
+ type: 'object',
51
+ properties: {
52
+ vcpus: {
53
+ type: 'number',
54
+ description: 'Desired number of vCPUs',
55
+ },
56
+ memoryGB: {
57
+ type: 'number',
58
+ description: 'Desired memory in GB',
59
+ },
60
+ category: {
61
+ type: 'string',
62
+ enum: ['general', 'compute', 'memory', 'storage', 'gpu', 'arm'],
63
+ description: 'Optional: filter by instance category',
64
+ },
65
+ },
66
+ required: ['vcpus', 'memoryGB'],
67
+ },
68
+ },
69
+ {
70
+ name: 'compare_storage',
71
+ description: 'Compare object and block storage pricing across all clouds.',
72
+ inputSchema: {
73
+ type: 'object',
74
+ properties: {
75
+ sizeGB: {
76
+ type: 'number',
77
+ description: 'Storage size in GB',
78
+ },
79
+ tier: {
80
+ type: 'string',
81
+ enum: ['hot', 'cool', 'cold', 'archive'],
82
+ description: 'Optional: storage tier',
83
+ },
84
+ type: {
85
+ type: 'string',
86
+ enum: ['object', 'block'],
87
+ description: 'Optional: storage type',
88
+ },
89
+ },
90
+ required: ['sizeGB'],
91
+ },
92
+ },
93
+ {
94
+ name: 'compare_egress',
95
+ description: 'Compare data transfer/egress costs. OCI offers 10TB/month free (100x more than others)!',
96
+ inputSchema: {
97
+ type: 'object',
98
+ properties: {
99
+ monthlyGB: {
100
+ type: 'number',
101
+ description: 'Monthly outbound data in GB',
102
+ },
103
+ },
104
+ required: ['monthlyGB'],
105
+ },
106
+ },
107
+ {
108
+ name: 'compare_kubernetes',
109
+ description: 'Compare managed Kubernetes pricing (EKS, AKS, GKE, OKE). Shows control plane and worker node costs.',
110
+ inputSchema: {
111
+ type: 'object',
112
+ properties: {
113
+ nodeCount: {
114
+ type: 'number',
115
+ description: 'Number of worker nodes',
116
+ },
117
+ nodeVcpus: {
118
+ type: 'number',
119
+ description: 'vCPUs per node',
120
+ },
121
+ nodeMemoryGB: {
122
+ type: 'number',
123
+ description: 'Memory per node in GB',
124
+ },
125
+ },
126
+ required: ['nodeCount', 'nodeVcpus', 'nodeMemoryGB'],
127
+ },
128
+ },
129
+ {
130
+ name: 'find_cheapest_compute',
131
+ description: 'Find the cheapest cloud provider for specific compute specs.',
132
+ inputSchema: {
133
+ type: 'object',
134
+ properties: {
135
+ vcpus: {
136
+ type: 'number',
137
+ description: 'Desired number of vCPUs',
138
+ },
139
+ memoryGB: {
140
+ type: 'number',
141
+ description: 'Desired memory in GB',
142
+ },
143
+ category: {
144
+ type: 'string',
145
+ enum: ['general', 'compute', 'memory', 'storage', 'gpu', 'arm'],
146
+ description: 'Optional: filter by instance category',
147
+ },
148
+ },
149
+ required: ['vcpus', 'memoryGB'],
150
+ },
151
+ },
152
+ // Calculator tools
153
+ {
154
+ name: 'calculate_workload_cost',
155
+ description: 'Estimate total monthly cost for a workload across all cloud providers. Includes compute, storage, egress, and Kubernetes.',
156
+ inputSchema: {
157
+ type: 'object',
158
+ properties: {
159
+ compute: {
160
+ type: 'object',
161
+ properties: {
162
+ vcpus: { type: 'number' },
163
+ memoryGB: { type: 'number' },
164
+ count: { type: 'number', description: 'Number of instances (default: 1)' },
165
+ },
166
+ required: ['vcpus', 'memoryGB'],
167
+ },
168
+ storage: {
169
+ type: 'object',
170
+ properties: {
171
+ objectGB: { type: 'number', description: 'Object storage in GB' },
172
+ blockGB: { type: 'number', description: 'Block storage in GB' },
173
+ },
174
+ },
175
+ egress: {
176
+ type: 'object',
177
+ properties: {
178
+ monthlyGB: { type: 'number', description: 'Monthly outbound data in GB' },
179
+ },
180
+ },
181
+ kubernetes: {
182
+ type: 'object',
183
+ properties: {
184
+ nodeCount: { type: 'number' },
185
+ nodeVcpus: { type: 'number' },
186
+ nodeMemoryGB: { type: 'number' },
187
+ },
188
+ required: ['nodeCount', 'nodeVcpus', 'nodeMemoryGB'],
189
+ },
190
+ },
191
+ },
192
+ },
193
+ {
194
+ name: 'quick_estimate',
195
+ description: 'Get instant cost comparison for common deployment presets.',
196
+ inputSchema: {
197
+ type: 'object',
198
+ properties: {
199
+ preset: {
200
+ type: 'string',
201
+ enum: ['small-web-app', 'medium-api-server', 'large-database', 'ml-training', 'kubernetes-cluster', 'data-lake', 'high-egress-cdn'],
202
+ description: 'Deployment preset name',
203
+ },
204
+ },
205
+ required: ['preset'],
206
+ },
207
+ },
208
+ {
209
+ name: 'list_presets',
210
+ description: 'List all available deployment presets for quick_estimate.',
211
+ inputSchema: {
212
+ type: 'object',
213
+ properties: {},
214
+ },
215
+ },
216
+ {
217
+ name: 'estimate_migration_savings',
218
+ description: 'Calculate potential savings when migrating from one cloud provider to another.',
219
+ inputSchema: {
220
+ type: 'object',
221
+ properties: {
222
+ currentProvider: {
223
+ type: 'string',
224
+ enum: ['aws', 'azure', 'gcp', 'oci'],
225
+ description: 'Your current cloud provider',
226
+ },
227
+ targetProvider: {
228
+ type: 'string',
229
+ enum: ['aws', 'azure', 'gcp', 'oci'],
230
+ description: 'Optional: target provider (finds cheapest if not specified)',
231
+ },
232
+ compute: {
233
+ type: 'object',
234
+ properties: {
235
+ vcpus: { type: 'number' },
236
+ memoryGB: { type: 'number' },
237
+ count: { type: 'number' },
238
+ },
239
+ },
240
+ storage: {
241
+ type: 'object',
242
+ properties: {
243
+ objectGB: { type: 'number' },
244
+ blockGB: { type: 'number' },
245
+ },
246
+ },
247
+ egress: {
248
+ type: 'object',
249
+ properties: {
250
+ monthlyGB: { type: 'number' },
251
+ },
252
+ },
253
+ },
254
+ required: ['currentProvider'],
255
+ },
256
+ },
257
+ // Data management tools
258
+ {
259
+ name: 'get_data_freshness',
260
+ description: 'Check how recent the pricing data is for each provider. Warns if data is stale (>30 days).',
261
+ inputSchema: {
262
+ type: 'object',
263
+ properties: {},
264
+ },
265
+ },
266
+ {
267
+ name: 'get_provider_details',
268
+ description: 'Get detailed pricing data for a specific cloud provider.',
269
+ inputSchema: {
270
+ type: 'object',
271
+ properties: {
272
+ provider: {
273
+ type: 'string',
274
+ enum: ['aws', 'azure', 'gcp', 'oci'],
275
+ description: 'Cloud provider',
276
+ },
277
+ category: {
278
+ type: 'string',
279
+ enum: ['compute', 'storage', 'egress', 'kubernetes', 'database'],
280
+ description: 'Optional: filter by category',
281
+ },
282
+ },
283
+ required: ['provider'],
284
+ },
285
+ },
286
+ {
287
+ name: 'get_storage_summary',
288
+ description: 'Get storage pricing summary by tier (hot, cool, cold, archive) for all providers.',
289
+ inputSchema: {
290
+ type: 'object',
291
+ properties: {
292
+ sizeGB: {
293
+ type: 'number',
294
+ description: 'Storage size in GB for cost calculation',
295
+ },
296
+ },
297
+ required: ['sizeGB'],
298
+ },
299
+ },
300
+ // Real-time API tools
301
+ {
302
+ name: 'refresh_azure_pricing',
303
+ description: 'Fetch latest Azure VM pricing from the public Azure Retail Prices API. No authentication required.',
304
+ inputSchema: {
305
+ type: 'object',
306
+ properties: {
307
+ region: {
308
+ type: 'string',
309
+ description: 'Azure region (default: eastus)',
310
+ },
311
+ vmSeries: {
312
+ type: 'string',
313
+ description: 'Optional: filter by VM series (e.g., "D", "E", "F")',
314
+ },
315
+ maxResults: {
316
+ type: 'number',
317
+ description: 'Maximum results to return (default: 100)',
318
+ },
319
+ },
320
+ },
321
+ },
322
+ {
323
+ name: 'refresh_oci_pricing',
324
+ description: 'Fetch latest OCI pricing from Oracle\'s public API. Returns 600+ products. No authentication required.',
325
+ inputSchema: {
326
+ type: 'object',
327
+ properties: {
328
+ currency: {
329
+ type: 'string',
330
+ description: 'Currency code (default: USD)',
331
+ },
332
+ category: {
333
+ type: 'string',
334
+ description: 'Filter by service category (e.g., "Compute", "Storage")',
335
+ },
336
+ search: {
337
+ type: 'string',
338
+ description: 'Search term for product name',
339
+ },
340
+ },
341
+ },
342
+ },
343
+ {
344
+ name: 'list_oci_categories',
345
+ description: 'List all service categories available from OCI\'s real-time pricing API.',
346
+ inputSchema: {
347
+ type: 'object',
348
+ properties: {},
349
+ },
350
+ },
351
+ {
352
+ name: 'check_api_status',
353
+ description: 'Check if the real-time pricing APIs (Azure, OCI, AWS) are accessible.',
354
+ inputSchema: {
355
+ type: 'object',
356
+ properties: {},
357
+ },
358
+ },
359
+ // AWS Real-Time Pricing Tools (1,147 EC2 instances, 353 RDS instances)
360
+ {
361
+ name: 'refresh_aws_ec2_pricing',
362
+ description: 'Fetch real-time AWS EC2 pricing from instances.vantage.sh. Returns 1,147 instance types with on-demand, spot, and reserved pricing. No authentication required.',
363
+ inputSchema: {
364
+ type: 'object',
365
+ properties: {
366
+ region: {
367
+ type: 'string',
368
+ description: 'AWS region (default: us-east-1). Use list_aws_regions to see all available.',
369
+ },
370
+ family: {
371
+ type: 'string',
372
+ description: 'Filter by instance family (e.g., "General purpose", "Compute optimized")',
373
+ },
374
+ architecture: {
375
+ type: 'string',
376
+ enum: ['x86', 'arm'],
377
+ description: 'Filter by CPU architecture',
378
+ },
379
+ maxResults: {
380
+ type: 'number',
381
+ description: 'Maximum results to return (default: 500)',
382
+ },
383
+ includeSpot: {
384
+ type: 'boolean',
385
+ description: 'Include spot pricing in notes',
386
+ },
387
+ includeReserved: {
388
+ type: 'boolean',
389
+ description: 'Include reserved pricing in notes',
390
+ },
391
+ },
392
+ },
393
+ },
394
+ {
395
+ name: 'refresh_aws_rds_pricing',
396
+ description: 'Fetch real-time AWS RDS database pricing. Returns 353 instance types across multiple database engines.',
397
+ inputSchema: {
398
+ type: 'object',
399
+ properties: {
400
+ region: {
401
+ type: 'string',
402
+ description: 'AWS region (default: us-east-1)',
403
+ },
404
+ engine: {
405
+ type: 'string',
406
+ description: 'Database engine (default: PostgreSQL). Options: PostgreSQL, MySQL, MariaDB, Oracle, SQL Server',
407
+ },
408
+ maxResults: {
409
+ type: 'number',
410
+ description: 'Maximum results to return (default: 100)',
411
+ },
412
+ },
413
+ },
414
+ },
415
+ {
416
+ name: 'get_aws_lightsail_pricing',
417
+ description: 'Get AWS Lightsail bundle pricing. Simplified VPS with fixed monthly pricing including storage and transfer.',
418
+ inputSchema: {
419
+ type: 'object',
420
+ properties: {
421
+ region: {
422
+ type: 'string',
423
+ description: 'AWS region (default: us-east-1)',
424
+ },
425
+ },
426
+ },
427
+ },
428
+ {
429
+ name: 'list_aws_regions',
430
+ description: 'List all AWS regions available in the pricing data.',
431
+ inputSchema: {
432
+ type: 'object',
433
+ properties: {},
434
+ },
435
+ },
436
+ {
437
+ name: 'list_aws_instance_families',
438
+ description: 'List AWS EC2 instance families with counts (e.g., General purpose: 200, Compute optimized: 150).',
439
+ inputSchema: {
440
+ type: 'object',
441
+ properties: {},
442
+ },
443
+ },
444
+ // GCP Real-Time Pricing Tools (287 instance types, 40+ regions)
445
+ {
446
+ name: 'refresh_gcp_pricing',
447
+ description: 'Fetch real-time GCP Compute Engine pricing from instances.vantage.sh. Returns 287 instance types with on-demand and spot pricing across 40+ regions.',
448
+ inputSchema: {
449
+ type: 'object',
450
+ properties: {
451
+ region: {
452
+ type: 'string',
453
+ description: 'GCP region (default: us-central1). Use list_gcp_regions to see all available.',
454
+ },
455
+ family: {
456
+ type: 'string',
457
+ description: 'Filter by instance family (e.g., "General purpose", "Compute optimized")',
458
+ },
459
+ includeSpot: {
460
+ type: 'boolean',
461
+ description: 'Include spot/preemptible pricing in notes',
462
+ },
463
+ maxResults: {
464
+ type: 'number',
465
+ description: 'Maximum results to return (default: 300)',
466
+ },
467
+ },
468
+ },
469
+ },
470
+ {
471
+ name: 'list_gcp_regions',
472
+ description: 'List all GCP regions available in the pricing data with their display names.',
473
+ inputSchema: {
474
+ type: 'object',
475
+ properties: {},
476
+ },
477
+ },
478
+ {
479
+ name: 'list_gcp_instance_families',
480
+ description: 'List GCP instance families with counts.',
481
+ inputSchema: {
482
+ type: 'object',
483
+ properties: {},
484
+ },
485
+ },
486
+ // Azure Enhanced Pricing Tools (1,199 instance types)
487
+ {
488
+ name: 'refresh_azure_full_pricing',
489
+ description: 'Fetch comprehensive Azure VM pricing from instances.vantage.sh. Returns 1,199 instance types with on-demand, spot, and Windows pricing.',
490
+ inputSchema: {
491
+ type: 'object',
492
+ properties: {
493
+ region: {
494
+ type: 'string',
495
+ description: 'Azure region (default: us-east). Use list_azure_regions to see all available.',
496
+ },
497
+ category: {
498
+ type: 'string',
499
+ description: 'Filter by category (e.g., "generalpurpose", "computeoptimized", "memoryoptimized")',
500
+ },
501
+ includeSpot: {
502
+ type: 'boolean',
503
+ description: 'Include spot pricing in notes',
504
+ },
505
+ maxResults: {
506
+ type: 'number',
507
+ description: 'Maximum results to return (default: 500)',
508
+ },
509
+ },
510
+ },
511
+ },
512
+ {
513
+ name: 'list_azure_regions',
514
+ description: 'List all Azure regions available in the pricing data.',
515
+ inputSchema: {
516
+ type: 'object',
517
+ properties: {},
518
+ },
519
+ },
520
+ {
521
+ name: 'list_azure_categories',
522
+ description: 'List Azure VM categories with counts (e.g., generalpurpose: 400, computeoptimized: 200).',
523
+ inputSchema: {
524
+ type: 'object',
525
+ properties: {},
526
+ },
527
+ },
528
+ ];
529
+ // Handle list tools request
530
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
531
+ return { tools: TOOLS };
532
+ });
533
+ // Handle tool calls
534
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
535
+ const { name, arguments: args } = request.params;
536
+ try {
537
+ let result;
538
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
539
+ const typedArgs = args;
540
+ switch (name) {
541
+ // Comparison tools
542
+ case 'compare_compute':
543
+ result = compareCompute(typedArgs);
544
+ break;
545
+ case 'compare_storage':
546
+ result = compareStorage(typedArgs);
547
+ break;
548
+ case 'compare_egress':
549
+ result = compareEgress(typedArgs);
550
+ break;
551
+ case 'compare_kubernetes':
552
+ result = compareKubernetes(typedArgs);
553
+ break;
554
+ case 'find_cheapest_compute':
555
+ result = findCheapestCompute(typedArgs);
556
+ break;
557
+ // Calculator tools
558
+ case 'calculate_workload_cost':
559
+ result = calculateWorkloadCost(typedArgs);
560
+ break;
561
+ case 'quick_estimate':
562
+ result = quickEstimate(typedArgs.preset);
563
+ break;
564
+ case 'list_presets':
565
+ result = getAvailablePresets();
566
+ break;
567
+ case 'estimate_migration_savings':
568
+ result = estimateMigrationSavings({
569
+ spec: {
570
+ compute: typedArgs.compute,
571
+ storage: typedArgs.storage,
572
+ egress: typedArgs.egress,
573
+ },
574
+ currentProvider: typedArgs.currentProvider,
575
+ targetProvider: typedArgs.targetProvider,
576
+ });
577
+ break;
578
+ // Data management tools
579
+ case 'get_data_freshness':
580
+ result = {
581
+ providers: getDataFreshness(),
582
+ note: 'Azure and OCI can be refreshed in real-time using refresh_azure_pricing and refresh_oci_pricing tools. AWS and GCP require an npm update for new data.',
583
+ };
584
+ break;
585
+ case 'get_provider_details': {
586
+ const data = getProviderData(typedArgs.provider);
587
+ if (typedArgs.category) {
588
+ result = {
589
+ provider: typedArgs.provider,
590
+ metadata: data.metadata,
591
+ [typedArgs.category]: data[typedArgs.category],
592
+ };
593
+ }
594
+ else {
595
+ result = data;
596
+ }
597
+ break;
598
+ }
599
+ case 'get_storage_summary':
600
+ result = getStoragePricingSummary(typedArgs.sizeGB);
601
+ break;
602
+ // Real-time API tools
603
+ case 'refresh_azure_pricing':
604
+ result = {
605
+ instances: await fetchAzureComputePricing(typedArgs),
606
+ note: 'Real-time pricing from Azure Retail Prices API',
607
+ timestamp: new Date().toISOString(),
608
+ };
609
+ break;
610
+ case 'refresh_oci_pricing':
611
+ result = await fetchOCIRealTimePricing(typedArgs);
612
+ break;
613
+ case 'list_oci_categories':
614
+ result = await getOCICategories();
615
+ break;
616
+ case 'check_api_status':
617
+ const [azureStatus, ociStatus, awsStatus, gcpStatus] = await Promise.all([
618
+ checkAzureAPIStatus(),
619
+ checkOCIAPIStatus(),
620
+ checkAWSAPIStatus(),
621
+ checkGCPAPIStatus(),
622
+ ]);
623
+ result = {
624
+ aws: awsStatus,
625
+ azure: azureStatus,
626
+ gcp: gcpStatus,
627
+ oci: ociStatus,
628
+ note: 'All providers now have real-time pricing via instances.vantage.sh: AWS (1,147), Azure (1,199), GCP (287), OCI (600+)',
629
+ };
630
+ break;
631
+ // AWS Real-Time Pricing Tools
632
+ case 'refresh_aws_ec2_pricing':
633
+ result = await fetchAWSEC2Pricing(typedArgs);
634
+ break;
635
+ case 'refresh_aws_rds_pricing':
636
+ result = await fetchAWSRDSPricing(typedArgs);
637
+ break;
638
+ case 'get_aws_lightsail_pricing':
639
+ result = getAWSLightsailPricing(typedArgs);
640
+ break;
641
+ case 'list_aws_regions':
642
+ result = {
643
+ regions: await getAWSRegions(),
644
+ note: 'Regions with EC2 pricing data available',
645
+ };
646
+ break;
647
+ case 'list_aws_instance_families':
648
+ result = {
649
+ families: await getAWSInstanceFamilies(),
650
+ note: 'EC2 instance families with count of instance types',
651
+ };
652
+ break;
653
+ // GCP Real-Time Pricing Tools
654
+ case 'refresh_gcp_pricing':
655
+ result = await fetchGCPComputePricing(typedArgs);
656
+ break;
657
+ case 'list_gcp_regions':
658
+ result = {
659
+ regions: await getGCPRegions(),
660
+ note: 'GCP regions with compute pricing data available',
661
+ };
662
+ break;
663
+ case 'list_gcp_instance_families':
664
+ result = {
665
+ families: await getGCPInstanceFamilies(),
666
+ note: 'GCP instance families with count of instance types',
667
+ };
668
+ break;
669
+ // Azure Enhanced Pricing Tools (1,199 instance types from vantage.sh)
670
+ case 'refresh_azure_full_pricing':
671
+ result = await fetchAzureVantagePricing(typedArgs);
672
+ break;
673
+ case 'list_azure_regions':
674
+ result = {
675
+ regions: await getAzureVantageRegions(),
676
+ note: 'Azure regions with compute pricing data available',
677
+ };
678
+ break;
679
+ case 'list_azure_categories':
680
+ result = {
681
+ categories: await getAzureCategories(),
682
+ note: 'Azure VM categories with count of instance types',
683
+ };
684
+ break;
685
+ default:
686
+ throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
687
+ }
688
+ return {
689
+ content: [
690
+ {
691
+ type: 'text',
692
+ text: JSON.stringify(result, null, 2),
693
+ },
694
+ ],
695
+ };
696
+ }
697
+ catch (error) {
698
+ if (error instanceof McpError) {
699
+ throw error;
700
+ }
701
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
702
+ throw new McpError(ErrorCode.InternalError, errorMessage);
703
+ }
704
+ });
705
+ // Start the server
706
+ async function main() {
707
+ const transport = new StdioServerTransport();
708
+ await server.connect(transport);
709
+ console.error('Cloud Cost MCP Server running on stdio');
710
+ }
711
+ main().catch((error) => {
712
+ console.error('Fatal error:', error);
713
+ process.exit(1);
714
+ });
715
+ //# sourceMappingURL=index.js.map