mapbox-create-map-mcp 1.3.0 → 1.3.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 +35 -1
- package/package.json +1 -1
- package/src/server.js +3 -3
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ npx mapbox-create-map-mcp
|
|
|
33
33
|
|
|
34
34
|
### MCP 工具
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
#### CreateMap - 生成地图图层配置
|
|
37
37
|
|
|
38
38
|
输入参数:
|
|
39
39
|
- `title` (string, 必需): 地图标题
|
|
@@ -43,6 +43,40 @@ npx mapbox-create-map-mcp
|
|
|
43
43
|
- `center` (array, 可选): 中心点 [经度, 纬度]
|
|
44
44
|
- `zoom` (number, 可选): 缩放级别
|
|
45
45
|
|
|
46
|
+
#### CreatePopup - 生成弹框样式配置
|
|
47
|
+
|
|
48
|
+
输入参数:
|
|
49
|
+
- `name` (string, 必需): 弹框样式名称
|
|
50
|
+
- `htmlContent` (string, 必需): 弹框的HTML内容
|
|
51
|
+
- `theme` (string, 可选): 预设主题 `light` | `dark` | `minimal` | `custom`
|
|
52
|
+
- `closeButton` (boolean, 可选): 是否显示关闭按钮
|
|
53
|
+
- `closeOnClick` (boolean, 可选): 点击地图时是否关闭
|
|
54
|
+
- `closeOnMove` (boolean, 可选): 地图移动时是否关闭
|
|
55
|
+
- `anchor` (string, 可选): 锚点位置 `top` | `bottom` | `left` | `right` 等
|
|
56
|
+
- `offset` (array, 可选): 偏移量 [x, y]
|
|
57
|
+
- `maxWidth` (number, 可选): 最大宽度(px)
|
|
58
|
+
- `altitude` (number, 可选): 海拔高度(米)
|
|
59
|
+
- `className` (string, 可选): 自定义CSS类名
|
|
60
|
+
|
|
61
|
+
返回结果示例:
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"success": true,
|
|
65
|
+
"config": {
|
|
66
|
+
"name": "深色主题",
|
|
67
|
+
"closeButton": true,
|
|
68
|
+
"closeOnClick": true,
|
|
69
|
+
"closeOnMove": false,
|
|
70
|
+
"anchor": "top",
|
|
71
|
+
"offset": [0, 0],
|
|
72
|
+
"maxWidth": 240,
|
|
73
|
+
"className": "dark-popup",
|
|
74
|
+
"altitude": 0,
|
|
75
|
+
"htmlContent": "<div style=\"padding: 15px; background: #2d2d2d; color: #fff;\">...</div>"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
46
80
|
## JavaScript 库使用
|
|
47
81
|
|
|
48
82
|
### 基本使用
|
package/package.json
CHANGED
package/src/server.js
CHANGED
|
@@ -87,8 +87,8 @@ class CreatePopup {
|
|
|
87
87
|
htmlContent: {
|
|
88
88
|
type: 'string',
|
|
89
89
|
required: true,
|
|
90
|
-
default: '<div style="padding: 10px;"><h3
|
|
91
|
-
description: '弹框的HTML
|
|
90
|
+
default: '<div style="padding: 10px;"><h3>{name}</h3><p>{description}</p></div>',
|
|
91
|
+
description: '弹框的HTML内容,支持{fieldName}占位符动态绑定GeoJSON要素的properties属性。例如: "<h3>{name}</h3><p>{address}</p>"'
|
|
92
92
|
},
|
|
93
93
|
theme: {
|
|
94
94
|
type: 'string',
|
|
@@ -430,7 +430,7 @@ class McpServer {
|
|
|
430
430
|
},
|
|
431
431
|
htmlContent: {
|
|
432
432
|
type: 'string',
|
|
433
|
-
description: '弹框的HTML内容,支持完整的HTML
|
|
433
|
+
description: '弹框的HTML内容,支持完整的HTML标签和内联样式。支持使用{fieldName}占位符动态绑定GeoJSON要素的properties属性,点击要素时占位符会被替换为实际值。例如:"<h3>{name}</h3><p>地址: {address}</p><p>类型: {type}</p>",当点击的要素properties为{"name":"北京站","address":"北京市东城区","type":"火车站"}时,弹框会显示"<h3>北京站</h3><p>地址: 北京市东城区</p><p>类型: 火车站</p>"。常用占位符: {name}名称, {id}标识, {address}地址, {value}数值, {description}描述等。'
|
|
434
434
|
},
|
|
435
435
|
theme: {
|
|
436
436
|
type: 'string',
|