@modelcontextprotocol/server-map 0.4.1

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/README.md ADDED
@@ -0,0 +1,92 @@
1
+ # Example: Interactive Map
2
+
3
+ ![Screenshot](screenshot.png)
4
+
5
+ Interactive 3D globe viewer using CesiumJS with OpenStreetMap tiles. Demonstrates geocoding integration and full MCP App capabilities.
6
+
7
+ ## Features
8
+
9
+ - **3D Globe Rendering**: Interactive CesiumJS globe with rotation, zoom, and 3D perspective
10
+ - **Geocoding**: Search for places using OpenStreetMap Nominatim (no API key required)
11
+ - **OpenStreetMap Tiles**: Uses free OSM tile server (no Cesium Ion token needed)
12
+ - **Dynamic Loading**: CesiumJS loaded from CDN at runtime for smaller bundle size
13
+
14
+ ## Running
15
+
16
+ 1. Install dependencies:
17
+
18
+ ```bash
19
+ npm install
20
+ ```
21
+
22
+ 2. Build and start the server:
23
+
24
+ ```bash
25
+ npm run start:http # for Streamable HTTP transport
26
+ # OR
27
+ npm run start:stdio # for stdio transport
28
+ ```
29
+
30
+ 3. View using the [`basic-host`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-host) example or another MCP Apps-compatible host.
31
+
32
+ ## Tools
33
+
34
+ ### `geocode`
35
+
36
+ Search for places by name or address. Returns coordinates and bounding boxes.
37
+
38
+ ```json
39
+ {
40
+ "query": "Eiffel Tower"
41
+ }
42
+ ```
43
+
44
+ Returns up to 5 matches with lat/lon coordinates and bounding boxes.
45
+
46
+ ### `show-map`
47
+
48
+ Display the 3D globe zoomed to a bounding box.
49
+
50
+ ```json
51
+ {
52
+ "west": 2.29,
53
+ "south": 48.85,
54
+ "east": 2.3,
55
+ "north": 48.86,
56
+ "label": "Eiffel Tower"
57
+ }
58
+ ```
59
+
60
+ Defaults to London if no coordinates provided.
61
+
62
+ ## Architecture
63
+
64
+ ### Server (`server.ts`)
65
+
66
+ Exposes two tools:
67
+
68
+ - `geocode` - Queries OpenStreetMap Nominatim API with rate limiting
69
+ - `show-map` - Renders the CesiumJS globe UI at a specified location
70
+
71
+ Configures Content Security Policy to allow fetching tiles from OSM and Cesium CDN.
72
+
73
+ ### App (`src/mcp-app.ts`)
74
+
75
+ Vanilla TypeScript app that:
76
+
77
+ - Dynamically loads CesiumJS from CDN
78
+ - Initializes globe with OpenStreetMap imagery (no Ion token)
79
+ - Receives tool inputs via the MCP App SDK
80
+ - Handles camera navigation to specified bounding boxes
81
+
82
+ ## Key Files
83
+
84
+ - [`server.ts`](server.ts) - MCP server with geocode and show-map tools
85
+ - [`mcp-app.html`](mcp-app.html) / [`src/mcp-app.ts`](src/mcp-app.ts) - CesiumJS globe UI
86
+ - [`server-utils.ts`](server-utils.ts) - HTTP server utilities
87
+
88
+ ## Notes
89
+
90
+ - Rate limiting is applied to Nominatim requests (1 request per second per their usage policy)
91
+ - The globe works in sandboxed iframes with appropriate CSP configuration
92
+ - No external API keys required - uses only open data sources