Transport NSW API Client MCP
新南威尔士州交通 API 客户端(MCP 实施)
使用直接 HTTP 请求与 Transport NSW API 进行交互的 Claude MCP。
关于
该项目为新南威尔士州交通局的 API 实现了模型上下文协议 (MCP) 服务。
Related MCP server: openbusdata
设置
克隆此存储库
使用 uv(快速 Python 包管理器)安装依赖项:
uv venv uv sync使用您的 API 密钥创建一个
.env文件:OPEN_TRANSPORT_API_KEY=your_api_key_here(可选)运行 MCP 检查器:
uv run mcp dev api.py并访问服务器http://localhost:5173 (端口可能不同)。
特征
站点查找器 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 都会自动运行测试。工作流程如下:
设置 Python 3.10
安装 uv 和项目依赖项
运行测试并报告覆盖率
要使用此功能:
将您的
OPEN_TRANSPORT_API_KEY添加为 GitHub 存储库密钥将代码推送到 GitHub
MCP 集成
该项目遵循模型上下文协议规范,允许人工智能模型通过标准化接口访问新南威尔士州交通部数据。
包管理
本项目使用 uv,一个用 Rust 编写的现代 Python 包管理器。依赖项通过以下方式管理:
pyproject.toml:定义项目依赖项uv.lock:锁定可重现环境的依赖版本
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceAn MCP server for interacting with the Berlin Public Transport (BVG) API to search for locations and plan journeys. It provides real-time access to departures, arrivals, trip details, and vehicle tracking within Berlin's transit network.MIT
- AlicenseCqualityBmaintenanceMCP server for the UK Bus Open Data Service, enabling timetable queries, stop search, route discovery, journey planning, and real-time bus tracking.16MIT
- Flicense-qualityDmaintenanceMCP server for real-time German public transport data (HAFAS/VBN network). Enables querying departures, arrivals, journeys, and nearby stops using natural language.
- Alicense-qualityBmaintenanceMCP server that integrates with the transport12 API to provide tools for searching stops, routes, arrivals, and vehicle forecasts, enabling natural language interaction with public transport data.9MIT
Related MCP Connectors
Swiss Transport MCP — wraps Transport Open Data API (free, no auth)
TomTom MCP — wraps the TomTom Search & Routing APIs (api.tomtom.com)
Real-time transit stops, routes, arrivals, vehicle positions, and schedules via OneBusAway APIs.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/danhussey/transportnsw-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server