Get real-time bus arrival times for any Singapore bus stop by code, with optional service filterin…
An MCP (Model Context Protocol) server that provides real-time bus arrival information for Singapore using the LTA DataMall API.
LTA DataMall API Key: You need to register for a free API key from LTA DataMall:
Node.js: Version 18 or higher
# Install dependencies
npm installnpm run devThe server will start on http://localhost:3000
You can test the bus arrival tool using curl:
# Initialize the connection with your API key
curl -X POST "http://127.0.0.1:3000/mcp?ltaApiKey=YOUR_API_KEY_HERE&debug=false" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{"tools":{}},"clientInfo":{"name":"test-client","version":"1.0.0"}}}'
# Send initialized notification
curl -X POST "http://127.0.0.1:3000/mcp?ltaApiKey=YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","method":"notifications/initialized"}'
# Get bus arrival for a specific bus stop (e.g., 83139)
curl -X POST "http://127.0.0.1:3000/mcp?ltaApiKey=YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"name":"get-bus-arrival","arguments":{"busStopCode":"83139"}}}'
# Get arrival for a specific bus service at a bus stop
curl -X POST "http://127.0.0.1:3000/mcp?ltaApiKey=YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":6,"method":"tools/call","params":{"name":"get-bus-arrival","arguments":{"busStopCode":"83139","serviceNo":"15"}}}'Replace YOUR_API_KEY_HERE with your actual LTA DataMall API key.
The server requires the following configuration:
ltaApiKey (required): Your LTA DataMall API key (AccountKey)debug (optional, default: false): Enable debug loggingget-bus-arrivalGet real-time bus arrival information for a specific bus stop.
Parameters:
busStopCode (required): Bus stop reference code (e.g., "83139")serviceNo (optional): Specific bus service number to filter (e.g., "15")Example Response:
📍 Bus Stop: 83139
⏰ Updated: 10/7/2025, 2:30:00 PM
🚌 Service 15 (GAS)
Next: 3 min 🟢 (SEA) | Single Deck ♿
2nd: 8 min 🟡 (SDA) | Double Deck
3rd: 15 min 🟢 (SEA) | Single Deck
🚌 Service 175 (SMRT)
Next: 5 min 🟢 (SEA) | Double Deck
2nd: 12 min 🟢 (SEA) | Double Deck
3rd: No data
🟢 Seats Available | 🟡 Standing Available | 🔴 Limited Standing | ♿ Wheelchair AccessibleTo find bus stop codes:
https://datamall2.mytransport.sg/ltaodataservice/BusStopsnpm run buildThe LTA DataMall Bus Arrival API updates every 20 seconds with real-time information.
ISC