Shipxy MCP Server 是一个完全符合 MCP 协议的开源海事场景位置服务(LBS)解决方案,为开发者和 AI 智能体提供了一套全面的船舶和港口 API 及工具。它可以让你的应用程序无缝集成实时船舶数据、航线规划、天气、潮汐等信息。
在 Shipxy 开放平台 注册并创建一个服务器端 API 密钥。
注意:所有请求都需要使用 API 密钥。
pip install -r requirements.txt
在项目根目录下创建一个 .env 文件:
SHIPXY_API_KEY=your_api_key_here
建议:使用 mcp.json 配置文件,以便与 MCP CLI 和智能体平台轻松集成。示例如下:
{
"mcpServers": {
"shipxy-api-mcp": {
"command": "python",
"args": ["/path/to/your/server.py"],
"env": {
"SHIPXY_API_KEY": "your_api_key_here"
}
}
}
}
以下是使用 search_ship API 进行船舶模糊搜索的示例:
# 这里可以添加调用 search_ship API 的示例代码
# 假设使用 Python 的 requests 库
import requests
api_key = "your_api_key"
url = f"https://api.shipxy.com/v3/search_ship?api_key={api_key}&keyword=your_search_keyword"
response = requests.get(url)
print(response.json())
以下是使用 plan_route_by_point API 进行两点间航线规划的示例:
# 高级场景说明:根据给定的两个坐标点,规划船舶航线
import requests
api_key = "your_api_key"
start_point = "120.0,30.0"
end_point = "121.0,31.0"
url = f"https://api.shipxy.com/v3/plan_route_by_point?api_key={api_key}&start={start_point}&end={end_point}"
response = requests.get(url)
print(response.json())
| 工具名称 | 描述 |
|---|---|
| search_ship | 通过 MMSI、IMO、名称或呼号模糊搜索船舶 |
| get_single_ship | 通过 MMSI 查询单艘船舶的实时信息 |
| get_many_ship | 通过 MMSI 列表查询多艘船舶的实时信息 |
| get_fleet_ship | 查询船队中的所有船舶 |
| get_surrounding_ship | 查询给定船舶 10 海里范围内的船舶 |
| get_area_ship | 查询指定区域内的船舶 |
| get_ship_registry | 查询船舶注册/国家信息 |
| search_ship_particular | 通过 MMSI/IMO/呼号/名称查询船舶详细信息 |
| search_port | 通过名称或代码模糊搜索港口 |
| get_berth_ships | 查询当前在港口停泊的船舶 |
| get_anchor_ships | 查询在港口锚泊的船舶 |
| get_eta_ships | 查询预计到达港口的船舶 |
| get_ship_track | 查询船舶的历史轨迹点 |
| search_ship_approach | 查询船舶间的接近事件 |
| get_port_of_call_by_ship | 查询船舶的港口停靠记录 |
| get_port_of_call_by_port | 查询港口的船舶停靠记录 |
| plan_route_by_point | 规划两个坐标点之间的航线 |
| plan_route_by_port | 规划两个港口之间的航线 |
| get_single_eta_precise | 获取船舶的预计到达时间和航行信息 |
| get_weather_by_point | 通过坐标查询海洋天气 |
| get_weather | 通过区域查询海洋天气 |
| get_all_typhoon | 列出近期台风 |
| get_single_typhoon | 查询特定台风的详细信息 |
| get_tides | 列出潮汐站 |
| get_tide_data | 查询潮汐站的潮汐数据 |
.
├── server.py # MCP 服务器入口点
├── ship_service.py # Shipxy API 集成和业务逻辑
├── requirements.txt # Python 依赖项
├── pyproject.toml # 项目元数据
└── README.md # 本文件
本项目采用 MIT 许可证,© shipxy-api-mcp 贡献者
如需更多信息或商务咨询,请联系: 电话:400 - 010 - 8558 / 010 - 8286 8599