@squawk/mcp 0.2.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 (56) hide show
  1. package/README.md +301 -0
  2. package/dist/bin.d.ts +11 -0
  3. package/dist/bin.d.ts.map +1 -0
  4. package/dist/bin.js +41 -0
  5. package/dist/index.d.ts +24 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +23 -0
  8. package/dist/resolvers.d.ts +60 -0
  9. package/dist/resolvers.d.ts.map +1 -0
  10. package/dist/resolvers.js +94 -0
  11. package/dist/server.d.ts +45 -0
  12. package/dist/server.d.ts.map +1 -0
  13. package/dist/server.js +92 -0
  14. package/dist/tools/airports.d.ts +16 -0
  15. package/dist/tools/airports.d.ts.map +1 -0
  16. package/dist/tools/airports.js +142 -0
  17. package/dist/tools/airspace.d.ts +15 -0
  18. package/dist/tools/airspace.d.ts.map +1 -0
  19. package/dist/tools/airspace.js +81 -0
  20. package/dist/tools/airways.d.ts +14 -0
  21. package/dist/tools/airways.d.ts.map +1 -0
  22. package/dist/tools/airways.js +115 -0
  23. package/dist/tools/datasets.d.ts +18 -0
  24. package/dist/tools/datasets.d.ts.map +1 -0
  25. package/dist/tools/datasets.js +78 -0
  26. package/dist/tools/fixes.d.ts +14 -0
  27. package/dist/tools/fixes.d.ts.map +1 -0
  28. package/dist/tools/fixes.js +108 -0
  29. package/dist/tools/flight-math.d.ts +23 -0
  30. package/dist/tools/flight-math.d.ts.map +1 -0
  31. package/dist/tools/flight-math.js +643 -0
  32. package/dist/tools/flightplan.d.ts +17 -0
  33. package/dist/tools/flightplan.d.ts.map +1 -0
  34. package/dist/tools/flightplan.js +64 -0
  35. package/dist/tools/geo.d.ts +15 -0
  36. package/dist/tools/geo.d.ts.map +1 -0
  37. package/dist/tools/geo.js +127 -0
  38. package/dist/tools/icao-registry.d.ts +19 -0
  39. package/dist/tools/icao-registry.d.ts.map +1 -0
  40. package/dist/tools/icao-registry.js +45 -0
  41. package/dist/tools/navaids.d.ts +14 -0
  42. package/dist/tools/navaids.d.ts.map +1 -0
  43. package/dist/tools/navaids.js +143 -0
  44. package/dist/tools/notams.d.ts +13 -0
  45. package/dist/tools/notams.d.ts.map +1 -0
  46. package/dist/tools/notams.js +29 -0
  47. package/dist/tools/procedures.d.ts +15 -0
  48. package/dist/tools/procedures.d.ts.map +1 -0
  49. package/dist/tools/procedures.js +120 -0
  50. package/dist/tools/tool-helpers.d.ts +66 -0
  51. package/dist/tools/tool-helpers.d.ts.map +1 -0
  52. package/dist/tools/tool-helpers.js +55 -0
  53. package/dist/tools/weather.d.ts +18 -0
  54. package/dist/tools/weather.d.ts.map +1 -0
  55. package/dist/tools/weather.js +215 -0
  56. package/package.json +77 -0
