mcp-travelcode 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +133 -0
  2. package/build/auth/cli-auth.d.ts +16 -0
  3. package/build/auth/cli-auth.js +281 -0
  4. package/build/auth/token-store.d.ts +39 -0
  5. package/build/auth/token-store.js +113 -0
  6. package/build/client/api-client.d.ts +42 -0
  7. package/build/client/api-client.js +235 -0
  8. package/build/client/types.d.ts +420 -0
  9. package/build/client/types.js +3 -0
  10. package/build/config.d.ts +9 -0
  11. package/build/config.js +30 -0
  12. package/build/formatters/aerodatabox-formatter.d.ts +6 -0
  13. package/build/formatters/aerodatabox-formatter.js +246 -0
  14. package/build/formatters/airline-formatter.d.ts +3 -0
  15. package/build/formatters/airline-formatter.js +12 -0
  16. package/build/formatters/airport-formatter.d.ts +4 -0
  17. package/build/formatters/airport-formatter.js +28 -0
  18. package/build/formatters/flight-formatter.d.ts +13 -0
  19. package/build/formatters/flight-formatter.js +100 -0
  20. package/build/formatters/hotel-formatter.d.ts +4 -0
  21. package/build/formatters/hotel-formatter.js +55 -0
  22. package/build/formatters/order-formatter.d.ts +8 -0
  23. package/build/formatters/order-formatter.js +115 -0
  24. package/build/http-server.d.ts +16 -0
  25. package/build/http-server.js +164 -0
  26. package/build/index.d.ts +3 -0
  27. package/build/index.js +16 -0
  28. package/build/polling/flight-poller.d.ts +11 -0
  29. package/build/polling/flight-poller.js +60 -0
  30. package/build/server.d.ts +4 -0
  31. package/build/server.js +54 -0
  32. package/build/tools/cancel-order.d.ts +9 -0
  33. package/build/tools/cancel-order.js +24 -0
  34. package/build/tools/check-order-cancellation.d.ts +8 -0
  35. package/build/tools/check-order-cancellation.js +22 -0
  36. package/build/tools/check-order-modification.d.ts +8 -0
  37. package/build/tools/check-order-modification.js +22 -0
  38. package/build/tools/create-order.d.ts +75 -0
  39. package/build/tools/create-order.js +52 -0
  40. package/build/tools/get-airport-delay-stats.d.ts +9 -0
  41. package/build/tools/get-airport-delay-stats.js +31 -0
  42. package/build/tools/get-airport-flights.d.ts +13 -0
  43. package/build/tools/get-airport-flights.js +78 -0
  44. package/build/tools/get-airport.d.ts +8 -0
  45. package/build/tools/get-airport.js +25 -0
  46. package/build/tools/get-flight-delay-stats.d.ts +8 -0
  47. package/build/tools/get-flight-delay-stats.js +28 -0
  48. package/build/tools/get-flight-results.d.ts +16 -0
  49. package/build/tools/get-flight-results.js +68 -0
  50. package/build/tools/get-flight-status.d.ts +11 -0
  51. package/build/tools/get-flight-status.js +42 -0
  52. package/build/tools/get-hotel-location.d.ts +8 -0
  53. package/build/tools/get-hotel-location.js +27 -0
  54. package/build/tools/get-order.d.ts +8 -0
  55. package/build/tools/get-order.js +22 -0
  56. package/build/tools/list-orders.d.ts +16 -0
  57. package/build/tools/list-orders.js +46 -0
  58. package/build/tools/modify-order.d.ts +10 -0
  59. package/build/tools/modify-order.js +33 -0
  60. package/build/tools/search-airlines.d.ts +9 -0
  61. package/build/tools/search-airlines.js +29 -0
  62. package/build/tools/search-airports.d.ts +9 -0
  63. package/build/tools/search-airports.js +30 -0
  64. package/build/tools/search-flights.d.ts +17 -0
  65. package/build/tools/search-flights.js +82 -0
  66. package/build/tools/search-hotel-locations.d.ts +9 -0
  67. package/build/tools/search-hotel-locations.js +23 -0
  68. package/build/tools/search-hotels.d.ts +46 -0
  69. package/build/tools/search-hotels.js +106 -0
  70. package/package.json +60 -0
