@mapbox/mcp-server 0.13.0 → 0.15.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 (257) hide show
  1. package/README.md +111 -14
  2. package/dist/commonjs/cli.d.ts.map +1 -1
  3. package/dist/commonjs/cli.js +5 -2
  4. package/dist/commonjs/cli.js.map +1 -1
  5. package/dist/commonjs/index.js +38 -1
  6. package/dist/commonjs/index.js.map +1 -1
  7. package/dist/commonjs/resources/BaseResource.d.ts +18 -0
  8. package/dist/commonjs/resources/BaseResource.d.ts.map +1 -1
  9. package/dist/commonjs/resources/BaseResource.js +26 -4
  10. package/dist/commonjs/resources/BaseResource.js.map +1 -1
  11. package/dist/commonjs/resources/resourceRegistry.d.ts +1 -2
  12. package/dist/commonjs/resources/resourceRegistry.d.ts.map +1 -1
  13. package/dist/commonjs/resources/resourceRegistry.js +0 -2
  14. package/dist/commonjs/resources/resourceRegistry.js.map +1 -1
  15. package/dist/commonjs/resources/temporary/TemporaryDataResource.d.ts.map +1 -1
  16. package/dist/commonjs/resources/temporary/TemporaryDataResource.js +20 -10
  17. package/dist/commonjs/resources/temporary/TemporaryDataResource.js.map +1 -1
  18. package/dist/commonjs/resources/ui-apps/MapAppUIResource.d.ts.map +1 -1
  19. package/dist/commonjs/resources/ui-apps/MapAppUIResource.js +2 -8
  20. package/dist/commonjs/resources/ui-apps/MapAppUIResource.js.map +1 -1
  21. package/dist/commonjs/resources/ui-apps/mapAppCsp.d.ts +22 -0
  22. package/dist/commonjs/resources/ui-apps/mapAppCsp.d.ts.map +1 -0
  23. package/dist/commonjs/resources/ui-apps/mapAppCsp.js +39 -0
  24. package/dist/commonjs/resources/ui-apps/mapAppCsp.js.map +1 -0
  25. package/dist/commonjs/resources/ui-apps/mapAppHtml.d.ts +3 -3
  26. package/dist/commonjs/resources/ui-apps/mapAppHtml.d.ts.map +1 -1
  27. package/dist/commonjs/resources/ui-apps/mapAppHtml.js +89 -13
  28. package/dist/commonjs/resources/ui-apps/mapAppHtml.js.map +1 -1
  29. package/dist/commonjs/tools/BaseTool.d.ts +19 -0
  30. package/dist/commonjs/tools/BaseTool.d.ts.map +1 -1
  31. package/dist/commonjs/tools/BaseTool.js +25 -3
  32. package/dist/commonjs/tools/BaseTool.js.map +1 -1
  33. package/dist/commonjs/tools/directions-tool/DirectionsTool.d.ts +16 -0
  34. package/dist/commonjs/tools/directions-tool/DirectionsTool.d.ts.map +1 -1
  35. package/dist/commonjs/tools/directions-tool/DirectionsTool.js +107 -2
  36. package/dist/commonjs/tools/directions-tool/DirectionsTool.js.map +1 -1
  37. package/dist/commonjs/tools/ground-location-tool/GroundLocationTool.d.ts.map +1 -1
  38. package/dist/commonjs/tools/ground-location-tool/GroundLocationTool.js +7 -4
  39. package/dist/commonjs/tools/ground-location-tool/GroundLocationTool.js.map +1 -1
  40. package/dist/commonjs/tools/ground-location-tool/GroundLocationTool.output.schema.d.ts +4 -0
  41. package/dist/commonjs/tools/ground-location-tool/GroundLocationTool.output.schema.d.ts.map +1 -1
  42. package/dist/commonjs/tools/ground-location-tool/GroundLocationTool.output.schema.js +9 -1
  43. package/dist/commonjs/tools/ground-location-tool/GroundLocationTool.output.schema.js.map +1 -1
  44. package/dist/commonjs/tools/isochrone-tool/IsochroneTool.js +1 -1
  45. package/dist/commonjs/tools/place-details-tool/PlaceDetailsTool.d.ts +11 -1
  46. package/dist/commonjs/tools/place-details-tool/PlaceDetailsTool.d.ts.map +1 -1
  47. package/dist/commonjs/tools/place-details-tool/PlaceDetailsTool.input.schema.js +3 -3
  48. package/dist/commonjs/tools/place-details-tool/PlaceDetailsTool.input.schema.js.map +1 -1
  49. package/dist/commonjs/tools/place-details-tool/PlaceDetailsTool.js +134 -139
  50. package/dist/commonjs/tools/place-details-tool/PlaceDetailsTool.js.map +1 -1
  51. package/dist/commonjs/tools/place-details-tool/PlaceDetailsTool.output.schema.d.ts +71 -10
  52. package/dist/commonjs/tools/place-details-tool/PlaceDetailsTool.output.schema.d.ts.map +1 -1
  53. package/dist/commonjs/tools/place-details-tool/PlaceDetailsTool.output.schema.js +86 -10
  54. package/dist/commonjs/tools/place-details-tool/PlaceDetailsTool.output.schema.js.map +1 -1
  55. package/dist/commonjs/tools/render-map-tool/RenderMapTool.d.ts +2 -4
  56. package/dist/commonjs/tools/render-map-tool/RenderMapTool.d.ts.map +1 -1
  57. package/dist/commonjs/tools/render-map-tool/RenderMapTool.input.schema.d.ts +50 -0
  58. package/dist/commonjs/tools/render-map-tool/RenderMapTool.input.schema.d.ts.map +1 -1
  59. package/dist/commonjs/tools/render-map-tool/RenderMapTool.input.schema.js +51 -2
  60. package/dist/commonjs/tools/render-map-tool/RenderMapTool.input.schema.js.map +1 -1
  61. package/dist/commonjs/tools/render-map-tool/RenderMapTool.js +50 -18
  62. package/dist/commonjs/tools/render-map-tool/RenderMapTool.js.map +1 -1
  63. package/dist/commonjs/tools/render-map-tool/RenderMapTool.output.schema.d.ts +50 -0
  64. package/dist/commonjs/tools/render-map-tool/RenderMapTool.output.schema.d.ts.map +1 -1
  65. package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.d.ts.map +1 -1
  66. package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.input.schema.d.ts.map +1 -1
  67. package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.input.schema.js +2 -2
  68. package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.input.schema.js.map +1 -1
  69. package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.js +6 -3
  70. package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.js.map +1 -1
  71. package/dist/commonjs/tools/static-map-image-tool/StaticMapImageTool.d.ts.map +1 -1
  72. package/dist/commonjs/tools/static-map-image-tool/StaticMapImageTool.input.schema.d.ts +3 -3
  73. package/dist/commonjs/tools/static-map-image-tool/StaticMapImageTool.input.schema.d.ts.map +1 -1
  74. package/dist/commonjs/tools/static-map-image-tool/StaticMapImageTool.input.schema.js +16 -2
  75. package/dist/commonjs/tools/static-map-image-tool/StaticMapImageTool.input.schema.js.map +1 -1
  76. package/dist/commonjs/tools/static-map-image-tool/StaticMapImageTool.js +17 -6
  77. package/dist/commonjs/tools/static-map-image-tool/StaticMapImageTool.js.map +1 -1
  78. package/dist/commonjs/utils/index.d.ts +2 -0
  79. package/dist/commonjs/utils/index.d.ts.map +1 -1
  80. package/dist/commonjs/utils/index.js +8 -1
  81. package/dist/commonjs/utils/index.js.map +1 -1
  82. package/dist/commonjs/utils/jsonSchema2020.d.ts +26 -0
  83. package/dist/commonjs/utils/jsonSchema2020.d.ts.map +1 -0
  84. package/dist/commonjs/utils/jsonSchema2020.js +143 -0
  85. package/dist/commonjs/utils/jsonSchema2020.js.map +1 -0
  86. package/dist/commonjs/utils/jwtUtils.d.ts +48 -0
  87. package/dist/commonjs/utils/jwtUtils.d.ts.map +1 -1
  88. package/dist/commonjs/utils/jwtUtils.js +63 -0
  89. package/dist/commonjs/utils/jwtUtils.js.map +1 -1
  90. package/dist/commonjs/utils/mapAppPayload.d.ts +109 -0
  91. package/dist/commonjs/utils/mapAppPayload.d.ts.map +1 -1
  92. package/dist/commonjs/utils/mapAppPayload.js +38 -2
  93. package/dist/commonjs/utils/mapAppPayload.js.map +1 -1
  94. package/dist/commonjs/utils/redactToken.d.ts +3 -0
  95. package/dist/commonjs/utils/redactToken.d.ts.map +1 -0
  96. package/dist/commonjs/utils/redactToken.js +55 -0
  97. package/dist/commonjs/utils/redactToken.js.map +1 -0
  98. package/dist/commonjs/utils/redactingSpanExporter.d.ts +24 -0
  99. package/dist/commonjs/utils/redactingSpanExporter.d.ts.map +1 -0
  100. package/dist/commonjs/utils/redactingSpanExporter.js +97 -0
  101. package/dist/commonjs/utils/redactingSpanExporter.js.map +1 -0
  102. package/dist/commonjs/utils/selfFetchRef.d.ts.map +1 -1
  103. package/dist/commonjs/utils/selfFetchRef.js +31 -0
  104. package/dist/commonjs/utils/selfFetchRef.js.map +1 -1
  105. package/dist/commonjs/utils/serverInstructions.d.ts +12 -0
  106. package/dist/commonjs/utils/serverInstructions.d.ts.map +1 -0
  107. package/dist/commonjs/utils/serverInstructions.js +28 -0
  108. package/dist/commonjs/utils/serverInstructions.js.map +1 -0
  109. package/dist/commonjs/utils/storeMapPayload.d.ts +11 -11
  110. package/dist/commonjs/utils/storeMapPayload.d.ts.map +1 -1
  111. package/dist/commonjs/utils/storeMapPayload.js +14 -13
  112. package/dist/commonjs/utils/storeMapPayload.js.map +1 -1
  113. package/dist/commonjs/utils/temporaryResourceManager.d.ts +10 -4
  114. package/dist/commonjs/utils/temporaryResourceManager.d.ts.map +1 -1
  115. package/dist/commonjs/utils/temporaryResourceManager.js.map +1 -1
  116. package/dist/commonjs/utils/tracing.d.ts +4 -0
  117. package/dist/commonjs/utils/tracing.d.ts.map +1 -1
  118. package/dist/commonjs/utils/tracing.js +24 -1
  119. package/dist/commonjs/utils/tracing.js.map +1 -1
  120. package/dist/commonjs/utils/urlSafety.d.ts +23 -7
  121. package/dist/commonjs/utils/urlSafety.d.ts.map +1 -1
  122. package/dist/commonjs/utils/urlSafety.js +84 -66
  123. package/dist/commonjs/utils/urlSafety.js.map +1 -1
  124. package/dist/commonjs/version.json +3 -3
  125. package/dist/esm/cli.d.ts.map +1 -1
  126. package/dist/esm/cli.js +5 -2
  127. package/dist/esm/cli.js.map +1 -1
  128. package/dist/esm/index.js +39 -2
  129. package/dist/esm/index.js.map +1 -1
  130. package/dist/esm/resources/BaseResource.d.ts +18 -0
  131. package/dist/esm/resources/BaseResource.d.ts.map +1 -1
  132. package/dist/esm/resources/BaseResource.js +26 -4
  133. package/dist/esm/resources/BaseResource.js.map +1 -1
  134. package/dist/esm/resources/resourceRegistry.d.ts +1 -2
  135. package/dist/esm/resources/resourceRegistry.d.ts.map +1 -1
  136. package/dist/esm/resources/resourceRegistry.js +0 -2
  137. package/dist/esm/resources/resourceRegistry.js.map +1 -1
  138. package/dist/esm/resources/temporary/TemporaryDataResource.d.ts.map +1 -1
  139. package/dist/esm/resources/temporary/TemporaryDataResource.js +21 -11
  140. package/dist/esm/resources/temporary/TemporaryDataResource.js.map +1 -1
  141. package/dist/esm/resources/ui-apps/MapAppUIResource.d.ts.map +1 -1
  142. package/dist/esm/resources/ui-apps/MapAppUIResource.js +2 -8
  143. package/dist/esm/resources/ui-apps/MapAppUIResource.js.map +1 -1
  144. package/dist/esm/resources/ui-apps/mapAppCsp.d.ts +22 -0
  145. package/dist/esm/resources/ui-apps/mapAppCsp.d.ts.map +1 -0
  146. package/dist/esm/resources/ui-apps/mapAppCsp.js +36 -0
  147. package/dist/esm/resources/ui-apps/mapAppCsp.js.map +1 -0
  148. package/dist/esm/resources/ui-apps/mapAppHtml.d.ts +3 -3
  149. package/dist/esm/resources/ui-apps/mapAppHtml.d.ts.map +1 -1
  150. package/dist/esm/resources/ui-apps/mapAppHtml.js +89 -13
  151. package/dist/esm/resources/ui-apps/mapAppHtml.js.map +1 -1
  152. package/dist/esm/tools/BaseTool.d.ts +19 -0
  153. package/dist/esm/tools/BaseTool.d.ts.map +1 -1
  154. package/dist/esm/tools/BaseTool.js +25 -3
  155. package/dist/esm/tools/BaseTool.js.map +1 -1
  156. package/dist/esm/tools/directions-tool/DirectionsTool.d.ts +16 -0
  157. package/dist/esm/tools/directions-tool/DirectionsTool.d.ts.map +1 -1
  158. package/dist/esm/tools/directions-tool/DirectionsTool.js +108 -3
  159. package/dist/esm/tools/directions-tool/DirectionsTool.js.map +1 -1
  160. package/dist/esm/tools/ground-location-tool/GroundLocationTool.d.ts.map +1 -1
  161. package/dist/esm/tools/ground-location-tool/GroundLocationTool.js +7 -4
  162. package/dist/esm/tools/ground-location-tool/GroundLocationTool.js.map +1 -1
  163. package/dist/esm/tools/ground-location-tool/GroundLocationTool.output.schema.d.ts +4 -0
  164. package/dist/esm/tools/ground-location-tool/GroundLocationTool.output.schema.d.ts.map +1 -1
  165. package/dist/esm/tools/ground-location-tool/GroundLocationTool.output.schema.js +9 -1
  166. package/dist/esm/tools/ground-location-tool/GroundLocationTool.output.schema.js.map +1 -1
  167. package/dist/esm/tools/isochrone-tool/IsochroneTool.js +2 -2
  168. package/dist/esm/tools/place-details-tool/PlaceDetailsTool.d.ts +11 -1
  169. package/dist/esm/tools/place-details-tool/PlaceDetailsTool.d.ts.map +1 -1
  170. package/dist/esm/tools/place-details-tool/PlaceDetailsTool.input.schema.js +3 -3
  171. package/dist/esm/tools/place-details-tool/PlaceDetailsTool.input.schema.js.map +1 -1
  172. package/dist/esm/tools/place-details-tool/PlaceDetailsTool.js +135 -140
  173. package/dist/esm/tools/place-details-tool/PlaceDetailsTool.js.map +1 -1
  174. package/dist/esm/tools/place-details-tool/PlaceDetailsTool.output.schema.d.ts +71 -10
  175. package/dist/esm/tools/place-details-tool/PlaceDetailsTool.output.schema.d.ts.map +1 -1
  176. package/dist/esm/tools/place-details-tool/PlaceDetailsTool.output.schema.js +85 -9
  177. package/dist/esm/tools/place-details-tool/PlaceDetailsTool.output.schema.js.map +1 -1
  178. package/dist/esm/tools/render-map-tool/RenderMapTool.d.ts +2 -4
  179. package/dist/esm/tools/render-map-tool/RenderMapTool.d.ts.map +1 -1
  180. package/dist/esm/tools/render-map-tool/RenderMapTool.input.schema.d.ts +50 -0
  181. package/dist/esm/tools/render-map-tool/RenderMapTool.input.schema.d.ts.map +1 -1
  182. package/dist/esm/tools/render-map-tool/RenderMapTool.input.schema.js +51 -2
  183. package/dist/esm/tools/render-map-tool/RenderMapTool.input.schema.js.map +1 -1
  184. package/dist/esm/tools/render-map-tool/RenderMapTool.js +51 -19
  185. package/dist/esm/tools/render-map-tool/RenderMapTool.js.map +1 -1
  186. package/dist/esm/tools/render-map-tool/RenderMapTool.output.schema.d.ts +50 -0
  187. package/dist/esm/tools/render-map-tool/RenderMapTool.output.schema.d.ts.map +1 -1
  188. package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.d.ts.map +1 -1
  189. package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.input.schema.d.ts.map +1 -1
  190. package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.input.schema.js +2 -2
  191. package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.input.schema.js.map +1 -1
  192. package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.js +6 -3
  193. package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.js.map +1 -1
  194. package/dist/esm/tools/static-map-image-tool/StaticMapImageTool.d.ts.map +1 -1
  195. package/dist/esm/tools/static-map-image-tool/StaticMapImageTool.input.schema.d.ts +3 -3
  196. package/dist/esm/tools/static-map-image-tool/StaticMapImageTool.input.schema.d.ts.map +1 -1
  197. package/dist/esm/tools/static-map-image-tool/StaticMapImageTool.input.schema.js +17 -3
  198. package/dist/esm/tools/static-map-image-tool/StaticMapImageTool.input.schema.js.map +1 -1
  199. package/dist/esm/tools/static-map-image-tool/StaticMapImageTool.js +18 -7
  200. package/dist/esm/tools/static-map-image-tool/StaticMapImageTool.js.map +1 -1
  201. package/dist/esm/utils/index.d.ts +2 -0
  202. package/dist/esm/utils/index.d.ts.map +1 -1
  203. package/dist/esm/utils/index.js +5 -0
  204. package/dist/esm/utils/index.js.map +1 -1
  205. package/dist/esm/utils/jsonSchema2020.d.ts +26 -0
  206. package/dist/esm/utils/jsonSchema2020.d.ts.map +1 -0
  207. package/dist/esm/utils/jsonSchema2020.js +138 -0
  208. package/dist/esm/utils/jsonSchema2020.js.map +1 -0
  209. package/dist/esm/utils/jwtUtils.d.ts +48 -0
  210. package/dist/esm/utils/jwtUtils.d.ts.map +1 -1
  211. package/dist/esm/utils/jwtUtils.js +61 -0
  212. package/dist/esm/utils/jwtUtils.js.map +1 -1
  213. package/dist/esm/utils/mapAppPayload.d.ts +109 -0
  214. package/dist/esm/utils/mapAppPayload.d.ts.map +1 -1
  215. package/dist/esm/utils/mapAppPayload.js +38 -2
  216. package/dist/esm/utils/mapAppPayload.js.map +1 -1
  217. package/dist/esm/utils/redactToken.d.ts +3 -0
  218. package/dist/esm/utils/redactToken.d.ts.map +1 -0
  219. package/dist/esm/utils/redactToken.js +52 -0
  220. package/dist/esm/utils/redactToken.js.map +1 -0
  221. package/dist/esm/utils/redactingSpanExporter.d.ts +24 -0
  222. package/dist/esm/utils/redactingSpanExporter.d.ts.map +1 -0
  223. package/dist/esm/utils/redactingSpanExporter.js +93 -0
  224. package/dist/esm/utils/redactingSpanExporter.js.map +1 -0
  225. package/dist/esm/utils/selfFetchRef.d.ts.map +1 -1
  226. package/dist/esm/utils/selfFetchRef.js +31 -0
  227. package/dist/esm/utils/selfFetchRef.js.map +1 -1
  228. package/dist/esm/utils/serverInstructions.d.ts +12 -0
  229. package/dist/esm/utils/serverInstructions.d.ts.map +1 -0
  230. package/dist/esm/utils/serverInstructions.js +25 -0
  231. package/dist/esm/utils/serverInstructions.js.map +1 -0
  232. package/dist/esm/utils/storeMapPayload.d.ts +11 -11
  233. package/dist/esm/utils/storeMapPayload.d.ts.map +1 -1
  234. package/dist/esm/utils/storeMapPayload.js +14 -13
  235. package/dist/esm/utils/storeMapPayload.js.map +1 -1
  236. package/dist/esm/utils/temporaryResourceManager.d.ts +10 -4
  237. package/dist/esm/utils/temporaryResourceManager.d.ts.map +1 -1
  238. package/dist/esm/utils/temporaryResourceManager.js.map +1 -1
  239. package/dist/esm/utils/tracing.d.ts +4 -0
  240. package/dist/esm/utils/tracing.d.ts.map +1 -1
  241. package/dist/esm/utils/tracing.js +23 -1
  242. package/dist/esm/utils/tracing.js.map +1 -1
  243. package/dist/esm/utils/urlSafety.d.ts +23 -7
  244. package/dist/esm/utils/urlSafety.d.ts.map +1 -1
  245. package/dist/esm/utils/urlSafety.js +80 -66
  246. package/dist/esm/utils/urlSafety.js.map +1 -1
  247. package/dist/esm/version.json +3 -3
  248. package/package.json +3 -2
  249. package/patches/{@modelcontextprotocol+sdk+1.29.0.patch → @modelcontextprotocol+sdk+1.30.0.patch} +6 -2
  250. package/dist/commonjs/resources/ui-apps/StaticMapUIResource.d.ts +0 -15
  251. package/dist/commonjs/resources/ui-apps/StaticMapUIResource.d.ts.map +0 -1
  252. package/dist/commonjs/resources/ui-apps/StaticMapUIResource.js +0 -262
  253. package/dist/commonjs/resources/ui-apps/StaticMapUIResource.js.map +0 -1
  254. package/dist/esm/resources/ui-apps/StaticMapUIResource.d.ts +0 -15
  255. package/dist/esm/resources/ui-apps/StaticMapUIResource.d.ts.map +0 -1
  256. package/dist/esm/resources/ui-apps/StaticMapUIResource.js +0 -258
  257. package/dist/esm/resources/ui-apps/StaticMapUIResource.js.map +0 -1
