google-flights-mcp-server 0.1.1
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.
- package/README.md +129 -0
- package/build/index.js +31 -0
- package/package.json +49 -0
- package/shared/flights-client/flights-client.d.ts +23 -0
- package/shared/flights-client/flights-client.js +522 -0
- package/shared/flights-client/types.d.ts +100 -0
- package/shared/flights-client/types.js +1 -0
- package/shared/index.d.ts +7 -0
- package/shared/index.js +8 -0
- package/shared/logging.d.ts +9 -0
- package/shared/logging.js +24 -0
- package/shared/resources.d.ts +3 -0
- package/shared/resources.js +43 -0
- package/shared/server.d.ts +54 -0
- package/shared/server.js +33 -0
- package/shared/tools/find-airport-code.d.ts +38 -0
- package/shared/tools/find-airport-code.js +63 -0
- package/shared/tools/get-date-grid.d.ts +82 -0
- package/shared/tools/get-date-grid.js +106 -0
- package/shared/tools/search-flights.d.ts +140 -0
- package/shared/tools/search-flights.js +171 -0
- package/shared/tools.d.ts +5 -0
- package/shared/tools.js +32 -0
package/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Google Flights MCP Server
|
|
2
|
+
|
|
3
|
+
> **Note**: This package is part of the [MCP Servers](https://github.com/pulsemcp/mcp-servers) monorepo. For the latest updates and full source code, visit the [Google Flights MCP Server directory](https://github.com/pulsemcp/mcp-servers/tree/main/experimental/google-flights).
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
MCP server for searching Google Flights. Provides flight search, date-price grids for finding cheapest travel dates, and airport IATA code lookup. No API key required.
|
|
7
|
+
|
|
8
|
+
## Highlights
|
|
9
|
+
|
|
10
|
+
- Flight search with full filtering (cabin class, stops, sorting, pagination)
|
|
11
|
+
- Date-price grid for finding cheapest travel dates across ~60 days
|
|
12
|
+
- Airport IATA code lookup by city name, airport name, or partial code
|
|
13
|
+
- No API key or authentication required
|
|
14
|
+
- Multi-passenger support (adults, children, infants)
|
|
15
|
+
- Multiple currency support
|
|
16
|
+
- Built-in rate limiting to avoid throttling
|
|
17
|
+
- TypeScript with strict type checking
|
|
18
|
+
|
|
19
|
+
## Capabilities
|
|
20
|
+
|
|
21
|
+
### Tools
|
|
22
|
+
|
|
23
|
+
| Tool | Description |
|
|
24
|
+
| ------------------- | ---------------------------------------------------------------------- |
|
|
25
|
+
| `search_flights` | Search for flights with full filtering, sorting, and pagination |
|
|
26
|
+
| `get_date_grid` | Get a date-price grid showing the cheapest flight price for each day |
|
|
27
|
+
| `find_airport_code` | Look up airport IATA codes by city name, airport name, or partial code |
|
|
28
|
+
|
|
29
|
+
### Resources
|
|
30
|
+
|
|
31
|
+
| Resource | Description |
|
|
32
|
+
| ------------------------- | ---------------------------------------- |
|
|
33
|
+
| `google-flights://config` | Server configuration and available tools |
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
### Claude Desktop Configuration
|
|
38
|
+
|
|
39
|
+
If this is your first time using MCP Servers, make sure you have the [Claude Desktop application](https://claude.ai/download) and follow the [official MCP setup instructions](https://modelcontextprotocol.io/quickstart/user).
|
|
40
|
+
|
|
41
|
+
macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
42
|
+
|
|
43
|
+
Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"mcpServers": {
|
|
48
|
+
"google-flights": {
|
|
49
|
+
"command": "npx",
|
|
50
|
+
"args": ["-y", "google-flights-mcp-server"]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Restart Claude Desktop and you should be ready to go!
|
|
57
|
+
|
|
58
|
+
### Example Usage
|
|
59
|
+
|
|
60
|
+
Search for flights:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
"Find me the cheapest nonstop flights from SFO to LAX next Friday"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Find cheapest dates:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
"When is the cheapest time to fly from JFK to London in March?"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Look up airport codes:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
"What are the airport codes for Tokyo?"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Development
|
|
79
|
+
|
|
80
|
+
### Install Dependencies
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npm install
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Build
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npm run build
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Running in Development Mode
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
npm run dev
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Testing
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Run manual tests (hits real Google Flights)
|
|
102
|
+
npm run test:manual
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Project Structure
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
google-flights/
|
|
109
|
+
├── local/ # Local server implementation
|
|
110
|
+
│ ├── src/
|
|
111
|
+
│ │ └── index.ts # Main entry point
|
|
112
|
+
│ └── package.json
|
|
113
|
+
├── shared/ # Shared business logic
|
|
114
|
+
│ ├── src/
|
|
115
|
+
│ │ ├── server.ts # Server factory with DI
|
|
116
|
+
│ │ ├── tools.ts # Tool registration
|
|
117
|
+
│ │ ├── tools/ # Individual tool implementations
|
|
118
|
+
│ │ ├── resources.ts # Resource implementations
|
|
119
|
+
│ │ ├── flights-client/ # Google Flights client (protobuf + HTTP)
|
|
120
|
+
│ │ └── logging.ts
|
|
121
|
+
│ └── package.json
|
|
122
|
+
├── tests/ # Test suite
|
|
123
|
+
│ └── manual/ # Manual tests against real Google Flights
|
|
124
|
+
└── package.json # Root workspace config
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
MIT
|
package/build/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync } from 'fs';
|
|
3
|
+
import { dirname, join } from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
6
|
+
import { createMCPServer } from '../shared/index.js';
|
|
7
|
+
import { logServerStart, logError } from '../shared/logging.js';
|
|
8
|
+
// Read version from package.json
|
|
9
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const packageJsonPath = join(__dirname, '..', 'package.json');
|
|
11
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
12
|
+
const VERSION = packageJson.version;
|
|
13
|
+
// =============================================================================
|
|
14
|
+
// MAIN ENTRY POINT
|
|
15
|
+
// =============================================================================
|
|
16
|
+
async function main() {
|
|
17
|
+
// No required environment variables — Google Flights uses public HTTP endpoints.
|
|
18
|
+
// No health checks needed — the first search will validate connectivity.
|
|
19
|
+
// Create server using factory
|
|
20
|
+
const { server, registerHandlers } = createMCPServer({ version: VERSION });
|
|
21
|
+
// Register all handlers (resources and tools)
|
|
22
|
+
await registerHandlers(server);
|
|
23
|
+
// Start server with stdio transport
|
|
24
|
+
const transport = new StdioServerTransport();
|
|
25
|
+
await server.connect(transport);
|
|
26
|
+
logServerStart('google-flights-mcp-server');
|
|
27
|
+
}
|
|
28
|
+
main().catch((error) => {
|
|
29
|
+
logError('main', error);
|
|
30
|
+
process.exit(1);
|
|
31
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "google-flights-mcp-server",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "MCP server for searching Google Flights — flight search, date grid pricing, and airport lookup",
|
|
5
|
+
"main": "build/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"google-flights-mcp-server": "./build/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"build/**/*.js",
|
|
12
|
+
"build/**/*.d.ts",
|
|
13
|
+
"shared/**/*.js",
|
|
14
|
+
"shared/**/*.d.ts",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"start": "node build/index.js",
|
|
20
|
+
"dev": "tsx src/index.ts",
|
|
21
|
+
"predev": "cd ../shared && npm run build && cd ../local && node setup-dev.js",
|
|
22
|
+
"prebuild": "cd ../shared && npm run build && cd ../local && node setup-dev.js",
|
|
23
|
+
"prepublishOnly": "node prepare-publish.js && node ../scripts/prepare-npm-readme.js",
|
|
24
|
+
"lint": "eslint . --ext .ts,.tsx",
|
|
25
|
+
"lint:fix": "eslint . --ext .ts,.tsx --fix",
|
|
26
|
+
"format": "prettier --write .",
|
|
27
|
+
"format:check": "prettier --check .",
|
|
28
|
+
"stage-publish": "npm version"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@modelcontextprotocol/sdk": "^1.19.1",
|
|
32
|
+
"protobufjs": "^7.4.0",
|
|
33
|
+
"zod": "^3.24.1"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/node": "^22.10.6",
|
|
37
|
+
"tsx": "^4.19.4",
|
|
38
|
+
"typescript": "^5.7.3"
|
|
39
|
+
},
|
|
40
|
+
"keywords": [
|
|
41
|
+
"mcp",
|
|
42
|
+
"google-flights",
|
|
43
|
+
"flights",
|
|
44
|
+
"flight-search",
|
|
45
|
+
"model-context-protocol"
|
|
46
|
+
],
|
|
47
|
+
"author": "PulseMCP",
|
|
48
|
+
"license": "MIT"
|
|
49
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { FlightOffer, DateGridResult, SearchFlightsOptions, SearchFlightsResult, GetDateGridOptions, AirportResult, SeatClass, TripType } from './types.js';
|
|
2
|
+
export declare function buildTfsParam(options: {
|
|
3
|
+
origin: string;
|
|
4
|
+
destination: string;
|
|
5
|
+
departureDate: string;
|
|
6
|
+
returnDate?: string;
|
|
7
|
+
tripType: TripType;
|
|
8
|
+
seatClass: SeatClass;
|
|
9
|
+
adults: number;
|
|
10
|
+
children: number;
|
|
11
|
+
infantsInSeat: number;
|
|
12
|
+
infantsOnLap: number;
|
|
13
|
+
maxStops?: number;
|
|
14
|
+
}): Promise<string>;
|
|
15
|
+
declare function extractDs1(html: string): any | null;
|
|
16
|
+
declare function formatTime(timeArr: number[] | null | undefined): string;
|
|
17
|
+
declare function formatDate(dateArr: number[] | null | undefined): string;
|
|
18
|
+
declare function parseFlightOffers(ds1: any, currency: string): FlightOffer[];
|
|
19
|
+
export declare function searchFlights(options: SearchFlightsOptions): Promise<SearchFlightsResult>;
|
|
20
|
+
export declare function getDateGrid(options: GetDateGridOptions): Promise<DateGridResult>;
|
|
21
|
+
export declare function findAirportCode(query: string): Promise<AirportResult[]>;
|
|
22
|
+
export { extractDs1, parseFlightOffers, formatTime, formatDate };
|
|
23
|
+
//# sourceMappingURL=flights-client.d.ts.map
|