Surf MCP Server

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Retrieves tide information for specific locations and dates using the Storm Glass API, providing high/low tide times, heights, and nearby station information to help determine optimal surfing conditions.

浏览 MCP 服务器

MCP 服务器适用于冲浪和上网的人。

图表

视频演示

https://github.com/user-attachments/assets/0a4453e2-66df-4bf5-8366-8538cda366ed

特征

  • 使用经纬度获取任意位置的潮汐信息
  • 支持特定日期的潮汐查询
  • 详细的潮汐数据,包括高潮/低潮和站点信息
  • 自动时区处理(UTC)

先决条件

  • Python 3.x
  • Storm Glass API 密钥

获取您的 Storm Glass API 密钥

  1. 参观Storm Glass
  2. 点击“免费试用”或“登录”创建帐户
  3. 注册后,您将收到您的 API 密钥

关于 API 使用限制的说明:

  • 免费套餐:每天 10 个请求
  • 可用的付费计划:
    • 小型:500 个请求/天(19 欧元/月)
    • 中等:5000 个请求/天(49 欧元/月)
    • 大型:25,000 个请求/天(129 欧元/月)
    • 企业:提供定制计划

根据您的使用需求选择套餐。免费套餐适合测试和个人使用。

安装

  1. 克隆存储库:
git clone https://github.com/ravinahp/surf-mcp.git cd surf-mcp
  1. 使用 uv 安装依赖项:
uv sync

注意:由于该项目使用pyproject.toml进行依赖管理,因此我们使用uv而不是 pip。

配置为 MCP 服务器

要将此工具添加为 MCP 服务器,您需要修改 Claude 桌面配置文件。此配置包含您的 Storm Glass API 密钥,因此您无需单独设置。

配置文件位置取决于您的操作系统:

  • MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%/Claude/claude_desktop_config.json

将以下配置添加到您的 JSON 文件:

{ "surf-mcp": { "command": "uv", "args": [ "--directory", "/Users/YOUR_USERNAME/Code/surf-mcp", "run", "surf-mcp" ], "env": { "STORMGLASS_API_KEY": "your_api_key_here" } } }

⚠️重要提示:

  1. YOUR_USERNAME替换为您的实际系统用户名
  2. your_api_key_here替换为你的实际 Storm Glass API 密钥
  3. 确保目录路径与本地安装匹配

部署

建筑

准备包:

  1. 同步依赖项并更新锁文件:
uv sync
  1. 构建包:
uv build

这将在dist/目录中创建分布。

调试

由于 MCP 服务器通过 stdio 运行,调试起来可能颇具挑战性。为了获得最佳调试体验,我们强烈建议使用 MCP Inspector。

您可以使用以下命令启动 MCP Inspector:

npx @modelcontextprotocol/inspector uv --directory /path/to/surf-mcp run surf-mcp

启动后,检查器将显示一个 URL,您可以在浏览器中访问该 URL 以开始调试。

检查员提供:

  • 实时请求/响应监控
  • 输入/输出验证
  • 错误追踪
  • 性能指标

用法

该服务提供了一个用于获取潮汐信息的 FastMCP 工具:

@mcp.tool() async def get_tides(latitude: float, longitude: float, date: str) -> str: """Get tide information for a specific location and date."""

参数:

  • latitude :表示位置纬度的浮点值
  • longitude :表示位置经度的浮点值
  • date :YYYY-MM-DD 格式的日期字符串

响应示例:

Tide Times: Time: 2024-01-20T00:30:00+00:00 (UTC) Type: HIGH tide Height: 1.52m Time: 2024-01-20T06:45:00+00:00 (UTC) Type: LOW tide Height: 0.25m Station Information: Name: Sample Station Distance: 20.5km from requested location

用例

示例 1:寻找最佳冲浪时间

您可以使用此工具确定您最喜欢的海滩和最近的冲浪站的最佳冲浪时间。通常,最佳冲浪条件是在涨潮时,即涨潮前约 2 小时。

给 Claude 的示例提示:

注意:不同的海滩可能因其特定的地理位置和浪涌类型而具有不同的最佳潮汐条件。此工具还提供站点距离信息,应与潮汐信息一起考虑。(例如,站点距离越长,误差变化越大——您也可以在提示时向 Claude 询问此信息)。

错误处理

该服务包括针对以下方面的强大错误处理:

  • API 请求失败
  • 无效坐标
  • API 密钥缺失或无效
  • 网络超时

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

使用纬度和经度获取任何位置的潮汐信息,提供详细的潮汐数据,包括高潮/低潮和站点信息,并自动处理 UTC 时区。

  1. Diagram
    1. Video Demo
      1. Features
        1. Prerequisites
          1. Getting Your Storm Glass API Key
            1. Installation
              1. Configure as MCP Server
                1. Deployment
                  1. Building
                  2. Debugging
                2. Usage
                  1. Parameters:
                  2. Example Response:
                3. Use Cases
                  1. Example #1: Finding the Best Surf Time
                4. Error Handling
                  ID: rog4v53kgl