@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,164 +0,0 @@
1
- import axios from 'axios';
2
- // Base URL for the NOAA Derived Product API
3
- const DPAPI_BASE_URL = 'https://api.tidesandcurrents.noaa.gov/dpapi/prod';
4
- /**
5
- * Service for interacting with NOAA Derived Product API (DPAPI)
6
- */
7
- export class DpapiService {
8
- /**
9
- * Build parameters for the API request
10
- * @param params Parameters for the request
11
- * @returns URL-encoded parameters string
12
- */
13
- buildParams(params) {
14
- // Remove undefined and null values
15
- const filteredParams = Object.entries(params)
16
- .filter(([_, value]) => value !== undefined && value !== null)
17
- .reduce((acc, [key, value]) => {
18
- acc[key] = value;
19
- return acc;
20
- }, {});
21
- // Convert to URL parameters
22
- return new URLSearchParams(filteredParams).toString();
23
- }
24
- /**
25
- * Make a request to the DPAPI
26
- * @param endpoint Endpoint path
27
- * @param params Parameters for the request
28
- * @returns Response data
29
- */
30
- async fetchDpapi(endpoint, params = {}) {
31
- try {
32
- const queryParams = this.buildParams(params);
33
- const url = `${DPAPI_BASE_URL}${endpoint}${queryParams ? '?' + queryParams : ''}`;
34
- const response = await axios.get(url);
35
- return response.data;
36
- }
37
- catch (error) {
38
- if (axios.isAxiosError(error) && error.response) {
39
- throw new Error(`NOAA DPAPI Error: ${error.response.status} - ${JSON.stringify(error.response.data)}`);
40
- }
41
- throw error;
42
- }
43
- }
44
- /**
45
- * Get sea level trends for a station
46
- * @param params Parameters including station ID and affiliation
47
- * @returns Sea level trend data
48
- */
49
- async getSeaLevelTrends(params) {
50
- const { station, affil = 'Global', format = 'json', ...rest } = params;
51
- return this.fetchDpapi('/sltrends', {
52
- station,
53
- affil,
54
- format,
55
- ...rest
56
- });
57
- }
58
- /**
59
- * Get extreme water levels for a station
60
- * @param params Parameters including station ID and units
61
- * @returns Extreme water level data
62
- */
63
- async getExtremeWaterLevels(params) {
64
- const { station, units = 'english', format = 'json', ...rest } = params;
65
- return this.fetchDpapi('/ewl', {
66
- station,
67
- units,
68
- format,
69
- ...rest
70
- });
71
- }
72
- /**
73
- * Get high tide flooding daily count data
74
- * @param params Parameters including station ID, date range, and thresholds
75
- * @returns Daily flood count data
76
- */
77
- async getHighTideFloodingDaily(params) {
78
- const { station, format = 'json', ...rest } = params;
79
- return this.fetchDpapi('/htf/daily', {
80
- station,
81
- format,
82
- ...rest
83
- });
84
- }
85
- /**
86
- * Get high tide flooding monthly count data
87
- * @param params Parameters including station ID, date range, and thresholds
88
- * @returns Monthly flood count data
89
- */
90
- async getHighTideFloodingMonthly(params) {
91
- const { station, format = 'json', ...rest } = params;
92
- return this.fetchDpapi('/htf/monthly', {
93
- station,
94
- format,
95
- ...rest
96
- });
97
- }
98
- /**
99
- * Get high tide flooding seasonal count data
100
- * @param params Parameters including station ID, seasons, and thresholds
101
- * @returns Seasonal flood count data
102
- */
103
- async getHighTideFloodingSeasonal(params) {
104
- const { station, format = 'json', ...rest } = params;
105
- return this.fetchDpapi('/htf/seasonal', {
106
- station,
107
- format,
108
- ...rest
109
- });
110
- }
111
- /**
112
- * Get high tide flooding annual count data
113
- * @param params Parameters including station ID, year range, and thresholds
114
- * @returns Annual flood count data
115
- */
116
- async getHighTideFloodingAnnual(params) {
117
- const { station, format = 'json', ...rest } = params;
118
- return this.fetchDpapi('/htf/annual', {
119
- station,
120
- format,
121
- ...rest
122
- });
123
- }
124
- /**
125
- * Get high tide flooding decadal projections
126
- * @param params Parameters including station ID, scenario, and decade
127
- * @returns Decadal projection data
128
- */
129
- async getHighTideFloodingProjections(params) {
130
- const { station, scenario = 'all', format = 'json', ...rest } = params;
131
- return this.fetchDpapi('/htf/projections', {
132
- station,
133
- scenario,
134
- format,
135
- ...rest
136
- });
137
- }
138
- /**
139
- * Get high tide flooding daily likelihoods
140
- * @param params Parameters including station ID and date
141
- * @returns Daily likelihood data
142
- */
143
- async getHighTideFloodingLikelihoods(params) {
144
- const { station, format = 'json', ...rest } = params;
145
- return this.fetchDpapi('/htf/likelihoods', {
146
- station,
147
- format,
148
- ...rest
149
- });
150
- }
151
- /**
152
- * Get top ten water levels for a station
153
- * @param params Parameters including station ID and analysis type
154
- * @returns Top ten water level data
155
- */
156
- async getTopTenWaterLevels(params) {
157
- const { station, format = 'json', ...rest } = params;
158
- return this.fetchDpapi('/topten', {
159
- station,
160
- format,
161
- ...rest
162
- });
163
- }
164
- }
@@ -1,76 +0,0 @@
1
- /**
2
- * Provides information about valid NOAA Tides and Currents API parameters
3
- */
4
- export declare class NoaaParametersService {
5
- /**
6
- * Get valid time zone values
7
- */
8
- getTimeZones(): {
9
- id: string;
10
- description: string;
11
- }[];
12
- /**
13
- * Get valid datum values
14
- */
15
- getDatums(): {
16
- id: string;
17
- description: string;
18
- }[];
19
- /**
20
- * Get valid units
21
- */
22
- getUnits(): {
23
- id: string;
24
- description: string;
25
- }[];
26
- /**
27
- * Get valid intervals for tide predictions
28
- */
29
- getTidePredictionIntervals(): {
30
- id: string;
31
- description: string;
32
- }[];
33
- /**
34
- * Get valid intervals for current predictions
35
- */
36
- getCurrentPredictionIntervals(): {
37
- id: string;
38
- description: string;
39
- }[];
40
- /**
41
- * Get valid velocity types for current predictions
42
- */
43
- getVelocityTypes(): {
44
- id: string;
45
- description: string;
46
- }[];
47
- /**
48
- * Get valid meteorological products
49
- */
50
- getMeteorologicalProducts(): {
51
- id: string;
52
- description: string;
53
- }[];
54
- /**
55
- * Get valid station types
56
- */
57
- getStationTypes(): {
58
- id: string;
59
- description: string;
60
- }[];
61
- /**
62
- * Get valid date formats
63
- */
64
- getDateFormats(): {
65
- format: string;
66
- description: string;
67
- example: string;
68
- }[];
69
- /**
70
- * Get valid output formats
71
- */
72
- getOutputFormats(): {
73
- id: string;
74
- description: string;
75
- }[];
76
- }
@@ -1,128 +0,0 @@
1
- /**
2
- * Provides information about valid NOAA Tides and Currents API parameters
3
- */
4
- export class NoaaParametersService {
5
- /**
6
- * Get valid time zone values
7
- */
8
- getTimeZones() {
9
- return [
10
- { id: 'gmt', description: 'Greenwich Mean Time' },
11
- { id: 'lst', description: 'Local Standard Time' },
12
- { id: 'lst_ldt', description: 'Local Standard/Local Daylight Time' }
13
- ];
14
- }
15
- /**
16
- * Get valid datum values
17
- */
18
- getDatums() {
19
- return [
20
- { id: 'MHHW', description: 'Mean Higher High Water' },
21
- { id: 'MHW', description: 'Mean High Water' },
22
- { id: 'MTL', description: 'Mean Tide Level' },
23
- { id: 'MSL', description: 'Mean Sea Level' },
24
- { id: 'MLW', description: 'Mean Low Water' },
25
- { id: 'MLLW', description: 'Mean Lower Low Water' },
26
- { id: 'NAVD', description: 'North American Vertical Datum' },
27
- { id: 'STND', description: 'Station Datum' }
28
- ];
29
- }
30
- /**
31
- * Get valid units
32
- */
33
- getUnits() {
34
- return [
35
- { id: 'english', description: 'English units (feet, mph, etc.)' },
36
- { id: 'metric', description: 'Metric units (meters, kph, etc.)' }
37
- ];
38
- }
39
- /**
40
- * Get valid intervals for tide predictions
41
- */
42
- getTidePredictionIntervals() {
43
- return [
44
- { id: 'hilo', description: 'High/low tide predictions only' },
45
- { id: 'h', description: 'Hourly predictions' },
46
- { id: '6', description: '6-minute predictions' },
47
- { id: '30', description: '30-minute predictions' },
48
- { id: '60', description: '60-minute predictions' }
49
- ];
50
- }
51
- /**
52
- * Get valid intervals for current predictions
53
- */
54
- getCurrentPredictionIntervals() {
55
- return [
56
- { id: 'MAX_SLACK', description: 'Maximum flood/ebb and slack predictions only' },
57
- { id: '6', description: '6-minute predictions' },
58
- { id: '30', description: '30-minute predictions' },
59
- { id: '60', description: '60-minute predictions' }
60
- ];
61
- }
62
- /**
63
- * Get valid velocity types for current predictions
64
- */
65
- getVelocityTypes() {
66
- return [
67
- { id: 'default', description: 'Default velocity reporting (flood/ebb direction)' },
68
- { id: 'speed_dir', description: 'Speed and direction format' }
69
- ];
70
- }
71
- /**
72
- * Get valid meteorological products
73
- */
74
- getMeteorologicalProducts() {
75
- return [
76
- { id: 'air_temperature', description: 'Air temperature' },
77
- { id: 'water_temperature', description: 'Water temperature' },
78
- { id: 'wind', description: 'Wind speed and direction' },
79
- { id: 'air_pressure', description: 'Barometric pressure' },
80
- { id: 'air_gap', description: 'Air gap (distance between bridge and water surface)' },
81
- { id: 'conductivity', description: 'Conductivity' },
82
- { id: 'visibility', description: 'Visibility' },
83
- { id: 'humidity', description: 'Relative humidity' },
84
- { id: 'salinity', description: 'Salinity' },
85
- { id: 'hourly_height', description: 'Verified hourly height water level' },
86
- { id: 'high_low', description: 'Verified high/low water level' },
87
- { id: 'daily_mean', description: 'Verified daily mean water level' },
88
- { id: 'monthly_mean', description: 'Verified monthly mean water level' },
89
- { id: 'one_minute_water_level', description: 'One-minute water level data' },
90
- { id: 'datums', description: 'Datums' }
91
- ];
92
- }
93
- /**
94
- * Get valid station types
95
- */
96
- getStationTypes() {
97
- return [
98
- { id: 'waterlevels', description: 'Water level stations' },
99
- { id: 'currentpredictions', description: 'Current prediction stations' },
100
- { id: 'currents', description: 'Current observation stations' },
101
- { id: 'tidepredictions', description: 'Tide prediction stations' },
102
- { id: 'weather', description: 'Weather stations' },
103
- { id: 'ports', description: 'Physical Oceanographic Real-Time System (PORTS) stations' }
104
- ];
105
- }
106
- /**
107
- * Get valid date formats
108
- */
109
- getDateFormats() {
110
- return [
111
- { format: 'YYYYMMDD', description: 'Year, month, day without separators', example: '20230401' },
112
- { format: 'MM/DD/YYYY', description: 'Month/day/year with separators', example: '04/01/2023' },
113
- { format: 'today', description: 'Current date', example: 'today' },
114
- { format: 'latest', description: 'Latest available data', example: 'latest' },
115
- { format: 'recent', description: 'Most recent data', example: 'recent' }
116
- ];
117
- }
118
- /**
119
- * Get valid output formats
120
- */
121
- getOutputFormats() {
122
- return [
123
- { id: 'json', description: 'JSON format' },
124
- { id: 'xml', description: 'XML format' },
125
- { id: 'csv', description: 'CSV format (not available for all endpoints)' }
126
- ];
127
- }
128
- }
@@ -1,52 +0,0 @@
1
- /**
2
- * Service for interacting with NOAA Tides and Currents APIs
3
- */
4
- export declare class NoaaService {
5
- /**
6
- * Build parameters for the API request
7
- * @param params Parameters for the request
8
- * @returns URL-encoded parameters string
9
- */
10
- private buildParams;
11
- /**
12
- * Make a request to the Data API
13
- * @param params Parameters for the request
14
- * @returns Response data
15
- */
16
- fetchDataApi(params: Record<string, any>): Promise<any>;
17
- /**
18
- * Make a request to the Metadata API
19
- * @param endpoint Endpoint path
20
- * @param params Parameters for the request
21
- * @returns Response data
22
- */
23
- fetchMetadataApi(endpoint: string, params?: Record<string, any>): Promise<any>;
24
- /**
25
- * Get water level data
26
- */
27
- getWaterLevels(params: Record<string, any>): Promise<any>;
28
- /**
29
- * Get tide predictions
30
- */
31
- getTidePredictions(params: Record<string, any>): Promise<any>;
32
- /**
33
- * Get currents data
34
- */
35
- getCurrents(params: Record<string, any>): Promise<any>;
36
- /**
37
- * Get current predictions
38
- */
39
- getCurrentPredictions(params: Record<string, any>): Promise<any>;
40
- /**
41
- * Get meteorological data (air_temperature, wind, etc.)
42
- */
43
- getMeteorologicalData(params: Record<string, any>): Promise<any>;
44
- /**
45
- * Get list of stations
46
- */
47
- getStations(params: Record<string, any>): Promise<any>;
48
- /**
49
- * Get station details
50
- */
51
- getStationDetails(params: Record<string, any>): Promise<any>;
52
- }
@@ -1,151 +0,0 @@
1
- import axios from 'axios';
2
- // Base URLs for the different NOAA APIs
3
- const DATA_API_BASE_URL = 'https://api.tidesandcurrents.noaa.gov/api/prod/datagetter';
4
- const METADATA_API_BASE_URL = 'https://api.tidesandcurrents.noaa.gov/mdapi/prod/webapi';
5
- /**
6
- * Service for interacting with NOAA Tides and Currents APIs
7
- */
8
- export class NoaaService {
9
- /**
10
- * Build parameters for the API request
11
- * @param params Parameters for the request
12
- * @returns URL-encoded parameters string
13
- */
14
- buildParams(params) {
15
- // Remove undefined and null values
16
- const filteredParams = Object.entries(params)
17
- .filter(([_, value]) => value !== undefined && value !== null)
18
- .reduce((acc, [key, value]) => {
19
- acc[key] = value;
20
- return acc;
21
- }, {});
22
- // Convert to URL parameters
23
- return new URLSearchParams(filteredParams).toString();
24
- }
25
- /**
26
- * Make a request to the Data API
27
- * @param params Parameters for the request
28
- * @returns Response data
29
- */
30
- async fetchDataApi(params) {
31
- try {
32
- const queryParams = this.buildParams(params);
33
- const url = `${DATA_API_BASE_URL}?${queryParams}`;
34
- const response = await axios.get(url);
35
- return response.data;
36
- }
37
- catch (error) {
38
- if (axios.isAxiosError(error) && error.response) {
39
- throw new Error(`NOAA API Error: ${error.response.status} - ${JSON.stringify(error.response.data)}`);
40
- }
41
- throw error;
42
- }
43
- }
44
- /**
45
- * Make a request to the Metadata API
46
- * @param endpoint Endpoint path
47
- * @param params Parameters for the request
48
- * @returns Response data
49
- */
50
- async fetchMetadataApi(endpoint, params = {}) {
51
- try {
52
- const queryParams = this.buildParams(params);
53
- const url = `${METADATA_API_BASE_URL}${endpoint}${queryParams ? '?' + queryParams : ''}`;
54
- const response = await axios.get(url);
55
- return response.data;
56
- }
57
- catch (error) {
58
- if (axios.isAxiosError(error) && error.response) {
59
- throw new Error(`NOAA API Error: ${error.response.status} - ${JSON.stringify(error.response.data)}`);
60
- }
61
- throw error;
62
- }
63
- }
64
- /**
65
- * Get water level data
66
- */
67
- async getWaterLevels(params) {
68
- return this.fetchDataApi({
69
- ...params,
70
- product: 'water_level'
71
- });
72
- }
73
- /**
74
- * Get tide predictions
75
- */
76
- async getTidePredictions(params) {
77
- return this.fetchDataApi({
78
- ...params,
79
- product: 'predictions'
80
- });
81
- }
82
- /**
83
- * Get currents data
84
- */
85
- async getCurrents(params) {
86
- return this.fetchDataApi({
87
- ...params,
88
- product: 'currents'
89
- });
90
- }
91
- /**
92
- * Get current predictions
93
- */
94
- async getCurrentPredictions(params) {
95
- return this.fetchDataApi({
96
- ...params,
97
- product: 'currents_predictions'
98
- });
99
- }
100
- /**
101
- * Get meteorological data (air_temperature, wind, etc.)
102
- */
103
- async getMeteorologicalData(params) {
104
- const { product, ...rest } = params;
105
- return this.fetchDataApi({
106
- ...rest,
107
- product
108
- });
109
- }
110
- /**
111
- * Get list of stations
112
- */
113
- async getStations(params) {
114
- const { type, name, lat_min, lat_max, lon_min, lon_max, state, limit, offset, sort_by, sort_order, ...rest } = params;
115
- const endpoint = '/stations.' + (rest.format || 'json');
116
- // Build query parameters with all the filters
117
- const queryParams = { ...rest };
118
- // Add filters only if they are defined
119
- if (type)
120
- queryParams.type = type;
121
- if (name)
122
- queryParams.name = name;
123
- if (lat_min !== undefined)
124
- queryParams.lat_min = lat_min;
125
- if (lat_max !== undefined)
126
- queryParams.lat_max = lat_max;
127
- if (lon_min !== undefined)
128
- queryParams.lon_min = lon_min;
129
- if (lon_max !== undefined)
130
- queryParams.lon_max = lon_max;
131
- if (state)
132
- queryParams.state = state;
133
- if (limit !== undefined)
134
- queryParams.limit = limit;
135
- if (offset !== undefined)
136
- queryParams.offset = offset;
137
- if (sort_by)
138
- queryParams.sort_by = sort_by;
139
- if (sort_order)
140
- queryParams.sort_order = sort_order;
141
- return this.fetchMetadataApi(endpoint, queryParams);
142
- }
143
- /**
144
- * Get station details
145
- */
146
- async getStationDetails(params) {
147
- const { station, ...rest } = params;
148
- const endpoint = `/stations/${station}/details.` + (rest.format || 'json');
149
- return this.fetchMetadataApi(endpoint, rest);
150
- }
151
- }