mapnetwork-mcp 2.0.0__tar.gz → 3.0.0__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mapnetwork-mcp
3
- Version: 2.0.0
3
+ Version: 3.0.0
4
4
  Summary: MCP server — generate styled map images via mapnetwork.app
5
5
  Project-URL: Homepage, https://mapnetwork.app
6
6
  Project-URL: Repository, https://github.com/toruproject/mapnetwork-mcp
@@ -0,0 +1,22 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ Only the latest major version receives security fixes.
6
+
7
+ | Version | Supported |
8
+ | ------- | ------------------ |
9
+ | 2.x | :white_check_mark: |
10
+ | < 2.0 | :x: |
11
+
12
+ ## Reporting a Vulnerability
13
+
14
+ Please report security vulnerabilities privately through
15
+ [GitHub Private Vulnerability Reporting](https://github.com/toruproject/mapnetwork-mcp/security/advisories/new).
16
+ This opens a private advisory visible only to the maintainer and you, so the
17
+ issue is not disclosed publicly before a fix is available.
18
+
19
+ Do not report security vulnerabilities through public GitHub issues.
20
+
21
+ We aim to respond as quickly as possible on a best-effort basis; we do not
22
+ currently commit to a fixed response-time SLA.
@@ -2,7 +2,7 @@
2
2
  "manifest_version": "0.4",
3
3
  "name": "mapnetwork-mcp",
4
4
  "display_name": "MapNetwork",
5
- "version": "2.0.0",
5
+ "version": "3.0.0",
6
6
  "description": "Generate styled PNG/SVG map images of any location with 11 customizable color themes.",
7
7
  "long_description": "MCP server for MapNetwork — generate styled map images (PNG / SVG) for any location on Earth, directly from Claude.\n\n- Generate maps from a place name, coordinates, or a list of markers\n- 11 color themes (white, darkBlue, darkGreen, popArt, lightBlue, lightGreen, beige, magenta, gray, black, brawn)\n- Overlay walking / driving routes on the map\n- PNG or SVG output, saved to your Downloads folder\n- Re-download a previously generated map in a different theme or format without regenerating\n- Open any generated map in the MapNetwork web editor for manual customization",
8
8
  "author": {
@@ -22,17 +22,6 @@ INITIAL_WAIT_SEC = 40.0
22
22
  # check_map_statusをモデルが連打しても機械的に間隔が空くようにする最低待機時間
23
23
  CHECK_THROTTLE_SEC = 5.0
24
24
 
25
- # layersは自由な多値配列にすると、モデルが「roadはhighway/driving/walkingの上位互換」
26
- # といった内部の組み合わせルールを知らないまま組み合わせを選んでしまう。
27
- # 人間側で意味のある4パターンだけに絞り込み、モデルにはこのプリセット名だけを選ばせる。
28
- _LAYER_PRESETS: dict[str, list[str]] = {
29
- "default": ["road", "poi"],
30
- "road_and_railway": ["road", "railway", "poi"],
31
- "only_driving_road": ["driving"],
32
- "fully_detailed": ["road", "railway", "poi", "waterline", "greenarea"],
33
- }
34
-
35
-
36
25
  class Location(BaseModel):
37
26
  lat: float = Field(description="Latitude.")
38
27
  lng: float = Field(description="Longitude.")
@@ -70,19 +59,23 @@ mcp = FastMCP(
70
59
  "You have access to MapNetwork, which generates styled map images (PNG or SVG) "
71
60
  "for any location on Earth.\n\n"
72
61
  "## Key capabilities\n"
73
- "- **Single location**: pass `place` (geocoded server-side) or `lat`/`lng` as the map center\n"
62
+ "- **Single location**: pass `place` (geocoded server-side). If you already know the "
63
+ "coordinates, pair it with `location` ({lat, lng}) to skip geocoding — same pattern as a "
64
+ "marker's `label`+`location`. `location` alone (without `place`) also works, but places no "
65
+ "labeled pin. `location` is not necessarily the final map center — see below.\n"
74
66
  "- **Multiple locations**: pass `markers` — a list of places to pin on the map. "
75
- "Each marker needs only a `label` (geocoded automatically); explicit `lat`/`lng` is optional. "
76
- "When `markers` are given without a `place`/`lat`/`lng` center, the server derives the center "
77
- "from the centroid of the markers and sets the radius automatically (1.2× farthest marker distance). "
67
+ "Each marker needs only a `label` (geocoded automatically); explicit `location` is optional. "
78
68
  "Use this whenever the user asks to show multiple places on a single map.\n"
79
- "- **Circular area**: specify `radius` in meters (default 500, max 2500) around the center\n"
80
- "- **Rectangular area**: specify `size_ew` (east-west) and `size_ns` (north-south) in meters "
81
- "instead of radius — useful when the area of interest is not square\n"
82
- "- **Layers**: choose a preset via `layers` — 'default' (roads + POI), "
83
- "'only_driving_road' (car-accessible roads only), 'road_and_railway' (roads + railway, no POI), "
84
- "or 'fully_detailed' (roads + railway + waterline + greenarea + POI; waterline/greenarea only "
85
- "apply within Japan). Omit for 'default'.\n"
69
+ "- **Map shape and size are fully automatic**: with a single input location (`place`/`location`, "
70
+ "or one marker), the server centers a circular map on it with a small default radius. "
71
+ "With multiple input locations (`markers`, or a `route`), the server fits a rectangle (or square) "
72
+ "around all of them, and the center becomes the midpoint of that rectangle — not any single "
73
+ "input coordinate. There is no way to manually set the radius or rectangle size (the exact "
74
+ "defaults and limits are server-side details that may change).\n"
75
+ "- **Layers are fully automatic**: roads and POI icons are always included. The server picks "
76
+ "walkable roads vs. car-only roads based on the route or the map's east-west extent, and adds "
77
+ "railway/waterline/aerialway layers automatically when POIs like stations, harbours, beaches, or "
78
+ "ropeways are detected nearby (Japan only). There is no way to manually choose layers.\n"
86
79
  "- **Color themes** via `color_set`: "
87
80
  "white (clean, default), darkBlue (navy bg), darkGreen (dark teal bg), "
88
81
  "popArt (blue bg, bold contrast), lightBlue (pale blue bg), lightGreen (pale green bg), "
@@ -117,10 +110,8 @@ mcp = FastMCP(
117
110
  "Mention this when relevant, but do not ask the user unprompted. "
118
111
  "Only set color_set when the user explicitly requests a theme.\n\n"
119
112
  "## Parameter discipline\n"
120
- "- **lat/lng**: Never guess or estimate coordinates from training data. "
121
- "If the location is known only by name, use `place` and let the server geocode it.\n"
122
- "- **radius / size_ew / size_ns**: Do not set these unless the user has explicitly asked for "
123
- "a specific map range or shape. Omit them to let the server apply its default (500 m radius)."
113
+ "- **location**: Never guess or estimate coordinates from training data. "
114
+ "If the location is known only by name, use `place` and let the server geocode it."
124
115
  ),
125
116
  )
126
117
 
@@ -244,28 +235,14 @@ async def compute_route(
244
235
  @mcp.tool()
245
236
  async def generate_map(
246
237
  place: Annotated[
247
- str | None, Field(description="Place name to center the map on. Use this OR lat/lng, not both.")
238
+ str | None, Field(description="Place name to center the map on (geocoded server-side unless 'location' is also given).")
239
+ ] = None,
240
+ location: Annotated[
241
+ Location | None,
242
+ Field(description="Explicit coordinates for 'place'. If given, geocoding of 'place' is skipped. Not necessarily the map's final center — see server instructions."),
248
243
  ] = None,
249
- lat: Annotated[float | None, Field(description="Latitude of the map center. Must be combined with lng.")] = None,
250
- lng: Annotated[float | None, Field(description="Longitude of the map center. Must be combined with lat.")] = None,
251
244
  markers: Annotated[list[Marker] | None, Field(description="Locations to pin on the map.")] = None,
252
245
  name: Annotated[str | None, Field(description="Map name stored in the data file.")] = None,
253
- radius: Annotated[
254
- int | None,
255
- Field(description="Circular radius in meters (default 500, max 2500). Exclusive with size_ew/size_ns."),
256
- ] = None,
257
- size_ew: Annotated[
258
- float | None,
259
- Field(description="Rectangular area width (east-west), meters. Must pair with size_ns; exclusive with radius."),
260
- ] = None,
261
- size_ns: Annotated[
262
- float | None,
263
- Field(description="Rectangular area height (north-south), meters. Must pair with size_ew."),
264
- ] = None,
265
- layers: Annotated[
266
- Literal["default", "road_and_railway", "only_driving_road", "fully_detailed"] | None,
267
- Field(description="Layer preset — see server instructions for what each preset includes. Omit for 'default'."),
268
- ] = None,
269
246
  route: Annotated[
270
247
  RouteInput | None,
271
248
  Field(description="Route to overlay — pass compute_route()'s result directly. Add/override 'color' (hex) to customize."),
@@ -286,32 +263,22 @@ async def generate_map(
286
263
 
287
264
  Example: generate_map(place="Tokyo Station")
288
265
  """
289
- has_center = place or (lat is not None and lng is not None)
266
+ has_center = place or location is not None
290
267
  has_route_coords = route is not None and route.coords is not None and len(route.coords) >= 2
291
268
  if not has_center and not markers and not has_route_coords:
292
- raise ValueError("Specify 'place', both 'lat'+'lng', 'markers', or a 'route' with coords.")
293
- if radius is not None and (size_ew is not None or size_ns is not None):
294
- raise ValueError("Specify either 'radius' or 'size_ew'+'size_ns', not both.")
295
- if (size_ew is None) != (size_ns is None):
296
- raise ValueError("'size_ew' and 'size_ns' must be specified together.")
269
+ raise ValueError("Specify 'place', 'location', 'markers', or a 'route' with coords.")
297
270
 
298
271
  body: dict = {}
299
- if layers is not None:
300
- body["layers"] = _LAYER_PRESETS[layers]
301
272
  if place:
302
273
  body["place"] = place
303
- elif lat is not None and lng is not None:
304
- body["center"] = {"lat": lat, "lng": lng}
274
+ if location is not None:
275
+ body["center"] = location.model_dump()
305
276
  if markers is not None:
306
277
  body["markers"] = [m.model_dump(exclude_none=True) for m in markers]
307
278
  if name is not None:
308
279
  body["name"] = name
309
280
  if color_set is not None:
310
281
  body["colorSet"] = color_set
311
- if radius is not None:
312
- body["radius"] = radius
313
- elif size_ew is not None:
314
- body["size"] = {"ew": size_ew, "ns": size_ns}
315
282
  if route is not None:
316
283
  body["route"] = route.model_dump(by_alias=True, exclude_none=True)
317
284
 
@@ -336,7 +303,7 @@ async def generate_map(
336
303
  if status == "failed":
337
304
  raise RuntimeError(
338
305
  f"Map generation failed (dataKey={data_key}). "
339
- "Try a different location or smaller radius."
306
+ "Try a different location."
340
307
  )
341
308
  if status == "pending":
342
309
  return _still_in_progress_result(data_key)
@@ -347,8 +314,8 @@ async def generate_map(
347
314
 
348
315
  if place:
349
316
  label = place
350
- elif lat is not None and lng is not None:
351
- label = f"{lat}_{lng}"
317
+ elif location is not None:
318
+ label = f"{location.lat}_{location.lng}"
352
319
  elif markers:
353
320
  label = "_".join(m.label or "" for m in markers)[:40]
354
321
  else:
@@ -391,7 +358,7 @@ async def check_map_status(
391
358
  if status == "failed":
392
359
  raise RuntimeError(
393
360
  f"Map generation failed (dataKey={data_key}). "
394
- "Try a different location or smaller radius."
361
+ "Try a different location."
395
362
  )
396
363
  if status != "ready":
397
364
  if ctx is not None:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mapnetwork-mcp"
3
- version = "2.0.0"
3
+ version = "3.0.0"
4
4
  description = "MCP server — generate styled map images via mapnetwork.app"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -0,0 +1,158 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "MapNetwork MCP - 入力JSON仕様",
4
+ "description": "mapnetwork_mcp/server.py で定義されている4つのMCPツールの入力パラメータ仕様。各属性の型・デフォルト値・設定可能値(enum)・制約を示す。",
5
+ "definitions": {
6
+ "Location": {
7
+ "type": "object",
8
+ "description": "明示的な緯度経度座標",
9
+ "properties": {
10
+ "lat": { "type": "number", "description": "緯度" },
11
+ "lng": { "type": "number", "description": "経度" }
12
+ },
13
+ "required": ["lat", "lng"]
14
+ },
15
+ "Marker": {
16
+ "type": "object",
17
+ "description": "地図上にピン留めする地点",
18
+ "properties": {
19
+ "label": { "type": ["string", "null"], "default": null, "description": "地名(ジオコーディング・表示用)" },
20
+ "location": { "oneOf": [{ "$ref": "#/definitions/Location" }, { "type": "null" }], "default": null, "description": "明示的な座標。指定するとlabelのジオコーディングは省略される" }
21
+ }
22
+ },
23
+ "RouteEndpoint": {
24
+ "type": "object",
25
+ "description": "ルートの始点/終点",
26
+ "properties": {
27
+ "label": { "type": ["string", "null"], "default": null, "description": "地名(ジオコーディング・表示用)" },
28
+ "location": { "oneOf": [{ "$ref": "#/definitions/Location" }, { "type": "null" }], "default": null, "description": "明示的な座標" }
29
+ }
30
+ },
31
+ "RouteInput": {
32
+ "type": "object",
33
+ "description": "generate_mapのrouteパラメータ。compute_routeの戻り値をそのまま渡せる",
34
+ "properties": {
35
+ "coords": {
36
+ "type": ["array", "null"],
37
+ "default": null,
38
+ "description": "ルート上の[lat, lng]座標列",
39
+ "items": { "type": "array", "items": { "type": "number" }, "minItems": 2, "maxItems": 2 }
40
+ },
41
+ "mode": { "oneOf": [{ "type": "string", "enum": ["walking", "driving"] }, { "type": "null" }], "default": null },
42
+ "from": { "oneOf": [{ "$ref": "#/definitions/RouteEndpoint" }, { "type": "null" }], "default": null, "description": "ルート始点" },
43
+ "to": { "oneOf": [{ "$ref": "#/definitions/RouteEndpoint" }, { "type": "null" }], "default": null, "description": "ルート終点" },
44
+ "color": { "type": ["string", "null"], "default": null, "description": "ルート線の色(CSS16進カラー、例: '#FF4500')" }
45
+ }
46
+ },
47
+ "ColorSet": {
48
+ "type": "string",
49
+ "description": "カラーテーマ",
50
+ "enum": ["white", "darkBlue", "darkGreen", "popArt", "lightBlue", "lightGreen", "beige", "magenta", "gray", "black", "brawn"],
51
+ "default": "white"
52
+ },
53
+ "Format": {
54
+ "type": "string",
55
+ "enum": ["png", "svg"],
56
+ "default": "png"
57
+ }
58
+ },
59
+ "tools": {
60
+ "generate_map": {
61
+ "description": "指定した場所のスタイル付き地図画像を生成し、Downloadsフォルダに保存する",
62
+ "type": "object",
63
+ "properties": {
64
+ "place": { "type": ["string", "null"], "default": null, "description": "地図に表示する地名。locationが未指定ならサーバー側でジオコーディングする" },
65
+ "location": {
66
+ "oneOf": [{ "$ref": "#/definitions/Location" }, { "type": "null" }],
67
+ "default": null,
68
+ "description": "placeの明示的な座標。指定するとplaceのジオコーディングは省略される(Markerのlabel+locationと同じパターン)。locationのみの指定も可能(ただしその場合ピンは表示されない)。地図の最終的な中心(center)と必ずしも一致しない点に注意(markers/routeで複数座標がある場合、centerはそれらを包含する範囲の中点になる)"
69
+ },
70
+ "markers": {
71
+ "type": ["array", "null"],
72
+ "default": null,
73
+ "description": "地図上にピン留めする地点リスト",
74
+ "items": { "$ref": "#/definitions/Marker" }
75
+ },
76
+ "name": { "type": ["string", "null"], "default": null, "description": "データファイルに保存する地図名" },
77
+ "route": {
78
+ "oneOf": [{ "$ref": "#/definitions/RouteInput" }, { "type": "null" }],
79
+ "default": null,
80
+ "description": "地図に重ねるルート。compute_routeの戻り値をそのまま渡せる"
81
+ },
82
+ "color_set": {
83
+ "oneOf": [{ "$ref": "#/definitions/ColorSet" }, { "type": "null" }],
84
+ "default": null,
85
+ "description": "カラーテーマ。ユーザーが明示的に要求した場合のみ設定"
86
+ },
87
+ "format": { "allOf": [{ "$ref": "#/definitions/Format" }], "description": "出力形式" },
88
+ "canvas_width": { "type": ["integer", "null"], "default": null, "description": "キャンバス幅(ピクセル)。未指定時サーバー側デフォルト1000" },
89
+ "canvas_height": { "type": ["integer", "null"], "default": null, "description": "キャンバス高さ(ピクセル)。未指定時サーバー側デフォルト600" }
90
+ },
91
+ "constraints": [
92
+ "place / location / markers / route.coords(2点以上) のいずれか1つ以上を指定する必要がある",
93
+ "地図の形状・サイズ(円形/矩形)、および取得レイヤー(道路・POI・鉄道・水域・索道)はサーバー側で入力座標から自動決定され、手動指定はできない。入力座標が1点のみなら円形、2点以上ならそれらを包含する矩形(または正方形)になる。具体的な半径・サイズの初期値や上限はサーバー側の実装詳細であり、将来変更されうる"
94
+ ],
95
+ "example": { "place": "Tokyo Station" }
96
+ },
97
+ "compute_route": {
98
+ "description": "2地点間の徒歩/車ルートを計算する。戻り値はgenerate_mapのrouteパラメータにそのまま渡せる",
99
+ "type": "object",
100
+ "properties": {
101
+ "from_location": {
102
+ "allOf": [{ "$ref": "#/definitions/RouteEndpoint" }],
103
+ "description": "ルート始点。'location'で座標指定、または'label'でジオコーディング",
104
+ "required": true
105
+ },
106
+ "to_location": {
107
+ "allOf": [{ "$ref": "#/definitions/RouteEndpoint" }],
108
+ "description": "ルート終点。from_locationと同じ形式",
109
+ "required": true
110
+ },
111
+ "mode": {
112
+ "allOf": [{ "type": "string", "enum": ["walking", "driving"] }],
113
+ "default": "walking",
114
+ "description": "移動手段"
115
+ }
116
+ },
117
+ "required": ["from_location", "to_location"],
118
+ "example": {
119
+ "from_location": { "label": "Tokyo Station" },
120
+ "to_location": { "label": "Tokyo Tower" }
121
+ }
122
+ },
123
+ "check_map_status": {
124
+ "description": "generate_mapが未完了(pending)を返した場合のジョブをポーリングし、完了していればダウンロードする",
125
+ "type": "object",
126
+ "properties": {
127
+ "data_key": { "type": "string", "description": "generate_mapが返したdataKey", "required": true },
128
+ "color_set": {
129
+ "oneOf": [{ "$ref": "#/definitions/ColorSet" }, { "type": "null" }],
130
+ "default": null,
131
+ "description": "generate_map呼び出し時と同じ値を指定"
132
+ },
133
+ "format": { "allOf": [{ "$ref": "#/definitions/Format" }], "description": "generate_map呼び出し時と同じ値を指定" },
134
+ "canvas_width": { "type": ["integer", "null"], "default": null, "description": "generate_map呼び出し時と同じ値を指定" },
135
+ "canvas_height": { "type": ["integer", "null"], "default": null, "description": "generate_map呼び出し時と同じ値を指定" }
136
+ },
137
+ "required": ["data_key"],
138
+ "example": { "data_key": "20260618aBcDeFgHiJ" }
139
+ },
140
+ "redownload_map": {
141
+ "description": "生成済みの地図を、再生成せずに別のカラーテーマ/形式/サイズで再ダウンロードする",
142
+ "type": "object",
143
+ "properties": {
144
+ "data_key": { "type": "string", "description": "以前のgenerate_map呼び出しが返したdataKey", "required": true },
145
+ "color_set": {
146
+ "oneOf": [{ "$ref": "#/definitions/ColorSet" }, { "type": "null" }],
147
+ "default": null,
148
+ "description": "ユーザーが明示的に要求した場合のみ設定"
149
+ },
150
+ "format": { "allOf": [{ "$ref": "#/definitions/Format" }], "description": "'png'(ラスター)または'svg'(ベクター)" },
151
+ "canvas_width": { "type": ["integer", "null"], "default": null, "description": "キャンバス幅(ピクセル)。未指定時サーバー側デフォルト1000" },
152
+ "canvas_height": { "type": ["integer", "null"], "default": null, "description": "キャンバス高さ(ピクセル)。未指定時サーバー側デフォルト600" }
153
+ },
154
+ "required": ["data_key"],
155
+ "example": { "data_key": "20260618aBcDeFgHiJ", "color_set": "black" }
156
+ }
157
+ }
158
+ }
File without changes
File without changes