@pipeworx/mcp-aviationstack 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pipeworx
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # mcp-aviationstack
2
+
3
+ Aviationstack MCP — global flight + airport + airline data
4
+
5
+ Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 250+ live data sources.
6
+
7
+ ## Tools
8
+
9
+ | Tool | Description |
10
+ |------|-------------|
11
+ | `airports` | Airport directory — name, IATA/ICAO codes, country, GPS, timezone. |
12
+ | `airlines` | Airline directory. |
13
+ | `cities` | City + primary-airport database. |
14
+ | `countries` | Country reference with capital city, currency, etc. |
15
+ | `routes` | Scheduled routes between airports. |
16
+
17
+ ## Quick Start
18
+
19
+ Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
20
+
21
+ ```json
22
+ {
23
+ "mcpServers": {
24
+ "aviationstack": {
25
+ "url": "https://gateway.pipeworx.io/aviationstack/mcp"
26
+ }
27
+ }
28
+ }
29
+ ```
30
+
31
+ Or connect to the full Pipeworx gateway for access to all 250+ data sources:
32
+
33
+ ```json
34
+ {
35
+ "mcpServers": {
36
+ "pipeworx": {
37
+ "url": "https://gateway.pipeworx.io/mcp"
38
+ }
39
+ }
40
+ }
41
+ ```
42
+
43
+ ## Using with ask_pipeworx
44
+
45
+ Instead of calling tools directly, you can ask questions in plain English:
46
+
47
+ ```
48
+ ask_pipeworx({ question: "your question about Aviationstack data" })
49
+ ```
50
+
51
+ The gateway picks the right tool and fills the arguments automatically.
52
+
53
+ ## More
54
+
55
+ - [All tools and guides](https://github.com/pipeworx-io/examples)
56
+ - [pipeworx.io](https://pipeworx.io)
57
+
58
+ ## License
59
+
60
+ MIT
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@pipeworx/mcp-aviationstack",
3
+ "version": "0.1.0",
4
+ "description": "Aviationstack MCP — global flight + airport + airline data",
5
+ "type": "module",
6
+ "main": "src/index.ts",
7
+ "types": "src/index.ts",
8
+ "keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "aviationstack"],
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/pipeworx-io/mcp-aviationstack"
13
+ },
14
+ "scripts": {
15
+ "typecheck": "tsc --noEmit"
16
+ },
17
+ "devDependencies": {
18
+ "typescript": "^5.7.0"
19
+ }
20
+ }
package/server.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.pipeworx-io/aviationstack",
4
+ "title": "Aviationstack",
5
+ "description": "Aviationstack MCP — global flight + airport + airline data",
6
+ "version": "0.1.0",
7
+ "websiteUrl": "https://pipeworx.io/packs/aviationstack",
8
+ "repository": {
9
+ "url": "https://github.com/pipeworx-io/mcp-aviationstack",
10
+ "source": "github"
11
+ },
12
+ "remotes": [
13
+ {
14
+ "type": "streamable-http",
15
+ "url": "https://gateway.pipeworx.io/aviationstack/mcp"
16
+ }
17
+ ]
18
+ }
package/src/index.ts ADDED
@@ -0,0 +1,152 @@
1
+ interface McpToolDefinition {
2
+ name: string;
3
+ description: string;
4
+ inputSchema: {
5
+ type: 'object';
6
+ properties: Record<string, unknown>;
7
+ required?: string[];
8
+ };
9
+ }
10
+
11
+ interface McpToolExport {
12
+ tools: McpToolDefinition[];
13
+ callTool: (name: string, args: Record<string, unknown>) => Promise<unknown>;
14
+ meter?: { credits: number };
15
+ cost?: Record<string, unknown>;
16
+ provider?: string;
17
+ }
18
+
19
+ /**
20
+ * Aviationstack MCP — global flight + airport + airline data
21
+ *
22
+ * Auth: ?access_key= query param.
23
+ * Free plan: 100 req/mo, HTTP-only (https is a paid feature).
24
+ *
25
+ * Docs: https://aviationstack.com/documentation
26
+ */
27
+
28
+
29
+ const BASE = 'http://api.aviationstack.com/v1';
30
+
31
+ const tools: McpToolExport['tools'] = [
32
+ {
33
+ name: 'flights',
34
+ description:
35
+ 'Real-time and scheduled flights with departure/arrival airport, time, gate, status. Combine filters to narrow down.',
36
+ inputSchema: {
37
+ type: 'object',
38
+ properties: {
39
+ flight_iata: { type: 'string', description: 'IATA flight number (e.g. "AA100")' },
40
+ flight_icao: { type: 'string', description: 'ICAO flight number' },
41
+ dep_iata: { type: 'string', description: 'Departure airport IATA (e.g. "JFK")' },
42
+ arr_iata: { type: 'string', description: 'Arrival airport IATA' },
43
+ airline_iata: { type: 'string', description: 'Airline IATA code' },
44
+ flight_status: { type: 'string', description: 'scheduled | active | landed | cancelled | incident | diverted' },
45
+ limit: { type: 'number', description: '1-100 (default 25)' },
46
+ offset: { type: 'number', description: '0-based offset' },
47
+ },
48
+ },
49
+ },
50
+ {
51
+ name: 'airports',
52
+ description: 'Airport directory — name, IATA/ICAO codes, country, GPS, timezone.',
53
+ inputSchema: {
54
+ type: 'object',
55
+ properties: {
56
+ search: { type: 'string', description: 'Free-text — name / city' },
57
+ iata_code: { type: 'string', description: '3-letter IATA code' },
58
+ icao_code: { type: 'string', description: '4-letter ICAO code' },
59
+ country_iso2: { type: 'string', description: 'ISO 3166-1 alpha-2 country' },
60
+ limit: { type: 'number' },
61
+ offset: { type: 'number' },
62
+ },
63
+ },
64
+ },
65
+ {
66
+ name: 'airlines',
67
+ description: 'Airline directory.',
68
+ inputSchema: {
69
+ type: 'object',
70
+ properties: {
71
+ search: { type: 'string' },
72
+ iata_code: { type: 'string', description: '2-letter IATA' },
73
+ icao_code: { type: 'string', description: '3-letter ICAO' },
74
+ limit: { type: 'number' },
75
+ offset: { type: 'number' },
76
+ },
77
+ },
78
+ },
79
+ {
80
+ name: 'cities',
81
+ description: 'City + primary-airport database.',
82
+ inputSchema: {
83
+ type: 'object',
84
+ properties: {
85
+ search: { type: 'string' },
86
+ iata_code: { type: 'string', description: 'City IATA code (e.g. "NYC" for all NYC airports)' },
87
+ country_iso2: { type: 'string' },
88
+ limit: { type: 'number' },
89
+ },
90
+ },
91
+ },
92
+ {
93
+ name: 'countries',
94
+ description: 'Country reference with capital city, currency, etc.',
95
+ inputSchema: {
96
+ type: 'object',
97
+ properties: {
98
+ search: { type: 'string' },
99
+ country_iso2: { type: 'string' },
100
+ limit: { type: 'number' },
101
+ },
102
+ },
103
+ },
104
+ {
105
+ name: 'routes',
106
+ description: 'Scheduled routes between airports.',
107
+ inputSchema: {
108
+ type: 'object',
109
+ properties: {
110
+ dep_iata: { type: 'string' },
111
+ arr_iata: { type: 'string' },
112
+ airline_iata: { type: 'string' },
113
+ flight_number: { type: 'string' },
114
+ limit: { type: 'number' },
115
+ },
116
+ },
117
+ },
118
+ ];
119
+
120
+ async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
121
+ const apiKey = (args._apiKey as string | undefined)?.trim();
122
+ if (!apiKey) {
123
+ throw new Error(
124
+ 'Aviationstack requires an API key. Contact the operator about platform credentials, or BYO via ?_apiKey=<key> after registering at https://aviationstack.com/signup/free.',
125
+ );
126
+ }
127
+ const path = `/${name}`;
128
+ const params = new URLSearchParams({ access_key: apiKey });
129
+ for (const [k, v] of Object.entries(args)) {
130
+ if (k.startsWith('_') || v === undefined || v === null) continue;
131
+ params.set(k, String(v));
132
+ }
133
+ return avsGet(`${path}?${params}`);
134
+ }
135
+
136
+ async function avsGet(path: string) {
137
+ const url = `${BASE}${path}`;
138
+ const res = await fetch(url, { headers: { Accept: 'application/json' } });
139
+ if (res.status === 401) throw new Error('Aviationstack: unauthorized — check key');
140
+ if (res.status === 429) throw new Error('Aviationstack: rate-limit (HTTP 429)');
141
+ if (!res.ok) {
142
+ const t = await res.text();
143
+ throw new Error(`Aviationstack error: ${res.status} ${t.slice(0, 200)}`);
144
+ }
145
+ const data = (await res.json()) as { error?: { code?: string; message?: string } };
146
+ if (data.error) {
147
+ throw new Error(`Aviationstack: ${data.error.code ?? 'error'} — ${data.error.message ?? 'unknown'}`);
148
+ }
149
+ return data;
150
+ }
151
+
152
+ export default { tools, callTool, meter: { credits: 1 } } satisfies McpToolExport;
package/tsconfig.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "strict": true,
7
+ "esModuleInterop": true,
8
+ "skipLibCheck": true,
9
+ "outDir": "dist",
10
+ "rootDir": "src",
11
+ "declaration": true
12
+ },
13
+ "include": ["src"]
14
+ }