@@ -0,0 +1,22 @@
1
+ export interface MapAppCsp {
2
+ connectDomains: string[];
3
+ resourceDomains: string[];
4
+ workerDomains: string[];
5
+ }
6
+ /**
7
+ * The exact origins the map app uses, for its MCP Apps CSP.
8
+ *
9
+ * Hosts compare the declared CSP against what the UI actually loads, and
10
+ * reviewers expect the narrowest list that works, so this names hosts instead
11
+ * of allowing all of `*.mapbox.com`:
12
+ *
13
+ * - GL JS loads its script and stylesheet, and fetches styles, tiles, sprites,
14
+ * glyphs and 3D models, from api.mapbox.com, and sends telemetry to
15
+ * events.mapbox.com (see Mapbox GL JS's CSP guide).
16
+ * - The page's own API calls (Directions, Isochrone, Search Box and so on) go to
17
+ * `apiEndpoint`, which `MAPBOX_API_ENDPOINT` can point somewhere else, so its
18
+ * origin is added when it differs.
19
+ * - GL JS runs its workers from `blob:` URLs.
20
+ */
21
+ export declare function mapAppCsp(apiEndpoint: string): MapAppCsp;
22
+ //# sourceMappingURL=mapAppCsp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapAppCsp.d.ts","sourceRoot":"","sources":["../../../../src/resources/ui-apps/mapAppCsp.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,SAAS;IACxB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAKD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAaxD"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ // Copyright (c) Mapbox, Inc.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.mapAppCsp = mapAppCsp;
6
+ const MAPBOX_API_ORIGIN = 'https://api.mapbox.com';
7
+ const MAPBOX_EVENTS_ORIGIN = 'https://events.mapbox.com';
8
+ /**
9
+ * The exact origins the map app uses, for its MCP Apps CSP.
10
+ *
11
+ * Hosts compare the declared CSP against what the UI actually loads, and
12
+ * reviewers expect the narrowest list that works, so this names hosts instead
13
+ * of allowing all of `*.mapbox.com`:
14
+ *
15
+ * - GL JS loads its script and stylesheet, and fetches styles, tiles, sprites,
16
+ * glyphs and 3D models, from api.mapbox.com, and sends telemetry to
17
+ * events.mapbox.com (see Mapbox GL JS's CSP guide).
18
+ * - The page's own API calls (Directions, Isochrone, Search Box and so on) go to
19
+ * `apiEndpoint`, which `MAPBOX_API_ENDPOINT` can point somewhere else, so its
20
+ * origin is added when it differs.
21
+ * - GL JS runs its workers from `blob:` URLs.
22
+ */
23
+ function mapAppCsp(apiEndpoint) {
24
+ const connectDomains = [MAPBOX_API_ORIGIN, MAPBOX_EVENTS_ORIGIN];
25
+ try {
26
+ const apiOrigin = new URL(apiEndpoint).origin;
27
+ if (!connectDomains.includes(apiOrigin))
28
+ connectDomains.push(apiOrigin);
29
+ }
30
+ catch {
31
+ // An endpoint that isn't a valid URL can't be reached by the page anyway.
32
+ }
33
+ return {
34
+ connectDomains,
35
+ resourceDomains: [MAPBOX_API_ORIGIN],
36
+ workerDomains: ['blob:']
37
+ };
38
+ }
39
+ //# sourceMappingURL=mapAppCsp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapAppCsp.js","sourceRoot":"","sources":["../../../../src/resources/ui-apps/mapAppCsp.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;AA0BlC,8BAaC;AA/BD,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AACnD,MAAM,oBAAoB,GAAG,2BAA2B,CAAC;AAEzD;;;;;;;;;;;;;;GAcG;AACH,SAAgB,SAAS,CAAC,WAAmB;IAC3C,MAAM,cAAc,GAAG,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,CAAC;IACjE,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC;QAC9C,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC;YAAE,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1E,CAAC;IAAC,MAAM,CAAC;QACP,0EAA0E;IAC5E,CAAC;IACD,OAAO;QACL,cAAc;QACd,eAAe,EAAE,CAAC,iBAAiB,CAAC;QACpC,aAAa,EAAE,CAAC,OAAO,CAAC;KACzB,CAAC;AACJ,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import type { MapAppPayload } from '../../utils/mapAppPayload.js';
2
2
  /**
3
- * Render the generic Mapbox MCP App HTML — used by both the MCP Apps
4
- * resource (postMessage delivery) and any tool's inline MCP-UI rawHtml
5
- * block (initial-data baked in).
3
+ * Render the generic Mapbox MCP App HTML — served by the MCP Apps resource
4
+ * (`MapAppUIResource`) that `render_map_tool` targets exclusively via
5
+ * postMessage delivery.
6
6
  *
7
7
  * The iframe is a thin renderer over Mapbox GL JS. Tools produce a
8
8
  * `MapAppPayload` (see src/utils/mapAppPayload.ts) and the iframe
@@ -1 +1 @@
1
- {"version":3,"file":"mapAppHtml.d.ts","sourceRoot":"","sources":["../../../../src/resources/ui-apps/mapAppHtml.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE;;;;;;;;;GASG;AAMH,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAE1C,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,aAAa,CAAC;CAC7B,GAAG,MAAM,CA+jDT"}
1
+ {"version":3,"file":"mapAppHtml.d.ts","sourceRoot":"","sources":["../../../../src/resources/ui-apps/mapAppHtml.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE;;;;;;;;;GASG;AAMH,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAE1C,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,aAAa,CAAC;CAC7B,GAAG,MAAM,CA2oDT"}
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.MAPBOX_GL_VERSION = void 0;
6
6
  exports.renderMapAppHtml = renderMapAppHtml;
7
7
  /**
8
- * Render the generic Mapbox MCP App HTML — used by both the MCP Apps
9
- * resource (postMessage delivery) and any tool's inline MCP-UI rawHtml
10
- * block (initial-data baked in).
8
+ * Render the generic Mapbox MCP App HTML — served by the MCP Apps resource
9
+ * (`MapAppUIResource`) that `render_map_tool` targets exclusively via
10
+ * postMessage delivery.
11
11
  *
12
12
  * The iframe is a thin renderer over Mapbox GL JS. Tools produce a
13
13
  * `MapAppPayload` (see src/utils/mapAppPayload.ts) and the iframe
@@ -98,6 +98,10 @@ ${initialDataScript}
98
98
  var map = null;
99
99
  var mapLoaded = false;
100
100
  var pendingPayload = null;
101
+ // Tracks which base style the map is currently constructed with, so a
102
+ // later render() can detect a baseStyle change and switch via setStyle()
103
+ // -- the style is otherwise only ever set once, at construction time.
104
+ var currentBaseStyleId = 'standard';
101
105
  var currentDisplayMode = 'inline';
102
106
 
103
107
  // Tracks what we've added so re-renders can tear down cleanly.
@@ -162,6 +166,23 @@ ${initialDataScript}
162
166
  );
163
167
 
164
168
  // --- Map setup ------------------------------------------------------------
169
+ var initialDataRead = false;
170
+ var initialData = null;
171
+
172
+ // Parses the #initial-data script tag once and caches the result — read
173
+ // before map construction (to seed the constructor's config option, so
174
+ // a baseMapConfig takes effect before first paint instead of flashing
175
+ // default colors) and again by consumeInitialData() after load.
176
+ function readInitialData() {
177
+ if (initialDataRead) return initialData;
178
+ initialDataRead = true;
179
+ var el = document.getElementById('initial-data');
180
+ if (el && el.textContent) {
181
+ try { initialData = JSON.parse(el.textContent); } catch (_) { /* ignore */ }
182
+ }
183
+ return initialData;
184
+ }
185
+
165
186
  function initMap() {
166
187
  if (!TOKEN) {
167
188
  showError('No Mapbox public token available. Set MAPBOX_PUBLIC_TOKEN or grant tokens:read to the OAuth client.');
@@ -172,12 +193,23 @@ ${initialDataScript}
172
193
  return;
173
194
  }
174
195
  mapboxgl.accessToken = TOKEN;
175
- map = new mapboxgl.Map({
196
+ var data = readInitialData();
197
+ // Allowlisted rather than interpolated directly, so an unrecognized
198
+ // value can never reach the style URL -- falls back to 'standard'.
199
+ var baseStyleId = (data && data.baseStyle === 'standard-satellite')
200
+ ? 'standard-satellite'
201
+ : 'standard';
202
+ currentBaseStyleId = baseStyleId;
203
+ var mapOptions = {
176
204
  container: 'map',
177
- style: 'mapbox://styles/mapbox/streets-v12',
205
+ style: 'mapbox://styles/mapbox/' + baseStyleId,
178
206
  center: [0, 20],
179
207
  zoom: 1.5
180
- });
208
+ };
209
+ if (data && data.baseMapConfig) {
210
+ mapOptions.config = { basemap: data.baseMapConfig };
211
+ }
212
+ map = new mapboxgl.Map(mapOptions);
181
213
  map.addControl(new mapboxgl.NavigationControl(), 'top-left');
182
214
  map.on('load', function() {
183
215
  mapLoaded = true;
@@ -192,12 +224,8 @@ ${initialDataScript}
192
224
  initMap();
193
225
 
194
226
  function consumeInitialData() {
195
- var el = document.getElementById('initial-data');
196
- if (!el || !el.textContent) return;
197
- try {
198
- var data = JSON.parse(el.textContent);
199
- if (data && Array.isArray(data.layers)) render(data);
200
- } catch (_) { /* ignore */ }
227
+ var data = readInitialData();
228
+ if (data && Array.isArray(data.layers)) render(data);
201
229
  }
202
230
 
203
231
  // --- Tool result extraction ----------------------------------------------
@@ -391,6 +419,7 @@ ${initialDataScript}
391
419
  };
392
420
  if (layer.paint) def.paint = layer.paint;
393
421
  if (layer.layout) def.layout = layer.layout;
422
+ if (layer.slot) def.slot = layer.slot;
394
423
  map.addLayer(def);
395
424
  trackedLayerIds.push(layer.id);
396
425
 
@@ -456,9 +485,37 @@ ${initialDataScript}
456
485
  if (bounds) fitToBounds(bounds);
457
486
  }
458
487
 
488
+ function applyBaseMapConfig(baseMapConfig) {
489
+ if (!baseMapConfig || typeof baseMapConfig !== 'object') return;
490
+ if (typeof map.setConfigProperty !== 'function') return;
491
+ Object.keys(baseMapConfig).forEach(function(key) {
492
+ try { map.setConfigProperty('basemap', key, baseMapConfig[key]); } catch (_) { /* not a Standard-based style */ }
493
+ });
494
+ }
495
+
459
496
  function render(payload) {
460
497
  if (!map) return;
498
+ // baseStyle is only otherwise applied at map-construction time (see
499
+ // initMap()) -- MapAppUIResource never seeds initial-data server-side,
500
+ // so every real render_map_tool call arrives here instead. Without this
501
+ // check, a later call passing baseStyle: "standard-satellite" would be
502
+ // silently ignored and the map would stay on whatever style it was
503
+ // constructed with (always "standard" in practice).
504
+ var desiredBaseStyleId = payload.baseStyle === 'standard-satellite'
505
+ ? 'standard-satellite'
506
+ : (payload.baseStyle === 'standard' ? 'standard' : null);
507
+ if (desiredBaseStyleId && desiredBaseStyleId !== currentBaseStyleId) {
508
+ currentBaseStyleId = desiredBaseStyleId;
509
+ map.setStyle('mapbox://styles/mapbox/' + desiredBaseStyleId);
510
+ map.once('style.load', function() { renderBody(payload); });
511
+ return;
512
+ }
513
+ renderBody(payload);
514
+ }
515
+
516
+ function renderBody(payload) {
461
517
  teardown();
518
+ applyBaseMapConfig(payload.baseMapConfig);
462
519
 
463
520
  var bbox = bboxAccumulator();
464
521
  var layers = Array.isArray(payload.layers) ? payload.layers : [];
@@ -626,6 +683,11 @@ ${initialDataScript}
626
683
  if (typeof params.exclude !== 'string') return false;
627
684
  if (!/^[A-Za-z0-9_,.() -]+$/.test(params.exclude)) return false;
628
685
  }
686
+ if (params.selectedRouteIndex !== undefined && params.selectedRouteIndex !== null) {
687
+ if (typeof params.selectedRouteIndex !== 'number') return false;
688
+ if (!isFinite(params.selectedRouteIndex) || params.selectedRouteIndex < 0) return false;
689
+ if (Math.floor(params.selectedRouteIndex) !== params.selectedRouteIndex) return false;
690
+ }
629
691
  return true;
630
692
  }
