@ryancardin/noaa-tides-currents-mcp-server 2.0.0 → 2.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 (68) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +18 -5
  3. package/dist/client/deadline.d.ts +6 -0
  4. package/dist/client/deadline.js +23 -0
  5. package/dist/client/http.d.ts +2 -0
  6. package/dist/client/http.js +75 -4
  7. package/dist/constants.d.ts +11 -0
  8. package/dist/constants.js +11 -0
  9. package/dist/format/respond.d.ts +37 -1
  10. package/dist/format/respond.js +45 -10
  11. package/dist/index.js +0 -0
  12. package/dist/reference/content.d.ts +1 -1
  13. package/dist/reference/content.js +24 -0
  14. package/dist/resources/index.js +8 -0
  15. package/dist/services/nws-api.d.ts +115 -0
  16. package/dist/services/nws-api.js +267 -0
  17. package/dist/tools/astronomy.js +6 -1
  18. package/dist/tools/currents.js +3 -1
  19. package/dist/tools/derived.js +6 -1
  20. package/dist/tools/index.js +12 -0
  21. package/dist/tools/marine-forecast.d.ts +7 -0
  22. package/dist/tools/marine-forecast.js +177 -0
  23. package/dist/tools/met.js +2 -1
  24. package/dist/tools/reference.js +4 -0
  25. package/dist/tools/station-metadata.js +4 -1
  26. package/dist/tools/stations.js +4 -1
  27. package/dist/tools/water.js +4 -1
  28. package/package.json +6 -6
  29. package/dist/interfaces/config.d.ts +0 -6
  30. package/dist/interfaces/config.js +0 -1
  31. package/dist/interfaces/noaa.d.ts +0 -334
  32. package/dist/interfaces/noaa.js +0 -98
  33. package/dist/interfaces/parameters.d.ts +0 -18
  34. package/dist/interfaces/parameters.js +0 -5
  35. package/dist/mcp-server.d.ts +0 -12
  36. package/dist/mcp-server.js +0 -103
  37. package/dist/moon-phase-service.d.ts +0 -122
  38. package/dist/moon-phase-service.js +0 -187
  39. package/dist/noaa-service.d.ts +0 -60
  40. package/dist/noaa-service.js +0 -159
  41. package/dist/schemas/dpapi.d.ts +0 -198
  42. package/dist/schemas/dpapi.js +0 -89
  43. package/dist/server/config.d.ts +0 -9
  44. package/dist/server/config.js +0 -40
  45. package/dist/server/mcp-server.d.ts +0 -12
  46. package/dist/server/mcp-server.js +0 -103
  47. package/dist/services/dpapi-service.d.ts +0 -72
  48. package/dist/services/dpapi-service.js +0 -164
  49. package/dist/services/noaa-parameters-service.d.ts +0 -76
  50. package/dist/services/noaa-parameters-service.js +0 -128
  51. package/dist/services/noaa-service.d.ts +0 -52
  52. package/dist/services/noaa-service.js +0 -151
  53. package/dist/sun-service.d.ts +0 -184
  54. package/dist/sun-service.js +0 -218
  55. package/dist/tools/derived-product-tools.d.ts +0 -6
  56. package/dist/tools/derived-product-tools.js +0 -168
  57. package/dist/tools/moon-tools.d.ts +0 -6
  58. package/dist/tools/moon-tools.js +0 -69
  59. package/dist/tools/parameter-tools.d.ts +0 -6
  60. package/dist/tools/parameter-tools.js +0 -77
  61. package/dist/tools/station-tools.d.ts +0 -6
  62. package/dist/tools/station-tools.js +0 -51
  63. package/dist/tools/sun-tools.d.ts +0 -6
  64. package/dist/tools/sun-tools.js +0 -109
  65. package/dist/tools/water-tools.d.ts +0 -6
  66. package/dist/tools/water-tools.js +0 -150
  67. package/dist/types.d.ts +0 -337
  68. package/dist/types.js +0 -98
