timetable-api-node 1.7.1 → 1.7.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/INTEGRATION.md +39 -1
- package/README.md +24 -9
- package/mcp/stdio.js +18 -1
- package/package.json +1 -1
package/INTEGRATION.md
CHANGED
|
@@ -23,6 +23,44 @@ Open **Settings → Connectors → Add custom connector** and paste `https://api
|
|
|
23
23
|
|
|
24
24
|
`claude_desktop_config.json` only takes stdio servers (`command`/`args`), not a `url` — to go through the config file instead, use the stdio entry below.
|
|
25
25
|
|
|
26
|
+
### ChatGPT
|
|
27
|
+
|
|
28
|
+
Paid plans (Plus, Pro, Business, Enterprise, Edu), on the web:
|
|
29
|
+
|
|
30
|
+
1. **Settings → Apps & Connectors → Advanced settings** → turn on **Developer mode**.
|
|
31
|
+
2. Back in **Apps & Connectors**, click **Create** (Business/Enterprise/Edu: an admin can also publish it to the whole workspace).
|
|
32
|
+
3. Name it (e.g. "Lviv transport"), set the MCP server URL to `https://api.lad.lviv.ua/mcp`, and authentication to **No authentication**.
|
|
33
|
+
4. In a chat, enable the connector from the **+** menu and ask, e.g. "When is the next tram at stop 707?"
|
|
34
|
+
|
|
35
|
+
ChatGPT shows the text and data of each result; whether it draws the `map` / `arrival_list` blocks is up to its UI. Menu names move between ChatGPT releases — if they differ, look for *Developer mode* and *custom connector / app*.
|
|
36
|
+
|
|
37
|
+
### OpenAI Responses API
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from openai import OpenAI
|
|
41
|
+
|
|
42
|
+
client = OpenAI()
|
|
43
|
+
response = client.responses.create(
|
|
44
|
+
model="your-model",
|
|
45
|
+
tools=[{
|
|
46
|
+
"type": "mcp",
|
|
47
|
+
"server_label": "lviv_transport",
|
|
48
|
+
"server_url": "https://api.lad.lviv.ua/mcp",
|
|
49
|
+
"require_approval": "never", # every tool is read-only
|
|
50
|
+
}],
|
|
51
|
+
input="How do I get from Рясне-1 to Сихівська?",
|
|
52
|
+
)
|
|
53
|
+
print(response.output_text)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Gemini
|
|
57
|
+
|
|
58
|
+
- **Gemini Enterprise** — an admin opens the Gemini Enterprise app in the Google Cloud console, goes to **Data stores → Add data store → MCP server** (custom MCP), and enters `https://api.lad.lviv.ua/mcp` with no authentication. Users then pick it as a source in chat.
|
|
59
|
+
- **Gemini app (consumer)** — adding a remote MCP server by URL is part of Gemini Spark (Google AI Ultra plan): add a custom connector and paste `https://api.lad.lviv.ua/mcp`.
|
|
60
|
+
- **Antigravity CLI and other Gemini-based agents** — register it as a remote (HTTP / streamable HTTP) MCP server with URL `https://api.lad.lviv.ua/mcp`; no headers or key needed.
|
|
61
|
+
|
|
62
|
+
As with ChatGPT, these menus are new and still moving; the constant is the URL and "no authentication".
|
|
63
|
+
|
|
26
64
|
### Cursor / Windsurf / other clients with remote MCP support
|
|
27
65
|
|
|
28
66
|
```json
|
|
@@ -73,7 +111,7 @@ All tools are read-only. Argument names are **exact** — pass them as shown.
|
|
|
73
111
|
| `search_stops` | `query` (string), `limit` (int 1–25, optional) | Stop IDs by name — Ukrainian or English, partial, inflection-tolerant. |
|
|
74
112
|
| `get_stops_around_location` | `latitude`, `longitude` (numbers), `radius_meters` (int 50–3000, optional) | Stop IDs near a coordinate, with serving routes. |
|
|
75
113
|
| `get_stop_realtime` | `stop_id` (number or digit string) | Live arrivals at a stop: route, destination, minutes to arrival. |
|
|
76
|
-
| `find_routes_between` | `from_stop_id`, `to_stop_id` |
|
|
114
|
+
| `find_routes_between` | `from_stop_id`, `to_stop_id` | Routes from A to B, direct or with one interchange in a nearby-stop cluster: where to board, transfer and get off. |
|
|
77
115
|
| `get_route_static` | `route_name` (string, e.g. `"T30"`), `include_shapes` (bool, optional) | Stop lists (both directions), first-stop timetable; polylines on request. |
|
|
78
116
|
| `get_route_realtime` | `route_name` (string) | Live vehicles on a route with destination and next stop. |
|
|
79
117
|
| `get_nearby_vehicles` | `latitude`, `longitude` (numbers), `radius_meters`, `route`, `limit` (optional) | Live vehicles near a coordinate, nearest first. |
|
package/README.md
CHANGED
|
@@ -147,7 +147,7 @@ All tools are read-only. Stop IDs are the numeric codes on stop signs, returned
|
|
|
147
147
|
| `search_stops` | `query` (string, ≥ 2 chars), `limit` (1–25, default 10) | Stops whose Ukrainian or English name contains every query word (inflection-tolerant: `"опера"` finds «Театр опери та балету»), with `routes`. |
|
|
148
148
|
| `get_stops_around_location` | `latitude`, `longitude`, `radius_meters` (50–3000, default 1000) | Stops near a point, nearest first, with `distance_meters` and `routes`. |
|
|
149
149
|
| `get_stop_realtime` | `stop_id` | Live arrivals: `route`, `direction` (destination), `vehicle_type`, `arrival_minutes`, vehicle position. |
|
|
150
|
-
| `find_routes_between` | `from_stop_id`, `to_stop_id` |
|
|
150
|
+
| `find_routes_between` | `from_stop_id`, `to_stop_id` | Routes within a 300 m walk of each end, best first: direct `options` (`board_stop`, `alight_stop`, `destination`, `stops_count`, walk at each end) and `transfer_options` with exactly one interchange inside a 300 m stop cluster. |
|
|
151
151
|
| `get_route_static` | `route_name`, `include_shapes` (default false) | Name, type, colour, stop lists for both directions, first-stop timetable; polylines only on request. |
|
|
152
152
|
| `get_route_realtime` | `route_name` | Vehicles on the route with `destination` and `next_stop` (`id`, `name`, ISO `arrival`). |
|
|
153
153
|
| `get_nearby_vehicles` | `latitude`, `longitude`, `radius_meters` (100–1000, default 500), `route`, `limit` (1–50, default 15) | Live vehicles nearest first, with `destination` and `distance_meters`; `total` counts all in range. |
|
|
@@ -241,13 +241,24 @@ Text summary: *"3 direct routes «Площа Ринок» → «Залізнич
|
|
|
241
241
|
"walk_from_alight_meters": 0
|
|
242
242
|
}
|
|
243
243
|
],
|
|
244
|
+
"transfer_options": [],
|
|
245
|
+
"map_stops": [
|
|
246
|
+
{ "id": "58", "name": "Руська", "lat": 49.84186, "lng": 24.03408, "role": "board" },
|
|
247
|
+
{ "id": "118", "name": "Залізничний вокзал", "lat": 49.839, "lng": 23.99677, "role": "alight" }
|
|
248
|
+
],
|
|
244
249
|
"updated_at": "2026-09-23T09:36:53Z"
|
|
245
250
|
},
|
|
246
|
-
"ui_blocks": [
|
|
251
|
+
"ui_blocks": [
|
|
252
|
+
{ "type": "map", "data": { "center": [49.84043, 24.01543], "zoom": 13, "layers": { "stops": "data.map_stops" } } }
|
|
253
|
+
]
|
|
247
254
|
}
|
|
248
255
|
```
|
|
249
256
|
|
|
250
|
-
Each end covers every stop within a 300 m walk (`stop_ids`): a line's two directions often stop on opposite sides of a street under different names, as here, where Т01 towards the station leaves from «Руська», not «Площа Ринок». Options are ranked by stops plus walking (150 m of walking weighs as one stop), one per route and direction. A direction's last stop counts as a place to get off, not to board.
|
|
257
|
+
Each end covers every stop within a 300 m walk (`stop_ids`): a line's two directions often stop on opposite sides of a street under different names, as here, where Т01 towards the station leaves from «Руська», not «Площа Ринок». Options are ranked by stops plus walking (150 m of walking weighs as one stop), one per route and direction. A direction's last stop counts as a place to get off, not to board.
|
|
258
|
+
|
|
259
|
+
`transfer_options` hold trips with exactly one interchange, never more. Each has two `legs` (same fields as a direct option, minus the walks) and `transfer_walk_meters`: the interchange may be the same stop (0) or any stop within 300 m of where the first leg ends, so a cluster of stops around a square or junction works as one interchange. A line that already reaches the destination directly is never used as either leg, and a transfer costs as much as 5 extra stops in the ranking. Transfer options are listed (up to 5) when there is no direct route, or when they beat the best direct one. Both lists empty means the trip needs two or more transfers.
|
|
260
|
+
|
|
261
|
+
`map_stops` is the best trip's stops in riding order (a transfer option when one is listed, since those only appear when they beat every direct one), each with a `role`: `board`, `transfer` (same-stop interchange) or `transfer_alight` + `transfer_board` (walking interchange), and `alight`. The `map` block plots them, centred on the box around all of them (interchange included) with zoom 14–11 by its size.
|
|
251
262
|
|
|
252
263
|
</details>
|
|
253
264
|
|
|
@@ -386,13 +397,15 @@ Each end covers every stop within a 300 m walk (`stop_ids`): a line's two direct
|
|
|
386
397
|
|
|
387
398
|
### Prompts
|
|
388
399
|
|
|
389
|
-
Reusable instruction templates
|
|
400
|
+
Reusable instruction templates. `stop_id` is a positive integer or digits-only string.
|
|
390
401
|
|
|
391
|
-
| Prompt | Use case |
|
|
392
|
-
|
|
393
|
-
| `
|
|
394
|
-
| `
|
|
395
|
-
| `transit-
|
|
402
|
+
| Prompt | Arguments | Use case |
|
|
403
|
+
|--------|-----------|----------|
|
|
404
|
+
| `plan-trip` | `from`, `to` | Routes between two named places (or stop IDs), direct or with one transfer, with live departures from the boarding stop. |
|
|
405
|
+
| `route-status` | `route_name` | Where a route's vehicles are right now, by direction. `route_name` supports completion. |
|
|
406
|
+
| `transit-map-view` | `stop_id` | Map-first rendering of live vehicles for a stop. |
|
|
407
|
+
| `transit-arrival-list` | `stop_id` | Arrival list for a stop, sorted by ETA and grouped by route. |
|
|
408
|
+
| `transit-hybrid-view` | `stop_id` | Map block first, arrival-list block second, with ETA values kept consistent across both. |
|
|
396
409
|
|
|
397
410
|
### Resources and resource templates
|
|
398
411
|
|
|
@@ -406,6 +419,8 @@ In addition to tools, the server exposes MCP **resources** for reference data th
|
|
|
406
419
|
| `timetable://stop/{code}` | Static info for a stop by numeric code — name, coordinates, serving routes (JSON) |
|
|
407
420
|
| `timetable://route/{name}` | Static metadata for a route by short name — color, type, stop counts (JSON) |
|
|
408
421
|
|
|
422
|
+
`{name}` in `timetable://route/{name}` supports `completion/complete` ("t3" → "Т30", "a1" → "А01"). Unknown stops or routes fail with JSON-RPC error `-32002` (resource not found).
|
|
423
|
+
|
|
409
424
|
### Security model
|
|
410
425
|
|
|
411
426
|
- Public read-only (no authentication).
|
package/mcp/stdio.js
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
ReadResourceRequestSchema,
|
|
17
17
|
ListPromptsRequestSchema,
|
|
18
18
|
GetPromptRequestSchema,
|
|
19
|
+
CompleteRequestSchema,
|
|
19
20
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
20
21
|
|
|
21
22
|
const upstreamUrl = new URL(
|
|
@@ -37,14 +38,25 @@ async function main() {
|
|
|
37
38
|
upstream.listPrompts(),
|
|
38
39
|
]);
|
|
39
40
|
|
|
41
|
+
// Pass the upstream identity and instructions through: the instructions
|
|
42
|
+
// carry the tool-selection guidance, and without them a stdio client gets
|
|
43
|
+
// the bare tool list only.
|
|
44
|
+
const upstreamInfo = upstream.getServerVersion() ?? {};
|
|
45
|
+
const upstreamCapabilities = upstream.getServerCapabilities() ?? {};
|
|
40
46
|
const server = new Server(
|
|
41
|
-
{
|
|
47
|
+
{
|
|
48
|
+
...upstreamInfo,
|
|
49
|
+
name: upstreamInfo.name ?? "com.lad.lviv/timetable-api",
|
|
50
|
+
version: pkg.version,
|
|
51
|
+
},
|
|
42
52
|
{
|
|
43
53
|
capabilities: {
|
|
44
54
|
...(tools.length && { tools: {} }),
|
|
45
55
|
...(resources.length || resourceTemplates.length ? { resources: {} } : {}),
|
|
46
56
|
...(prompts.length && { prompts: {} }),
|
|
57
|
+
...(upstreamCapabilities.completions && { completions: {} }),
|
|
47
58
|
},
|
|
59
|
+
instructions: upstream.getInstructions(),
|
|
48
60
|
},
|
|
49
61
|
);
|
|
50
62
|
|
|
@@ -62,6 +74,11 @@ async function main() {
|
|
|
62
74
|
server.setRequestHandler(GetPromptRequestSchema, async (req) =>
|
|
63
75
|
upstream.getPrompt(req.params),
|
|
64
76
|
);
|
|
77
|
+
if (upstreamCapabilities.completions) {
|
|
78
|
+
server.setRequestHandler(CompleteRequestSchema, async (req) =>
|
|
79
|
+
upstream.complete(req.params),
|
|
80
|
+
);
|
|
81
|
+
}
|
|
65
82
|
|
|
66
83
|
await server.connect(new StdioServerTransport());
|
|
67
84
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "timetable-api-node",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.3",
|
|
4
4
|
"description": "Lviv (Ukraine) public transport REST API and read-only Model Context Protocol (MCP) server: stops, timetables, routes, live vehicle positions, GTFS/GTFS-RT. No API key required.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|