@mapbox/mcp-server 0.8.2 → 0.9.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 (177) hide show
  1. package/README.md +65 -12
  2. package/dist/commonjs/index.js +98 -7
  3. package/dist/commonjs/index.js.map +1 -1
  4. package/dist/commonjs/prompts/SearchAlongRoutePrompt.d.ts +26 -0
  5. package/dist/commonjs/prompts/SearchAlongRoutePrompt.d.ts.map +1 -0
  6. package/dist/commonjs/prompts/SearchAlongRoutePrompt.js +164 -0
  7. package/dist/commonjs/prompts/SearchAlongRoutePrompt.js.map +1 -0
  8. package/dist/commonjs/prompts/index.d.ts +41 -0
  9. package/dist/commonjs/prompts/index.d.ts.map +1 -0
  10. package/dist/commonjs/prompts/index.js +56 -0
  11. package/dist/commonjs/prompts/index.js.map +1 -0
  12. package/dist/commonjs/prompts/promptRegistry.d.ts +2 -1
  13. package/dist/commonjs/prompts/promptRegistry.d.ts.map +1 -1
  14. package/dist/commonjs/prompts/promptRegistry.js +2 -0
  15. package/dist/commonjs/prompts/promptRegistry.js.map +1 -1
  16. package/dist/commonjs/resources/index.d.ts +6 -0
  17. package/dist/commonjs/resources/index.d.ts.map +1 -0
  18. package/dist/commonjs/resources/index.js +43 -0
  19. package/dist/commonjs/resources/index.js.map +1 -0
  20. package/dist/commonjs/resources/resourceRegistry.d.ts +3 -1
  21. package/dist/commonjs/resources/resourceRegistry.d.ts.map +1 -1
  22. package/dist/commonjs/resources/resourceRegistry.js +5 -1
  23. package/dist/commonjs/resources/resourceRegistry.js.map +1 -1
  24. package/dist/commonjs/resources/temporary/TemporaryDataResource.d.ts +13 -0
  25. package/dist/commonjs/resources/temporary/TemporaryDataResource.d.ts.map +1 -0
  26. package/dist/commonjs/resources/temporary/TemporaryDataResource.js +41 -0
  27. package/dist/commonjs/resources/temporary/TemporaryDataResource.js.map +1 -0
  28. package/dist/commonjs/resources/ui-apps/StaticMapUIResource.d.ts +15 -0
  29. package/dist/commonjs/resources/ui-apps/StaticMapUIResource.d.ts.map +1 -0
  30. package/dist/commonjs/resources/ui-apps/StaticMapUIResource.js +262 -0
  31. package/dist/commonjs/resources/ui-apps/StaticMapUIResource.js.map +1 -0
  32. package/dist/commonjs/tools/BaseTool.d.ts +10 -0
  33. package/dist/commonjs/tools/BaseTool.d.ts.map +1 -1
  34. package/dist/commonjs/tools/BaseTool.js +9 -4
  35. package/dist/commonjs/tools/BaseTool.js.map +1 -1
  36. package/dist/commonjs/tools/category-search-tool/CategorySearchTool.d.ts.map +1 -1
  37. package/dist/commonjs/tools/category-search-tool/CategorySearchTool.input.schema.d.ts +2 -2
  38. package/dist/commonjs/tools/category-search-tool/CategorySearchTool.js +4 -0
  39. package/dist/commonjs/tools/category-search-tool/CategorySearchTool.js.map +1 -1
  40. package/dist/commonjs/tools/category-search-tool/CategorySearchTool.output.schema.d.ts +17846 -2030
  41. package/dist/commonjs/tools/category-search-tool/CategorySearchTool.output.schema.d.ts.map +1 -1
  42. package/dist/commonjs/tools/category-search-tool/CategorySearchTool.output.schema.js +73 -38
  43. package/dist/commonjs/tools/category-search-tool/CategorySearchTool.output.schema.js.map +1 -1
  44. package/dist/commonjs/tools/directions-tool/DirectionsTool.d.ts.map +1 -1
  45. package/dist/commonjs/tools/directions-tool/DirectionsTool.js +59 -2
  46. package/dist/commonjs/tools/directions-tool/DirectionsTool.js.map +1 -1
  47. package/dist/commonjs/tools/directions-tool/DirectionsTool.output.schema.d.ts +32 -32
  48. package/dist/commonjs/tools/index.d.ts +86 -0
  49. package/dist/commonjs/tools/index.d.ts.map +1 -0
  50. package/dist/commonjs/tools/index.js +146 -0
  51. package/dist/commonjs/tools/index.js.map +1 -0
  52. package/dist/commonjs/tools/place-details-tool/PlaceDetailsTool.d.ts +25 -0
  53. package/dist/commonjs/tools/place-details-tool/PlaceDetailsTool.d.ts.map +1 -0
  54. package/dist/commonjs/tools/place-details-tool/PlaceDetailsTool.input.schema.d.ts +25 -0
  55. package/dist/commonjs/tools/place-details-tool/PlaceDetailsTool.input.schema.d.ts.map +1 -0
  56. package/dist/commonjs/tools/place-details-tool/PlaceDetailsTool.input.schema.js +30 -0
  57. package/dist/commonjs/tools/place-details-tool/PlaceDetailsTool.input.schema.js.map +1 -0
  58. package/dist/commonjs/tools/place-details-tool/PlaceDetailsTool.js +193 -0
  59. package/dist/commonjs/tools/place-details-tool/PlaceDetailsTool.js.map +1 -0
  60. package/dist/commonjs/tools/place-details-tool/PlaceDetailsTool.output.schema.d.ts +296 -0
  61. package/dist/commonjs/tools/place-details-tool/PlaceDetailsTool.output.schema.d.ts.map +1 -0
  62. package/dist/commonjs/tools/place-details-tool/PlaceDetailsTool.output.schema.js +55 -0
  63. package/dist/commonjs/tools/place-details-tool/PlaceDetailsTool.output.schema.js.map +1 -0
  64. package/dist/commonjs/tools/reverse-geocode-tool/ReverseGeocodeTool.input.schema.d.ts +4 -4
  65. package/dist/commonjs/tools/reverse-geocode-tool/ReverseGeocodeTool.output.schema.d.ts +350 -350
  66. package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.d.ts.map +1 -1
  67. package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.input.schema.d.ts +4 -4
  68. package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.js +4 -0
  69. package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.js.map +1 -1
  70. package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.output.schema.d.ts +186 -186
  71. package/dist/commonjs/tools/static-map-image-tool/StaticMapImageTool.d.ts +9 -0
  72. package/dist/commonjs/tools/static-map-image-tool/StaticMapImageTool.d.ts.map +1 -1
  73. package/dist/commonjs/tools/static-map-image-tool/StaticMapImageTool.input.schema.d.ts +12 -12
  74. package/dist/commonjs/tools/static-map-image-tool/StaticMapImageTool.js +18 -30
  75. package/dist/commonjs/tools/static-map-image-tool/StaticMapImageTool.js.map +1 -1
  76. package/dist/commonjs/tools/toolRegistry.d.ts +52 -1
  77. package/dist/commonjs/tools/toolRegistry.d.ts.map +1 -1
  78. package/dist/commonjs/tools/toolRegistry.js +70 -5
  79. package/dist/commonjs/tools/toolRegistry.js.map +1 -1
  80. package/dist/commonjs/utils/index.d.ts +33 -0
  81. package/dist/commonjs/utils/index.d.ts.map +1 -0
  82. package/dist/commonjs/utils/index.js +45 -0
  83. package/dist/commonjs/utils/index.js.map +1 -0
  84. package/dist/commonjs/utils/temporaryResourceManager.d.ts +51 -0
  85. package/dist/commonjs/utils/temporaryResourceManager.d.ts.map +1 -0
  86. package/dist/commonjs/utils/temporaryResourceManager.js +92 -0
  87. package/dist/commonjs/utils/temporaryResourceManager.js.map +1 -0
  88. package/dist/commonjs/version.json +3 -3
  89. package/dist/esm/index.js +99 -8
  90. package/dist/esm/index.js.map +1 -1
  91. package/dist/esm/prompts/SearchAlongRoutePrompt.d.ts +26 -0
  92. package/dist/esm/prompts/SearchAlongRoutePrompt.d.ts.map +1 -0
  93. package/dist/esm/prompts/SearchAlongRoutePrompt.js +160 -0
  94. package/dist/esm/prompts/SearchAlongRoutePrompt.js.map +1 -0
  95. package/dist/esm/prompts/index.d.ts +41 -0
  96. package/dist/esm/prompts/index.d.ts.map +1 -0
  97. package/dist/esm/prompts/index.js +47 -0
  98. package/dist/esm/prompts/index.js.map +1 -0
  99. package/dist/esm/prompts/promptRegistry.d.ts +2 -1
  100. package/dist/esm/prompts/promptRegistry.d.ts.map +1 -1
  101. package/dist/esm/prompts/promptRegistry.js +2 -0
  102. package/dist/esm/prompts/promptRegistry.js.map +1 -1
  103. package/dist/esm/resources/index.d.ts +6 -0
  104. package/dist/esm/resources/index.d.ts.map +1 -0
  105. package/dist/esm/resources/index.js +37 -0
  106. package/dist/esm/resources/index.js.map +1 -0
  107. package/dist/esm/resources/resourceRegistry.d.ts +3 -1
  108. package/dist/esm/resources/resourceRegistry.d.ts.map +1 -1
  109. package/dist/esm/resources/resourceRegistry.js +5 -1
  110. package/dist/esm/resources/resourceRegistry.js.map +1 -1
  111. package/dist/esm/resources/temporary/TemporaryDataResource.d.ts +13 -0
  112. package/dist/esm/resources/temporary/TemporaryDataResource.d.ts.map +1 -0
  113. package/dist/esm/resources/temporary/TemporaryDataResource.js +37 -0
  114. package/dist/esm/resources/temporary/TemporaryDataResource.js.map +1 -0
  115. package/dist/esm/resources/ui-apps/StaticMapUIResource.d.ts +15 -0
  116. package/dist/esm/resources/ui-apps/StaticMapUIResource.d.ts.map +1 -0
  117. package/dist/esm/resources/ui-apps/StaticMapUIResource.js +258 -0
  118. package/dist/esm/resources/ui-apps/StaticMapUIResource.js.map +1 -0
  119. package/dist/esm/tools/BaseTool.d.ts +10 -0
  120. package/dist/esm/tools/BaseTool.d.ts.map +1 -1
  121. package/dist/esm/tools/BaseTool.js +9 -4
  122. package/dist/esm/tools/BaseTool.js.map +1 -1
  123. package/dist/esm/tools/category-search-tool/CategorySearchTool.d.ts.map +1 -1
  124. package/dist/esm/tools/category-search-tool/CategorySearchTool.input.schema.d.ts +2 -2
  125. package/dist/esm/tools/category-search-tool/CategorySearchTool.js +4 -0
  126. package/dist/esm/tools/category-search-tool/CategorySearchTool.js.map +1 -1
  127. package/dist/esm/tools/category-search-tool/CategorySearchTool.output.schema.d.ts +17846 -2030
  128. package/dist/esm/tools/category-search-tool/CategorySearchTool.output.schema.d.ts.map +1 -1
  129. package/dist/esm/tools/category-search-tool/CategorySearchTool.output.schema.js +73 -38
  130. package/dist/esm/tools/category-search-tool/CategorySearchTool.output.schema.js.map +1 -1
  131. package/dist/esm/tools/directions-tool/DirectionsTool.d.ts.map +1 -1
  132. package/dist/esm/tools/directions-tool/DirectionsTool.js +59 -2
  133. package/dist/esm/tools/directions-tool/DirectionsTool.js.map +1 -1
  134. package/dist/esm/tools/directions-tool/DirectionsTool.output.schema.d.ts +32 -32
  135. package/dist/esm/tools/index.d.ts +86 -0
  136. package/dist/esm/tools/index.d.ts.map +1 -0
  137. package/dist/esm/tools/index.js +118 -0
  138. package/dist/esm/tools/index.js.map +1 -0
  139. package/dist/esm/tools/place-details-tool/PlaceDetailsTool.d.ts +25 -0
  140. package/dist/esm/tools/place-details-tool/PlaceDetailsTool.d.ts.map +1 -0
  141. package/dist/esm/tools/place-details-tool/PlaceDetailsTool.input.schema.d.ts +25 -0
  142. package/dist/esm/tools/place-details-tool/PlaceDetailsTool.input.schema.d.ts.map +1 -0
  143. package/dist/esm/tools/place-details-tool/PlaceDetailsTool.input.schema.js +24 -0
  144. package/dist/esm/tools/place-details-tool/PlaceDetailsTool.input.schema.js.map +1 -0
  145. package/dist/esm/tools/place-details-tool/PlaceDetailsTool.js +189 -0
  146. package/dist/esm/tools/place-details-tool/PlaceDetailsTool.js.map +1 -0
  147. package/dist/esm/tools/place-details-tool/PlaceDetailsTool.output.schema.d.ts +296 -0
  148. package/dist/esm/tools/place-details-tool/PlaceDetailsTool.output.schema.d.ts.map +1 -0
  149. package/dist/esm/tools/place-details-tool/PlaceDetailsTool.output.schema.js +52 -0
  150. package/dist/esm/tools/place-details-tool/PlaceDetailsTool.output.schema.js.map +1 -0
  151. package/dist/esm/tools/reverse-geocode-tool/ReverseGeocodeTool.input.schema.d.ts +4 -4
  152. package/dist/esm/tools/reverse-geocode-tool/ReverseGeocodeTool.output.schema.d.ts +350 -350
  153. package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.d.ts.map +1 -1
  154. package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.input.schema.d.ts +4 -4
  155. package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.js +4 -0
  156. package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.js.map +1 -1
  157. package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.output.schema.d.ts +186 -186
  158. package/dist/esm/tools/static-map-image-tool/StaticMapImageTool.d.ts +9 -0
  159. package/dist/esm/tools/static-map-image-tool/StaticMapImageTool.d.ts.map +1 -1
  160. package/dist/esm/tools/static-map-image-tool/StaticMapImageTool.input.schema.d.ts +12 -12
  161. package/dist/esm/tools/static-map-image-tool/StaticMapImageTool.js +18 -30
  162. package/dist/esm/tools/static-map-image-tool/StaticMapImageTool.js.map +1 -1
  163. package/dist/esm/tools/toolRegistry.d.ts +52 -1
  164. package/dist/esm/tools/toolRegistry.d.ts.map +1 -1
  165. package/dist/esm/tools/toolRegistry.js +66 -4
  166. package/dist/esm/tools/toolRegistry.js.map +1 -1
  167. package/dist/esm/utils/index.d.ts +33 -0
  168. package/dist/esm/utils/index.d.ts.map +1 -0
  169. package/dist/esm/utils/index.js +36 -0
  170. package/dist/esm/utils/index.js.map +1 -0
  171. package/dist/esm/utils/temporaryResourceManager.d.ts +51 -0
  172. package/dist/esm/utils/temporaryResourceManager.d.ts.map +1 -0
  173. package/dist/esm/utils/temporaryResourceManager.js +88 -0
  174. package/dist/esm/utils/temporaryResourceManager.js.map +1 -0
  175. package/dist/esm/version.json +3 -3
  176. package/package.json +54 -8
  177. /package/patches/{@modelcontextprotocol+sdk+1.25.2.patch → @modelcontextprotocol+sdk+1.26.0.patch} +0 -0