@@ -0,0 +1,78 @@
1
+ import { z } from "zod";
2
+ import { formatAirportBoard } from "../formatters/aerodatabox-formatter.js";
3
+ export const getAirportFlightsSchema = {
4
+ airport_code: z
5
+ .string()
6
+ .describe("IATA airport code (e.g. 'JFK', 'LHR', 'WAW')"),
7
+ direction: z
8
+ .enum(["departure", "arrival"])
9
+ .default("departure")
10
+ .describe("Show departures or arrivals"),
11
+ from_time: z
12
+ .string()
13
+ .describe("Start of time window in YYYY-MM-DDTHH:mm format (local airport time, e.g. '2026-02-15T08:00')"),
14
+ to_time: z
15
+ .string()
16
+ .describe("End of time window in YYYY-MM-DDTHH:mm format (max 12 hours after from_time, e.g. '2026-02-15T14:00')"),
17
+ include_codeshares: z
18
+ .boolean()
19
+ .default(false)
20
+ .describe("Include codeshare flights (duplicates under different flight numbers)"),
21
+ include_cargo: z
22
+ .boolean()
23
+ .default(false)
24
+ .describe("Include cargo flights"),
25
+ };
26
+ export function registerGetAirportFlights(server, client) {
27
+ server.tool("get_airport_flights", "Get the departure or arrival board for an airport within a time window (max 12 hours). Shows all flights with their status, terminals, and gates. Use this to monitor departures/arrivals or check for widespread delays.", getAirportFlightsSchema, async ({ airport_code, direction, from_time, to_time, include_codeshares, include_cargo }) => {
28
+ try {
29
+ // Validate time window (max 12 hours)
30
+ const from = new Date(from_time);
31
+ const to = new Date(to_time);
32
+ const diffHours = (to.getTime() - from.getTime()) / (1000 * 60 * 60);
33
+ if (diffHours > 12) {
34
+ return {
35
+ content: [{
36
+ type: "text",
37
+ text: "Error: Time window must not exceed 12 hours. Please narrow the range.",
38
+ }],
39
+ isError: true,
40
+ };
41
+ }
42
+ if (diffHours <= 0) {
43
+ return {
44
+ content: [{
45
+ type: "text",
46
+ text: "Error: to_time must be after from_time.",
47
+ }],
48
+ isError: true,
49
+ };
50
+ }
51
+ const code = airport_code.toUpperCase();
52
+ const board = await client.getAerodatabox(`/flights/airports/iata/${encodeURIComponent(code)}/${from_time}/${to_time}`, {
53
+ withCancellations: true,
54
+ withCodeshares: include_codeshares,
55
+ withCargo: include_cargo,
56
+ withPrivate: false,
57
+ direction,
58
+ });
59
+ const flights = direction === "departure" ? board.departures || [] : board.arrivals || [];
60
+ return {
61
+ content: [{
62
+ type: "text",
63
+ text: formatAirportBoard(flights, code, direction, from_time, to_time),
64
+ }],
65
+ };
66
+ }
67
+ catch (error) {
68
+ return {
69
+ content: [{
70
+ type: "text",
71
+ text: `Error getting airport flights for ${airport_code}: ${error.message}`,
72
+ }],
73
+ isError: true,
74
+ };
75
+ }
76
+ });
77
+ }
78
+ //# sourceMappingURL=get-airport-flights.js.map
@@ -0,0 +1,8 @@
1
+ import { z } from "zod";
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { TravelCodeApiClient } from "../client/api-client.js";
4
+ export declare const getAirportSchema: {
5
+ code: z.ZodString;
6
+ };
7
+ export declare function registerGetAirport(server: McpServer, client: TravelCodeApiClient): void;
8
+ //# sourceMappingURL=get-airport.d.ts.map
@@ -0,0 +1,25 @@
1
+ import { z } from "zod";
2
+ import { formatAirportDetail } from "../formatters/airport-formatter.js";
3
+ export const getAirportSchema = {
4
+ code: z.string().describe("Airport IATA code (e.g. 'JFK', 'LHR') or internal airport ID"),
5
+ };
6
+ export function registerGetAirport(server, client) {
7
+ server.tool("get_airport", "Get detailed information about a specific airport or city by its IATA code. Returns name, city, and country.", getAirportSchema, async ({ code }) => {
8
+ try {
9
+ const airport = await client.get(`/data/airports/${encodeURIComponent(code)}`, {
10
+ type: "iata",
11
+ scope: "country,city",
12
+ });
13
+ return {
14
+ content: [{ type: "text", text: formatAirportDetail(airport) }],
15
+ };
16
+ }
17
+ catch (error) {
18
+ return {
19
+ content: [{ type: "text", text: `Error getting airport "${code}": ${error.message}` }],
20
+ isError: true,
21
+ };
22
+ }
23
+ });
24
+ }
25
+ //# sourceMappingURL=get-airport.js.map
@@ -0,0 +1,8 @@
1
+ import { z } from "zod";
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { TravelCodeApiClient } from "../client/api-client.js";
4
+ export declare const getFlightDelayStatsSchema: {
5
+ flight_number: z.ZodString;
6
+ };
7
+ export declare function registerGetFlightDelayStats(server: McpServer, client: TravelCodeApiClient): void;
8
+ //# sourceMappingURL=get-flight-delay-stats.d.ts.map
@@ -0,0 +1,28 @@
1
+ import { z } from "zod";
2
+ import { formatFlightDelayStats } from "../formatters/aerodatabox-formatter.js";
3
+ export const getFlightDelayStatsSchema = {
4
+ flight_number: z
5
+ .string()
6
+ .describe("Flight number including airline code (e.g. 'LO776', 'BA304')"),
7
+ };
8
+ export function registerGetFlightDelayStats(server, client) {
9
+ server.tool("get_flight_delay_stats", "Get historical delay statistics for a specific flight number. Shows how often the flight is delayed, average delay duration, and reliability assessment. Use this to evaluate a flight's punctuality before booking.", getFlightDelayStatsSchema, async ({ flight_number }) => {
10
+ try {
11
+ const normalized = flight_number.replace(/\s+/g, "").toUpperCase();
12
+ const stats = await client.getAerodatabox(`/flights/${encodeURIComponent(normalized)}/delays`);
13
+ return {
14
+ content: [{ type: "text", text: formatFlightDelayStats(stats, normalized) }],
15
+ };
16
+ }
17
+ catch (error) {
18
+ return {
19
+ content: [{
20
+ type: "text",
21
+ text: `Error getting delay stats for "${flight_number}": ${error.message}`,
22
+ }],
23
+ isError: true,
24
+ };
25
+ }
26
+ });
27
+ }
28
+ //# sourceMappingURL=get-flight-delay-stats.js.map
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { TravelCodeApiClient } from "../client/api-client.js";
4
+ export declare const getFlightResultsSchema: {
5
+ cache_id: z.ZodString;
6
+ max_stops: z.ZodOptional<z.ZodNumber>;
7
+ sort_by: z.ZodDefault<z.ZodEnum<["price", "duration"]>>;
8
+ sort_order: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
9
+ airlines: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
10
+ max_price: z.ZodOptional<z.ZodNumber>;
11
+ baggage_only: z.ZodDefault<z.ZodBoolean>;
12
+ offset: z.ZodDefault<z.ZodNumber>;
13
+ limit: z.ZodDefault<z.ZodNumber>;
14
+ };
15
+ export declare function registerGetFlightResults(server: McpServer, client: TravelCodeApiClient): void;
16
+ //# sourceMappingURL=get-flight-results.d.ts.map
@@ -0,0 +1,68 @@
1
+ import { z } from "zod";
2
+ import { formatFilteredResults } from "../formatters/flight-formatter.js";
3
+ export const getFlightResultsSchema = {
4
+ cache_id: z.string().describe("Cache ID from a previous search_flights result"),
5
+ max_stops: z.number().int().min(0).max(3).optional().describe("Maximum number of stops (0 = direct only, 1 = max 1 stop, etc.)"),
6
+ sort_by: z.enum(["price", "duration"]).default("price").describe("Sort results by price or duration"),
7
+ sort_order: z.enum(["asc", "desc"]).default("asc").describe("Sort direction"),
8
+ airlines: z.array(z.string()).optional().describe("Filter to specific airline IATA codes (e.g. ['BA', 'LH'])"),
9
+ max_price: z.number().optional().describe("Maximum price per person"),
10
+ baggage_only: z.boolean().default(false).describe("Only show flights with included baggage"),
11
+ offset: z.number().int().min(0).default(0).describe("Pagination offset"),
12
+ limit: z.number().int().min(1).max(50).default(10).describe("Number of results to return"),
13
+ };
14
+ export function registerGetFlightResults(server, client) {
15
+ server.tool("get_flight_results", "Retrieve or filter existing flight search results using a cache ID from a previous search. Apply filters (direct flights, specific airlines, price range), change sorting, or paginate through results without running a new search. Cache expires after ~15 minutes.", getFlightResultsSchema, async ({ cache_id, max_stops, sort_by, sort_order, airlines, max_price, baggage_only, offset, limit }) => {
16
+ try {
17
+ // Build query params
18
+ const params = {
19
+ offset,
20
+ limit,
21
+ sort: sort_by,
22
+ sortOrder: sort_order.toUpperCase(),
23
+ embedded: "airlines,dictionaries",
24
+ };
25
+ // Build filter params
26
+ if (max_stops !== undefined) {
27
+ params["filter[transfer]"] = max_stops;
28
+ params["filter[transferReturn]"] = max_stops;
29
+ }
30
+ if (max_price !== undefined) {
31
+ params["filter[maxprice]"] = max_price;
32
+ }
33
+ if (baggage_only) {
34
+ params["filter[baggage]"] = 1;
35
+ }
36
+ if (airlines && airlines.length > 0) {
37
+ params["filter[airlines]"] = airlines.map((a) => a.toUpperCase()).join(",");
38
+ }
39
+ const results = await client.get(`/search/flights/${encodeURIComponent(cache_id)}`, params);
40
+ // Build filter summary
41
+ const filterParts = [];
42
+ if (max_stops !== undefined) {
43
+ filterParts.push(max_stops === 0 ? "Direct only" : `Max ${max_stops} stop(s)`);
44
+ }
45
+ if (airlines && airlines.length > 0) {
46
+ filterParts.push(`Airlines: ${airlines.join(", ")}`);
47
+ }
48
+ if (max_price !== undefined) {
49
+ filterParts.push(`Max price: ${max_price}`);
50
+ }
51
+ if (baggage_only) {
52
+ filterParts.push("Baggage included only");
53
+ }
54
+ filterParts.push(`Sorted by ${sort_by} (${sort_order})`);
55
+ const text = formatFilteredResults(results, cache_id, filterParts.join(" | "));
56
+ return {
57
+ content: [{ type: "text", text }],
58
+ };
59
+ }
60
+ catch (error) {
61
+ return {
62
+ content: [{ type: "text", text: `Error getting flight results: ${error.message}` }],
63
+ isError: true,
64
+ };
65
+ }
66
+ });
67
+ }
68
+ //# sourceMappingURL=get-flight-results.js.map
@@ -0,0 +1,11 @@
1
+ import { z } from "zod";
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { TravelCodeApiClient } from "../client/api-client.js";
4
+ export declare const getFlightStatusSchema: {
5
+ flight_number: z.ZodString;
6
+ date: z.ZodString;
7
+ with_aircraft_image: z.ZodDefault<z.ZodBoolean>;
8
+ with_location: z.ZodDefault<z.ZodBoolean>;
9
+ };
10
+ export declare function registerGetFlightStatus(server: McpServer, client: TravelCodeApiClient): void;
11
+ //# sourceMappingURL=get-flight-status.d.ts.map
@@ -0,0 +1,42 @@
1
+ import { z } from "zod";
2
+ import { formatFlightStatus } from "../formatters/aerodatabox-formatter.js";
3
+ export const getFlightStatusSchema = {
4
+ flight_number: z
5
+ .string()
6
+ .describe("Flight number including airline code (e.g. 'LO776', 'BA304', 'LH1234')"),
7
+ date: z
8
+ .string()
9
+ .describe("Flight date in YYYY-MM-DD format (e.g. '2026-02-15')"),
10
+ with_aircraft_image: z
11
+ .boolean()
12
+ .default(false)
13
+ .describe("Include aircraft image URL in the response"),
14
+ with_location: z
15
+ .boolean()
16
+ .default(false)
17
+ .describe("Include current aircraft position if in-flight"),
18
+ };
19
+ export function registerGetFlightStatus(server, client) {
20
+ server.tool("get_flight_status", "Get real-time status of a specific flight by flight number and date. Returns departure/arrival times (scheduled, actual, estimated), terminals, gates, aircraft info, and delay information. Use this to check if a flight is on time, delayed, or cancelled.", getFlightStatusSchema, async ({ flight_number, date, with_aircraft_image, with_location }) => {
21
+ try {
22
+ const normalized = flight_number.replace(/\s+/g, "").toUpperCase();
23
+ const flights = await client.getAerodatabox(`/flights/number/${encodeURIComponent(normalized)}/${date}`, {
24
+ withAircraftImage: with_aircraft_image,
25
+ withLocation: with_location,
26
+ });
27
+ return {
28
+ content: [{ type: "text", text: formatFlightStatus(flights, normalized, date) }],
29
+ };
30
+ }
31
+ catch (error) {
32
+ return {
33
+ content: [{
34
+ type: "text",
35
+ text: `Error getting flight status for "${flight_number}" on ${date}: ${error.message}`,
36
+ }],
37
+ isError: true,
38
+ };
39
+ }
40
+ });
41
+ }
42
+ //# sourceMappingURL=get-flight-status.js.map
@@ -0,0 +1,8 @@
1
+ import { z } from "zod";
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { TravelCodeApiClient } from "../client/api-client.js";
4
+ export declare const getHotelLocationSchema: {
5
+ id: z.ZodNumber;
6
+ };
7
+ export declare function registerGetHotelLocation(server: McpServer, client: TravelCodeApiClient): void;
8
+ //# sourceMappingURL=get-hotel-location.d.ts.map
@@ -0,0 +1,27 @@
1
+ import { z } from "zod";
2
+ export const getHotelLocationSchema = {
3
+ id: z.number().int().describe("Location ID (from search_hotel_locations)"),
4
+ };
5
+ export function registerGetHotelLocation(server, client) {
6
+ server.tool("get_hotel_location", "Get hotel location details by ID. Returns name and entity type (city, region, hotel).", getHotelLocationSchema, async ({ id }) => {
7
+ try {
8
+ const data = await client.getWithTokenParam("/data/hotel-location", { id });
9
+ const loc = data.result;
10
+ const text = [
11
+ `Location #${loc.id}`,
12
+ `Name: ${loc.nameEn}${loc.nameRu !== loc.nameEn ? ` (${loc.nameRu})` : ""}`,
13
+ `Type: ${loc.entityType}`,
14
+ ].join("\n");
15
+ return {
16
+ content: [{ type: "text", text }],
17
+ };
18
+ }
19
+ catch (error) {
20
+ return {
21
+ content: [{ type: "text", text: `Error getting hotel location: ${error.message}` }],
22
+ isError: true,
23
+ };
24
+ }
25
+ });
26
+ }
27
+ //# sourceMappingURL=get-hotel-location.js.map
@@ -0,0 +1,8 @@
1
+ import { z } from "zod";
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { TravelCodeApiClient } from "../client/api-client.js";
4
+ export declare const getOrderSchema: {
5
+ order_id: z.ZodNumber;
6
+ };
7
+ export declare function registerGetOrder(server: McpServer, client: TravelCodeApiClient): void;
8
+ //# sourceMappingURL=get-order.d.ts.map
@@ -0,0 +1,22 @@
1
+ import { z } from "zod";
2
+ import { formatOrderDetail } from "../formatters/order-formatter.js";
3
+ export const getOrderSchema = {
4
+ order_id: z.number().int().describe("Order ID"),
5
+ };
6
+ export function registerGetOrder(server, client) {
7
+ server.tool("get_order", "Get full details of an order including passengers, services, tickets, and payment status.", getOrderSchema, async ({ order_id }) => {
8
+ try {
9
+ const order = await client.get(`/orders/${order_id}`);
10
+ return {
11
+ content: [{ type: "text", text: formatOrderDetail(order) }],
12
+ };
13
+ }
14
+ catch (error) {
15
+ return {
16
+ content: [{ type: "text", text: `Error getting order ${order_id}: ${error.message}` }],
17
+ isError: true,
18
+ };
19
+ }
20
+ });
21
+ }
22
+ //# sourceMappingURL=get-order.js.map
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { TravelCodeApiClient } from "../client/api-client.js";
4
+ export declare const listOrdersSchema: {
5
+ status: z.ZodOptional<z.ZodEnum<["pending", "confirmed", "ticketed", "pending_cancellation", "cancelled"]>>;
6
+ pnr: z.ZodOptional<z.ZodString>;
7
+ passenger_name: z.ZodOptional<z.ZodString>;
8
+ date_from: z.ZodOptional<z.ZodString>;
9
+ date_to: z.ZodOptional<z.ZodString>;
10
+ sort: z.ZodDefault<z.ZodEnum<["createdAt", "updatedAt", "price", "status"]>>;
11
+ sort_order: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
12
+ offset: z.ZodDefault<z.ZodNumber>;
13
+ limit: z.ZodDefault<z.ZodNumber>;
14
+ };
15
+ export declare function registerListOrders(server: McpServer, client: TravelCodeApiClient): void;
16
+ //# sourceMappingURL=list-orders.d.ts.map
@@ -0,0 +1,46 @@
1
+ import { z } from "zod";
2
+ import { formatOrderList } from "../formatters/order-formatter.js";
3
+ export const listOrdersSchema = {
4
+ status: z
5
+ .enum(["pending", "confirmed", "ticketed", "pending_cancellation", "cancelled"])
6
+ .optional()
7
+ .describe("Filter by order status"),
8
+ pnr: z.string().optional().describe("Search by PNR (booking reference)"),
9
+ passenger_name: z.string().optional().describe("Search by passenger first or last name"),
10
+ date_from: z.string().optional().describe("Filter orders created from this date (YYYY-MM-DD)"),
11
+ date_to: z.string().optional().describe("Filter orders created until this date (YYYY-MM-DD)"),
12
+ sort: z
13
+ .enum(["createdAt", "updatedAt", "price", "status"])
14
+ .default("createdAt")
15
+ .describe("Sort field"),
16
+ sort_order: z.enum(["asc", "desc"]).default("desc").describe("Sort direction"),
17
+ offset: z.number().int().min(0).default(0).describe("Pagination offset"),
18
+ limit: z.number().int().min(1).max(100).default(20).describe("Number of results to return"),
19
+ };
20
+ export function registerListOrders(server, client) {
21
+ server.tool("list_orders", "List user's orders with optional filtering by status, PNR, passenger name, or date range. Supports pagination and sorting.", listOrdersSchema, async ({ status, pnr, passenger_name, date_from, date_to, sort, sort_order, offset, limit }) => {
22
+ try {
23
+ const data = await client.get("/orders", {
24
+ status,
25
+ pnr,
26
+ passengerName: passenger_name,
27
+ dateFrom: date_from,
28
+ dateTo: date_to,
29
+ sort,
30
+ sortOrder: sort_order,
31
+ offset,
32
+ limit,
33
+ });
34
+ return {
35
+ content: [{ type: "text", text: formatOrderList(data) }],
36
+ };
37
+ }
38
+ catch (error) {
39
+ return {
40
+ content: [{ type: "text", text: `Error listing orders: ${error.message}` }],
41
+ isError: true,
42
+ };
43
+ }
44
+ });
45
+ }
46
+ //# sourceMappingURL=list-orders.js.map
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { TravelCodeApiClient } from "../client/api-client.js";
4
+ export declare const modifyOrderSchema: {
5
+ order_id: z.ZodNumber;
6
+ type: z.ZodEnum<["contact", "passport", "rebook", "baggage"]>;
7
+ changes: z.ZodRecord<z.ZodString, z.ZodUnknown>;
8
+ };
9
+ export declare function registerModifyOrder(server: McpServer, client: TravelCodeApiClient): void;
10
+ //# sourceMappingURL=modify-order.d.ts.map
@@ -0,0 +1,33 @@
1
+ import { z } from "zod";
2
+ import { formatModifyResult } from "../formatters/order-formatter.js";
3
+ export const modifyOrderSchema = {
4
+ order_id: z.number().int().describe("Order ID to modify"),
5
+ type: z
6
+ .enum(["contact", "passport", "rebook", "baggage"])
7
+ .describe("Type of modification: contact (change email/phone), passport (change document), rebook (change dates), baggage (add baggage)"),
8
+ changes: z.record(z.unknown()).describe("Changes object. Fields depend on type:\n" +
9
+ "- contact: { email, phoneCode, phoneNumber }\n" +
10
+ "- passport: { serviceId, passengerId, documentNumber, documentType, expiryDate, nationality }\n" +
11
+ "- rebook: { serviceId, newDate (DD.MM.YYYY), newDateEnd (DD.MM.YYYY) }\n" +
12
+ "- baggage: { serviceId, services: [{ type: 'baggage', weight, passengerId }] }"),
13
+ };
14
+ export function registerModifyOrder(server, client) {
15
+ server.tool("modify_order", "Modify an existing order. Modification is asynchronous — use get_order to poll for the result. Call check_order_modification first to see which changes are allowed. Supported types: contact, passport, rebook, baggage.", modifyOrderSchema, async ({ order_id, type, changes }) => {
16
+ try {
17
+ const data = await client.post(`/orders/${order_id}/modify`, {
18
+ type,
19
+ changes,
20
+ });
21
+ return {
22
+ content: [{ type: "text", text: formatModifyResult(data) }],
23
+ };
24
+ }
25
+ catch (error) {
26
+ return {
27
+ content: [{ type: "text", text: `Error modifying order ${order_id}: ${error.message}` }],
28
+ isError: true,
29
+ };
30
+ }
31
+ });
32
+ }
33
+ //# sourceMappingURL=modify-order.js.map
@@ -0,0 +1,9 @@
1
+ import { z } from "zod";
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { TravelCodeApiClient } from "../client/api-client.js";
4
+ export declare const searchAirlinesSchema: {
5
+ query: z.ZodString;
6
+ limit: z.ZodDefault<z.ZodNumber>;
7
+ };
8
+ export declare function registerSearchAirlines(server: McpServer, client: TravelCodeApiClient): void;
9
+ //# sourceMappingURL=search-airlines.d.ts.map
@@ -0,0 +1,29 @@
1
+ import { z } from "zod";
2
+ import { formatAirlineList } from "../formatters/airline-formatter.js";
3
+ export const searchAirlinesSchema = {
4
+ query: z.string().describe("Search term: airline name or IATA code (e.g. 'British Airways', 'BA', 'Lufthansa')"),
5
+ limit: z.number().int().min(1).max(50).default(10).describe("Maximum number of results to return"),
6
+ };
7
+ export function registerSearchAirlines(server, client) {
8
+ server.tool("search_airlines", "Search for airlines by name or IATA code. Returns matching airlines with their codes and names. Use this to find airline codes for filtering flight searches.", searchAirlinesSchema, async ({ query, limit }) => {
9
+ try {
10
+ const airlines = await client.get("/data/airlines", {
11
+ search: query,
12
+ limit,
13
+ offset: 0,
14
+ sort: "title",
15
+ sortOrder: "ASC",
16
+ });
17
+ return {
18
+ content: [{ type: "text", text: formatAirlineList(airlines, query) }],
19
+ };
20
+ }
21
+ catch (error) {
22
+ return {
23
+ content: [{ type: "text", text: `Error searching airlines: ${error.message}` }],
24
+ isError: true,
25
+ };
26
+ }
27
+ });
28
+ }
29
+ //# sourceMappingURL=search-airlines.js.map
@@ -0,0 +1,9 @@
1
+ import { z } from "zod";
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { TravelCodeApiClient } from "../client/api-client.js";
4
+ export declare const searchAirportsSchema: {
5
+ query: z.ZodString;
6
+ limit: z.ZodDefault<z.ZodNumber>;
7
+ };
8
+ export declare function registerSearchAirports(server: McpServer, client: TravelCodeApiClient): void;
9
+ //# sourceMappingURL=search-airports.d.ts.map
@@ -0,0 +1,30 @@
1
+ import { z } from "zod";
2
+ import { formatAirportList } from "../formatters/airport-formatter.js";
3
+ export const searchAirportsSchema = {
4
+ query: z.string().describe("Search term: airport name, city name, or IATA code (e.g. 'London', 'JFK', 'Heathrow')"),
5
+ limit: z.number().int().min(1).max(50).default(10).describe("Maximum number of results to return"),
6
+ };
7
+ export function registerSearchAirports(server, client) {
8
+ server.tool("search_airports", "Search for airports by name, city, or IATA code. Returns a list of matching airports and cities with their codes. Use this to find airport codes before searching for flights.", searchAirportsSchema, async ({ query, limit }) => {
9
+ try {
10
+ const airports = await client.get("/data/airports", {
11
+ search: query,
12
+ limit,
13
+ offset: 0,
14
+ sort: "title",
15
+ sortOrder: "ASC",
16
+ scope: "country,city",
17
+ });
18
+ return {
19
+ content: [{ type: "text", text: formatAirportList(airports, query) }],
20
+ };
21
+ }
22
+ catch (error) {
23
+ return {
24
+ content: [{ type: "text", text: `Error searching airports: ${error.message}` }],
25
+ isError: true,
26
+ };
27
+ }
28
+ });
29
+ }
30
+ //# sourceMappingURL=search-airports.js.map
@@ -0,0 +1,17 @@
1
+ import { z } from "zod";
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { TravelCodeApiClient } from "../client/api-client.js";
4
+ import { TravelCodeConfig } from "../config.js";
5
+ export declare const searchFlightsSchema: {
6
+ origin: z.ZodString;
7
+ destination: z.ZodString;
8
+ departure_date: z.ZodString;
9
+ return_date: z.ZodOptional<z.ZodString>;
10
+ cabin_class: z.ZodDefault<z.ZodEnum<["economy", "premium_economy", "business", "first"]>>;
11
+ adults: z.ZodDefault<z.ZodNumber>;
12
+ children: z.ZodDefault<z.ZodNumber>;
13
+ infants: z.ZodDefault<z.ZodNumber>;
14
+ preferred_airlines: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
15
+ };
16
+ export declare function registerSearchFlights(server: McpServer, client: TravelCodeApiClient, config: TravelCodeConfig): void;
17
+ //# sourceMappingURL=search-flights.d.ts.map