package/README.md ADDED
@@ -0,0 +1,301 @@
1
+ <h1><img src="../../assets/squawk-logo.svg" alt="squawk logo" width="48" height="48" style="vertical-align: middle">&nbsp; @squawk/mcp</h1>
2
+
3
+ [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](../../LICENSE.md) [![npm](https://img.shields.io/npm/v/@squawk/mcp)](https://www.npmjs.com/package/@squawk/mcp) ![TypeScript](https://img.shields.io/badge/TypeScript-blue?logo=typescript&logoColor=white)
4
+
5
+ Model Context Protocol (MCP) server that exposes the squawk aviation libraries as tools for LLM clients
6
+ like Claude Desktop, Cursor, and any other MCP-compatible host. A single `npx @squawk/mcp` command starts
7
+ a stdio server that surfaces airports, navaids, fixes, airways, procedures, airspace, ICAO aircraft
8
+ registrations, weather (parsing and live AWC fetch), NOTAMs, flight plan parsing, great-circle geometry,
9
+ and an E6B-style flight computer.
10
+
11
+ Part of the [@squawk](https://www.npmjs.com/org/squawk) aviation library suite. See all packages on npm.
12
+
13
+ ## Quick start
14
+
15
+ Pick the snippet for your MCP client. Each one tells the host to spawn `npx @squawk/mcp` over stdio.
16
+ After editing the config, restart the client; a `squawk` (or `@squawk/mcp`) entry should appear in
17
+ the tool picker.
18
+
19
+ ### Claude Desktop
20
+
21
+ Open `claude_desktop_config.json` via Settings -> Developer -> Edit Config:
22
+
23
+ ```json
24
+ {
25
+ "mcpServers": {
26
+ "squawk": {
27
+ "command": "npx",
28
+ "args": ["-y", "@squawk/mcp"]
29
+ }
30
+ }
31
+ }
32
+ ```
33
+
34
+ ### Cursor
35
+
36
+ Add to `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` (per-project) - same shape as Claude Desktop:
37
+
38
+ ```json
39
+ {
40
+ "mcpServers": {
41
+ "squawk": {
42
+ "command": "npx",
43
+ "args": ["-y", "@squawk/mcp"]
44
+ }
45
+ }
46
+ }
47
+ ```
48
+
49
+ ### VS Code (GitHub Copilot Chat)
50
+
51
+ VS Code 1.99+ ships an MCP runtime that GitHub Copilot Chat can call into agent mode.
52
+ Add to `.vscode/mcp.json` in your workspace, or to the user-level config via the
53
+ `MCP: Add Server` command:
54
+
55
+ ```json
56
+ {
57
+ "servers": {
58
+ "squawk": {
59
+ "type": "stdio",
60
+ "command": "npx",
61
+ "args": ["-y", "@squawk/mcp"]
62
+ }
63
+ }
64
+ }
65
+ ```
66
+
67
+ Note the schema differs from the other clients: VS Code uses `servers` (not `mcpServers`)
68
+ and requires an explicit `"type": "stdio"`.
69
+
70
+ ### Continue.dev
71
+
72
+ Continue exposes MCP via its experimental config block. In `~/.continue/config.json`:
73
+
74
+ ```json
75
+ {
76
+ "experimental": {
77
+ "modelContextProtocolServers": [
78
+ {
79
+ "transport": {
80
+ "type": "stdio",
81
+ "command": "npx",
82
+ "args": ["-y", "@squawk/mcp"]
83
+ }
84
+ }
85
+ ]
86
+ }
87
+ }
88
+ ```
89
+
90
+ ### Pinning a specific Node binary
91
+
92
+ `npx` resolves `node` through whatever PATH the host launches with. On macOS, GUI apps often
93
+ inherit a different PATH than your shell, so you may end up running an older Node than
94
+ `which node` shows. Live weather fetch tools require Node >= 22 (for global `fetch`). If the
95
+ startup log shows `WARNING: global fetch() is unavailable`, replace `"command": "npx"` with
96
+ the absolute path to a modern node + the absolute path to the installed `bin.js`:
97
+
98
+ ```json
99
+ {
100
+ "mcpServers": {
101
+ "squawk": {
102
+ "command": "/usr/local/bin/node",
103
+ "args": ["/absolute/path/to/node_modules/@squawk/mcp/dist/bin.js"]
104
+ }
105
+ }
106
+ }
107
+ ```
108
+
109
+ The server logs `[squawk-mcp] node <version> on <platform>/<arch>` and the tool-module count
110
+ to stderr on every startup so you can verify the right runtime is being used.
111
+
112
+ ### Example prompts
113
+
114
+ Once connected, the model can answer things like "what airspace is over KJFK at 4500 feet?",
115
+ "give me the live METAR for KSFO and KOAK", "parse this route: KJFK DCT MERIT J60 MARTN DCT KLAX",
116
+ or "look up the aircraft with ICAO hex AC82EC".
117
+
118
+ ## Standalone CLI
119
+
120
+ You can run the server directly without an MCP host to verify that it starts and responds to protocol
121
+ messages:
122
+
123
+ ```sh
124
+ npx @squawk/mcp
125
+ ```
126
+
127
+ The binary speaks MCP over stdio, so it expects an MCP client on the other end of stdin/stdout.
128
+ Logs go to stderr.
129
+
130
+ ## Programmatic use
131
+
132
+ Embed the server inside another MCP host or a custom transport:
133
+
134
+ ```typescript
135
+ import { createSquawkMcpServer } from '@squawk/mcp';
136
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
137
+
138
+ const server = createSquawkMcpServer();
139
+ await server.connect(new StdioServerTransport());
140
+ ```
141
+
142
+ ## Tool catalog
143
+
144
+ Tools are grouped by domain. Every tool returns both a human-readable text block and a structured
145
+ JSON payload (`structuredContent`) so MCP clients with strict schemas can consume the results
146
+ directly.
147
+
148
+ ### Geometry (`@squawk/geo`)
149
+
150
+ | Tool | Purpose |
151
+ | ----------------------------------- | ------------------------------------------------- |
152
+ | `great_circle_distance` | Distance in nautical miles between two positions |
153
+ | `great_circle_bearing` | Initial true bearing from one position to another |
154
+ | `great_circle_bearing_and_distance` | Bearing + distance in one call |
155
+ | `great_circle_midpoint` | Midpoint along the great-circle arc |
156
+ | `great_circle_destination` | Destination point given a bearing and distance |
157
+
158
+ ### Airports (`@squawk/airports` + `@squawk/airport-data`)
159
+
160
+ | Tool | Purpose |
161
+ | ----------------------- | -------------------------------------------------------------------------------------- |
162
+ | `get_airport_by_faa_id` | Look up an airport by FAA identifier |
163
+ | `get_airport_by_icao` | Look up an airport by ICAO code |
164
+ | `find_nearest_airports` | Find airports nearest a position with optional facility-type and runway-length filters |
165
+ | `search_airports` | Substring search by airport name or city |
166
+
167
+ ### Airspace (`@squawk/airspace` + `@squawk/airspace-data`)
168
+
169
+ | Tool | Purpose |
170
+ | ---------------------------- | --------------------------------------------------------------------------------------------------- |
171
+ | `query_airspace_at_position` | Class B/C/D/E and SUA features whose lateral polygon and vertical bounds contain a point + altitude |
172
+
173
+ ### Navaids (`@squawk/navaids` + `@squawk/navaid-data`)
174
+
175
+ | Tool | Purpose |
176
+ | --------------------------- | ----------------------------------------------- |
177
+ | `get_navaid_by_ident` | Look up navaids by identifier |
178
+ | `find_navaids_by_frequency` | Find navaids tuned to a given MHz/kHz frequency |
179
+ | `find_nearest_navaids` | Find navaids nearest a position |
180
+ | `search_navaids` | Substring search by name or identifier |
181
+
182
+ ### Fixes (`@squawk/fixes` + `@squawk/fix-data`)
183
+
184
+ | Tool | Purpose |
185
+ | -------------------- | ------------------------------ |
186
+ | `get_fix_by_ident` | Look up fixes by identifier |
187
+ | `find_nearest_fixes` | Find fixes nearest a position |
188
+ | `search_fixes` | Substring search by identifier |
189
+
190
+ ### Airways (`@squawk/airways` + `@squawk/airway-data`)
191
+
192
+ | Tool | Purpose |
193
+ | --------------------------- | ----------------------------------------------------- |
194
+ | `get_airway_by_designation` | Look up airways by designation |
195
+ | `expand_airway_segment` | Expand an airway between an entry fix and an exit fix |
196
+ | `find_airways_by_fix` | Reverse lookup: airways that pass through a given fix |
197
+ | `search_airways` | Substring search by designation |
198
+
199
+ ### Procedures (`@squawk/procedures` + `@squawk/procedure-data`)
200
+
201
+ | Tool | Purpose |
202
+ | ---------------------------- | ------------------------------------------------------------------------ |
203
+ | `get_procedure_by_code` | Look up a SID/STAR by FAA computer code |
204
+ | `find_procedures_by_airport` | Procedures associated with an airport |
205
+ | `expand_procedure` | Expand a procedure into its waypoint sequence (with optional transition) |
206
+ | `search_procedures` | Substring search by name or code, optionally filtered to SIDs or STARs |
207
+
208
+ ### ICAO aircraft registry (`@squawk/icao-registry` + `@squawk/icao-registry-data`)
209
+
210
+ | Tool | Purpose |
211
+ | ----------------------------- | ------------------------------------------------------------- |
212
+ | `lookup_aircraft_by_icao_hex` | Resolve a 24-bit ICAO hex address to an aircraft registration |
213
+
214
+ The registry data (~40 MB raw) is loaded lazily on the first lookup so sessions that never need it
215
+ do not pay the decompression cost.
216
+
217
+ ### Weather (`@squawk/weather` + `@squawk/weather/fetch`)
218
+
219
+ | Tool | Purpose |
220
+ | ----------------------------- | -------------------------------------------------------------- |
221
+ | `parse_metar` | Parse a user-supplied METAR/SPECI string |
222
+ | `parse_taf` | Parse a user-supplied TAF |
223
+ | `parse_sigmet` | Parse a US-domestic or ICAO SIGMET |
224
+ | `parse_airmet` | Parse an AIRMET bulletin |
225
+ | `parse_pirep` | Parse a PIREP report |
226
+ | `fetch_metar` | Fetch and parse live METARs from the Aviation Weather Center |
227
+ | `fetch_taf` | Fetch and parse live TAFs |
228
+ | `fetch_pirep` | Fetch PIREPs near a center station |
229
+ | `fetch_sigmets` | Fetch active US (CONUS) SIGMETs, optionally filtered by hazard |
230
+ | `fetch_international_sigmets` | Fetch active international SIGMETs in ICAO format |
231
+
232
+ ### NOTAMs (`@squawk/notams`)
233
+
234
+ | Tool | Purpose |
235
+ | ------------------ | ------------------------------------ |
236
+ | `parse_icao_notam` | Parse an ICAO-format NOTAM |
237
+ | `parse_faa_notam` | Parse an FAA domestic (legacy) NOTAM |
238
+
239
+ ### Flight plans (`@squawk/flightplan`)
240
+
241
+ | Tool | Purpose |
242
+ | ------------------------ | ---------------------------------------------------------- |
243
+ | `parse_flightplan_route` | Parse an ICAO Item 15 route into structured route elements |
244
+ | `compute_route_distance` | Total great-circle route distance with optional ETE |
245
+
246
+ ### Flight computer (`@squawk/flight-math`)
247
+
248
+ Selected E6B calculations: any operation that embeds a non-trivial constant, formula, or model
249
+ (WMM2025, NOAA solar, compressible-flow pitot equations, etc.) is exposed; trivial unit math is
250
+ left to the model itself.
251
+
252
+ | Tool | Purpose |
253
+ | ------------------------------------------------ | ----------------------------------------------------------------- |
254
+ | `compute_density_altitude` | Density altitude from field observations |
255
+ | `compute_true_altitude` | True altitude from indicated altitude with temperature correction |
256
+ | `compute_calibrated_airspeed_from_true_airspeed` | CAS from TAS via the ICAO compressible-flow equations |
257
+ | `solve_wind_triangle` | Heading + groundspeed from TAS, course, and wind |
258
+ | `compute_headwind_crosswind` | Headwind/crosswind component breakdown |
259
+ | `find_wind_from_track` | Reverse wind triangle from observed ground track |
260
+ | `compute_crosswind_component` | Absolute crosswind for a runway |
261
+ | `compute_top_of_descent_distance` | TOD from glidepath angle |
262
+ | `compute_top_of_descent_distance_from_rate` | TOD from descent rate + groundspeed |
263
+ | `compute_required_descent_rate` | Required descent rate over a distance |
264
+ | `compute_required_climb_rate` | Required climb rate over a distance |
265
+ | `compute_visual_descent_point` | VDP for a non-precision approach |
266
+ | `recommend_holding_pattern_entry` | Direct/teardrop/parallel entry per AIM 5-3-8 |
267
+ | `compute_standard_rate_bank_angle` | Bank angle for a 3 deg/sec turn at a given TAS |
268
+ | `compute_turn_radius` | Turn radius for a given TAS and bank angle |
269
+ | `compute_glide_distance_with_wind` | Glide distance scaled by groundspeed/TAS ratio |
270
+ | `compute_solar_times` | Sunrise, sunset, civil twilight (NOAA algorithm) |
271
+ | `is_daytime` | Daytime/nighttime per FAR 1.1 at a UTC instant |
272
+ | `compute_magnetic_declination` | WMM2025 declination at a position |
273
+ | `convert_true_to_magnetic_bearing` | True -> magnetic bearing using WMM2025 |
274
+ | `convert_magnetic_to_true_bearing` | Magnetic -> true bearing using WMM2025 |
275
+ | `compute_fuel_required` | Fuel for a leg given distance, GS, and burn rate |
276
+ | `compute_point_of_no_return` | PNR with separate outbound/return groundspeeds |
277
+ | `compute_equal_time_point` | ETP with separate continuing/returning groundspeeds |
278
+
279
+ ### Server diagnostics
280
+
281
+ | Tool | Purpose |
282
+ | -------------------- | ------------------------------------------------------------------------------------------------------------ |
283
+ | `get_dataset_status` | Report NASR cycle date, build timestamp, and record counts for every loaded snapshot (incl. lazy-load state) |
284
+
285
+ ## Configuration
286
+
287
+ | Environment variable | Effect |
288
+ | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
289
+ | `SQUAWK_AWC_BASE_URL` | Override the Aviation Weather Center base URL used by every `fetch_*` tool. Defaults to `https://aviationweather.gov/api/data`. Useful for proxies and regional mirrors. |
290
+
291
+ ## Notes
292
+
293
+ - All NASR-derived data sources cover the contiguous United States plus the territories included in
294
+ the FAA NASR 28-day subscription. Outside the US the lookup tools will return empty results. Use
295
+ `get_dataset_status` to confirm which NASR cycle the running server is serving.
296
+ - Live weather tools issue HTTPS requests to `https://aviationweather.gov/api/data/...` (or the
297
+ override above). They are the only tools that touch the network at invocation time; everything
298
+ else operates against bundled snapshots in memory.
299
+ - The bundled NASR snapshots are decompressed and indexed once when the server starts. Expect a few
300
+ hundred milliseconds of startup time. The aircraft registration snapshot (the largest) is loaded
301
+ lazily on the first `lookup_aircraft_by_icao_hex` call.
package/dist/bin.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @packageDocumentation
4
+ * Stdio entrypoint for @squawk/mcp. Connects the server from
5
+ * {@link createSquawkMcpServer} to a `StdioServerTransport` so the binary
6
+ * behaves as an MCP server spawned by clients like Claude Desktop.
7
+ *
8
+ * All logs go to stderr; stdout is reserved for MCP protocol messages.
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=bin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA;;;;;;;GAOG"}
package/dist/bin.js ADDED
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @packageDocumentation
4
+ * Stdio entrypoint for @squawk/mcp. Connects the server from
5
+ * {@link createSquawkMcpServer} to a `StdioServerTransport` so the binary
6
+ * behaves as an MCP server spawned by clients like Claude Desktop.
7
+ *
8
+ * All logs go to stderr; stdout is reserved for MCP protocol messages.
9
+ */
10
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
11
+ import { createSquawkMcpServer, PACKAGE_NAME, PACKAGE_VERSION, TOOL_MODULE_COUNT, } from './server.js';
12
+ /**
13
+ * Logs the Node.js version this process is running on, the running build's
14
+ * package version, the tool-module count, and warns when the environment is
15
+ * missing capabilities the live weather fetch tools require.
16
+ *
17
+ * GUI MCP hosts (Claude Desktop, etc.) often launch child processes with a
18
+ * different PATH than the user's interactive shell, so `node` may resolve to
19
+ * an older binary than `which node` suggests. Surfacing the actual runtime
20
+ * version and the running package version up front makes mismatches easy to
21
+ * diagnose from the host's MCP log without bisecting tool failures.
22
+ */
23
+ function logRuntimeDiagnostics() {
24
+ console.error(`[squawk-mcp] node ${process.version} on ${process.platform}/${process.arch}`);
25
+ console.error(`[squawk-mcp] ${PACKAGE_NAME} v${PACKAGE_VERSION}, ${TOOL_MODULE_COUNT} tool modules registered`);
26
+ if (typeof fetch !== 'function') {
27
+ console.error('[squawk-mcp] WARNING: global fetch() is unavailable in this Node runtime. ' +
28
+ 'Live weather fetch_* tools will fail. Upgrade to Node >=22, or pin an ' +
29
+ 'absolute path to a modern node binary in your MCP host config.');
30
+ }
31
+ }
32
+ async function main() {
33
+ logRuntimeDiagnostics();
34
+ const server = createSquawkMcpServer();
35
+ const transport = new StdioServerTransport();
36
+ await server.connect(transport);
37
+ }
38
+ main().catch((err) => {
39
+ console.error('[squawk-mcp] fatal error:', err);
40
+ process.exit(1);
41
+ });
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * @squawk/mcp - Model Context Protocol server exposing squawk's aviation
4
+ * libraries (geo, airports, airspace, weather, flightplan, and more) as
5
+ * tools for LLM clients like Claude Desktop, Cursor, and other MCP hosts.
6
+ *
7
+ * Run via the CLI:
8
+ *
9
+ * ```sh
10
+ * npx @squawk/mcp
11
+ * ```
12
+ *
13
+ * Or embed the server programmatically in another MCP host:
14
+ *
15
+ * ```typescript
16
+ * import { createSquawkMcpServer } from '@squawk/mcp';
17
+ * import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
18
+ *
19
+ * const server = createSquawkMcpServer();
20
+ * await server.connect(new StdioServerTransport());
21
+ * ```
22
+ */
23
+ export { createSquawkMcpServer } from './server.js';
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * @squawk/mcp - Model Context Protocol server exposing squawk's aviation
4
+ * libraries (geo, airports, airspace, weather, flightplan, and more) as
5
+ * tools for LLM clients like Claude Desktop, Cursor, and other MCP hosts.
6
+ *
7
+ * Run via the CLI:
8
+ *
9
+ * ```sh
10
+ * npx @squawk/mcp
11
+ * ```
12
+ *
13
+ * Or embed the server programmatically in another MCP host:
14
+ *
15
+ * ```typescript
16
+ * import { createSquawkMcpServer } from '@squawk/mcp';
17
+ * import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
18
+ *
19
+ * const server = createSquawkMcpServer();
20
+ * await server.connect(new StdioServerTransport());
21
+ * ```
22
+ */
23
+ export { createSquawkMcpServer } from './server.js';
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * Shared resolver instances used across the squawk MCP tool modules. Each
4
+ * resolver is constructed once at module load time so the bundled FAA data
5
+ * snapshots are decoded and indexed exactly once per server process.
6
+ *
7
+ * The ICAO registry is the only resolver that loads lazily: its bundled data
8
+ * package decompresses ~40 MB of records on import, which is wasted work for
9
+ * sessions that never call the tail-number lookup. The registry is built on
10
+ * the first {@link getIcaoRegistry} call and cached for subsequent calls.
11
+ */
12
+ import { type AirportResolver } from '@squawk/airports';
13
+ import { type AirspaceResolver } from '@squawk/airspace';
14
+ import { type AirwayResolver } from '@squawk/airways';
15
+ import { type FixResolver } from '@squawk/fixes';
16
+ import { type NavaidResolver } from '@squawk/navaids';
17
+ import { type ProcedureResolver } from '@squawk/procedures';
18
+ import { type IcaoRegistry } from '@squawk/icao-registry';
19
+ /** Eagerly-built airport resolver backed by the US NASR snapshot. */
20
+ export declare const airportResolver: AirportResolver;
21
+ /** Eagerly-built airspace resolver backed by the US NASR airspace GeoJSON snapshot. */
22
+ export declare const airspaceResolver: AirspaceResolver;
23
+ /** Eagerly-built airway resolver backed by the US NASR snapshot. */
24
+ export declare const airwayResolver: AirwayResolver;
25
+ /** Eagerly-built fix resolver backed by the US NASR snapshot. */
26
+ export declare const fixResolver: FixResolver;
27
+ /** Eagerly-built navaid resolver backed by the US NASR snapshot. */
28
+ export declare const navaidResolver: NavaidResolver;
29
+ /** Eagerly-built procedure resolver backed by the US NASR snapshot. */
30
+ export declare const procedureResolver: ProcedureResolver;
31
+ /**
32
+ * Returns the shared {@link IcaoRegistry} instance, decompressing and indexing
33
+ * the bundled FAA aircraft registration snapshot on the first call. Subsequent
34
+ * calls reuse the cached instance.
35
+ *
36
+ * The registry is initialized lazily because the underlying bundled data
37
+ * package is the largest snapshot in the suite (roughly 40 MB raw). Sessions
38
+ * that never look up an aircraft by ICAO hex avoid the cost entirely.
39
+ *
40
+ * @returns The shared registry instance.
41
+ */
42
+ export declare function getIcaoRegistry(): Promise<IcaoRegistry>;
43
+ /**
44
+ * Reports whether the lazily-loaded ICAO aircraft registry has been
45
+ * initialized in this process.
46
+ *
47
+ * @returns `true` once {@link getIcaoRegistry} has resolved at least once.
48
+ */
49
+ export declare function isIcaoRegistryLoaded(): boolean;
50
+ /**
51
+ * Returns the cached metadata for the loaded ICAO registry, or `undefined`
52
+ * when the registry has not been initialized yet. Does not trigger a load.
53
+ *
54
+ * @returns The registry metadata if loaded, otherwise `undefined`.
55
+ */
56
+ export declare function getIcaoRegistryMetadata(): {
57
+ generatedAt: string;
58
+ recordCount: number;
59
+ } | undefined;
60
+ //# sourceMappingURL=resolvers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../src/resolvers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE9E,qEAAqE;AACrE,eAAO,MAAM,eAAe,EAAE,eAE5B,CAAC;AAEH,uFAAuF;AACvF,eAAO,MAAM,gBAAgB,EAAE,gBAE7B,CAAC;AAEH,oEAAoE;AACpE,eAAO,MAAM,cAAc,EAAE,cAE3B,CAAC;AAEH,iEAAiE;AACjE,eAAO,MAAM,WAAW,EAAE,WAAiE,CAAC;AAE5F,oEAAoE;AACpE,eAAO,MAAM,cAAc,EAAE,cAE3B,CAAC;AAEH,uEAAuE;AACvE,eAAO,MAAM,iBAAiB,EAAE,iBAE9B,CAAC;AAYH;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,YAAY,CAAC,CAU7D;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,IACnC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAC5C,SAAS,CAEZ"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * Shared resolver instances used across the squawk MCP tool modules. Each
4
+ * resolver is constructed once at module load time so the bundled FAA data
5
+ * snapshots are decoded and indexed exactly once per server process.
6
+ *
7
+ * The ICAO registry is the only resolver that loads lazily: its bundled data
8
+ * package decompresses ~40 MB of records on import, which is wasted work for
9
+ * sessions that never call the tail-number lookup. The registry is built on
10
+ * the first {@link getIcaoRegistry} call and cached for subsequent calls.
11
+ */
12
+ import { usBundledAirports } from '@squawk/airport-data';
13
+ import { usBundledAirspace } from '@squawk/airspace-data';
14
+ import { usBundledAirways } from '@squawk/airway-data';
15
+ import { usBundledFixes } from '@squawk/fix-data';
16
+ import { usBundledNavaids } from '@squawk/navaid-data';
17
+ import { usBundledProcedures } from '@squawk/procedure-data';
18
+ import { createAirportResolver } from '@squawk/airports';
19
+ import { createAirspaceResolver } from '@squawk/airspace';
20
+ import { createAirwayResolver } from '@squawk/airways';
21
+ import { createFixResolver } from '@squawk/fixes';
22
+ import { createNavaidResolver } from '@squawk/navaids';
23
+ import { createProcedureResolver } from '@squawk/procedures';
24
+ import { createIcaoRegistry } from '@squawk/icao-registry';
25
+ /** Eagerly-built airport resolver backed by the US NASR snapshot. */
26
+ export const airportResolver = createAirportResolver({
27
+ data: usBundledAirports.records,
28
+ });
29
+ /** Eagerly-built airspace resolver backed by the US NASR airspace GeoJSON snapshot. */
30
+ export const airspaceResolver = createAirspaceResolver({
31
+ data: usBundledAirspace,
32
+ });
33
+ /** Eagerly-built airway resolver backed by the US NASR snapshot. */
34
+ export const airwayResolver = createAirwayResolver({
35
+ data: usBundledAirways.records,
36
+ });
37
+ /** Eagerly-built fix resolver backed by the US NASR snapshot. */
38
+ export const fixResolver = createFixResolver({ data: usBundledFixes.records });
39
+ /** Eagerly-built navaid resolver backed by the US NASR snapshot. */
40
+ export const navaidResolver = createNavaidResolver({
41
+ data: usBundledNavaids.records,
42
+ });
43
+ /** Eagerly-built procedure resolver backed by the US NASR snapshot. */
44
+ export const procedureResolver = createProcedureResolver({
45
+ data: usBundledProcedures.records,
46
+ });
47
+ /** Cached ICAO registry instance, populated on the first {@link getIcaoRegistry} call. */
48
+ let icaoRegistryInstance;
49
+ /**
50
+ * Cached metadata captured the first time the registry is loaded. Held
51
+ * separately from the registry instance so {@link getIcaoRegistryMetadata}
52
+ * can return it without forcing another import.
53
+ */
54
+ let icaoRegistryMetadata;
55
+ /**
56
+ * Returns the shared {@link IcaoRegistry} instance, decompressing and indexing
57
+ * the bundled FAA aircraft registration snapshot on the first call. Subsequent
58
+ * calls reuse the cached instance.
59
+ *
60
+ * The registry is initialized lazily because the underlying bundled data
61
+ * package is the largest snapshot in the suite (roughly 40 MB raw). Sessions
62
+ * that never look up an aircraft by ICAO hex avoid the cost entirely.
63
+ *
64
+ * @returns The shared registry instance.
65
+ */
66
+ export async function getIcaoRegistry() {
67
+ if (icaoRegistryInstance === undefined) {
68
+ const { usBundledRegistry } = await import('@squawk/icao-registry-data');
69
+ icaoRegistryInstance = createIcaoRegistry({ data: usBundledRegistry.records });
70
+ icaoRegistryMetadata = {
71
+ generatedAt: usBundledRegistry.properties.generatedAt,
72
+ recordCount: usBundledRegistry.properties.recordCount,
73
+ };
74
+ }
75
+ return icaoRegistryInstance;
76
+ }
77
+ /**
78
+ * Reports whether the lazily-loaded ICAO aircraft registry has been
79
+ * initialized in this process.
80
+ *
81
+ * @returns `true` once {@link getIcaoRegistry} has resolved at least once.
82
+ */
83
+ export function isIcaoRegistryLoaded() {
84
+ return icaoRegistryInstance !== undefined;
85
+ }
86
+ /**
87
+ * Returns the cached metadata for the loaded ICAO registry, or `undefined`
88
+ * when the registry has not been initialized yet. Does not trigger a load.
89
+ *
90
+ * @returns The registry metadata if loaded, otherwise `undefined`.
91
+ */
92
+ export function getIcaoRegistryMetadata() {
93
+ return icaoRegistryMetadata;
94
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * Server factory for @squawk/mcp. Assembles an {@link McpServer} preloaded
4
+ * with every squawk aviation tool module.
5
+ */
6
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
7
+ /**
8
+ * Number of tool modules registered by {@link createSquawkMcpServer}. Exposed
9
+ * so the stdio entrypoint can include the count in its startup diagnostic
10
+ * without re-counting at runtime.
11
+ */
12
+ export declare const TOOL_MODULE_COUNT: number;
13
+ /**
14
+ * Package name as published to npm. Convenient for diagnostic logs that want
15
+ * to identify the running server without re-reading `package.json`.
16
+ */
17
+ export declare const PACKAGE_NAME: string;
18
+ /**
19
+ * Package version pulled from `package.json` at module load. Mirrored as the
20
+ * server's `version` field and reused by the stdio entrypoint diagnostic.
21
+ */
22
+ export declare const PACKAGE_VERSION: string;
23
+ /**
24
+ * Creates an MCP server preloaded with every squawk aviation tool module.
25
+ *
26
+ * Tool registration triggers eager construction of the shared resolver
27
+ * singletons in `./resolvers.js` for every domain except the ICAO aircraft
28
+ * registry, which loads on first lookup. Live weather fetch tools issue
29
+ * outbound HTTPS requests to the Aviation Weather Center text API only when
30
+ * invoked.
31
+ *
32
+ * ```typescript
33
+ * import { createSquawkMcpServer } from '@squawk/mcp';
34
+ * import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
35
+ *
36
+ * const server = createSquawkMcpServer();
37
+ * await server.connect(new StdioServerTransport());
38
+ * ```
39
+ *
40
+ * @returns A fully configured MCP server instance. Connect it to a transport
41
+ * (typically `StdioServerTransport` for CLI use) via
42
+ * `server.connect(transport)` to begin handling protocol messages.
43
+ */
44
+ export declare function createSquawkMcpServer(): McpServer;
45
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA6CpE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAsC,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,MAAyB,CAAC;AAErD;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,MAA4B,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,qBAAqB,IAAI,SAAS,CAWjD"}