@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
  } | {
@@ -3,6 +3,7 @@
3
3
  // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.StaticMapImageTool = void 0;
6
+ const node_crypto_1 = require("node:crypto");
6
7
  const server_1 = require("@mcp-ui/server");
7
8
  const MapboxApiBasedTool_js_1 = require("../MapboxApiBasedTool.js");
8
9
  const StaticMapImageTool_input_schema_js_1 = require("./StaticMapImageTool.input.schema.js");
@@ -17,6 +18,15 @@ class StaticMapImageTool extends MapboxApiBasedTool_js_1.MapboxApiBasedTool {
17
18
  idempotentHint: true,
18
19
  openWorldHint: true
19
20
  };
21
+ meta = {
22
+ ui: {
23
+ resourceUri: 'ui://mapbox/static-map/index.html',
24
+ csp: {
25
+ connectDomains: ['https://api.mapbox.com'],
26
+ resourceDomains: ['https://api.mapbox.com']
27
+ }
28
+ }
29
+ };
20
30
  constructor(params) {
21
31
  super({
22
32
  inputSchema: StaticMapImageTool_input_schema_js_1.StaticMapImageInputSchema,
@@ -76,42 +86,17 @@ class StaticMapImageTool extends MapboxApiBasedTool_js_1.MapboxApiBasedTool {
76
86
  }
77
87
  const density = input.highDensity ? '@2x' : '';
78
88
  const url = `${MapboxApiBasedTool_js_1.MapboxApiBasedTool.mapboxApiEndpoint}styles/v1/${input.style}/static/${overlayString}${lng},${lat},${input.zoom}/${width}x${height}${density}?access_token=${accessToken}`;
89
+ // Fetch and encode image as base64 for clients without MCP Apps support
79
90
  const response = await this.httpRequest(url);
80
- if (!response.ok) {
81
- const errorMessage = await this.getErrorMessage(response);
82
- return {
83
- content: [
84
- {
85
- type: 'text',
86
- text: `Static Map API error: ${errorMessage}`
87
- }
88
- ],
89
- isError: true
90
- };
91
- }
92
91
  const buffer = await response.arrayBuffer();
93
92
  const base64Data = Buffer.from(buffer).toString('base64');
94
- // Determine MIME type based on style (raster-only styles return JPEG)
95
93
  const isRasterStyle = input.style.includes('satellite');
96
94
  const mimeType = isRasterStyle ? 'image/jpeg' : 'image/png';
97
- // Build descriptive text with map metadata (Issue #103)
98
- // Text content provides additional context alongside the image
99
- const textDescription = [
100
- 'Static map image generated successfully.',
101
- `Center: ${lat}, ${lng}`,
102
- `Zoom: ${input.zoom}`,
103
- `Size: ${width}x${height}${input.highDensity ? ' @2x' : ''}`,
104
- `Style: ${input.style}`,
105
- input.overlays?.length ? `Overlays: ${input.overlays.length}` : null
106
- ]
107
- .filter(Boolean)
108
- .join('\n');
109
- // Build content array with text first, then image
110
- // Per MCP spec, content array can have multiple items of different types
95
+ // content[0] MUST be the URL text MCP Apps UI finds it via content.find(c => c.type === 'text')
111
96
  const content = [
112
97
  {
113
98
  type: 'text',
114
- text: textDescription
99
+ text: url
115
100
  },
116
101
  {
117
102
  type: 'image',
@@ -119,7 +104,7 @@ class StaticMapImageTool extends MapboxApiBasedTool_js_1.MapboxApiBasedTool {
119
104
  mimeType
120
105
  }
121
106
  ];
122
- // Conditionally add MCP-UI resource if enabled
107
+ // Conditionally add MCP-UI resource if enabled (backward compatibility)
123
108
  if ((0, toolConfig_js_1.isMcpUiEnabled)()) {
124
109
  const uiResource = (0, server_1.createUIResource)({
125
110
  uri: `ui://mapbox/static-map/${input.style}/${lng},${lat},${input.zoom}`,
@@ -136,7 +121,10 @@ class StaticMapImageTool extends MapboxApiBasedTool_js_1.MapboxApiBasedTool {
136
121
  }
137
122
  return {
138
123
  content,
139
- isError: false
124
+ isError: false,
125
+ _meta: {
126
+ viewUUID: (0, node_crypto_1.randomUUID)()
127
+ }
140
128
  };
141
129
  }
142
130
  }
@@ -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,2CAAkD;AAClD,oEAA8D;AAE9D,6FAAiF;AAGjF,8DAA4D;AAE5D,MAAa,kBAAmB,SAAQ,0CAEvC;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,8DAAyB;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,CA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E,OAAO;gBACb,IAAI,EAAE,UAAU;gBAChB,QAAQ;aACT;SACF,CAAC;QAEF,+CAA+C;QAC/C,IAAI,IAAA,8BAAc,GAAE,EAAE,CAAC;YACrB,MAAM,UAAU,GAAG,IAAA,yBAAgB,EAAC;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;AAjKD,gDAiKC"}
1
+ {"version":3,"file":"StaticMapImageTool.js","sourceRoot":"","sources":["../../../../src/tools/static-map-image-tool/StaticMapImageTool.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;AAElC,6CAAyC;AAEzC,2CAAkD;AAClD,oEAA8D;AAE9D,6FAAiF;AAGjF,8DAA4D;AAE5D,MAAa,kBAAmB,SAAQ,0CAEvC;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;QACd,EAAE,EAAE;YACF,WAAW,EAAE,mCAAmC;YAChD,GAAG,EAAE;gBACH,cAAc,EAAE,CAAC,wBAAwB,CAAC;gBAC1C,eAAe,EAA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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,IAAA,wBAAU,GAAE;aACvB;SACF,CAAC;IACJ,CAAC;CACF;AA/ID,gDA+IC"}
@@ -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,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM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ClE,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,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAG5D;;;GAGG;AACH,eAAO,MAAM,UAAU,0UAsBb,CAAC;AAEX;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,aAAc,CAAC;AAE7C;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,uBAAuB,iDAG1B,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,SAAS,gXAIZ,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD;;;GAGG;AACH,wBAAgB,WAAW,IAAI,SAAS,YAAY,EAAE,CAErD;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,SAAS,YAAY,EAAE,CAEtD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,SAAS,YAAY,EAAE,CAE7D;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,SAAS,YAAY,EAAE,CAElE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAEpE"}
@@ -2,10 +2,14 @@
2
2
  // Copyright (c) Mapbox, Inc.
3
3
  // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.ALL_TOOLS = void 0;
5
+ exports.ALL_TOOLS = exports.RESOURCE_FALLBACK_TOOLS = exports.ELICITATION_TOOLS = exports.CORE_TOOLS = void 0;
6
6
  exports.getAllTools = getAllTools;
7
+ exports.getCoreTools = getCoreTools;
8
+ exports.getElicitationTools = getElicitationTools;
9
+ exports.getResourceFallbackTools = getResourceFallbackTools;
7
10
  exports.getToolByName = getToolByName;
8
11
  // INSERT NEW TOOL IMPORT HERE
12
+ const PlaceDetailsTool_js_1 = require("./place-details-tool/PlaceDetailsTool.js");
9
13
  const SimplifyTool_js_1 = require("./simplify-tool/SimplifyTool.js");
10
14
  const BoundingBoxTool_js_1 = require("./bounding-box-tool/BoundingBoxTool.js");
11
15
  const CentroidTool_js_1 = require("./centroid-tool/CentroidTool.js");
@@ -28,9 +32,13 @@ const StaticMapImageTool_js_1 = require("./static-map-image-tool/StaticMapImageT
28
32
  const SearchAndGeocodeTool_js_1 = require("./search-and-geocode-tool/SearchAndGeocodeTool.js");
29
33
  const VersionTool_js_1 = require("./version-tool/VersionTool.js");
30
34
  const httpPipeline_js_1 = require("../utils/httpPipeline.js");
31
- // Central registry of all tools
32
- exports.ALL_TOOLS = [
35
+ /**
36
+ * Core tools that work in all MCP clients without requiring special capabilities
37
+ * These tools are registered immediately during server startup
38
+ */
39
+ exports.CORE_TOOLS = [
33
40
  // INSERT NEW TOOL INSTANCE HERE
41
+ new PlaceDetailsTool_js_1.PlaceDetailsTool({ httpRequest: httpPipeline_js_1.httpRequest }),
34
42
  new SimplifyTool_js_1.SimplifyTool(),
35
43
  new BoundingBoxTool_js_1.BoundingBoxTool(),
36
44
  new CentroidTool_js_1.CentroidTool(),
@@ -41,8 +49,6 @@ exports.ALL_TOOLS = [
41
49
  new PointInPolygonTool_js_1.PointInPolygonTool(),
42
50
  new DistanceTool_js_1.DistanceTool(),
43
51
  new VersionTool_js_1.VersionTool(),
44
- new ResourceReaderTool_js_1.ResourceReaderTool(),
45
- new CategoryListTool_js_1.CategoryListTool({ httpRequest: httpPipeline_js_1.httpRequest }),
46
52
  new CategorySearchTool_js_1.CategorySearchTool({ httpRequest: httpPipeline_js_1.httpRequest }),
47
53
  new DirectionsTool_js_1.DirectionsTool({ httpRequest: httpPipeline_js_1.httpRequest }),
48
54
  new IsochroneTool_js_1.IsochroneTool({ httpRequest: httpPipeline_js_1.httpRequest }),
@@ -53,9 +59,68 @@ exports.ALL_TOOLS = [
53
59
  new StaticMapImageTool_js_1.StaticMapImageTool({ httpRequest: httpPipeline_js_1.httpRequest }),
54
60
  new SearchAndGeocodeTool_js_1.SearchAndGeocodeTool({ httpRequest: httpPipeline_js_1.httpRequest })
55
61
  ];
62
+ /**
63
+ * Tools that require elicitation capability for optimal functionality
64
+ * These tools use elicitInput() for secure token management
65
+ * Registered only if client supports elicitation
66
+ *
67
+ * Currently empty - elicitation support will be added in a future PR.
68
+ * This category is ready for tools that require the elicitation capability.
69
+ */
70
+ exports.ELICITATION_TOOLS = [];
71
+ /**
72
+ * Tools that serve as bridges for clients without resource support
73
+ * These tools are only registered if CLIENT_NEEDS_RESOURCE_FALLBACK env var is set to "true"
74
+ *
75
+ * Context: Most MCP clients support resources (Claude Desktop, VS Code, Inspector, etc.).
76
+ * However, some clients (like smolagents) don't support resources at all.
77
+ * These tools provide the same content as resources but via tool calls instead.
78
+ *
79
+ * Configuration:
80
+ * - Leave unset (default) = Skip these tools (assumes client supports resources)
81
+ * - Set CLIENT_NEEDS_RESOURCE_FALLBACK=true = Include these tools (for smolagents, etc.)
82
+ *
83
+ * Tools:
84
+ * - ResourceReaderTool: Generic fallback for reading any resource by URI
85
+ * - CategoryListTool: Provides access to category list (mapbox://categories)
86
+ */
87
+ exports.RESOURCE_FALLBACK_TOOLS = [
88
+ new ResourceReaderTool_js_1.ResourceReaderTool(),
89
+ new CategoryListTool_js_1.CategoryListTool({ httpRequest: httpPipeline_js_1.httpRequest })
90
+ ];
91
+ /**
92
+ * All tools combined (for backward compatibility and testing)
93
+ */
94
+ exports.ALL_TOOLS = [
95
+ ...exports.CORE_TOOLS,
96
+ ...exports.ELICITATION_TOOLS,
97
+ ...exports.RESOURCE_FALLBACK_TOOLS
98
+ ];
99
+ /**
100
+ * Get all tools (for backward compatibility)
101
+ * @deprecated Use getCoreTools(), getElicitationTools(), etc. instead for capability-aware registration
102
+ */
56
103
  function getAllTools() {
57
104
  return exports.ALL_TOOLS;
58
105
  }
106
+ /**
107
+ * Get tools that work in all MCP clients
108
+ */
109
+ function getCoreTools() {
110
+ return exports.CORE_TOOLS;
111
+ }
112
+ /**
113
+ * Get tools that require elicitation capability
114
+ */
115
+ function getElicitationTools() {
116
+ return exports.ELICITATION_TOOLS;
117
+ }
118
+ /**
119
+ * Get tools that serve as fallbacks when client doesn't support resources
120
+ */
121
+ function getResourceFallbackTools() {
122
+ return exports.RESOURCE_FALLBACK_TOOLS;
123
+ }
59
124
  function getToolByName(name) {
60
125
  return exports.ALL_TOOLS.find((tool) => tool.name === name);
61
126
  }
@@ -1 +1 @@
1
- {"version":3,"file":"toolRegistry.js","sourceRoot":"","sources":["../../../src/tools/toolRegistry.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;AAsDlC,kCAEC;AAED,sCAEC;AA1DD,8BAA8B;AAC9B,qEAA+D;AAC/D,+EAAyE;AACzE,qEAA+D;AAC/D,qEAA+D;AAC/D,kEAA4D;AAC5D,yDAAmD;AACnD,+DAAyD;AACzD,yFAAmF;AACnF,qEAA+D;AAC/D,kFAA4E;AAC5E,wFAAkF;AAClF,2EAAqE;AACrE,wEAAkE;AAClE,+EAAyE;AACzE,+DAAyD;AACzD,iFAA2E;AAC3E,wFAAkF;AAClF,wFAAkF;AAClF,yFAAmF;AACnF,+FAAyF;AACzF,kEAA4D;AAC5D,8DAAuD;AAEvD,gCAAgC;AACnB,QAAA,SAAS,GAAG;IACvB,gCAAgC;IAChC,IAAI,8BAAY,EAAE;IAClB,IAAI,oCAAe,EAAE;IACrB,IAAI,8BAAY,EAAE;IAClB,IAAI,8BAAY,EAAE;IAClB,IAAI,4BAAW,EAAE;IACjB,IAAI,sBAAQ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,CAAC;CACjC,CAAC;AAEX;;;;;;;GAOG;AACU,QAAA,iBAAiB,GAAG,EAAW,CAAC;AAE7C;;;;;;;;;;;;;;;GAeG;AACU,QAAA,uBAAuB,GAAG;IACrC,IAAI,0CAAkB,EAAE;IACxB,IAAI,sCAAgB,CAAC,EAAE,WAAW,EAAX,6BAAW,EAAE,CAAC;CAC7B,CAAC;AAEX;;GAEG;AACU,QAAA,SAAS,GAAG;IACvB,GAAG,kBAAU;IACb,GAAG,yBAAiB;IACpB,GAAG,+BAAuB;CAClB,CAAC;AAIX;;;GAGG;AACH,SAAgB,WAAW;IACzB,OAAO,iBAAS,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,SAAgB,YAAY;IAC1B,OAAO,kBAAU,CAAC;AACpB,CAAC;AAED;;GAEG;AACH,SAAgB,mBAAmB;IACjC,OAAO,yBAAiB,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,SAAgB,wBAAwB;IACtC,OAAO,+BAAuB,CAAC;AACjC,CAAC;AAED,SAAgB,aAAa,CAAC,IAAY;IACxC,OAAO,iBAAS,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,45 @@
1
+ "use strict";
2
+ // Copyright (c) Mapbox, Inc.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.TracingPolicy = exports.RetryPolicy = exports.UserAgentPolicy = exports.HttpPipeline = exports.systemHttpPipeline = exports.httpRequest = void 0;
6
+ /**
7
+ * @module utils
8
+ *
9
+ * Public API for Mapbox MCP utilities. This module exports the HTTP pipeline
10
+ * system for making requests to Mapbox APIs with built-in policies like
11
+ * User-Agent, Retry, and Tracing.
12
+ *
13
+ * @example Using the default pipeline
14
+ * ```typescript
15
+ * import { httpRequest } from '@mapbox/mcp-server/utils';
16
+ * import { DirectionsTool } from '@mapbox/mcp-server/tools';
17
+ *
18
+ * // Use the pre-configured default pipeline
19
+ * const tool = new DirectionsTool({ httpRequest });
20
+ * ```
21
+ *
22
+ * @example Creating a custom pipeline
23
+ * ```typescript
24
+ * import { HttpPipeline, UserAgentPolicy, RetryPolicy } from '@mapbox/mcp-server/utils';
25
+ * import { DirectionsTool } from '@mapbox/mcp-server/tools';
26
+ *
27
+ * // Create a custom pipeline with your own policies
28
+ * const pipeline = new HttpPipeline();
29
+ * pipeline.usePolicy(new UserAgentPolicy('MyApp/1.0.0'));
30
+ * pipeline.usePolicy(new RetryPolicy(5, 300, 3000)); // More aggressive retry
31
+ *
32
+ * const tool = new DirectionsTool({ httpRequest: pipeline.execute.bind(pipeline) });
33
+ * ```
34
+ */
35
+ // Export the pre-configured default HTTP pipeline
36
+ var httpPipeline_js_1 = require("./httpPipeline.js");
37
+ Object.defineProperty(exports, "httpRequest", { enumerable: true, get: function () { return httpPipeline_js_1.httpRequest; } });
38
+ Object.defineProperty(exports, "systemHttpPipeline", { enumerable: true, get: function () { return httpPipeline_js_1.systemHttpPipeline; } });
39
+ // Export HTTP pipeline classes and interfaces for custom pipelines
40
+ var httpPipeline_js_2 = require("./httpPipeline.js");
41
+ Object.defineProperty(exports, "HttpPipeline", { enumerable: true, get: function () { return httpPipeline_js_2.HttpPipeline; } });
42
+ Object.defineProperty(exports, "UserAgentPolicy", { enumerable: true, get: function () { return httpPipeline_js_2.UserAgentPolicy; } });
43
+ Object.defineProperty(exports, "RetryPolicy", { enumerable: true, get: function () { return httpPipeline_js_2.RetryPolicy; } });
44
+ Object.defineProperty(exports, "TracingPolicy", { enumerable: true, get: function () { return httpPipeline_js_2.TracingPolicy; } });
45
+ //# 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,qDAAoE;AAA3D,8GAAA,WAAW,OAAA;AAAE,qHAAA,kBAAkB,OAAA;AAExC,mEAAmE;AACnE,qDAM2B;AALzB,+GAAA,YAAY,OAAA;AACZ,kHAAA,eAAe,OAAA;AACf,8GAAA,WAAW,OAAA;AACX,gHAAA,aAAa,OAAA"}
@@ -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"}