631
693
 
@@ -747,7 +809,16 @@ ${initialDataScript}
747
809
  return res.json();
748
810
  })
749
811
  .then(function(data) {
750
- var route = data && data.routes && data.routes[0];
812
+ var routes = (data && data.routes) || [];
813
+ // If elicitation resolved to a specific route server-side, draw that
814
+ // same one out of the freshly re-fetched alternatives — falling back
815
+ // to the first route if the index is out of range (e.g. the API
816
+ // returned fewer alternatives this time around), same fallback
817
+ // philosophy as selectedMapboxId in the search self-fetch.
818
+ var route =
819
+ (typeof params.selectedRouteIndex === 'number' &&
820
+ routes[params.selectedRouteIndex]) ||
821
+ routes[0];
751
822
  var coords = route ? pickRouteGeometryClient(route) : null;
752
823
  if (!coords) {
753
824
  showError('Directions API returned no route.');
@@ -815,6 +886,11 @@ ${initialDataScript}
815
886
  if (typeof params.profile !== 'string') return false;
816
887
  if (!/^mapbox\\/[a-z-]+$/.test(params.profile)) return false;
817
888
  }
889
+ // The Isochrone API requires one of these; a scalar (e.g. 15 instead
890
+ // of [15]) would be silently dropped by buildIsochroneApiUrl.
891
+ var hasMinutes = Array.isArray(params.contours_minutes) && params.contours_minutes.length > 0;
892
+ var hasMeters = Array.isArray(params.contours_meters) && params.contours_meters.length > 0;
893
+ if (!hasMinutes && !hasMeters) return false;
818
894
  return true;
819
895
  }
820
896
 
@@ -1 +1 @@
1
- {"version":3,"file":"mapAppHtml.js","sourceRoot":"","sources":["../../../../src/resources/ui-apps/mapAppHtml.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;AAqBlC,4CAokDC;AArlDD;;;;;;;;;GASG;AAEH,yEAAyE;AACzE,wEAAwE;AACxE,6EAA6E;AAC7E,8CAA8C;AACjC,QAAA,iBAAiB,GAAG,QAAQ,CAAC;AAE1C,SAAgB,gBAAgB,CAAC,MAKhC;IACC,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;IAC5C,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,yBAAyB,CAAC;IACpE,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,yBAAiB,CAAC;IAExD,MAAM,iBAAiB,GAAG,WAAW;QACnC,CAAC,CAAC,qDAAqD,eAAe,CAClE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAC5B,WAAW;QACd,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO;;;;;;mDAM0C,SAAS;oDACR,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkD3D,iBAAiB;;;;gBAIH,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;uBACpB,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAikD1C,CAAC;AACT,CAAC;AAED,SAAS,eAAe,CAAC,CAAS;IAChC,OAAO,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;AAClD,CAAC"}
@@ -15,10 +15,29 @@ export declare abstract class BaseTool<InputSchema extends ZodTypeAny, OutputSch
15
15
  connectDomains?: string[];
16
16
  resourceDomains?: string[];
17
17
  frameDomains?: string[];
18
+ workerDomains?: string[];
18
19
  };
19
20
  };
