Back to MCP directory
publicPublicdnsLocal runtime

NOAA Tides and Currents

这是一个基于FastMCP框架的NOAA潮汐与海流数据服务项目,提供水位数据、潮汐预测、海流数据、气象数据、月相信息等多种海洋相关数据的API访问功能。

article

README

🚀 NOAA 潮汐与海流 API 文档

本 API 文档提供了 NOAA 潮汐与海流相关的数据查询、天文事件查询等功能,同时介绍了 FastMCP 框架,帮助开发者快速构建和部署海流与潮汐监测系统。

🚀 快速开始

基础 URL

  • CO - OPS 数据 API: https://api.tidesandcurrents.noaa.gov/api/prod/
  • CO - OPS 元数据 API: https://api.tidesandcurrents.noaa.gov/mdapi/prod/
  • CO - OPS 衍生产品 API: https://api.tidesandcurrents.noaa.gov/dpapi/prod/

请求方法

所有请求必须使用 GET 方法。

响应格式

API 支持以下响应格式:

  1. JSON:适用于大多数查询。
  2. XML:适用于需要特定数据结构的请求。
  3. CSV:适用于数据导出和批量处理。

示例请求

获取潮汐预测

https://api.tidesandcurrents.noaa.gov/api/prod/tidepredictions?station=8537062

获取海流数据

https://api.tidesandcurrents.noaa.gov/api/prod/currents?station=9410160

返回参数

  • status:请求状态(成功或失败)。
  • message:详细的错误信息(仅在失败时返回)。
  • data:查询结果的数据。

✨ 主要特性

功能模块

潮汐与海流数据查询

  • 获取潮汐预测
async function getTidePredictions(stationId) {
    const response = await fetch(`https://api.tidesandcurrents.noaa.gov/api/prod/tidepredictions?station=${stationId}`);
    return await response.json();
}
  • 获取历史海流数据
async function getHistoricalCurrents(stationId, date) {
    const response = await fetch(`https://api.tidesandcurrents.noaa.gov/api/prod/currents/historical?station=${stationId}&date=${date}`);
    return await response.json();
}

衍生产品 API

  • 获取潮汐与海流警报
async function getWarnings(warningType) {
    const response = await fetch(`https://api.tidesandcurrents.noaa.gov/dpapi/prod/alerts?type=${warningType}`);
    return await response.json();
}

元数据 API

  • 获取观测站信息
async function getStationInfo(stationId) {
    const response = await fetch(`https://api.tidesandcurrents.noaa.gov/mdapi/prod/stations/${stationId}`);
    return await response.json();
}

天文事件查询

月相信息

  • 获取当前月相
async function getCurrentMoonPhase() {
    const response = await fetch('https://api.tidesandcurrents.noaa.gov/moon/currentphase');
    return await response.json();
}
  • 获取未来月相
async function getNextMoonPhases(count) {
    const response = await fetch(`https://api.tidesandcurrents.noaa.gov/moon/nextphases?count=${count}`);
    return await response.json();
}

太阳位置与时间

  • 获取日出日落时间
async function getSunriseSunset(latitude, longitude) {
    const response = await fetch(`https://api.tidesandcurrents.noaa.gov/sun?lat=${latitude}&lon=${longitude}`);
    return await response.json();
}

FastMCP 框架

简介

FastMCP 是一个用于开发高效、可扩展的海流与潮汐监测系统的框架。它提供了一系列工具和服务,帮助开发者快速构建和部署相关应用。

主要功能

  • 数据采集与处理
    • 支持多种数据源接入。
    • 提供实时数据处理能力。
  • 可视化界面
    • 自动生成交互式图表和地图。
    • 提供多维度的数据展示。
  • 扩展插件系统
    • 支持自定义插件开发。
    • 提供丰富的社区插件资源。

📦 安装指南

安装与配置

npm install fastmcp

💻 使用示例

创建基本应用

const FastMCP = require('fastmcp');

const app = new FastMCP({
    port: 3000,
    plugins: ['dataCollector', 'visualizer']
});

app.start().then(() => {
    console.log('Application started on port 3000');
});

开发指南

数据处理

app.use('dataProcessor', (data, next) => {
    // 处理数据
    next();
});

获取实时海流数据

async function fetchCurrents() {
    const response = await fetch('https://api.tidesandcurrents.noaa.gov/api/prod/currents');
    return await response.json();
}

处理响应

fetchCurrents().then(data => {
    console.log(data);
});

📚 详细文档

常见问题

如何处理 API 错误?

  • 检查返回的状态码。
  • 查看详细的错误信息。

性能优化建议

  • 使用缓存机制。
  • 限制请求频率。

支持的浏览器

  • Chrome
  • Firefox
  • Safari
  • Edge

贡献指南

如何提交问题?

  • 提交到 GitHub Issues。

如何贡献代码?

  • Fork 仓库。
  • 提交 Pull Request。

📄 许可证

项目遵循 MIT 许可证,具体内容请参考 LICENSE 文件。


感谢您使用 NOAA 潮汐与海流 API!如需更多信息,请访问我们的官方网站或查阅详细的开发者文档。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client