Token导航 LogoToken导航TokenDH.com
Transport NSW API Client MCP logo
运维云端stdio官方级别未说明来源级核验

Transport NSW API Client MCP

MCP Server

一个用于通过直接HTTP请求与Transport NSW API交互的MCP实现,提供站点查找、交通警报和实时出发信息等功能。

工具数

3

提示词数

0

GitHub Stars

0

资源数

0
PythonClaude云端部署Claude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

danhussey

提供方

danhussey

最后核验

2026/5/17 20:21

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

uv run mcp dev api.py

详细介绍

新南威尔士州交通部API客户(MCP实施)

![Tests](https://github.com/danhussey/transportnsw-mcp/actions/workflows/tests.yml)

Claude MCP,用于使用直接HTTP请求与新南威尔士州API交通部进行交互。

关于

本项目为新南威尔士州交通部API提供模型上下文协议(MCP)服务。

设置

  1. 克隆此存储库
  2. 使用uv(快速Python包管理器)安装依赖项:
   uv venv
   uv sync
  1. 创建一个 .env 使用API密钥文件:
   OPEN_TRANSPORT_API_KEY=your_api_key_here
  1. (可选)运行MCP检查器:
   uv run mcp dev api.py

并访问服务器http://localhost:5173(端口可能不同)。

特性

  • Stop-Finder API:按名称或坐标查找交通站点
  • 警报API:获取有关交通警报和中断的信息
  • 离港监视器API:获取交通站点的实时出发信息
  • MCP实施:结构化为模型上下文协议服务

使用示例

MCP示例即将推出。下面是标准Python示例:

查找交通站点

from api import find_transport_stops

# Search by name
stops = find_transport_stops(stop_name="Central Station")

# Search by coordinates (Central Station area)
central_station = '151.206290:-33.884080:EPSG:4326'
stops = find_transport_stops(coord=central_station, radius=500)

获取交通警报

from api import get_transport_alerts

# Get all current alerts
alerts = get_transport_alerts()

# Get alerts for a specific date
date_alerts = get_transport_alerts(date='22-03-2025')

# Get train alerts only (mot_type=1)
train_alerts = get_transport_alerts(mot_type=1)

监控实时出发

from api import get_departure_monitor

# Get departures from Central Station
departures = get_departure_monitor("200060")  # Central Station ID

# Get departures for a specific time
from datetime import datetime
time_departures = get_departure_monitor("200060", time="15:30")

# Get only train departures
train_departures = get_departure_monitor("200060", mot_type=1)  # 1 = Train

演示脚本

该项目包括一个全面的演示脚本,展示了API的所有功能:

# Run the full demo
python demo.py

# Run specific sections
python demo.py --stops       # Stop finder demo
python demo.py --alerts      # Transport alerts demo
python demo.py --departures  # Departure monitoring demo

测试

局部测试

使用pytest运行完整的测试套件:

uv run pytest

运行覆盖率报告:

uv run pytest --cov=api

持续集成

对于向主分支发送的每个推送和拉取请求,测试会自动在GitHub Actions上运行。工作流程:

  1. 设置Python 3.10
  2. 安装uv和项目依赖关系
  3. 运行具有覆盖率报告的测试

要使用此功能,请执行以下操作:

  1. 添加您的 OPEN_TRANSPORT_API_KEY 作为GitHub存储库的秘密
  2. 将代码推送到GitHub

MCP集成

该项目遵循模型上下文协议规范,允许AI模型通过标准化接口访问新南威尔士州交通局的数据。

包管理

这个项目使用uv,一个用Rust编写的现代Python包管理器。依赖关系通过以下方式管理:

  • pyproject.toml:定义项目依赖关系

许可证

该项目根据 MIT许可证.

目录标签

目录标签

PythonClaude云端部署交通服务本地部署API客户端实时数据公共交通MCP实现

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Python

部署方式(deploymentType,部署类型)

remote-capable

工具数量(toolCount,工具数)

3

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiononeremote-capable

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP