@mapbox/mcp-server 0.17.0-dev.1 → 0.17.0-dev.3
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.
- package/dist/commonjs/resources/BaseResource.d.ts +7 -0
- package/dist/commonjs/resources/BaseResource.d.ts.map +1 -1
- package/dist/commonjs/resources/BaseResource.js +13 -2
- package/dist/commonjs/resources/BaseResource.js.map +1 -1
- package/dist/commonjs/resources/category-list/CategoryListResource.d.ts +7 -2
- package/dist/commonjs/resources/category-list/CategoryListResource.d.ts.map +1 -1
- package/dist/commonjs/resources/category-list/CategoryListResource.js +14 -4
- package/dist/commonjs/resources/category-list/CategoryListResource.js.map +1 -1
- package/dist/commonjs/resources/place-photo/PlacePhotoResource.d.ts +1 -1
- package/dist/commonjs/resources/place-photo/PlacePhotoResource.js +2 -2
- package/dist/commonjs/resources/place-photo/PlacePhotoResource.js.map +1 -1
- package/dist/commonjs/resources/resourceRegistry.d.ts +2 -1
- package/dist/commonjs/resources/resourceRegistry.d.ts.map +1 -1
- package/dist/commonjs/resources/resourceRegistry.js +10 -5
- package/dist/commonjs/resources/resourceRegistry.js.map +1 -1
- package/dist/commonjs/resources/tool-response/ToolResponseResource.d.ts +6 -5
- package/dist/commonjs/resources/tool-response/ToolResponseResource.d.ts.map +1 -1
- package/dist/commonjs/resources/tool-response/ToolResponseResource.js +29 -5
- package/dist/commonjs/resources/tool-response/ToolResponseResource.js.map +1 -1
- package/dist/commonjs/resources/ui-apps/StaticMapViewerUIResource.d.ts +28 -0
- package/dist/commonjs/resources/ui-apps/StaticMapViewerUIResource.d.ts.map +1 -0
- package/dist/commonjs/resources/ui-apps/StaticMapViewerUIResource.js +64 -0
- package/dist/commonjs/resources/ui-apps/StaticMapViewerUIResource.js.map +1 -0
- package/dist/commonjs/resources/ui-apps/mapAppHtml.d.ts.map +1 -1
- package/dist/commonjs/resources/ui-apps/mapAppHtml.js +977 -252
- package/dist/commonjs/resources/ui-apps/mapAppHtml.js.map +1 -1
- package/dist/commonjs/resources/ui-apps/staticMapViewerHtml.d.ts +17 -0
- package/dist/commonjs/resources/ui-apps/staticMapViewerHtml.d.ts.map +1 -0
- package/dist/commonjs/resources/ui-apps/staticMapViewerHtml.js +180 -0
- package/dist/commonjs/resources/ui-apps/staticMapViewerHtml.js.map +1 -0
- package/dist/commonjs/tools/MapboxApiBasedTool.d.ts.map +1 -1
- package/dist/commonjs/tools/MapboxApiBasedTool.js +6 -2
- package/dist/commonjs/tools/MapboxApiBasedTool.js.map +1 -1
- package/dist/commonjs/tools/category-search-tool/CategorySearchTool.d.ts.map +1 -1
- package/dist/commonjs/tools/category-search-tool/CategorySearchTool.js +1 -1
- package/dist/commonjs/tools/category-search-tool/CategorySearchTool.js.map +1 -1
- package/dist/commonjs/tools/list-public-tokens-tool/ListPublicTokensTool.d.ts.map +1 -1
- package/dist/commonjs/tools/list-public-tokens-tool/ListPublicTokensTool.js +2 -0
- package/dist/commonjs/tools/list-public-tokens-tool/ListPublicTokensTool.js.map +1 -1
- package/dist/commonjs/tools/render-map-tool/RenderMapTool.d.ts.map +1 -1
- package/dist/commonjs/tools/render-map-tool/RenderMapTool.input.schema.d.ts +1 -0
- package/dist/commonjs/tools/render-map-tool/RenderMapTool.input.schema.d.ts.map +1 -1
- package/dist/commonjs/tools/render-map-tool/RenderMapTool.input.schema.js +10 -6
- package/dist/commonjs/tools/render-map-tool/RenderMapTool.input.schema.js.map +1 -1
- package/dist/commonjs/tools/render-map-tool/RenderMapTool.js +26 -12
- package/dist/commonjs/tools/render-map-tool/RenderMapTool.js.map +1 -1
- package/dist/commonjs/tools/render-map-tool/RenderMapTool.output.schema.d.ts +1 -0
- package/dist/commonjs/tools/render-map-tool/RenderMapTool.output.schema.d.ts.map +1 -1
- package/dist/commonjs/tools/resource-reader-tool/ResourceReaderTool.d.ts.map +1 -1
- package/dist/commonjs/tools/resource-reader-tool/ResourceReaderTool.js +43 -9
- package/dist/commonjs/tools/resource-reader-tool/ResourceReaderTool.js.map +1 -1
- package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.d.ts.map +1 -1
- package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.js +1 -1
- package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.js.map +1 -1
- package/dist/commonjs/tools/static-map-image-tool/StaticMapImageTool.d.ts +8 -1
- package/dist/commonjs/tools/static-map-image-tool/StaticMapImageTool.d.ts.map +1 -1
- package/dist/commonjs/tools/static-map-image-tool/StaticMapImageTool.js +113 -90
- package/dist/commonjs/tools/static-map-image-tool/StaticMapImageTool.js.map +1 -1
- package/dist/commonjs/tools/static-map-image-tool/buildStaticMapRequestUrl.d.ts +23 -0
- package/dist/commonjs/tools/static-map-image-tool/buildStaticMapRequestUrl.d.ts.map +1 -0
- package/dist/commonjs/tools/static-map-image-tool/buildStaticMapRequestUrl.js +84 -0
- package/dist/commonjs/tools/static-map-image-tool/buildStaticMapRequestUrl.js.map +1 -0
- package/dist/commonjs/utils/mapAppPayload.d.ts +15 -6
- package/dist/commonjs/utils/mapAppPayload.d.ts.map +1 -1
- package/dist/commonjs/utils/mapAppPayload.js +2 -1
- package/dist/commonjs/utils/mapAppPayload.js.map +1 -1
- package/dist/commonjs/utils/mapboxPublicToken.d.ts +5 -1
- package/dist/commonjs/utils/mapboxPublicToken.d.ts.map +1 -1
- package/dist/commonjs/utils/mapboxPublicToken.js +6 -1
- package/dist/commonjs/utils/mapboxPublicToken.js.map +1 -1
- package/dist/commonjs/utils/responseRef.d.ts +1 -1
- package/dist/commonjs/utils/responseRef.d.ts.map +1 -1
- package/dist/commonjs/utils/responseRef.js +1 -1
- package/dist/commonjs/utils/responseRef.js.map +1 -1
- package/dist/commonjs/utils/selfFetchRef.d.ts +24 -0
- package/dist/commonjs/utils/selfFetchRef.d.ts.map +1 -1
- package/dist/commonjs/utils/selfFetchRef.js +68 -0
- package/dist/commonjs/utils/selfFetchRef.js.map +1 -1
- package/dist/commonjs/utils/serverInstructions.js +1 -1
- package/dist/commonjs/utils/serverInstructions.js.map +1 -1
- package/dist/commonjs/version.json +3 -3
- package/dist/esm/resources/BaseResource.d.ts +7 -0
- package/dist/esm/resources/BaseResource.d.ts.map +1 -1
- package/dist/esm/resources/BaseResource.js +13 -2
- package/dist/esm/resources/BaseResource.js.map +1 -1
- package/dist/esm/resources/category-list/CategoryListResource.d.ts +7 -2
- package/dist/esm/resources/category-list/CategoryListResource.d.ts.map +1 -1
- package/dist/esm/resources/category-list/CategoryListResource.js +14 -4
- package/dist/esm/resources/category-list/CategoryListResource.js.map +1 -1
- package/dist/esm/resources/place-photo/PlacePhotoResource.d.ts +1 -1
- package/dist/esm/resources/place-photo/PlacePhotoResource.js +2 -2
- package/dist/esm/resources/place-photo/PlacePhotoResource.js.map +1 -1
- package/dist/esm/resources/resourceRegistry.d.ts +2 -1
- package/dist/esm/resources/resourceRegistry.d.ts.map +1 -1
- package/dist/esm/resources/resourceRegistry.js +10 -5
- package/dist/esm/resources/resourceRegistry.js.map +1 -1
- package/dist/esm/resources/tool-response/ToolResponseResource.d.ts +6 -5
- package/dist/esm/resources/tool-response/ToolResponseResource.d.ts.map +1 -1
- package/dist/esm/resources/tool-response/ToolResponseResource.js +29 -5
- package/dist/esm/resources/tool-response/ToolResponseResource.js.map +1 -1
- package/dist/esm/resources/ui-apps/StaticMapViewerUIResource.d.ts +28 -0
- package/dist/esm/resources/ui-apps/StaticMapViewerUIResource.d.ts.map +1 -0
- package/dist/esm/resources/ui-apps/StaticMapViewerUIResource.js +59 -0
- package/dist/esm/resources/ui-apps/StaticMapViewerUIResource.js.map +1 -0
- package/dist/esm/resources/ui-apps/mapAppHtml.d.ts.map +1 -1
- package/dist/esm/resources/ui-apps/mapAppHtml.js +977 -252
- package/dist/esm/resources/ui-apps/mapAppHtml.js.map +1 -1
- package/dist/esm/resources/ui-apps/staticMapViewerHtml.d.ts +17 -0
- package/dist/esm/resources/ui-apps/staticMapViewerHtml.d.ts.map +1 -0
- package/dist/esm/resources/ui-apps/staticMapViewerHtml.js +177 -0
- package/dist/esm/resources/ui-apps/staticMapViewerHtml.js.map +1 -0
- package/dist/esm/tools/MapboxApiBasedTool.d.ts.map +1 -1
- package/dist/esm/tools/MapboxApiBasedTool.js +6 -2
- package/dist/esm/tools/MapboxApiBasedTool.js.map +1 -1
- package/dist/esm/tools/category-search-tool/CategorySearchTool.d.ts.map +1 -1
- package/dist/esm/tools/category-search-tool/CategorySearchTool.js +2 -2
- package/dist/esm/tools/category-search-tool/CategorySearchTool.js.map +1 -1
- package/dist/esm/tools/list-public-tokens-tool/ListPublicTokensTool.d.ts.map +1 -1
- package/dist/esm/tools/list-public-tokens-tool/ListPublicTokensTool.js +2 -0
- package/dist/esm/tools/list-public-tokens-tool/ListPublicTokensTool.js.map +1 -1
- package/dist/esm/tools/render-map-tool/RenderMapTool.d.ts.map +1 -1
- package/dist/esm/tools/render-map-tool/RenderMapTool.input.schema.d.ts +1 -0
- package/dist/esm/tools/render-map-tool/RenderMapTool.input.schema.d.ts.map +1 -1
- package/dist/esm/tools/render-map-tool/RenderMapTool.input.schema.js +10 -6
- package/dist/esm/tools/render-map-tool/RenderMapTool.input.schema.js.map +1 -1
- package/dist/esm/tools/render-map-tool/RenderMapTool.js +26 -12
- package/dist/esm/tools/render-map-tool/RenderMapTool.js.map +1 -1
- package/dist/esm/tools/render-map-tool/RenderMapTool.output.schema.d.ts +1 -0
- package/dist/esm/tools/render-map-tool/RenderMapTool.output.schema.d.ts.map +1 -1
- package/dist/esm/tools/resource-reader-tool/ResourceReaderTool.d.ts.map +1 -1
- package/dist/esm/tools/resource-reader-tool/ResourceReaderTool.js +43 -9
- package/dist/esm/tools/resource-reader-tool/ResourceReaderTool.js.map +1 -1
- package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.d.ts.map +1 -1
- package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.js +2 -2
- package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.js.map +1 -1
- package/dist/esm/tools/static-map-image-tool/StaticMapImageTool.d.ts +8 -1
- package/dist/esm/tools/static-map-image-tool/StaticMapImageTool.d.ts.map +1 -1
- package/dist/esm/tools/static-map-image-tool/StaticMapImageTool.js +114 -91
- package/dist/esm/tools/static-map-image-tool/StaticMapImageTool.js.map +1 -1
- package/dist/esm/tools/static-map-image-tool/buildStaticMapRequestUrl.d.ts +23 -0
- package/dist/esm/tools/static-map-image-tool/buildStaticMapRequestUrl.d.ts.map +1 -0
- package/dist/esm/tools/static-map-image-tool/buildStaticMapRequestUrl.js +78 -0
- package/dist/esm/tools/static-map-image-tool/buildStaticMapRequestUrl.js.map +1 -0
- package/dist/esm/utils/mapAppPayload.d.ts +15 -6
- package/dist/esm/utils/mapAppPayload.d.ts.map +1 -1
- package/dist/esm/utils/mapAppPayload.js +2 -1
- package/dist/esm/utils/mapAppPayload.js.map +1 -1
- package/dist/esm/utils/mapboxPublicToken.d.ts +5 -1
- package/dist/esm/utils/mapboxPublicToken.d.ts.map +1 -1
- package/dist/esm/utils/mapboxPublicToken.js +6 -1
- package/dist/esm/utils/mapboxPublicToken.js.map +1 -1
- package/dist/esm/utils/responseRef.d.ts +1 -1
- package/dist/esm/utils/responseRef.d.ts.map +1 -1
- package/dist/esm/utils/responseRef.js +1 -1
- package/dist/esm/utils/responseRef.js.map +1 -1
- package/dist/esm/utils/selfFetchRef.d.ts +24 -0
- package/dist/esm/utils/selfFetchRef.d.ts.map +1 -1
- package/dist/esm/utils/selfFetchRef.js +67 -0
- package/dist/esm/utils/selfFetchRef.js.map +1 -1
- package/dist/esm/utils/serverInstructions.js +1 -1
- package/dist/esm/utils/serverInstructions.js.map +1 -1
- package/dist/esm/version.json +3 -3
- package/package.json +1 -1
|
@@ -4,9 +4,10 @@ import { ComputeResource } from './compute/ComputeResource.js';
|
|
|
4
4
|
import { InlinePayloadResource } from './inline-payload/InlinePayloadResource.js';
|
|
5
5
|
import { ToolResponseResource } from './tool-response/ToolResponseResource.js';
|
|
6
6
|
import { MapAppUIResource } from './ui-apps/MapAppUIResource.js';
|
|
7
|
+
import { StaticMapViewerUIResource } from './ui-apps/StaticMapViewerUIResource.js';
|
|
7
8
|
import { VersionResource } from './version/VersionResource.js';
|
|
8
9
|
import { PlacePhotoResource } from './place-photo/PlacePhotoResource.js';
|
|
9
|
-
export declare const ALL_RESOURCES: readonly [CategoryListResource, TemporaryDataResource, ComputeResource, InlinePayloadResource, ToolResponseResource, MapAppUIResource, PlacePhotoResource, VersionResource];
|
|
10
|
+
export declare const ALL_RESOURCES: readonly [CategoryListResource, TemporaryDataResource, ComputeResource, InlinePayloadResource, ToolResponseResource, MapAppUIResource, StaticMapViewerUIResource, PlacePhotoResource, VersionResource];
|
|
10
11
|
export type ResourceInstance = (typeof ALL_RESOURCES)[number];
|
|
11
12
|
export declare function getAllResources(): readonly ResourceInstance[];
|
|
12
13
|
export declare function getResourceByUri(uri: string): ResourceInstance | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resourceRegistry.d.ts","sourceRoot":"","sources":["../../../src/resources/resourceRegistry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAIzE,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"resourceRegistry.d.ts","sourceRoot":"","sources":["../../../src/resources/resourceRegistry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAIzE,eAAO,MAAM,aAAa,wMAchB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,wBAAgB,eAAe,IAAI,SAAS,gBAAgB,EAAE,CAE7D;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAoB1E"}
|
|
@@ -7,6 +7,7 @@ import { ComputeResource } from './compute/ComputeResource.js';
|
|
|
7
7
|
import { InlinePayloadResource } from './inline-payload/InlinePayloadResource.js';
|
|
8
8
|
import { ToolResponseResource } from './tool-response/ToolResponseResource.js';
|
|
9
9
|
import { MapAppUIResource } from './ui-apps/MapAppUIResource.js';
|
|
10
|
+
import { StaticMapViewerUIResource } from './ui-apps/StaticMapViewerUIResource.js';
|
|
10
11
|
import { VersionResource } from './version/VersionResource.js';
|
|
11
12
|
import { PlacePhotoResource } from './place-photo/PlacePhotoResource.js';
|
|
12
13
|
import { httpRequest } from '../utils/httpPipeline.js';
|
|
@@ -20,7 +21,9 @@ export const ALL_RESOURCES = [
|
|
|
20
21
|
new ToolResponseResource({ httpRequest }),
|
|
21
22
|
// Single shared map renderer, targeted exclusively by render_map_tool.
|
|
22
23
|
new MapAppUIResource({ httpRequest }),
|
|
23
|
-
//
|
|
24
|
+
// Full-width viewer for static_map_image_tool's image.
|
|
25
|
+
new StaticMapViewerUIResource(),
|
|
26
|
+
// Photos for the map app's results carousel, which its CSP can't load directly.
|
|
24
27
|
new PlacePhotoResource({ httpRequest }),
|
|
25
28
|
new VersionResource()
|
|
26
29
|
];
|
|
@@ -32,16 +35,18 @@ export function getResourceByUri(uri) {
|
|
|
32
35
|
const exactMatch = ALL_RESOURCES.find((resource) => resource.uri === uri);
|
|
33
36
|
if (exactMatch)
|
|
34
37
|
return exactMatch;
|
|
35
|
-
// Find pattern match (e.g., mapbox://categories/ja matches mapbox://categories
|
|
38
|
+
// Find pattern match (e.g., mapbox://categories/ja matches mapbox://categories,
|
|
39
|
+
// mapbox://temp/abc matches the template mapbox://temp/{id}). The prefix is
|
|
40
|
+
// everything before the first `{` or `*`.
|
|
36
41
|
// Plain string prefix check — avoids building a RegExp from data at runtime,
|
|
37
42
|
// which would let an unbounded, user-supplied `uri` be tested against a
|
|
38
43
|
// dynamically constructed pattern (untrusted-input-into-RegExp is a ReDoS
|
|
39
44
|
// smell even though today's static resource URIs are innocuous).
|
|
40
45
|
return ALL_RESOURCES.find((resource) => {
|
|
41
|
-
const
|
|
42
|
-
const basePrefix =
|
|
46
|
+
const variableIndex = resource.uri.search(/[{*]/);
|
|
47
|
+
const basePrefix = variableIndex === -1
|
|
43
48
|
? resource.uri
|
|
44
|
-
: resource.uri.slice(0,
|
|
49
|
+
: resource.uri.slice(0, variableIndex);
|
|
45
50
|
return uri.startsWith(basePrefix);
|
|
46
51
|
});
|
|
47
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resourceRegistry.js","sourceRoot":"","sources":["../../../src/resources/resourceRegistry.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,kCAAkC;AAElC,kCAAkC;AAClC,OAAO,EAAE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AAC;YAClB,CAAC,CAAC,QAAQ,CAAC,GAAG;YACd,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;QAC3C,OAAO,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -2,15 +2,16 @@ import type { ReadResourceResult } from '@modelcontextprotocol/server';
|
|
|
2
2
|
import { MapboxApiBasedResource } from '../MapboxApiBasedResource.js';
|
|
3
3
|
import type { HttpRequest } from '../../utils/types.js';
|
|
4
4
|
/**
|
|
5
|
-
* Full `directions_tool` / `isochrone_tool` responses
|
|
6
|
-
* to return inline. The
|
|
7
|
-
* call's inputs (see
|
|
8
|
-
*
|
|
5
|
+
* Full `directions_tool` / `isochrone_tool` responses and
|
|
6
|
+
* `static_map_image_tool` images that were too large to return inline. The
|
|
7
|
+
* `mapbox://response/{tool}?data=...` ref carries the call's inputs (see
|
|
8
|
+
* responseRef.ts), and reading it runs the same request again with the
|
|
9
|
+
* reader's token, so any server process can answer it.
|
|
9
10
|
*/
|
|
10
11
|
export declare class ToolResponseResource extends MapboxApiBasedResource {
|
|
11
12
|
readonly name = "Full Tool Response";
|
|
12
13
|
readonly uri = "mapbox://response/{spec}";
|
|
13
|
-
readonly description = "The full response of a directions_tool or isochrone_tool call that was too large to return inline, fetched again from its ref.";
|
|
14
|
+
readonly description = "The full response of a directions_tool or isochrone_tool call, or a static_map_image_tool image, that was too large to return inline, fetched again from its ref.";
|
|
14
15
|
readonly mimeType = "application/json";
|
|
15
16
|
constructor(params: {
|
|
16
17
|
httpRequest: HttpRequest;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolResponseResource.d.ts","sourceRoot":"","sources":["../../../../src/resources/tool-response/ToolResponseResource.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"ToolResponseResource.d.ts","sourceRoot":"","sources":["../../../../src/resources/tool-response/ToolResponseResource.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAcxD;;;;;;GAMG;AACH,qBAAa,oBAAqB,SAAQ,sBAAsB;IAC9D,QAAQ,CAAC,IAAI,wBAAwB;IACrC,QAAQ,CAAC,GAAG,8BAA8B;IAC1C,QAAQ,CAAC,WAAW,uKACkJ;IACtK,QAAQ,CAAC,QAAQ,sBAAsB;gBAE3B,MAAM,EAAE;QAAE,WAAW,EAAE,WAAW,CAAA;KAAE;cAIhC,OAAO,CACrB,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,kBAAkB,CAAC;CAyF/B"}
|
|
@@ -7,16 +7,19 @@ import { buildDirectionsRequestUrl } from '../../tools/directions-tool/buildDire
|
|
|
7
7
|
import { cleanResponseData } from '../../tools/directions-tool/cleanResponseData.js';
|
|
8
8
|
import { IsochroneInputSchema } from '../../tools/isochrone-tool/IsochroneTool.input.schema.js';
|
|
9
9
|
import { buildIsochroneRequestUrl } from '../../tools/isochrone-tool/buildIsochroneRequestUrl.js';
|
|
10
|
+
import { StaticMapImageInputSchema } from '../../tools/static-map-image-tool/StaticMapImageTool.input.schema.js';
|
|
11
|
+
import { buildStaticMapRequestUrl, getStaticMapMimeType } from '../../tools/static-map-image-tool/buildStaticMapRequestUrl.js';
|
|
10
12
|
/**
|
|
11
|
-
* Full `directions_tool` / `isochrone_tool` responses
|
|
12
|
-
* to return inline. The
|
|
13
|
-
* call's inputs (see
|
|
14
|
-
*
|
|
13
|
+
* Full `directions_tool` / `isochrone_tool` responses and
|
|
14
|
+
* `static_map_image_tool` images that were too large to return inline. The
|
|
15
|
+
* `mapbox://response/{tool}?data=...` ref carries the call's inputs (see
|
|
16
|
+
* responseRef.ts), and reading it runs the same request again with the
|
|
17
|
+
* reader's token, so any server process can answer it.
|
|
15
18
|
*/
|
|
16
19
|
export class ToolResponseResource extends MapboxApiBasedResource {
|
|
17
20
|
name = 'Full Tool Response';
|
|
18
21
|
uri = 'mapbox://response/{spec}';
|
|
19
|
-
description = 'The full response of a directions_tool or isochrone_tool call that was too large to return inline, fetched again from its ref.';
|
|
22
|
+
description = 'The full response of a directions_tool or isochrone_tool call, or a static_map_image_tool image, that was too large to return inline, fetched again from its ref.';
|
|
20
23
|
mimeType = 'application/json';
|
|
21
24
|
constructor(params) {
|
|
22
25
|
super(params);
|
|
@@ -24,6 +27,27 @@ export class ToolResponseResource extends MapboxApiBasedResource {
|
|
|
24
27
|
async execute(uri, accessToken) {
|
|
25
28
|
const spec = resolveResponseRef(uri);
|
|
26
29
|
const apiEndpoint = MapboxApiBasedResource.mapboxApiEndpoint;
|
|
30
|
+
if (spec?.tool === 'static-map') {
|
|
31
|
+
const parsed = StaticMapImageInputSchema.safeParse(spec.input);
|
|
32
|
+
if (!parsed.success) {
|
|
33
|
+
return text(uri, 'Response ref was malformed or unsupported.');
|
|
34
|
+
}
|
|
35
|
+
const { url } = buildStaticMapRequestUrl({
|
|
36
|
+
input: parsed.data,
|
|
37
|
+
accessToken,
|
|
38
|
+
apiEndpoint
|
|
39
|
+
});
|
|
40
|
+
const response = await this.httpRequest(url);
|
|
41
|
+
if (!response.ok) {
|
|
42
|
+
return text(uri, `Fetching the image failed: ${response.status} ${response.statusText}`);
|
|
43
|
+
}
|
|
44
|
+
const blob = Buffer.from(await response.arrayBuffer()).toString('base64');
|
|
45
|
+
return {
|
|
46
|
+
contents: [
|
|
47
|
+
{ uri, mimeType: getStaticMapMimeType(parsed.data.style), blob }
|
|
48
|
+
]
|
|
49
|
+
};
|
|
50
|
+
}
|
|
27
51
|
let url = null;
|
|
28
52
|
let directionsInput = null;
|
|
29
53
|
if (spec?.tool === 'directions') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolResponseResource.js","sourceRoot":"","sources":["../../../../src/resources/tool-response/ToolResponseResource.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,kCAAkC;AAGlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4DAA4D,CAAC;AACnG,OAAO,EAAE,yBAAyB,EAAE,MAAM,0DAA0D,CAAC;AACrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AAErF,OAAO,EAAE,oBAAoB,EAAE,MAAM,0DAA0D,CAAC;AAChG,OAAO,EAAE,wBAAwB,EAAE,MAAM,wDAAwD,CAAC;
|
|
1
|
+
{"version":3,"file":"ToolResponseResource.js","sourceRoot":"","sources":["../../../../src/resources/tool-response/ToolResponseResource.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,kCAAkC;AAGlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4DAA4D,CAAC;AACnG,OAAO,EAAE,yBAAyB,EAAE,MAAM,0DAA0D,CAAC;AACrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AAErF,OAAO,EAAE,oBAAoB,EAAE,MAAM,0DAA0D,CAAC;AAChG,OAAO,EAAE,wBAAwB,EAAE,MAAM,wDAAwD,CAAC;AAClG,OAAO,EAAE,yBAAyB,EAAE,MAAM,sEAAsE,CAAC;AACjH,OAAO,EACL,wBAAwB,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AAG,EACH,sCAAsC,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAC/E,CAAC;QACJ,CAAC;QACD,IAAI,IAAI,GAAY,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAE1C,IAAI,eAAe,EAAE,CAAC;YACpB,0DAA0D;YAC1D,IAAI,OAAO,GAAG,iBAAiB,CAC7B,eAAe,EACf,IAA0B,CAC3B,CAAC;YACF,8DAA8D;YAC9D,MAAM,KAAK,GAAG,IAAI,EAAE,kBAAkB,CAAC;YACvC,IAAI,KAAK,KAAK,SAAS,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;gBACnD,OAAO,GAAG,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YAC5D,CAAC;YACD,IAAI,GAAG,OAAO,CAAC;QACjB,CAAC;QAED,OAAO;YACL,QAAQ,EAAE;gBACR,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;aACtE;SACF,CAAC;IACJ,CAAC;CACF;AAED,SAAS,IAAI,CAAC,GAAW,EAAE,OAAe;IACxC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ReadResourceResult } from '@modelcontextprotocol/server';
|
|
2
|
+
import { BaseResource } from '../BaseResource.js';
|
|
3
|
+
export declare const STATIC_MAP_VIEWER_URI = "ui://mapbox/static-map/index.html";
|
|
4
|
+
/**
|
|
5
|
+
* The MCP App `static_map_image_tool` points at, which shows its image at
|
|
6
|
+
* full width (see staticMapViewerHtml.ts).
|
|
7
|
+
*
|
|
8
|
+
* The image comes from the tool result itself, so unlike the map app this
|
|
9
|
+
* page needs no token. Its CSP only allows images from the API origin, for
|
|
10
|
+
* the public-token URL it falls back to when the image went to a temporary
|
|
11
|
+
* resource.
|
|
12
|
+
*/
|
|
13
|
+
export declare class StaticMapViewerUIResource extends BaseResource {
|
|
14
|
+
readonly name = "Mapbox Static Map Viewer";
|
|
15
|
+
readonly uri = "ui://mapbox/static-map/index.html";
|
|
16
|
+
readonly description = "Shows the static_map_image_tool image at full width (MCP Apps)";
|
|
17
|
+
readonly mimeType = "text/html;profile=mcp-app";
|
|
18
|
+
private readonly apiEndpoint;
|
|
19
|
+
constructor(params?: {
|
|
20
|
+
apiEndpoint?: () => string;
|
|
21
|
+
});
|
|
22
|
+
read(): Promise<ReadResourceResult>;
|
|
23
|
+
}
|
|
24
|
+
/** Images from the API origin only; the page fetches nothing else. */
|
|
25
|
+
export declare function staticMapViewerCsp(apiEndpoint: string): {
|
|
26
|
+
resourceDomains: string[];
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=StaticMapViewerUIResource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StaticMapViewerUIResource.d.ts","sourceRoot":"","sources":["../../../../src/resources/ui-apps/StaticMapViewerUIResource.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,eAAO,MAAM,qBAAqB,sCAAsC,CAAC;AAEzE;;;;;;;;GAQG;AACH,qBAAa,yBAA0B,SAAQ,YAAY;IACzD,QAAQ,CAAC,IAAI,8BAA8B;IAC3C,QAAQ,CAAC,GAAG,uCAAyB;IACrC,QAAQ,CAAC,WAAW,oEAC+C;IACnE,QAAQ,CAAC,QAAQ,+BAAsB;IAEvC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;gBAE/B,MAAM,GAAE;QAAE,WAAW,CAAC,EAAE,MAAM,MAAM,CAAA;KAAO;IAOjD,IAAI,IAAI,OAAO,CAAC,kBAAkB,CAAC;CAiB1C;AAED,sEAAsE;AACtE,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG;IACvD,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CASA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Copyright (c) Mapbox, Inc.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { RESOURCE_MIME_TYPE } from '@modelcontextprotocol/ext-apps/server';
|
|
4
|
+
import { BaseResource } from '../BaseResource.js';
|
|
5
|
+
import { renderStaticMapViewerHtml } from './staticMapViewerHtml.js';
|
|
6
|
+
export const STATIC_MAP_VIEWER_URI = 'ui://mapbox/static-map/index.html';
|
|
7
|
+
/**
|
|
8
|
+
* The MCP App `static_map_image_tool` points at, which shows its image at
|
|
9
|
+
* full width (see staticMapViewerHtml.ts).
|
|
10
|
+
*
|
|
11
|
+
* The image comes from the tool result itself, so unlike the map app this
|
|
12
|
+
* page needs no token. Its CSP only allows images from the API origin, for
|
|
13
|
+
* the public-token URL it falls back to when the image went to a temporary
|
|
14
|
+
* resource.
|
|
15
|
+
*/
|
|
16
|
+
export class StaticMapViewerUIResource extends BaseResource {
|
|
17
|
+
name = 'Mapbox Static Map Viewer';
|
|
18
|
+
uri = STATIC_MAP_VIEWER_URI;
|
|
19
|
+
description = 'Shows the static_map_image_tool image at full width (MCP Apps)';
|
|
20
|
+
mimeType = RESOURCE_MIME_TYPE;
|
|
21
|
+
apiEndpoint;
|
|
22
|
+
constructor(params = {}) {
|
|
23
|
+
super();
|
|
24
|
+
this.apiEndpoint =
|
|
25
|
+
params.apiEndpoint ??
|
|
26
|
+
(() => process.env.MAPBOX_API_ENDPOINT || 'https://api.mapbox.com/');
|
|
27
|
+
}
|
|
28
|
+
async read() {
|
|
29
|
+
return {
|
|
30
|
+
contents: [
|
|
31
|
+
{
|
|
32
|
+
uri: this.uri,
|
|
33
|
+
mimeType: RESOURCE_MIME_TYPE,
|
|
34
|
+
text: renderStaticMapViewerHtml({ apiEndpoint: this.apiEndpoint() }),
|
|
35
|
+
_meta: {
|
|
36
|
+
ui: {
|
|
37
|
+
csp: staticMapViewerCsp(this.apiEndpoint()),
|
|
38
|
+
prefersBorder: false
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/** Images from the API origin only; the page fetches nothing else. */
|
|
47
|
+
export function staticMapViewerCsp(apiEndpoint) {
|
|
48
|
+
const resourceDomains = ['https://api.mapbox.com'];
|
|
49
|
+
try {
|
|
50
|
+
const origin = new URL(apiEndpoint).origin;
|
|
51
|
+
if (!resourceDomains.includes(origin))
|
|
52
|
+
resourceDomains.push(origin);
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
// An endpoint that isn't a valid URL can't serve images anyway.
|
|
56
|
+
}
|
|
57
|
+
return { resourceDomains };
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=StaticMapViewerUIResource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StaticMapViewerUIResource.js","sourceRoot":"","sources":["../../../../src/resources/ui-apps/StaticMapViewerUIResource.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,kCAAkC;AAGlC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,MAAM,CAAC,MAAM,qBAAqB,GAAG,mCAAmC,CAAC;AAEzE;;;;;;;;GAQG;AACH,MAAM,OAAO,yBAA0B,SAAQ,YAAY;IAChD,IAAI,GAAG,0BAA0B,CAAC;IAClC,GAAG,GAAG,qBAA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AE,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,
|
|
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,CAyzFT"}
|