@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
@@ -0,0 +1,108 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * MCP tool module wrapping `@squawk/fixes` fix/waypoint lookup methods,
4
+ * backed by the US NASR snapshot in `@squawk/fix-data`.
5
+ */
6
+ import { z } from 'zod';
7
+ import { fixResolver } from '../resolvers.js';
8
+ /** All {@link FixUseCode} values, used for input validation. */
9
+ const FIX_USE_CODE_VALUES = [
10
+ 'WP',
11
+ 'RP',
12
+ 'MW',
13
+ 'MR',
14
+ 'CN',
15
+ 'VFR',
16
+ 'NRS',
17
+ 'RADAR',
18
+ ];
19
+ /**
20
+ * Registers fix/waypoint lookup tools on the given MCP server. Uses the
21
+ * shared {@link fixResolver} built at module load time.
22
+ *
23
+ * @param server - The MCP server instance to register tools on.
24
+ */
25
+ export function registerFixTools(server) {
26
+ server.registerTool('get_fix_by_ident', {
27
+ title: 'Get fixes by identifier',
28
+ description: 'Looks up US fixes/waypoints by identifier (e.g. "MERIT", "BOSCO"). Multiple fixes can share the same identifier across ICAO regions, so the result is always an array. Returns an empty array when no match is found.',
29
+ inputSchema: {
30
+ ident: z.string().min(1).describe('Fix identifier (case-insensitive).'),
31
+ },
32
+ }, ({ ident }) => {
33
+ const fixes = fixResolver.byIdent(ident);
34
+ return {
35
+ content: [{ type: 'text', text: JSON.stringify(fixes, null, 2) }],
36
+ structuredContent: { fixes },
37
+ };
38
+ });
39
+ server.registerTool('find_nearest_fixes', {
40
+ title: 'Find nearest fixes',
41
+ description: 'Finds US fixes/waypoints near a geographic position, sorted by great-circle distance in nautical miles.',
42
+ inputSchema: {
43
+ lat: z.number().min(-90).max(90).describe('Latitude in decimal degrees (WGS84).'),
44
+ lon: z.number().min(-180).max(180).describe('Longitude in decimal degrees (WGS84).'),
45
+ maxDistanceNm: z
46
+ .number()
47
+ .positive()
48
+ .optional()
49
+ .describe('Maximum search radius in nautical miles. Defaults to 30.'),
50
+ limit: z
51
+ .number()
52
+ .int()
53
+ .positive()
54
+ .optional()
55
+ .describe('Maximum number of results to return. Defaults to 10.'),
56
+ useCodes: z
57
+ .array(z.enum(FIX_USE_CODE_VALUES))
58
+ .optional()
59
+ .describe('Restrict results to these FAA fix-use codes (e.g. WP=waypoint, RP=reporting point, VFR=VFR waypoint). Omit to include all use codes.'),
60
+ },
61
+ }, ({ lat, lon, maxDistanceNm, limit, useCodes }) => {
62
+ const query = { lat, lon };
63
+ if (maxDistanceNm !== undefined) {
64
+ query.maxDistanceNm = maxDistanceNm;
65
+ }
66
+ if (limit !== undefined) {
67
+ query.limit = limit;
68
+ }
69
+ if (useCodes !== undefined) {
70
+ query.useCodes = new Set(useCodes);
71
+ }
72
+ const results = fixResolver.nearest(query);
73
+ return {
74
+ content: [{ type: 'text', text: JSON.stringify(results, null, 2) }],
75
+ structuredContent: { results },
76
+ };
77
+ });
78
+ server.registerTool('search_fixes', {
79
+ title: 'Search fixes by identifier',
80
+ description: 'Searches US fixes/waypoints by case-insensitive substring matching against the fix identifier. Results are returned in alphabetical order by identifier.',
81
+ inputSchema: {
82
+ text: z.string().min(1).describe('Substring to match against the fix identifier.'),
83
+ useCodes: z
84
+ .array(z.enum(FIX_USE_CODE_VALUES))
85
+ .optional()
86
+ .describe('Restrict results to these FAA fix-use codes. Omit to include all use codes.'),
87
+ limit: z
88
+ .number()
89
+ .int()
90
+ .positive()
91
+ .optional()
92
+ .describe('Maximum number of results to return. Defaults to 20.'),
93
+ },
94
+ }, ({ text, useCodes, limit }) => {
95
+ const query = { text };
96
+ if (useCodes !== undefined) {
97
+ query.useCodes = new Set(useCodes);
98
+ }
99
+ if (limit !== undefined) {
100
+ query.limit = limit;
101
+ }
102
+ const fixes = fixResolver.search(query);
103
+ return {
104
+ content: [{ type: 'text', text: JSON.stringify(fixes, null, 2) }],
105
+ structuredContent: { fixes },
106
+ };
107
+ });
108
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * MCP tool module wrapping `@squawk/flight-math` E6B-style flight computer
4
+ * calculations. Each tool corresponds to a single function from one of the
5
+ * package's namespaces (atmosphere, airspeed, wind, descent, navigation,
6
+ * turn, glide, solar, magnetic, planning).
7
+ *
8
+ * Trivially-simple operations (single multiplications, divisions, or
9
+ * trig calls) are intentionally not exposed as tools - LLMs handle those
10
+ * accurately on their own. The selected tools cover the cases where the
11
+ * underlying implementation embeds a non-trivial constant, formula, or
12
+ * lookup (the WMM2025 spherical harmonics, the NOAA solar algorithm,
13
+ * compressible-flow pitot equations, holding-pattern sector logic, and
14
+ * so on).
15
+ */
16
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
17
+ /**
18
+ * Registers flight-math computation tools on the given MCP server.
19
+ *
20
+ * @param server - The MCP server instance to register tools on.
21
+ */
22
+ export declare function registerFlightMathTools(server: McpServer): void;
23
+ //# sourceMappingURL=flight-math.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flight-math.d.ts","sourceRoot":"","sources":["../../src/tools/flight-math.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAiFzE;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAuwB/D"}