@@ -13,6 +13,15 @@ export declare class StaticMapImageTool extends MapboxApiBasedTool<typeof Static
13
13
  idempotentHint: boolean;
14
14
  openWorldHint: boolean;
15
15
  };
16
+ readonly meta: {
17
+ ui: {
18
+ resourceUri: string;
19
+ csp: {
20
+ connectDomains: string[];
21
+ resourceDomains: string[];
22
+ };
23
+ };
24
+ };
16
25
  constructor(params: {
17
26
  httpRequest: HttpRequest;
18
27
  });
@@ -1 +1 @@
1
- {"version":3,"file":"StaticMapImageTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/static-map-image-tool/StaticMapImageTool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OA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,8 @@ export declare const MarkerOverlaySchema: z.ZodObject<{
17
17
  type: "marker";
18
18
  longitude: number;
19
19
  latitude: number;
20
- color?: string | undefined;
21
20
  size?: "small" | "large" | undefined;
21
+ color?: string | undefined;
22
22
  label?: string | undefined;
23
23
  }>;
24
24
  export declare const CustomMarkerOverlaySchema: z.ZodObject<{
@@ -27,13 +27,13 @@ export declare const CustomMarkerOverlaySchema: z.ZodObject<{
27
27
  latitude: z.ZodNumber;
28
28
  url: z.ZodString;
29
29
  }, "strip", z.ZodTypeAny, {
30
- url: string;
31
30
  type: "custom-marker";
31
+ url: string;
32
32
  longitude: number;
33
33
  latitude: number;
34
34
  }, {
35
- url: string;
36
35
  type: "custom-marker";
36
+ url: string;
37
37
  longitude: number;
38
38
  latitude: number;
39
39
  }>;
@@ -90,8 +90,8 @@ export declare const OverlaySchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject
90
90
  type: "marker";
91
91
  longitude: number;
92
92
  latitude: number;
93
- color?: string | undefined;
94
93
  size?: "small" | "large" | undefined;
94
+ color?: string | undefined;
95
95
  label?: string | undefined;
96
96
  }>, z.ZodObject<{
97
97
  type: z.ZodLiteral<"custom-marker">;
@@ -99,13 +99,13 @@ export declare const OverlaySchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject
99
99
  latitude: z.ZodNumber;
100
100
  url: z.ZodString;
101
101
  }, "strip", z.ZodTypeAny, {
102
- url: string;
103
102
  type: "custom-marker";
103
+ url: string;
104
104
  longitude: number;
105
105
  latitude: number;
106
106
  }, {
107
- url: string;
108
107
  type: "custom-marker";
108
+ url: string;
109
109
  longitude: number;
110
110
  latitude: number;
111
111
  }>, z.ZodObject<{
@@ -184,8 +184,8 @@ export declare const StaticMapImageInputSchema: z.ZodObject<{
184
184
  type: "marker";
185
185
  longitude: number;
186
186
  latitude: number;
187
- color?: string | undefined;
188
187
  size?: "small" | "large" | undefined;
188
+ color?: string | undefined;
189
189
  label?: string | undefined;
190
190
  }>, z.ZodObject<{
191
191
  type: z.ZodLiteral<"custom-marker">;
@@ -193,13 +193,13 @@ export declare const StaticMapImageInputSchema: z.ZodObject<{
193
193
  latitude: z.ZodNumber;
194
194
  url: z.ZodString;
195
195
  }, "strip", z.ZodTypeAny, {
196
- url: string;
197
196
  type: "custom-marker";
197
+ url: string;
198
198
  longitude: number;
199
199
  latitude: number;
200
200
  }, {
201
- url: string;
202
201
  type: "custom-marker";
202
+ url: string;
203
203
  longitude: number;
204
204
  latitude: number;
205
205
  }>, z.ZodObject<{
@@ -256,8 +256,8 @@ export declare const StaticMapImageInputSchema: z.ZodObject<{
256
256
  color?: string | undefined;
257
257
  label?: string | undefined;
258
258
  } | {
259
- url: string;
260
259
  type: "custom-marker";
260
+ url: string;
261
261
  longitude: number;
262
262
  latitude: number;
263
263
  } | {
@@ -288,12 +288,12 @@ export declare const StaticMapImageInputSchema: z.ZodObject<{
288
288
  type: "marker";
289
289
  longitude: number;
290
290
  latitude: number;
291
- color?: string | undefined;
292
291
  size?: "small" | "large" | undefined;
292
+ color?: string | undefined;
293
293
  label?: string | undefined;
294
294
  } | {
295
- url: string;
296
295
  type: "custom-marker";
296
+ url: string;
297
297
  longitude: number;
298
298
  latitude: number;
299
299
  } | {
@@ -1,5 +1,6 @@
1
1
  // Copyright (c) Mapbox, Inc.
2
2
  // Licensed under the MIT License.
3
+ import { randomUUID } from 'node:crypto';
3
4
  import { createUIResource } from '@mcp-ui/server';
4
5
  import { MapboxApiBasedTool } from '../MapboxApiBasedTool.js';
5
6
  import { StaticMapImageInputSchema } from './StaticMapImageTool.input.schema.js';
@@ -14,6 +15,15 @@ export class StaticMapImageTool extends MapboxApiBasedTool {
14
15
  idempotentHint: true,
15
16
  openWorldHint: true
16
17
  };
18
+ meta = {
19
+ ui: {
20
+ resourceUri: 'ui://mapbox/static-map/index.html',
21
+ csp: {
22
+ connectDomains: ['https://api.mapbox.com'],
23
+ resourceDomains: ['https://api.mapbox.com']
24
+ }
25
+ }
26
+ };
17
27
  constructor(params) {
18
28
  super({
19
29
  inputSchema: StaticMapImageInputSchema,
@@ -73,42 +83,17 @@ export class StaticMapImageTool extends MapboxApiBasedTool {
73
83
  }
74
84
  const density = input.highDensity ? '@2x' : '';
75
85
  const url = `${MapboxApiBasedTool.mapboxApiEndpoint}styles/v1/${input.style}/static/${overlayString}${lng},${lat},${input.zoom}/${width}x${height}${density}?access_token=${accessToken}`;
86
+ // Fetch and encode image as base64 for clients without MCP Apps support
76
87
  const response = await this.httpRequest(url);
77
- if (!response.ok) {
78
- const errorMessage = await this.getErrorMessage(response);
79
- return {
80
- content: [
81
- {
82
- type: 'text',
83
- text: `Static Map API error: ${errorMessage}`
84
- }
85
- ],
86
- isError: true
87
- };
88
- }
89
88
  const buffer = await response.arrayBuffer();
90
89
  const base64Data = Buffer.from(buffer).toString('base64');
91
- // Determine MIME type based on style (raster-only styles return JPEG)
92
90
  const isRasterStyle = input.style.includes('satellite');
93
91
  const mimeType = isRasterStyle ? 'image/jpeg' : 'image/png';
94
- // Build descriptive text with map metadata (Issue #103)
95
- // Text content provides additional context alongside the image
96
- const textDescription = [
97
- 'Static map image generated successfully.',
98
- `Center: ${lat}, ${lng}`,
99
- `Zoom: ${input.zoom}`,
100
- `Size: ${width}x${height}${input.highDensity ? ' @2x' : ''}`,
101
- `Style: ${input.style}`,
102
- input.overlays?.length ? `Overlays: ${input.overlays.length}` : null
103
- ]
104
- .filter(Boolean)
105
- .join('\n');
106
- // Build content array with text first, then image
107
- // Per MCP spec, content array can have multiple items of different types
92
+ // content[0] MUST be the URL text MCP Apps UI finds it via content.find(c => c.type === 'text')
108
93
  const content = [
109
94
  {
110
95
  type: 'text',
111
- text: textDescription
96
+ text: url
112
97
  },
113
98
  {
114
99
  type: 'image',
@@ -116,7 +101,7 @@ export class StaticMapImageTool extends MapboxApiBasedTool {
116
101
  mimeType
117
102
  }
118
103
  ];
119
- // Conditionally add MCP-UI resource if enabled
104
+ // Conditionally add MCP-UI resource if enabled (backward compatibility)
120
105
  if (isMcpUiEnabled()) {
121
106
  const uiResource = createUIResource({
122
107
  uri: `ui://mapbox/static-map/${input.style}/${lng},${lat},${input.zoom}`,
@@ -133,7 +118,10 @@ export class StaticMapImageTool extends MapboxApiBasedTool {
133
118
  }
134
119
  return {
135
120
  content,
136
- isError: false
121
+ isError: false,
122
+ _meta: {
123
+ viewUUID: randomUUID()
124
+ }
137
125
  };
138
126
  }
139
127
  }
@@ -1 +1 @@
1
- {"version":3,"file":"StaticMapImageTool.js","sourceRoot":"","sources":["../../../../src/tools/static-map-image-tool/StaticMapImageTool.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,kCAAkC;AAGlC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAGjF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,MAAM,OAAO,kBAAmB,SAAQ,kBAEvC;IACC,IAAI,GAAG,uBAAuB,CAAC;IAC/B,WAAW,GACT,sQAAsQ,CAAC;IACzQ,WAAW,GAAG;QACZ,KAAK,EAAE,uBAAuB;QAC9B,YAAY,EAAE,IAAI;QAClB,eAAe,EAAE,KAAK;QACtB,cAAc,EAAE,IAAI;QACpB,aAAa,EAAE,IAAI;KACpB,CAAC;IAEF,YAAY,MAAoC;QAC9C,KAAK,CAAC;YACJ,WAAW,EAAE,yBAAyB;YACtC,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAC,CAAC;IACL,CAAC;IAEO,aAAa,CAAC,OAAsC;QAC1D,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;YACrB,KAAK,QAAQ,CAAC,CAAC,CAAC;gBACd,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;gBAC1D,IAAI,MAA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;aACT;SACF,CAAC;QAEF,+CAA+C;QAC/C,IAAI,cAAc,EAAE,EAAE,CAAC;YACrB,MAAM,UAAU,GAAG,gBAAgB,CAAC;gBAClC,GAAG,EAAE,0BAA0B,KAAK,CAAC,KAAK,IAAI,GAAG,IAAI,GAAG,IAAI,KAAK,CAAC,IAAI,EAAE;gBACxE,OAAO,EAAE;oBACP,IAAI,EAAE,aAAa;oBACnB,SAAS,EAAE,GAAG;iBACf;gBACD,QAAQ,EAAE,MAAM;gBAChB,UAAU,EAAE;oBACV,sBAAsB,EAAE,CAAC,GAAG,KAAK,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC;iBACtD;aACF,CAAC,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3B,CAAC;QAED,OAAO;YACL,OAAO;YACP,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;CACF"}
1
+ {"version":3,"file":"StaticMapImageTool.js","sourceRoot":"","sources":["../../../../src/tools/static-map-image-tool/StaticMapImageTool.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAGjF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,MAAM,OAAO,kBAAmB,SAAQ,kBAEvC;IACC,IAAI,GAAG,uBAAuB,CAAC;IAC/B,WAAW,GACT,sQAAsQ,CAAC;IACzQ,WAAW,GAAG;QACZ,KAAK,EAAE,uBAAuB;QAC9B,YAAY,EAAE,IAAI;QAClB,eAAe,EAAE,KAAK;QACtB,cAAc,EAAE,IAAI;QACpB,aAAa,EAAE,IAAI;KACpB,CAAC;IACO,IAAI,GAAG;QAC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SAAS,EAAE,GAAG;iBACf;gBACD,QAAQ,EAAE,MAAM;gBAChB,UAAU,EAAE;oBACV,sBAAsB,EAAE,CAAC,GAAG,KAAK,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC;iBACtD;aACF,CAAC,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3B,CAAC;QAED,OAAO;YACL,OAAO;YACP,OAAO,EAAE,KAAK;YACd,KAAK,EAAE;gBACL,QAAQ,EAAE,UAAU,EAAE;aACvB;SACF,CAAC;IACJ,CAAC;CACF"}
@@ -1,3 +1,4 @@
1
+ import { PlaceDetailsTool } from './place-details-tool/PlaceDetailsTool.js';
1
2
  import { SimplifyTool } from './simplify-tool/SimplifyTool.js';
2
3
  import { BoundingBoxTool } from './bounding-box-tool/BoundingBoxTool.js';
3
4
  import { CentroidTool } from './centroid-tool/CentroidTool.js';
@@ -19,8 +20,58 @@ import { ReverseGeocodeTool } from './reverse-geocode-tool/ReverseGeocodeTool.js
19
20
  import { StaticMapImageTool } from './static-map-image-tool/StaticMapImageTool.js';
20
21
  import { SearchAndGeocodeTool } from './search-and-geocode-tool/SearchAndGeocodeTool.js';
21
22
  import { VersionTool } from './version-tool/VersionTool.js';
22
- export declare const ALL_TOOLS: readonly [SimplifyTool, BoundingBoxTool, CentroidTool, MidpointTool, BearingTool, AreaTool, BufferTool, PointInPolygonTool, DistanceTool, VersionTool, ResourceReaderTool, CategoryListTool, CategorySearchTool, DirectionsTool, IsochroneTool, MapMatchingTool, MatrixTool, OptimizationTool, ReverseGeocodeTool, StaticMapImageTool, SearchAndGeocodeTool];
23
+ /**
24
+ * Core tools that work in all MCP clients without requiring special capabilities
25
+ * These tools are registered immediately during server startup
26
+ */
27
+ export declare const CORE_TOOLS: readonly [PlaceDetailsTool, SimplifyTool, BoundingBoxTool, CentroidTool, MidpointTool, BearingTool, AreaTool, BufferTool, PointInPolygonTool, DistanceTool, VersionTool, CategorySearchTool, DirectionsTool, IsochroneTool, MapMatchingTool, MatrixTool, OptimizationTool, ReverseGeocodeTool, StaticMapImageTool, SearchAndGeocodeTool];
28
+ /**
29
+ * Tools that require elicitation capability for optimal functionality
30
+ * These tools use elicitInput() for secure token management
31
+ * Registered only if client supports elicitation
32
+ *
33
+ * Currently empty - elicitation support will be added in a future PR.
34
+ * This category is ready for tools that require the elicitation capability.
35
+ */
36
+ export declare const ELICITATION_TOOLS: readonly [];
37
+ /**
38
+ * Tools that serve as bridges for clients without resource support
39
+ * These tools are only registered if CLIENT_NEEDS_RESOURCE_FALLBACK env var is set to "true"
40
+ *
41
+ * Context: Most MCP clients support resources (Claude Desktop, VS Code, Inspector, etc.).
42
+ * However, some clients (like smolagents) don't support resources at all.
43
+ * These tools provide the same content as resources but via tool calls instead.
44
+ *
45
+ * Configuration:
46
+ * - Leave unset (default) = Skip these tools (assumes client supports resources)
47
+ * - Set CLIENT_NEEDS_RESOURCE_FALLBACK=true = Include these tools (for smolagents, etc.)
48
+ *
49
+ * Tools:
50
+ * - ResourceReaderTool: Generic fallback for reading any resource by URI
51
+ * - CategoryListTool: Provides access to category list (mapbox://categories)
52
+ */
53
+ export declare const RESOURCE_FALLBACK_TOOLS: readonly [ResourceReaderTool, CategoryListTool];
54
+ /**
55
+ * All tools combined (for backward compatibility and testing)
56
+ */
57
+ export declare const ALL_TOOLS: readonly [PlaceDetailsTool, SimplifyTool, BoundingBoxTool, CentroidTool, MidpointTool, BearingTool, AreaTool, BufferTool, PointInPolygonTool, DistanceTool, VersionTool, CategorySearchTool, DirectionsTool, IsochroneTool, MapMatchingTool, MatrixTool, OptimizationTool, ReverseGeocodeTool, StaticMapImageTool, SearchAndGeocodeTool, ResourceReaderTool, CategoryListTool];
23
58
  export type ToolInstance = (typeof ALL_TOOLS)[number];
59
+ /**
60
+ * Get all tools (for backward compatibility)
61
+ * @deprecated Use getCoreTools(), getElicitationTools(), etc. instead for capability-aware registration
62
+ */
24
63
  export declare function getAllTools(): readonly ToolInstance[];
64
+ /**
65
+ * Get tools that work in all MCP clients
66
+ */
67
+ export declare function getCoreTools(): readonly ToolInstance[];
68
+ /**
69
+ * Get tools that require elicitation capability
70
+ */
71
+ export declare function getElicitationTools(): readonly ToolInstance[];
72
+ /**
73
+ * Get tools that serve as fallbacks when client doesn't support resources
74
+ */
75
+ export declare function getResourceFallbackTools(): readonly ToolInstance[];
25
76
  export declare function getToolByName(name: string): ToolInstance | undefined;
26
77
  //# sourceMappingURL=toolRegistry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolRegistry.d.ts","sourceRoot":"","sources":["../../../src/tools/toolRegistry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,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ERE
4
+ import { PlaceDetailsTool } from './place-details-tool/PlaceDetailsTool.js';
4
5
  import { SimplifyTool } from './simplify-tool/SimplifyTool.js';
5
6
  import { BoundingBoxTool } from './bounding-box-tool/BoundingBoxTool.js';
6
7
  import { CentroidTool } from './centroid-tool/CentroidTool.js';
@@ -23,9 +24,13 @@ import { StaticMapImageTool } from './static-map-image-tool/StaticMapImageTool.j
23
24
  import { SearchAndGeocodeTool } from './search-and-geocode-tool/SearchAndGeocodeTool.js';
24
25
  import { VersionTool } from './version-tool/VersionTool.js';
25
26
  import { httpRequest } from '../utils/httpPipeline.js';
26
- // Central registry of all tools
27
- export const ALL_TOOLS = [
27
+ /**
28
+ * Core tools that work in all MCP clients without requiring special capabilities
29
+ * These tools are registered immediately during server startup
30
+ */
31
+ export const CORE_TOOLS = [
28
32
  // INSERT NEW TOOL INSTANCE HERE
33
+ new PlaceDetailsTool({ httpRequest }),
29
34
  new SimplifyTool(),
30
35
  new BoundingBoxTool(),
31
36
  new CentroidTool(),
@@ -36,8 +41,6 @@ export const ALL_TOOLS = [
36
41
  new PointInPolygonTool(),
37
42
  new DistanceTool(),
38
43
  new VersionTool(),
39
- new ResourceReaderTool(),
40
- new CategoryListTool({ httpRequest }),
41
44
  new CategorySearchTool({ httpRequest }),
42
45
  new DirectionsTool({ httpRequest }),
43
46
  new IsochroneTool({ httpRequest }),
@@ -48,9 +51,68 @@ export const ALL_TOOLS = [
48
51
  new StaticMapImageTool({ httpRequest }),
49
52
  new SearchAndGeocodeTool({ httpRequest })
50
53
  ];
54
+ /**
55
+ * Tools that require elicitation capability for optimal functionality
56
+ * These tools use elicitInput() for secure token management
57
+ * Registered only if client supports elicitation
58
+ *
59
+ * Currently empty - elicitation support will be added in a future PR.
60
+ * This category is ready for tools that require the elicitation capability.
61
+ */
62
+ export const ELICITATION_TOOLS = [];
63
+ /**
64
+ * Tools that serve as bridges for clients without resource support
65
+ * These tools are only registered if CLIENT_NEEDS_RESOURCE_FALLBACK env var is set to "true"
66
+ *
67
+ * Context: Most MCP clients support resources (Claude Desktop, VS Code, Inspector, etc.).
68
+ * However, some clients (like smolagents) don't support resources at all.
69
+ * These tools provide the same content as resources but via tool calls instead.
70
+ *
71
+ * Configuration:
72
+ * - Leave unset (default) = Skip these tools (assumes client supports resources)
73
+ * - Set CLIENT_NEEDS_RESOURCE_FALLBACK=true = Include these tools (for smolagents, etc.)
74
+ *
75
+ * Tools:
76
+ * - ResourceReaderTool: Generic fallback for reading any resource by URI
77
+ * - CategoryListTool: Provides access to category list (mapbox://categories)
78
+ */
79
+ export const RESOURCE_FALLBACK_TOOLS = [
80
+ new ResourceReaderTool(),
81
+ new CategoryListTool({ httpRequest })
82
+ ];
83
+ /**
84
+ * All tools combined (for backward compatibility and testing)
85
+ */
86
+ export const ALL_TOOLS = [
87
+ ...CORE_TOOLS,
88
+ ...ELICITATION_TOOLS,
89
+ ...RESOURCE_FALLBACK_TOOLS
90
+ ];
91
+ /**
92
+ * Get all tools (for backward compatibility)
93
+ * @deprecated Use getCoreTools(), getElicitationTools(), etc. instead for capability-aware registration
94
+ */
51
95
  export function getAllTools() {
52
96
  return ALL_TOOLS;
53
97
  }
98
+ /**
99
+ * Get tools that work in all MCP clients
100
+ */
101
+ export function getCoreTools() {
102
+ return CORE_TOOLS;
103
+ }
104
+ /**
105
+ * Get tools that require elicitation capability
106
+ */
107
+ export function getElicitationTools() {
108
+ return ELICITATION_TOOLS;
109
+ }
110
+ /**
111
+ * Get tools that serve as fallbacks when client doesn't support resources
112
+ */
113
+ export function getResourceFallbackTools() {
114
+ return RESOURCE_FALLBACK_TOOLS;
115
+ }
54
116
  export function getToolByName(name) {
55
117
  return ALL_TOOLS.find((tool) => tool.name === name);
56
118
  }
@@ -1 +1 @@
1
- {"version":3,"file":"toolRegistry.js","sourceRoot":"","sources":["../../../src/tools/toolRegistry.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,kCAAkC;AAElC,8BAA8B;AAC9B,OAAO,EAAE,YAAY,EAA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O,uBAAuB,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACtD,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @module utils
3
+ *
4
+ * Public API for Mapbox MCP utilities. This module exports the HTTP pipeline
5
+ * system for making requests to Mapbox APIs with built-in policies like
6
+ * User-Agent, Retry, and Tracing.
7
+ *
8
+ * @example Using the default pipeline
9
+ * ```typescript
10
+ * import { httpRequest } from '@mapbox/mcp-server/utils';
11
+ * import { DirectionsTool } from '@mapbox/mcp-server/tools';
12
+ *
13
+ * // Use the pre-configured default pipeline
14
+ * const tool = new DirectionsTool({ httpRequest });
15
+ * ```
16
+ *
17
+ * @example Creating a custom pipeline
18
+ * ```typescript
19
+ * import { HttpPipeline, UserAgentPolicy, RetryPolicy } from '@mapbox/mcp-server/utils';
20
+ * import { DirectionsTool } from '@mapbox/mcp-server/tools';
21
+ *
22
+ * // Create a custom pipeline with your own policies
23
+ * const pipeline = new HttpPipeline();
24
+ * pipeline.usePolicy(new UserAgentPolicy('MyApp/1.0.0'));
25
+ * pipeline.usePolicy(new RetryPolicy(5, 300, 3000)); // More aggressive retry
26
+ *
27
+ * const tool = new DirectionsTool({ httpRequest: pipeline.execute.bind(pipeline) });
28
+ * ```
29
+ */
30
+ export { httpRequest, systemHttpPipeline } from './httpPipeline.js';
31
+ export { HttpPipeline, UserAgentPolicy, RetryPolicy, TracingPolicy, type HttpPolicy } from './httpPipeline.js';
32
+ export type { HttpRequest, TracedRequestInit } from './types.js';
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGpE,OAAO,EACL,YAAY,EACZ,eAAe,EACf,WAAW,EACX,aAAa,EACb,KAAK,UAAU,EAChB,MAAM,mBAAmB,CAAC;AAG3B,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,36 @@
1
+ // Copyright (c) Mapbox, Inc.
2
+ // Licensed under the MIT License.
3
+ /**
4
+ * @module utils
5
+ *
6
+ * Public API for Mapbox MCP utilities. This module exports the HTTP pipeline
7
+ * system for making requests to Mapbox APIs with built-in policies like
8
+ * User-Agent, Retry, and Tracing.
9
+ *
10
+ * @example Using the default pipeline
11
+ * ```typescript
12
+ * import { httpRequest } from '@mapbox/mcp-server/utils';
13
+ * import { DirectionsTool } from '@mapbox/mcp-server/tools';
14
+ *
15
+ * // Use the pre-configured default pipeline
16
+ * const tool = new DirectionsTool({ httpRequest });
17
+ * ```
18
+ *
19
+ * @example Creating a custom pipeline
20
+ * ```typescript
21
+ * import { HttpPipeline, UserAgentPolicy, RetryPolicy } from '@mapbox/mcp-server/utils';
22
+ * import { DirectionsTool } from '@mapbox/mcp-server/tools';
23
+ *
24
+ * // Create a custom pipeline with your own policies
25
+ * const pipeline = new HttpPipeline();
26
+ * pipeline.usePolicy(new UserAgentPolicy('MyApp/1.0.0'));
27
+ * pipeline.usePolicy(new RetryPolicy(5, 300, 3000)); // More aggressive retry
28
+ *
29
+ * const tool = new DirectionsTool({ httpRequest: pipeline.execute.bind(pipeline) });
30
+ * ```
31
+ */
32
+ // Export the pre-configured default HTTP pipeline
33
+ export { httpRequest, systemHttpPipeline } from './httpPipeline.js';
34
+ // Export HTTP pipeline classes and interfaces for custom pipelines
35
+ export { HttpPipeline, UserAgentPolicy, RetryPolicy, TracingPolicy } from './httpPipeline.js';
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,kCAAkC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,kDAAkD;AAClD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEpE,mEAAmE;AACnE,OAAO,EACL,YAAY,EACZ,eAAe,EACf,WAAW,EACX,aAAa,EAEd,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Manager for temporary resources created from large tool responses.
3
+ * Resources are stored in-memory with configurable TTL.
4
+ */
5
+ export interface TemporaryResource {
6
+ id: string;
7
+ uri: string;
8
+ data: unknown;
9
+ created: number;
10
+ ttl: number;
11
+ metadata?: {
12
+ toolName?: string;
13
+ size?: number;
14
+ };
15
+ }
16
+ export declare class TemporaryResourceManager {
17
+ private defaultTTL;
18
+ private resources;
19
+ private cleanupInterval?;
20
+ constructor(defaultTTL?: number);
21
+ /**
22
+ * Create a temporary resource
23
+ */
24
+ create(id: string, uri: string, data: unknown, metadata?: TemporaryResource['metadata'], ttl?: number): TemporaryResource;
25
+ /**
26
+ * Get a resource by URI
27
+ */
28
+ get(uri: string): TemporaryResource | undefined;
29
+ /**
30
+ * Delete a resource
31
+ */
32
+ delete(uri: string): boolean;
33
+ /**
34
+ * Clean up expired resources
35
+ */
36
+ cleanup(): number;
37
+ /**
38
+ * Get count of active resources
39
+ */
40
+ count(): number;
41
+ /**
42
+ * Clear all resources
43
+ */
44
+ clear(): void;
45
+ /**
46
+ * Stop cleanup interval
47
+ */
48
+ destroy(): void;
49
+ }
50
+ export declare const temporaryResourceManager: TemporaryResourceManager;
51
+ //# sourceMappingURL=temporaryResourceManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"temporaryResourceManager.d.ts","sourceRoot":"","sources":["../../../src/utils/temporaryResourceManager.ts"],"names":[],"mappings":"AAGA;;;GAGG;AAEH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE;QACT,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,qBAAa,wBAAwB;IAKjC,OAAO,CAAC,UAAU;IAJpB,OAAO,CAAC,SAAS,CAAwC;IACzD,OAAO,CAAC,eAAe,CAAC,CAAiB;gBAG/B,UAAU,GAAE,MAAuB;IAM7C;;OAEG;IACH,MAAM,CACJ,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,OAAO,EACb,QAAQ,CAAC,EAAE,iBAAiB,CAAC,UAAU,CAAC,EACxC,GAAG,CAAC,EAAE,MAAM,GACX,iBAAiB;IAcpB;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS;IAgB/C;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAI5B;;OAEG;IACH,OAAO,IAAI,MAAM;IAcjB;;OAEG;IACH,KAAK,IAAI,MAAM;IAIf;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,OAAO,IAAI,IAAI;CAOhB;AAGD,eAAO,MAAM,wBAAwB,0BAAiC,CAAC"}
@@ -0,0 +1,88 @@
1
+ // Copyright (c) Mapbox, Inc.
2
+ // Licensed under the MIT License.
3
+ export class TemporaryResourceManager {
4
+ defaultTTL;
5
+ resources = new Map();
6
+ cleanupInterval;
7
+ constructor(defaultTTL = 30 * 60 * 1000 // 30 minutes
8
+ ) {
9
+ this.defaultTTL = defaultTTL;
10
+ // Run cleanup every 5 minutes
11
+ this.cleanupInterval = setInterval(() => this.cleanup(), 5 * 60 * 1000);
12
+ }
13
+ /**
14
+ * Create a temporary resource
15
+ */
16
+ create(id, uri, data, metadata, ttl) {
17
+ const resource = {
18
+ id,
19
+ uri,
20
+ data,
21
+ created: Date.now(),
22
+ ttl: ttl ?? this.defaultTTL,
23
+ metadata
24
+ };
25
+ this.resources.set(uri, resource);
26
+ return resource;
27
+ }
28
+ /**
29
+ * Get a resource by URI
30
+ */
31
+ get(uri) {
32
+ const resource = this.resources.get(uri);
33
+ if (!resource) {
34
+ return undefined;
35
+ }
36
+ // Check if expired
37
+ if (Date.now() - resource.created > resource.ttl) {
38
+ this.resources.delete(uri);
39
+ return undefined;
40
+ }
41
+ return resource;
42
+ }
43
+ /**
44
+ * Delete a resource
45
+ */
46
+ delete(uri) {
47
+ return this.resources.delete(uri);
48
+ }
49
+ /**
50
+ * Clean up expired resources
51
+ */
52
+ cleanup() {
53
+ const now = Date.now();
54
+ let cleaned = 0;
55
+ for (const [uri, resource] of this.resources.entries()) {
56
+ if (now - resource.created > resource.ttl) {
57
+ this.resources.delete(uri);
58
+ cleaned++;
59
+ }
60
+ }
61
+ return cleaned;
62
+ }
63
+ /**
64
+ * Get count of active resources
65
+ */
66
+ count() {
67
+ return this.resources.size;
68
+ }
69
+ /**
70
+ * Clear all resources
71
+ */
72
+ clear() {
73
+ this.resources.clear();
74
+ }
75
+ /**
76
+ * Stop cleanup interval
77
+ */
78
+ destroy() {
79
+ if (this.cleanupInterval) {
80
+ clearInterval(this.cleanupInterval);
81
+ this.cleanupInterval = undefined;
82
+ }
83
+ this.clear();
84
+ }
85
+ }
86
+ // Singleton instance
87
+ export const temporaryResourceManager = new TemporaryResourceManager();
88
+ //# sourceMappingURL=temporaryResourceManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"temporaryResourceManager.js","sourceRoot":"","sources":["../../../src/utils/temporaryResourceManager.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,kCAAkC;AAmBlC,MAAM,OAAO,wBAAwB;IAKzB;IAJF,SAAS,GAAG,IAAI,GAAG,EAA6B,CAAC;IACjD,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