@squawk/mcp 0.2.0 → 0.3.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.
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * @packageDocumentation
3
- * MCP tool module wrapping `@squawk/airspace` point-in-airspace queries,
4
- * backed by the US NASR airspace GeoJSON snapshot in `@squawk/airspace-data`.
3
+ * MCP tool module wrapping `@squawk/airspace` queries (point-in-airspace and
4
+ * per-airport lookups), backed by the US NASR airspace GeoJSON snapshot in
5
+ * `@squawk/airspace-data`.
5
6
  */
6
7
  import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
7
8
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"airspace.d.ts","sourceRoot":"","sources":["../../src/tools/airspace.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAmEzE;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA+B7D"}
1
+ {"version":3,"file":"airspace.d.ts","sourceRoot":"","sources":["../../src/tools/airspace.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAmEzE;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAsE7D"}
@@ -1,10 +1,11 @@
1
1
  /**
2
2
  * @packageDocumentation
3
- * MCP tool module wrapping `@squawk/airspace` point-in-airspace queries,
4
- * backed by the US NASR airspace GeoJSON snapshot in `@squawk/airspace-data`.
3
+ * MCP tool module wrapping `@squawk/airspace` queries (point-in-airspace and
4
+ * per-airport lookups), backed by the US NASR airspace GeoJSON snapshot in
5
+ * `@squawk/airspace-data`.
5
6
  */
6
7
  import { z } from 'zod';
7
- import { airspaceResolver } from '../resolvers.js';
8
+ import { airportResolver, airspaceResolver } from '../resolvers.js';
8
9
  /** All {@link AirspaceType} values, used for input validation. */
9
10
  const AIRSPACE_TYPE_VALUES = [
10
11
  'CLASS_B',
@@ -72,10 +73,40 @@ export function registerAirspaceTools(server) {
72
73
  if (airspaceTypes !== undefined) {
73
74
  query.types = new Set(airspaceTypes);
74
75
  }
75
- const features = airspaceResolver(query).map(summarizeFeature);
76
+ const features = airspaceResolver.query(query).map(summarizeFeature);
76
77
  return {
77
78
  content: [{ type: 'text', text: JSON.stringify(features, null, 2) }],
78
79
  structuredContent: { features },
79
80
  };
80
81
  });
82
+ server.registerTool('get_airspace_for_airport', {
83
+ title: 'Get airspace features associated with an airport',
84
+ description: 'Returns every airspace feature associated with a given airport (Class B/C/D/E2 surface-area sectors), each with full polygon boundary coordinates suitable for drawing. Accepts either an FAA location identifier (e.g. "JFK", "LAX") or an ICAO code (e.g. "KJFK", "KLAX"); ICAO codes are resolved to the underlying FAA ID before lookup. Unlike query_airspace_at_position, boundary geometry is preserved so callers can render the full "wedding cake" of shells, and no altitude is needed. Returns an empty features array for airports with no surrounding controlled airspace (most GA fields).',
85
+ inputSchema: {
86
+ airportId: z
87
+ .string()
88
+ .min(1)
89
+ .describe('FAA location identifier or ICAO code (case-insensitive).'),
90
+ airspaceTypes: z
91
+ .array(z.enum(AIRSPACE_TYPE_VALUES))
92
+ .optional()
93
+ .describe('Restrict results to these airspace types. Defaults to surface-area classes (CLASS_B, CLASS_C, CLASS_D, CLASS_E2).'),
94
+ },
95
+ }, ({ airportId, airspaceTypes }) => {
96
+ const airport = airportResolver.byFaaId(airportId) ?? airportResolver.byIcao(airportId);
97
+ if (airport === undefined) {
98
+ return {
99
+ content: [{ type: 'text', text: `No airport found for identifier "${airportId}".` }],
100
+ structuredContent: { airport: null, features: [] },
101
+ };
102
+ }
103
+ const typeFilter = airspaceTypes === undefined
104
+ ? new Set(['CLASS_B', 'CLASS_C', 'CLASS_D', 'CLASS_E2'])
105
+ : new Set(airspaceTypes);
106
+ const features = airspaceResolver.byAirport(airport.faaId, typeFilter);
107
+ return {
108
+ content: [{ type: 'text', text: JSON.stringify({ airport, features }, null, 2) }],
109
+ structuredContent: { airport, features },
110
+ };
111
+ });
81
112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squawk/mcp",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "description": "Model Context Protocol server exposing squawk's aviation libraries as tools for LLM clients",
6
6
  "author": "Neil Cochran",
@@ -22,8 +22,8 @@
22
22
  },
23
23
  "exports": {
24
24
  ".": {
25
- "import": "./dist/index.js",
26
- "types": "./dist/index.d.ts"
25
+ "types": "./dist/index.d.ts",
26
+ "import": "./dist/index.js"
27
27
  }
28
28
  },
29
29
  "files": [
@@ -33,7 +33,8 @@
33
33
  "scripts": {
34
34
  "build": "tsc && chmod +x dist/bin.js",
35
35
  "test": "node --test 'dist/**/*.spec.js'",
36
- "lint": "tsc --noEmit && eslint src"
36
+ "lint": "tsc --noEmit && eslint src",
37
+ "lint:pack": "publint && attw --pack . --profile esm-only"
37
38
  },
38
39
  "dependencies": {
39
40
  "@modelcontextprotocol/sdk": "^1.29.0",