@siva-sub/mcp-public-transport
Version:
A Model Context Protocol server for Singapore transport data with real-time information and routing
42 lines (41 loc) • 1.54 kB
TypeScript
import { AxiosInstance } from 'axios';
import { CacheService } from './cache.js';
import { Location, JourneyPlan } from '../types/transport.js';
import { OneMapSearchResult } from '../types/location.js';
export declare class OneMapService {
private staticToken?;
private email?;
private password?;
private cache?;
private timeout;
client: AxiosInstance;
private readonly baseUrl;
private tokenCache;
constructor(staticToken?: string | undefined, email?: string | undefined, password?: string | undefined, cache?: CacheService | undefined, timeout?: number);
private setupInterceptors;
ensureValidToken(): Promise<string>;
private refreshToken;
geocodeWithAuth(query: string): Promise<OneMapSearchResult[]>;
geocode(query: string): Promise<Location | null>;
private _geocode;
planRoute(from: Location, to: Location, options?: {
mode?: 'PUBLIC_TRANSPORT' | 'WALK' | 'DRIVE';
departureTime?: Date;
arrivalTime?: Date;
maxWalkDistance?: number;
numItineraries?: number;
}): Promise<JourneyPlan | null>;
private _planRoute;
private mapModeToRouteType;
private formatDate;
private formatTime;
private formatDateForOneMap;
private formatTimeForOneMap;
private formatRouteResponse;
private formatPublicTransportResponse;
private formatDirectRoutingResponse;
private determineDirectRouteMode;
private createDirectRouteSummary;
private mapApiModeToMode;
private createJourneySummary;
}