@@ -1,77 +0,0 @@
1
- import { ParameterSchema } from '../interfaces/parameters.js';
2
- /**
3
- * Register parameter tools with the MCP server
4
- */
5
- export function registerParameterTools(server, parametersService) {
6
- /**
7
- * Add parameter definitions tool
8
- */
9
- server.addTool({
10
- name: 'get_parameter_definitions',
11
- description: 'Get information about valid parameter values for NOAA API requests',
12
- parameters: ParameterSchema,
13
- execute: async (params) => {
14
- try {
15
- const { parameter } = params;
16
- // If no parameter specified, return all parameter types and their descriptions
17
- if (!parameter) {
18
- return JSON.stringify({
19
- time_zones: parametersService.getTimeZones(),
20
- datums: parametersService.getDatums(),
21
- units: parametersService.getUnits(),
22
- tide_intervals: parametersService.getTidePredictionIntervals(),
23
- current_intervals: parametersService.getCurrentPredictionIntervals(),
24
- velocity_types: parametersService.getVelocityTypes(),
25
- products: parametersService.getMeteorologicalProducts(),
26
- station_types: parametersService.getStationTypes(),
27
- date_formats: parametersService.getDateFormats(),
28
- output_formats: parametersService.getOutputFormats()
29
- });
30
- }
31
- // Return specific parameter information based on the parameter type
32
- let result;
33
- switch (parameter) {
34
- case 'time_zones':
35
- result = parametersService.getTimeZones();
36
- break;
37
- case 'datums':
38
- result = parametersService.getDatums();
39
- break;
40
- case 'units':
41
- result = parametersService.getUnits();
42
- break;
43
- case 'tide_intervals':
44
- result = parametersService.getTidePredictionIntervals();
45
- break;
46
- case 'current_intervals':
47
- result = parametersService.getCurrentPredictionIntervals();
48
- break;
49
- case 'velocity_types':
50
- result = parametersService.getVelocityTypes();
51
- break;
52
- case 'products':
53
- result = parametersService.getMeteorologicalProducts();
54
- break;
55
- case 'station_types':
56
- result = parametersService.getStationTypes();
57
- break;
58
- case 'date_formats':
59
- result = parametersService.getDateFormats();
60
- break;
61
- case 'output_formats':
62
- result = parametersService.getOutputFormats();
63
- break;
64
- default:
65
- throw new Error(`Unknown parameter type: ${parameter}`);
66
- }
67
- return JSON.stringify(result);
68
- }
69
- catch (error) {
70
- if (error instanceof Error) {
71
- throw new Error(`Failed to get parameter definitions: ${error.message}`);
72
- }
73
- throw new Error('Failed to get parameter definitions');
74
- }
75
- }
76
- });
77
- }
@@ -1,6 +0,0 @@
1
- import { FastMCP } from 'fastmcp';
2
- import { NoaaService } from '../services/noaa-service.js';
3
- /**
4
- * Register station-related tools with the MCP server
5
- */
6
- export declare function registerStationTools(server: FastMCP, noaaService: NoaaService): void;
@@ -1,51 +0,0 @@
1
- import { z } from 'zod';
2
- import { StationSchema, UnitsSchema } from '../schemas/common.js';
3
- /**
4
- * Register station-related tools with the MCP server
5
- */
6
- export function registerStationTools(server, noaaService) {
7
- // Add stations tool
8
- server.addTool({
9
- name: 'get_stations',
10
- description: 'Get list of stations',
11
- parameters: z.object({
12
- type: z.string().optional().describe('Station type (waterlevels, currents, etc.)'),
13
- format: z.enum(['json', 'xml']).optional().describe('Output format (json, xml)'),
14
- units: UnitsSchema,
15
- }),
16
- execute: async (params) => {
17
- try {
18
- const result = await noaaService.getStations(params);
19
- return JSON.stringify(result);
20
- }
21
- catch (error) {
22
- if (error instanceof Error) {
23
- throw new Error(`Failed to get stations: ${error.message}`);
24
- }
25
- throw new Error('Failed to get stations');
26
- }
27
- }
28
- });
29
- // Add station details tool
30
- server.addTool({
31
- name: 'get_station_details',
32
- description: 'Get detailed information about a station',
33
- parameters: z.object({
34
- station: StationSchema,
35
- format: z.enum(['json', 'xml']).optional().describe('Output format (json, xml)'),
36
- units: UnitsSchema,
37
- }),
38
- execute: async (params) => {
39
- try {
40
- const result = await noaaService.getStationDetails(params);
41
- return JSON.stringify(result);
42
- }
43
- catch (error) {
44
- if (error instanceof Error) {
45
- throw new Error(`Failed to get station details: ${error.message}`);
46
- }
47
- throw new Error('Failed to get station details');
48
- }
49
- }
50
- });
51
- }
@@ -1,6 +0,0 @@
1
- import { FastMCP } from 'fastmcp';
2
- import { SunService } from '../services/sun-service.js';
3
- /**
4
- * Register sun-related tools with the MCP server
5
- */
6
- export declare function registerSunTools(server: FastMCP, sunService: SunService): void;
@@ -1,109 +0,0 @@
1
- import { SunTimesParamsSchema, SunTimesRangeParamsSchema, SunPositionParamsSchema, NextSunEventParamsSchema } from '../interfaces/sun.js';
2
- /**
3
- * Register sun-related tools with the MCP server
4
- */
5
- export function registerSunTools(server, sunService) {
6
- // Add sun times tool
7
- server.addTool({
8
- name: 'get_sun_times',
9
- description: 'Get sun rise/set and other sun event times for a specific date and location',
10
- parameters: SunTimesParamsSchema,
11
- execute: async (params) => {
12
- try {
13
- const result = sunService.getSunTimes(params);
14
- if (params.format === 'text') {
15
- let text = `Sun times for ${result.date} at latitude ${params.latitude}, longitude ${params.longitude}:\n`;
16
- text += `Sunrise: ${result.sunrise || 'N/A'}\n`;
17
- text += `Sunset: ${result.sunset || 'N/A'}\n`;
18
- text += `Day length: ${Math.floor(result.dayLength / 60)}h ${Math.round(result.dayLength % 60)}m\n`;
19
- text += `Solar noon: ${result.solarNoon || 'N/A'}\n`;
20
- text += `Dawn: ${result.dawn || 'N/A'}\n`;
21
- text += `Dusk: ${result.dusk || 'N/A'}\n`;
22
- return text;
23
- }
24
- return JSON.stringify(result);
25
- }
26
- catch (error) {
27
- if (error instanceof Error) {
28
- throw new Error(`Failed to get sun times: ${error.message}`);
29
- }
30
- throw new Error('Failed to get sun times');
31
- }
32
- }
33
- });
34
- // Add sun times range tool
35
- server.addTool({
36
- name: 'get_sun_times_range',
37
- description: 'Get sun rise/set and other sun event times for a date range and location',
38
- parameters: SunTimesRangeParamsSchema,
39
- execute: async (params) => {
40
- try {
41
- const results = sunService.getSunTimesRange(params);
42
- if (params.format === 'text') {
43
- let text = `Sun times from ${params.start_date} to ${params.end_date} at latitude ${params.latitude}, longitude ${params.longitude}:\n\n`;
44
- results.forEach(result => {
45
- text += `Date: ${result.date}\n`;
46
- text += `Sunrise: ${result.sunrise || 'N/A'}\n`;
47
- text += `Sunset: ${result.sunset || 'N/A'}\n`;
48
- text += `Day length: ${Math.floor(result.dayLength / 60)}h ${Math.round(result.dayLength % 60)}m\n\n`;
49
- });
50
- return text;
51
- }
52
- return JSON.stringify(results);
53
- }
54
- catch (error) {
55
- if (error instanceof Error) {
56
- throw new Error(`Failed to get sun times range: ${error.message}`);
57
- }
58
- throw new Error('Failed to get sun times range');
59
- }
60
- }
61
- });
62
- // Add sun position tool
63
- server.addTool({
64
- name: 'get_sun_position',
65
- description: 'Get sun position information for a specific date, time, and location',
66
- parameters: SunPositionParamsSchema,
67
- execute: async (params) => {
68
- try {
69
- const result = sunService.getSunPosition(params);
70
- if (params.format === 'text') {
71
- let text = `Sun position for ${result.date} ${result.time} at latitude ${params.latitude}, longitude ${params.longitude}:\n`;
72
- text += `Azimuth: ${result.azimuth.toFixed(2)}°\n`;
73
- text += `Altitude: ${result.altitude.toFixed(2)}°\n`;
74
- text += `Declination: ${result.declination.toFixed(2)}°\n`;
75
- text += `Right Ascension: ${result.rightAscension.toFixed(2)}h\n`;
76
- return text;
77
- }
78
- return JSON.stringify(result);
79
- }
80
- catch (error) {
81
- if (error instanceof Error) {
82
- throw new Error(`Failed to get sun position: ${error.message}`);
83
- }
84
- throw new Error('Failed to get sun position');
85
- }
86
- }
87
- });
88
- // Add next sun event tool
89
- server.addTool({
90
- name: 'get_next_sun_event',
91
- description: 'Get the next occurrence(s) of a specific sun event',
92
- parameters: NextSunEventParamsSchema,
93
- execute: async (params) => {
94
- try {
95
- const results = sunService.getNextSunEvent(params);
96
- if (params.format === 'text') {
97
- return results.map(result => `Next ${result.event}: ${result.date} at ${result.time}`).join('\n');
98
- }
99
- return JSON.stringify(results);
100
- }
101
- catch (error) {
102
- if (error instanceof Error) {
103
- throw new Error(`Failed to get next sun event: ${error.message}`);
104
- }
105
- throw new Error('Failed to get next sun event');
106
- }
107
- }
108
- });
109
- }
@@ -1,6 +0,0 @@
1
- import { FastMCP } from 'fastmcp';
2
- import { NoaaService } from '../services/noaa-service.js';
3
- /**
4
- * Register water-related tools with the MCP server
5
- */
6
- export declare function registerWaterTools(server: FastMCP, noaaService: NoaaService): void;
@@ -1,150 +0,0 @@
1
- import { z } from 'zod';
2
- import { StationSchema, DateSchema, BeginDateSchema, EndDateSchema, RangeSchema, DatumSchema, UnitsSchema, TimeZoneSchema, FormatSchema, BinSchema, IntervalSchema, refineDateParams, dateRefinementMessage } from '../schemas/common.js';
3
- /**
4
- * Register water-related tools with the MCP server
5
- */
6
- export function registerWaterTools(server, noaaService) {
7
- // Add water levels tool
8
- server.addTool({
9
- name: 'get_water_levels',
10
- description: 'Get water level data for a station',
11
- parameters: z.object({
12
- station: StationSchema,
13
- date: DateSchema,
14
- begin_date: BeginDateSchema,
15
- end_date: EndDateSchema,
16
- range: RangeSchema,
17
- datum: DatumSchema,
18
- units: UnitsSchema,
19
- time_zone: TimeZoneSchema,
20
- format: FormatSchema,
21
- }).refine(refineDateParams, { message: dateRefinementMessage }),
22
- execute: async (params) => {
23
- try {
24
- const result = await noaaService.getWaterLevels(params);
25
- return JSON.stringify(result);
26
- }
27
- catch (error) {
28
- if (error instanceof Error) {
29
- throw new Error(`Failed to get water levels: ${error.message}`);
30
- }
31
- throw new Error('Failed to get water levels');
32
- }
33
- }
34
- });
35
- // Add tide predictions tool
36
- server.addTool({
37
- name: 'get_tide_predictions',
38
- description: 'Get tide prediction data',
39
- parameters: z.object({
40
- station: StationSchema,
41
- begin_date: BeginDateSchema,
42
- end_date: EndDateSchema,
43
- date: DateSchema,
44
- range: RangeSchema,
45
- datum: DatumSchema,
46
- units: UnitsSchema,
47
- time_zone: TimeZoneSchema,
48
- interval: IntervalSchema,
49
- format: FormatSchema,
50
- }).refine(refineDateParams, { message: dateRefinementMessage }),
51
- execute: async (params) => {
52
- try {
53
- const result = await noaaService.getTidePredictions(params);
54
- return JSON.stringify(result);
55
- }
56
- catch (error) {
57
- if (error instanceof Error) {
58
- throw new Error(`Failed to get tide predictions: ${error.message}`);
59
- }
60
- throw new Error('Failed to get tide predictions');
61
- }
62
- }
63
- });
64
- // Add currents tool
65
- server.addTool({
66
- name: 'get_currents',
67
- description: 'Get currents data for a station',
68
- parameters: z.object({
69
- station: StationSchema,
70
- date: DateSchema,
71
- begin_date: BeginDateSchema,
72
- end_date: EndDateSchema,
73
- range: RangeSchema,
74
- bin: BinSchema,
75
- units: UnitsSchema,
76
- time_zone: TimeZoneSchema,
77
- format: FormatSchema,
78
- }).refine(refineDateParams, { message: dateRefinementMessage }),
79
- execute: async (params) => {
80
- try {
81
- const result = await noaaService.getCurrents(params);
82
- return JSON.stringify(result);
83
- }
84
- catch (error) {
85
- if (error instanceof Error) {
86
- throw new Error(`Failed to get currents: ${error.message}`);
87
- }
88
- throw new Error('Failed to get currents');
89
- }
90
- }
91
- });
92
- // Add current predictions tool
93
- server.addTool({
94
- name: 'get_current_predictions',
95
- description: 'Get current predictions',
96
- parameters: z.object({
97
- station: StationSchema,
98
- date: DateSchema,
99
- begin_date: BeginDateSchema,
100
- end_date: EndDateSchema,
101
- range: RangeSchema,
102
- bin: BinSchema,
103
- interval: z.string().optional().describe('Interval (MAX_SLACK or a number for minutes)'),
104
- vel_type: z.enum(['speed_dir', 'default']).optional().describe('Velocity type (speed_dir or default)'),
105
- units: UnitsSchema,
106
- time_zone: TimeZoneSchema,
107
- format: FormatSchema,
108
- }).refine(refineDateParams, { message: dateRefinementMessage }),
109
- execute: async (params) => {
110
- try {
111
- const result = await noaaService.getCurrentPredictions(params);
112
- return JSON.stringify(result);
113
- }
114
- catch (error) {
115
- if (error instanceof Error) {
116
- throw new Error(`Failed to get current predictions: ${error.message}`);
117
- }
118
- throw new Error('Failed to get current predictions');
119
- }
120
- }
121
- });
122
- // Add meteorological data tool
123
- server.addTool({
124
- name: 'get_meteorological_data',
125
- description: 'Get meteorological data',
126
- parameters: z.object({
127
- station: StationSchema,
128
- product: z.string().min(1).describe('Product (air_temperature, wind, etc.)'),
129
- date: DateSchema,
130
- begin_date: BeginDateSchema,
131
- end_date: EndDateSchema,
132
- range: RangeSchema,
133
- units: UnitsSchema,
134
- time_zone: TimeZoneSchema,
135
- format: FormatSchema,
136
- }).refine(refineDateParams, { message: dateRefinementMessage }),
137
- execute: async (params) => {
138
- try {
139
- const result = await noaaService.getMeteorologicalData(params);
140
- return JSON.stringify(result);
141
- }
142
- catch (error) {
143
- if (error instanceof Error) {
144
- throw new Error(`Failed to get meteorological data: ${error.message}`);
145
- }
146
- throw new Error('Failed to get meteorological data');
147
- }
148
- }
149
- });
150
- }