Singapore Location Intelligence MCP
Provides real-time Singapore transport data and routing information.
Singapore Location Intelligence MCP πΈπ¬
As the creator of this project, I, Siva (Sivasubramanian Ramanathan), developed this comprehensive Singapore Location Intelligence Platform to explore the capabilities of the Model Context Protocol (MCP). My goal was to test how MCP could be leveraged to help AI accurately plan routes, while also showcasing my ability to work with various APIs and my expertise in the technologies involved.
What began as an experiment with MCP integration evolved into a sophisticated, real-world application that demonstrates the power of this exciting new protocol to create tools that can rival commercial solutions. This platform provides enterprise-grade transport routing, postal code resolution, and location intelligence with Google Maps-level detailed navigation instructions, all optimized for Singapore's unique transport ecosystem.
π Key Features
π― NEW in v0.3.0 - MRT Exit Integration & Landmarks Tool Fix
- π MRT Exit Recommendations - Google Maps-level precision with specific exit codes
- ποΈ Enhanced Location Resolution - Fixed JSON string parsing and coordinate validation
- π Exit-Level Navigation - "Use Exit E (14m walk, 1 min)" for optimal station navigation
- π§ Robust Input Handling - All location formats now work correctly
- π― Singapore-Optimized - Proper coordinate bounds and postal code validation
π― v0.2.7 - Weather Service Fixes & Enhanced Reliability
- π¦οΈ Robust Weather Integration - Fixed all weather API inconsistencies and crashes
- π§ Production-Ready Error Handling - Graceful degradation when weather APIs fail
- π― Singapore Weather API Compatibility - Supports all 5 official weather endpoints
- β‘ Enhanced Journey Planning - Weather-aware routing with resilient fallbacks
- π‘οΈ Zero-Crash Guarantee - Weather service failures no longer break journey planning
π― NEW in v0.2.1 - Weather Intelligence
- π¦οΈ Standalone Weather Tools - Comprehensive weather conditions and activity-specific advisories
- π― Activity Recommendations - Tailored advice for walking, cycling, sports, photography, dining
- π‘οΈ Comfort Analysis - Intelligent comfort level assessment with travel impact
- β° Best Time Recommendations - Optimal timing for outdoor activities based on weather
π― NEW in v0.2.0 - Enhanced Intelligence
- π Advanced Fuzzy Search - "Opp Blk 910" β finds "Opposite Block 910" with 95% accuracy
- π¦οΈ Weather-Aware Routing - Real-time weather impact on walking times and route suggestions
- π Transfer Minimization - Smart algorithms to reduce transfers in multi-modal journeys
- πΊοΈ Google Maps-Quality Directions - "Turn Left To Stay On Thomson Road" level instructions
- π Comprehensive Stop Details - Nearby amenities, accessibility info, and location context
π― Core Features
- π― Advanced Postal Code Intelligence - 95% accuracy resolution for all Singapore postal codes
- πΊοΈ Professional Navigation Instructions - Turn-by-turn directions like "Turn Left To Stay On Thomson Road"
- π Multi-Modal Transport Planning - Seamless integration of MRT, LRT, buses, and walking
- β° Singapore Time Intelligence - Business hours, rush hour detection, and timing optimization
- π Intelligent Location Search - Fuzzy matching, typo tolerance, and smart suggestions
- π Comprehensive Geocoding - Forward and reverse geocoding with Singapore-specific accuracy
- π Real-Time Transport Data - Live bus arrivals, train status, and service disruptions
- π‘ Context-Aware Routing - Peak hour optimization, last train warnings, night bus alternatives
π― Real-World Problem Solved
Before: Basic transport tools with failed postal code resolution After: Enterprise-grade location intelligence platform with weather-aware routing
INPUT: "How to get to Suntec City from Little India MRT during heavy rain?"
OUTPUT:
β
Postal Code 039594 β SUNTEC CITY
π§οΈ Heavy rain detected - prefer covered routes
π Route: DT Line (8 min) β Covered walkway (6 min)
π° Cost: $1.55 | π Duration: 32 minutes (adjusted for weather)
π Step-by-step: "Walk 246m via covered walkway to ROCHOR MRT β Take DT Line from Rochor to Promenade β Use underground connection to Suntec City"
β οΈ Weather Advisory: Allow extra 5 minutes for walking segments
π Quick Start
Installation
npx @siva-sub/mcp-public-transport
Claude Desktop Setup
Add to your claude_desktop_config.json
:
{
"mcpServers": {
"singapore-transport": {
"command": "npx",
"args": ["-y", "@siva-sub/mcp-public-transport"],
"env": {
"LTA_ACCOUNT_KEY": "your_lta_api_key_here",
"ONEMAP_TOKEN": "your_onemap_token_here",
"ONEMAP_EMAIL": "your_onemap_email@example.com",
"ONEMAP_PASSWORD": "your_onemap_password"
}
}
}
}
βοΈ Configuration
Required Environment Variables
LTA_ACCOUNT_KEY
: Required. Your LTA DataMall API key (Get here)
Optional Environment Variables
ONEMAP_TOKEN
: OneMap API token for enhanced features (Register here)ONEMAP_EMAIL
: OneMap account email for authenticationONEMAP_PASSWORD
: OneMap account password for authenticationCACHE_DURATION
: Cache duration in seconds (default:300
)LOG_LEVEL
: Logging level (default:info
)
π οΈ Available Tools
π NEW - Enhanced Location Intelligence
-
search_bus_stops
β - Advanced fuzzy search with Singapore abbreviations- Supports: "Opp Blk 910", "Bef Jurong East MRT", "CP near Orchard"
- Intelligent pattern recognition and typo tolerance
- Distance-based ranking and confidence scoring
-
get_bus_stop_details
β - Comprehensive stop information- Real-time service information and nearby amenities
- Accessibility details and location context
- Walking distances to nearby stops
-
plan_comprehensive_journey
β - Complete multi-modal journey planning- Transfer minimization algorithms
- Real-time disruption handling
- Google Maps-quality turn-by-turn directions
- Weather impact on walking segments
- Supports all input types: addresses, postal codes, coordinates
π Location Intelligence
search_location
- Enhanced with fuzzy search capabilitiesresolve_postal_code
- High-accuracy Singapore postal code resolution (95% success rate)reverse_geocode
- Convert coordinates to addresses with Singapore-specific accuracy
π Public Transport
get_bus_arrival
- Real-time bus arrival times with crowding informationfind_bus_stops
- Find bus stops by location, name, or coordinatesplan_comprehensive_journey
- Multi-modal journey planning with detailed instructions
π Train Services
get_train_service_status
- Real-time MRT/LRT service status and disruptions
π Taxis & Ride-Hailing
get_nearby_taxis
- Find available taxis and estimate wait times
π¦ Traffic & Roads
get_traffic_conditions
- Live traffic conditions, incidents, and road speeds
π¦οΈ NEW - Weather Intelligence
-
get_weather_conditions
β - Comprehensive real-time weather with travel impact- Real-time temperature, rainfall, humidity, and wind data
- Comfort level analysis and walking condition ratings
- Travel impact assessment with time adjustments
- Activity-specific recommendations and safety advice
-
get_weather_advisory
β - Activity-specific weather recommendations- Tailored advice for walking, cycling, outdoor dining, sports, photography
- Suitability ratings and best time recommendations
- Weather-specific safety guidance and precautions
π Enterprise Features
Advanced Routing with Weather Intelligence
// Weather-aware journey planning
{
"primaryRoute": {
"summary": {
"totalTime": 1980, // seconds (adjusted for weather)
"walkingTime": 720, // includes weather buffer
"transfers": 1
},
"weatherImpact": {
"conditions": {
"rainfall": 12.5, // mm
"temperature": 28, // Β°C
"humidity": 85 // %
},
"advisories": [
{
"severity": "high",
"type": "rain",
"message": "Heavy rain detected. Allow extra time for walking.",
"routingImpact": {
"walkingTimeMultiplier": 1.5,
"preferredModes": ["MRT", "Covered Bus Stops"]
}
}
]
}
}
}
Enhanced Bus Stop Search
// Fuzzy search with Singapore intelligence
{
"query": "Opp Blk 910",
"searchType": "fuzzy",
"results": [
{
"busStopCode": "83139",
"description": "OPP BLK 910",
"matchScore": 0.95,
"locationPatterns": {
"blockNumber": "910",
"direction": "opp"
},
"searchContext": {
"queryVariations": ["opposite block 910", "opp blk 910"],
"bestMatch": "OPP BLK 910"
}
}
]
}
Comprehensive Stop Details
// Detailed stop information with context
{
"details": {
"busStopCode": "83139",
"description": "OPP BLK 910",
"services": [...], // Real-time arrivals
"nearbyStops": [...], // Within walking distance
"accessibility": {
"wheelchairAccessible": true,
"sheltered": true,
"tactilePaving": true
},
"locationContext": {
"district": "Tampines",
"landmarks": ["Block 910", "Tampines Mall"],
"transportHubs": ["Tampines MRT Station"]
},
"nearbyAmenities": [
{
"name": "Tampines Mall",
"type": "shopping",
"distance": 250,
"walkingTime": 3
}
]
}
}
Singapore Time Intelligence
{
"singaporeTime": "27/06/2025, 10:58 PM",
"businessHours": false,
"rushHour": false,
"contextInfo": {
"nextRushHour": "7:00 AM tomorrow",
"travelRecommendation": "Off-peak travel - comfortable journey expected"
}
}
Postal Code Intelligence
{
"postalCode": "039594",
"location": {
"name": "SUNTEC CITY",
"address": "3 TEMASEK BOULEVARD SUNTEC CITY SINGAPORE 039594",
"district": "Downtown Core",
"areaType": "Central Singapore",
"confidence": 0.98
}
}
π― Use Cases
1. Navigation Applications
- Weather-aware route planning
- Detailed turn-by-turn directions
- Multi-modal journey optimization
- Real-time traffic integration
2. Delivery & Logistics
- Postal code validation and resolution
- Optimal route planning with weather considerations
- Address standardization and fuzzy matching
3. Urban Planning
- Transport accessibility analysis
- Weather impact on pedestrian traffic
- Peak hour traffic optimization
- Public transport coverage mapping
4. Tourism & Hospitality
- Tourist-friendly directions with landmarks
- Weather-appropriate route suggestions
- Public transport guidance
- Location discovery with fuzzy search
π Performance & Reliability
- Sub-3-second route planning with weather integration
- 5-minute weather data cache for real-time responsiveness
- Intelligent caching with location and weather-aware TTL
- Graceful degradation during API maintenance
- 95% postal code resolution accuracy
- Real-time data integration with official Singapore APIs
- Fuzzy search accuracy of 90%+ for Singapore terms
π§ Advanced Configuration
Weather-Aware Route Preferences
{
"routingOptions": {
"includeWeatherImpact": true,
"maxWalkingDistance": 800,
"weatherSensitivity": "high",
"preferredModes": ["MRT", "Covered Bus Stops"],
"minimizeTransfers": true
}
}
Fuzzy Search Configuration
{
"searchOptions": {
"enableFuzzySearch": true,
"minScore": 0.3,
"singaporeAbbreviations": true,
"typoTolerance": true
}
}
Business Hours Configuration
{
"businessHours": {
"weekdays": { "start": 9, "end": 18 },
"saturday": { "start": 9, "end": 13 },
"sunday": { "closed": true }
}
}
π€ API Integration
OneMap Integration
- Authentication: Automatic token refresh with 3-day TTL
- Geocoding: High-accuracy address resolution with fuzzy matching
- Routing: Professional-grade turn-by-turn directions
- Weather Integration: Real-time weather data from Singapore APIs
LTA DataMall Integration
- Real-time Data: Bus arrivals, train status, traffic conditions
- Transport Network: Complete bus and train network data
- Service Alerts: Live disruption and maintenance notifications
- Enhanced Error Handling: Graceful degradation and retry logic
Singapore Weather API Integration
- Real-time Data: Rainfall, temperature, humidity, wind speed
- 5-minute Updates: Fresh weather data for accurate routing
- Location-based: Weather conditions for specific route segments
- Advisory Generation: Smart recommendations based on conditions
π Development
Local Development
git clone https://github.com/siva-sub/MCP-Public-Transport
cd MCP-Public-Transport
npm install
cp .env.example .env.local
# Add your API keys to .env.local
npm run dev
Building
npm run build # Builds both ESM and CJS versions
npm run test # Runs comprehensive test suite
npm run lint # TypeScript and ESLint checks
Testing
# Unit tests
npm run test
# Integration tests with real APIs
npm run test:integration
# Performance tests
npm run test:performance
π¦ Architecture
src/
βββ services/ # Core business logic
β βββ lta.ts # LTA DataMall integration
β βββ onemap.ts # OneMap API with authentication
β βββ weather.ts # β Real-time weather integration
β βββ routing.ts # β Enhanced multi-modal routing
β βββ fuzzySearch.ts # β Singapore-optimized fuzzy search
β βββ time.ts # Singapore time intelligence
β βββ postalCode.ts # Postal code validation & resolution
β βββ cache.ts # Intelligent caching layer
βββ tools/ # MCP tool implementations
β βββ location/ # Enhanced location intelligence tools
β βββ bus/ # β Enhanced bus tools with fuzzy search
β β βββ search.ts # β Advanced bus stop search
β β βββ details.ts # β Comprehensive stop details
β βββ routing/ # β Enhanced journey planning tools
β β βββ enhanced.ts# β Weather-aware optimal routing
β βββ train/ # Train service tools
β βββ traffic/ # Traffic and road tools
βββ types/ # TypeScript interfaces
β βββ location.ts # Location and search types
β βββ transport.ts # Transport system types
β βββ search.ts # Search and query types
β βββ time.ts # Singapore time types
βββ utils/ # Shared utilities
βββ errors.ts # Custom error handling
βββ logger.ts # Structured logging
βββ validation.ts # Input validation
π What Makes This Special
- Singapore-Optimized: Built specifically for Singapore's unique transport ecosystem with local intelligence
- Weather-Aware: Real-time weather integration affects routing decisions and walking time estimates
- Professional-Grade: Routing instructions comparable to Google Maps with fuzzy search capabilities
- Real-Time Context: Business hours, rush hour, weather, and timing intelligence
- High Accuracy: 95% success rate for postal code resolution, 90%+ fuzzy search accuracy
- Enterprise-Ready: Comprehensive error handling, weather resilience, and performance optimization
- Developer-Friendly: Full TypeScript support with comprehensive documentation
- Transfer Minimization: Smart algorithms to reduce transfers in multi-modal journeys
π― Contributing
We welcome contributions! Please see our Contributing Guide for details.
π License
MIT License - see LICENSE for details.
π Acknowledgments
- Singapore Land Authority (SLA) for OneMap API
- Land Transport Authority (LTA) for DataMall API
- Singapore Meteorological Service for weather data
- Model Context Protocol for the extensible framework
- Singapore Open Data initiative for public transport data
Built with β€οΈ for Singapore's smart city initiative and MCP exploration
π Version 0.2.0 Statistics
- 11 Total Tools (up from 8)
- 4 New Major Services added
- 3 New Tools with advanced capabilities
- Weather API Integration for real-time conditions
- Fuzzy Search Engine with 50+ Singapore abbreviations
- Google Maps-Quality turn-by-turn directions
- Transfer Minimization algorithms
Related Servers
Gemini DeepSearch MCP
An automated research agent using Google Gemini models and Google Search to perform deep, multi-step web research.
Naver Map Direction MCP
Provides geographical and directional data from the Naver Map API.
Google News
Google News search capabilities with automatic topic categorization and multi-language support via SerpAPI integration.
Bilibili API
Search for videos, users, and retrieve danmaku from the Bilibili API.
Dartpoint
Access public disclosure information for Korean companies (DART) using the dartpoint.ai API.
mxHERO Multi-Account Email Search
Search across multiple email accounts using mxHERO's vector search service.
RSS3
Integrates the RSS3 API to query the Open Web.
Stock Analysis
Access real-time and historical Indian stock data using the Yahoo Finance API.
QuantConnect PDF MCP Server
Converts QuantConnect PDF documentation into searchable markdown, enabling fast, context-aware search.
Kagi
Kagi search API integration