20
21
  };
22
+ /**
23
+ * The most recently installed server. Used as a fallback when `run()` is
24
+ * called directly rather than through a callback registered by `installTo()`.
25
+ * A single instance installed into several servers only retains the last one,
26
+ * so code handling a tool call should read `activeServer` instead.
27
+ */
21
28
  protected server: McpServer | null;
29
+ /**
30
+ * The server whose registered callback is handling the current tool call.
31
+ * Scoped per invocation, so concurrent calls arriving through different
32
+ * servers each observe their own.
33
+ */
34
+ private readonly invocationServer;
35
+ /**
36
+ * The server a tool call should communicate with — the one that registered
37
+ * the callback handling it, falling back to the last installed server when
38
+ * `run()` is invoked outside a registered callback.
39
+ */
40
+ protected get activeServer(): McpServer | null;
22
41
  constructor(params: {
23
42
  inputSchema: InputSchema;
24
43
  outputSchema?: OutputSchema;
@@ -1 +1 @@
1
- {"version":3,"file":"BaseTool.d.ts","sourceRoot":"","sources":["../../../src/tools/BaseTool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACf,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAGtC,8BAAsB,QAAQ,CAC5B,WAAW,SAAS,UAAU,EAC9B,YAAY,SAAS,UAAU,GAAG,UAAU;IAE5C,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAC;IAE/C,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IACrC,QAAQ,CAAC,IAAI,CAAC,EAAE;QACd,EAAE,CAAC,EAAE;YACH,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,GAAG,CAAC,EAAE;gBACJ,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;gBAC1B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;gBAC3B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;aACzB,CAAC;SACH,CAAC;KACH,CAAC;IACF,SAAS,CA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AAY,CAAC,EAAE,YAAY,CAAC;IACrC,QAAQ,CAAC,IAAI,CAAC,EAAE;QACd,EAAE,CAAC,EAAE;YACH,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,GAAG,CAAC,EAAE;gBACJ,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;gBAC1B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;gBAC3B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;gBACxB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;aAC1B,CAAC;SACH,CAAC;KACH,CAAC;IACF;;;;;OAKG;IACH,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAAQ;IAE1C;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAsC;IAEvE;;;;OAIG;IACH,SAAS,KAAK,YAAY,IAAI,SAAS,GAAG,IAAI,CAE7C;gBAEW,MAAM,EAAE;QAClB,WAAW,EAAE,WAAW,CAAC;QACzB,YAAY,CAAC,EAAE,YAAY,CAAC;KAC7B;IAKD;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,cAAc;IAmD5C;;OAEG;IACH,QAAQ,CAAC,GAAG,CACV,QAAQ,EAAE,OAAO,EAEjB,KAAK,CAAC,EAAE,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAC,GACpC,OAAO,CAAC,cAAc,CAAC;IAE1B;;OAEG;IACH,SAAS,CAAC,GAAG,CACX,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,EAC7C,IAAI,EAAE,OAAO,GACZ,IAAI;IAOP;;;;;OAKG;IACH,SAAS,CAAC,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,CAAC;CAgBjD"}
@@ -3,11 +3,32 @@
3
3
  // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.BaseTool = void 0;
6
+ const node_async_hooks_1 = require("node:async_hooks");
6
7
  class BaseTool {
7
8
  inputSchema;
8
9
  outputSchema;
9
10
  meta;
11
+ /**
12
+ * The most recently installed server. Used as a fallback when `run()` is
13
+ * called directly rather than through a callback registered by `installTo()`.
14
+ * A single instance installed into several servers only retains the last one,
15
+ * so code handling a tool call should read `activeServer` instead.
16
+ */
10
17
  server = null;
18
+ /**
19
+ * The server whose registered callback is handling the current tool call.
20
+ * Scoped per invocation, so concurrent calls arriving through different
21
+ * servers each observe their own.
22
+ */
23
+ invocationServer = new node_async_hooks_1.AsyncLocalStorage();
24
+ /**
25
+ * The server a tool call should communicate with — the one that registered
26
+ * the callback handling it, falling back to the last installed server when
27
+ * `run()` is invoked outside a registered callback.
28
+ */
29
+ get activeServer() {
30
+ return this.invocationServer.getStore() ?? this.server;
31
+ }
11
32
  constructor(params) {
12
33
  this.inputSchema = params.inputSchema;
13
34
  this.outputSchema = params.outputSchema;
@@ -36,14 +57,15 @@ class BaseTool {
36
57
  }
37
58
  return server.registerTool(this.name, config,
38
59
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
39
- (args, extra) => this.run(args, extra));
60
+ (args, extra) => this.invocationServer.run(server, () => this.run(args, extra)));
40
61
  }
41
62
  /**
42
63
  * Helper method to send logging messages
43
64
  */
44
65
  log(level, data) {
45
- if (this.server?.server) {
46
- void this.server.server.sendLoggingMessage({ level, data });
66
+ const server = this.activeServer;
67
+ if (server?.server) {
68
+ void server.server.sendLoggingMessage({ level, data });
47
69
  }
48
70
  }
49
71
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"BaseTool.js","sourceRoot":"","sources":["../../../src/tools/BaseTool.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;AAclC,MAAsB,QAAQ;IAQnB,WAAW,CAAc;IACzB,YAAY,CAAgB;IAC5B,IAAI,CASX;IACQ,MAAM,GAAqB,IAAI,CAAC;IAE1C,YAAY,MAGX;QACC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;Q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ACF,gCAAgC;YAChC,OAAO,OAAY,CAAC;QACtB,CAAC;IACH,CAAC;CACF;AAvJD,4BAuJC"}
@@ -17,6 +17,22 @@ export declare class DirectionsTool extends MapboxApiBasedTool<typeof Directions
17
17
  constructor(params: {
18
18
  httpRequest: HttpRequest;
19
19
  });
20
+ private formatDuration;
21
+ private formatDistance;
22
+ /** One-line label for a route option in the Stage 2 elicitation form. */
23
+ private describeRoute;
24
+ /**
25
+ * When multiple route alternatives come back, let the user pick one via
26
+ * MCP elicitation rather than handing all of them to the model. Returns
27
+ * the selected route's index (to thread through the self-fetch ref so the
28
+ * map preview draws the same route) and mutates nothing — the caller
29
+ * applies the filtered `routes` array itself.
30
+ *
31
+ * Mirrors search_and_geocode_tool's disambiguation elicitation: silent,
32
+ * best-effort fallback to "return everything" on decline, on an
33
+ * unsupported client, or on any elicitation error.
34
+ */
35
+ private elicitRouteSelection;
20
36
  protected execute(input: z.infer<typeof DirectionsInputSchema>, accessToken: string): Promise<CallToolResult>;
21
37
  }
22
38
  //# sourceMappingURL=DirectionsTool.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DirectionsTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/directions-tool/DirectionsTool.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAGzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EACL,wBAAwB,EAEzB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAQzD,qBAAa,cAAe,SAAQ,kBAAkB,CACpD,OAAO,qBAAqB,EAC5B,OAAO,wBAAwB,CAChC;IACC,IAAI,SAAqB;IACzB,WAAW,SAMkE;IAC7E,WAAW;;;;;;MAMT;gBACU,MAAM,EAAE;QAAE,WAAW,EAAE,WAAW,CAAA;KAAE;cAOhC,OAAO,CACrB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,EAC5C,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,cAAc,CAAC;CA4Q3B"}
1
+ {"version":3,"file":"DirectionsTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/directions-tool/DirectionsTool.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAGzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EACL,wBAAwB,EAGzB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAQzD,qBAAa,cAAe,SAAQ,kBAAkB,CACpD,OAAO,qBAAqB,EAC5B,OAAO,wBAAwB,CAChC;IACC,IAAI,SAAqB;IACzB,WAAW,SAMkE;IAC7E,WAAW;;;;;;MAMT;gBACU,MAAM,EAAE;QAAE,WAAW,EAAE,WAAW,CAAA;KAAE;IAQhD,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,cAAc;IAMtB,yEAAyE;IACzE,OAAO,CAAC,aAAa;IA6BrB;;;;;;;;;;OAUG;YACW,oBAAoB;cA8ClB,OAAO,CACrB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,EAC5C,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,cAAc,CAAC;CAkS3B"}
@@ -36,6 +36,92 @@ class DirectionsTool extends MapboxApiBasedTool_js_1.MapboxApiBasedTool {
36
36
  httpRequest: params.httpRequest
37
37
  });
38
38
  }
39
+ formatDuration(seconds) {
40
+ const hours = Math.floor(seconds / 3600);
41
+ const minutes = Math.round((seconds % 3600) / 60);
42
+ return hours > 0 ? `${hours}h ${minutes}min` : `${minutes}min`;
43
+ }
44
+ formatDistance(meters) {
45
+ const km = (meters / 1000).toFixed(1);
46
+ const miles = (meters / 1609.34).toFixed(1);
47
+ return `${km}km (${miles}mi)`;
48
+ }
49
+ /** One-line label for a route option in the Stage 2 elicitation form. */
50
+ describeRoute(route) {
51
+ const duration = this.formatDuration(route.duration);
52
+ const distance = this.formatDistance(route.distance);
53
+ const roads = route.leg_summaries?.[0] || 'Route';
54
+ let traffic = '';
55
+ const c = route.congestion_information;
56
+ if (c) {
57
+ const total = c.length_low + c.length_moderate + c.length_heavy + c.length_severe;
58
+ const heavyPct = total > 0
59
+ ? Math.round(((c.length_heavy + c.length_severe) / total) * 100)
60
+ : 0;
61
+ traffic =
62
+ heavyPct > 20
63
+ ? ` ⚠️ Heavy traffic (${heavyPct}%)`
64
+ : c.length_moderate > 0
65
+ ? ' 🟡 Moderate traffic'
66
+ : ' ✅ Light traffic';
67
+ }
68
+ const incidentCount = route.incidents_summary?.length ?? 0;
69
+ const incidents = incidentCount > 0 ? ` • ${incidentCount} incident(s)` : '';
70
+ return `${duration} via ${roads} • ${distance}${traffic}${incidents}`;
71
+ }
72
+ /**
73
+ * When multiple route alternatives come back, let the user pick one via
74
+ * MCP elicitation rather than handing all of them to the model. Returns
75
+ * the selected route's index (to thread through the self-fetch ref so the
76
+ * map preview draws the same route) and mutates nothing — the caller
77
+ * applies the filtered `routes` array itself.
78
+ *
79
+ * Mirrors search_and_geocode_tool's disambiguation elicitation: silent,
80
+ * best-effort fallback to "return everything" on decline, on an
81
+ * unsupported client, or on any elicitation error.
82
+ */
83
+ async elicitRouteSelection(routes) {
84
+ const server = this.activeServer;
85
+ if (!server || routes.length < 2)
86
+ return undefined;
87
+ try {
88
+ const options = routes.map((route, index) => ({
89
+ value: String(index),
90
+ label: this.describeRoute(route)
91
+ }));
92
+ const result = await server.server.elicitInput({
93
+ mode: 'form',
94
+ message: `Found ${routes.length} routes. Choose your preferred route:`,
95
+ requestedSchema: {
96
+ type: 'object',
97
+ properties: {
98
+ selectedIndex: {
99
+ type: 'string',
100
+ title: 'Select Route',
101
+ description: 'Choose the route that best fits your needs',
102
+ enum: options.map((o) => o.value),
103
+ enumNames: options.map((o) => o.label)
104
+ }
105
+ },
106
+ required: ['selectedIndex']
107
+ }
108
+ });
109
+ if (result.action === 'accept' && result.content?.selectedIndex) {
110
+ const index = parseInt(String(result.content.selectedIndex), 10);
111
+ if (Number.isInteger(index) && index >= 0 && index < routes.length) {
112
+ return index;
113
+ }
114
+ }
115
+ }
116
+ catch {
117
+ // Elicitation isn't supported by every MCP client (Claude Desktop
118
+ // doesn't, for example). Falling back to "return all routes" is the
119
+ // expected behavior — silent, since Claude Desktop's UI flags tool
120
+ // calls that emit notifications/message at any level as visually
121
+ // failed even when the JSON-RPC response is isError: false.
122
+ }
123
+ return undefined;
124
+ }
39
125
  async execute(input, accessToken) {
40
126
  // Validate exclude parameter against the actual routing_profile
41
127
  // This is needed because some exclusions are only driving specific
@@ -180,6 +266,21 @@ class DirectionsTool extends MapboxApiBasedTool_js_1.MapboxApiBasedTool {
180
266
  this.log('warning', `DirectionsTool: Response validation failed: ${error}`);
181
267
  validatedData = cleanedData;
182
268
  }
269
+ // When the API returns multiple route alternatives, let the user pick
270
+ // one via elicitation rather than handing every option to the model.
271
+ // selectedRouteIndex (into the *original* routes array) is threaded
272
+ // through the self-fetch ref below so the map preview draws the same
273
+ // route the user picked, not just whichever the API returns first.
274
+ let selectedRouteIndex;
275
+ if (validatedData.routes && validatedData.routes.length >= 2) {
276
+ selectedRouteIndex = await this.elicitRouteSelection(validatedData.routes);
277
+ if (selectedRouteIndex !== undefined) {
278
+ validatedData = {
279
+ ...validatedData,
280
+ routes: [validatedData.routes[selectedRouteIndex]]
281
+ };
282
+ }
283
+ }
183
284
  // Check response size and conditionally create temporary resource
184
285
  const RESPONSE_SIZE_THRESHOLD = 50 * 1024; // 50KB
185
286
  const responseText = JSON.stringify(validatedData, null, 2);
@@ -191,10 +292,14 @@ class DirectionsTool extends MapboxApiBasedTool_js_1.MapboxApiBasedTool {
191
292
  // (already visible to the LLM), so unlike a mapbox://temp/ ref there's
192
293
  // nothing server-side that a restart or a rehydrated conversation could
193
294
  // invalidate. Works regardless of input.geometries since the self-fetch
194
- // always forces geometries=geojson itself.
295
+ // always forces geometries=geojson itself. selectedRouteIndex (when
296
+ // elicitation resolved to one route) tells the client which of the
297
+ // freshly re-fetched alternatives to draw — see selectedMapboxId in
298
+ // search_and_geocode_tool for the equivalent pattern.
195
299
  const selfFetchRef = (0, selfFetchRef_js_1.buildSelfFetchRef)('directions', {
196
300
  coordinates: input.coordinates,
197
301
  routing_profile: input.routing_profile,
302
+ selectedRouteIndex,
198
303
  alternatives: input.alternatives,
199
304
  exclude: input.exclude,
200
305
  depart_at: input.depart_at,
@@ -212,7 +317,7 @@ class DirectionsTool extends MapboxApiBasedTool_js_1.MapboxApiBasedTool {
212
317
  uri: resourceUri,
213
318
  data: validatedData,
214
319
  metadata: { toolName: this.name, size: responseSize },
215
- owner: (0, jwtUtils_js_1.getUserNameFromToken)(accessToken)
320
+ owner: (0, jwtUtils_js_1.getOwnerKeyFromToken)(accessToken)
216
321
  });
217
322
  // Extract summary information
218
323
  const route = validatedData.routes?.[0];
@@ -1 +1 @@
1
- {"version":3,"file":"DirectionsTool.js","sourceRoot":"","sources":["../../../../src/tools/directions-tool/DirectionsTool.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;AAElC,6CAA0C;AAE1C,oEAA8D;AAE9D,iEAA2D;AAC3D,iFAA2E;AAC3E,qFAAyE;AACzE,uFAG2C;AAE3C,yFAAmF;AACnF,uEAA4D;AAC5D,iEAAgE;AAChE,yDAA+D;AAE/D,2DAA2D;AAE3D,MAAa,cAAe,SAAQ,0CAGnC;IACC,IAAI,GAAG,iBAAiB,CAAC;I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AE;aACpC;YACD,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;CACF;AAzSD,wCAySC"}
1
+ {"version":3,"file":"DirectionsTool.js","sourceRoot":"","sources":["../../../../src/tools/directions-tool/DirectionsTool.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;AAElC,6CAA0C;AAE1C,oEAA8D;AAE9D,iEAA2D;AAC3D,iFAA2E;AAC3E,qFAAyE;AACzE,uFAI2C;AAE3C,yFAAmF;AACnF,uEAA4D;AAC5D,iEAAgE;AAChE,yDAA+D;AAE/D,2DAA2D;AAE3D,MAAa,cAAe,SAAQ,0CAGnC;IACC,IAAI,GAAG,iBAAiB,CAAC;IACzB,WAAW,GACT,yFAAyF;QACzF,8FAA8F;QAC9F,yEAAyE;QACzE,uFAAuF;QACvF,wFAAwF;QACxF,0EAA0E,CAAC;IAC7E,WAAW,GAAG;QACZ,KAAK,EAAE,iBAAiB;QACxB,YAAY,EAAE,IAAI;QAClB,eAAe,EAAE,KAAK;QACtB,cAAc,EAAE,IAAI;QACpB,aAAa,EAAE,IAAI;KACpB,CAAC;IACF,YAAY,MAAoC;QAC9C,KAAK,CAAC;YACJ,WAAW,EAAE,sDAAqB;YAClC,YAAY,EAAE,0DAAwB;YACtC,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAC,CAAC;IACL,CAAC;IAEO,cAAc,CAAC,OAAe;QACpC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;QACzC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAClD,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,KAAK,CAAC;IACjE,CAAC;IAEO,cAAc,CAAC,MAAc;QACnC,MAAM,EAAE,GAAG,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C3C,wBAAwB,CAAC,YAAY,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,CAAC;YAC9D,MAAM,SAAS,GAAG,WAAW,GAAG,IAAA,+BAAU,EAAC,YAAY,CAAC,CAAC;YAEzD,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;gBAC5C,iBAAiB,EAAE,wBAAwB;gBAC3C,OAAO,EAAE,KAAK;aACf,CAAC;QACJ,CAAC;QAED,mEAAmE;QACnE,qEAAqE;QACrE,gEAAgE;QAChE,mDAAmD;QACnD,OAAO;YACL,OAAO,EAAE;gBACP,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,IAAA,+BAAU,EAAC,YAAY,CAAC,EAAE;aAChE;YACD,iBAAiB,EAAE;gBACjB,GAAG,aAAa;gBAChB,YAAY,EAAE,EAAE,GAAG,EAAE,YAAY,EAAE;aACpC;YACD,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;CACF;AAnaD,wCAmaC"}
@@ -1 +1 @@
1
- {"version":3,"file":"GroundLocationTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/ground-location-tool/GroundLocationTool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EACL,0BAA0B,EAE3B,MAAM,uCAAuC,CAAC;AA4D/C,qBAAa,kBAAmB,SAAQ,kBAAkB,CACxD,OAAO,yBAAyB,EAChC,OAAO,0BAA0B,CAClC;IACC,IAAI,SAA0B;IAC9B,WAAW,SAC2lB;IACtmB,WAAW;;;;;;MAMT;gBACU,MAAM,EAAE;QAAE,WAAW,EAAE,WAAW,CAAA;KAAE;IAQhD;;;OAGG;YACW,yBAAyB;YAqDzB,cAAc;YA2Bd,cAAc;YAqCd,SAAS;IA4BvB,OAAO,CAAC,YAAY;cAuDJ,OAAO,CACrB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,EAChD,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,cAAc,CAAC;CAsH3B"}
1
+ {"version":3,"file":"GroundLocationTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/ground-location-tool/GroundLocationTool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EACL,0BAA0B,EAE3B,MAAM,uCAAuC,CAAC;AA8D/C,qBAAa,kBAAmB,SAAQ,kBAAkB,CACxD,OAAO,yBAAyB,EAChC,OAAO,0BAA0B,CAClC;IACC,IAAI,SAA0B;IAC9B,WAAW,SAC2lB;IACtmB,WAAW;;;;;;MAMT;gBACU,MAAM,EAAE;QAAE,WAAW,EAAE,WAAW,CAAA;KAAE;IAQhD;;;OAGG;YACW,yBAAyB;YAqDzB,cAAc;YA2Bd,cAAc;YAuCd,SAAS;IA4BvB,OAAO,CAAC,YAAY;cAuDJ,OAAO,CACrB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,EAChD,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,cAAc,CAAC;CAsH3B"}
@@ -32,8 +32,9 @@ class GroundLocationTool extends MapboxApiBasedTool_js_1.MapboxApiBasedTool {
32
32
  * Falls back to 'neighborhood' if sampling is unavailable or classification fails.
33
33
  */
34
34
  async classifyGroundingStrategy(query, longitude, latitude) {
35
- const samplingCapability = this.server?.server.getClientCapabilities()?.sampling;
36
- if (!samplingCapability || !this.server) {
35
+ const server = this.activeServer;
36
+ const samplingCapability = server?.server.getClientCapabilities()?.sampling;
37
+ if (!samplingCapability || !server) {
37
38
  return 'neighborhood';
38
39
  }
39
40
  const contextHint = query ? ` The user also asked about: "${query}".` : '';
@@ -44,7 +45,7 @@ class GroundLocationTool extends MapboxApiBasedTool_js_1.MapboxApiBasedTool {
44
45
  `- "poi" — user wants nearby points of interest or places of a specific category\n` +
45
46
  `- "region" — user wants area/boundary context like travel-time zones or coverage areas`;
46
47
  try {
47
- const result = await this.server.server.createMessage({
48
+ const result = await server.server.createMessage({
48
49
  messages: [{ role: 'user', content: { type: 'text', text: prompt } }],
49
50
  maxTokens: 10
50
51
  });
@@ -107,7 +108,9 @@ class GroundLocationTool extends MapboxApiBasedTool_js_1.MapboxApiBasedTool {
107
108
  longitude: coords?.[0] ?? longitude,
108
109
  latitude: coords?.[1] ?? latitude,
109
110
  category: props.poi_category?.[0],
110
- distance_meters: props.distance
111
+ distance_meters: props.distance,
112
+ mapbox_id: props.mapbox_id,
113
+ external_ids: props.external_ids
111
114
  };
112
115
  });
113
116
  }