sbb-mcp 0.1.3 → 0.2.0

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/LICENSE CHANGED
@@ -1,57 +1,57 @@
1
- # Functional Source License, Version 1.1, MIT Future License
2
-
3
- ## Abbreviation
4
- FSL-1.1-MIT
5
-
6
- ## Notice
7
- Copyright 2026 SwissTrip (F. Weinhappl)
8
-
9
- ## Terms and Conditions
10
-
11
- ### Licensor ("We")
12
- The party offering the Software under these Terms and Conditions.
13
-
14
- ### The Software
15
- The "Software" is each version of the software that we make available under these Terms and Conditions, as indicated by our inclusion of these Terms and Conditions with the Software.
16
-
17
- ### License Grant
18
- Subject to your compliance with this License Grant and the Patents, Redistribution and Trademark clauses below, we hereby grant you the right to use, copy, modify, create derivative works, publicly perform, publicly display and redistribute the Software for any Permitted Purpose identified below.
19
-
20
- ### Permitted Purpose
21
- A Permitted Purpose is any purpose other than a Competing Use. A Competing Use means making the Software available to others in a commercial product or service that:
22
-
23
- 1. substitutes for the Software;
24
- 2. substitutes for any other product or service we offer using the Software that exists as of the date we make the Software available; or
25
- 3. offers the same or substantially similar functionality as the Software.
26
-
27
- Permitted Purposes specifically include using the Software:
28
-
29
- 1. for your internal use and access;
30
- 2. for non-commercial education;
31
- 3. for non-commercial research; and
32
- 4. in connection with professional services that you provide to a licensee using the Software in accordance with these Terms and Conditions.
33
-
34
- ### Patents
35
- To the extent your use for a Permitted Purpose would necessarily infringe our patents, the license grant above includes a license under our patents. If you make a claim against any party that the Software infringes or contributes to the infringement of any patent, then your patent license to the Software ends immediately.
36
-
37
- ### Redistribution
38
- The Terms and Conditions apply to all copies, modifications and derivatives of the Software.
39
-
40
- If you redistribute any copies, modifications or derivatives of the Software, you must include a copy of or a link to these Terms and Conditions and not remove any copyright notices provided in or with the Software.
41
-
42
- ### Disclaimer
43
- THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
44
-
45
- IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
46
-
47
- ### Trademarks
48
- Except for displaying the License Details and identifying us as the origin of the Software, you have no right under these Terms and Conditions to use our trademarks, trade names, service marks or product names.
49
-
50
- ## Grant of Future License
51
- We hereby irrevocably grant you an additional license to use the Software under the MIT license that is effective on the second anniversary of the date we make the Software available. On or after that date, you may use the Software under the MIT license, in which case the following will apply:
52
-
53
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
54
-
55
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
56
-
57
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ # Functional Source License, Version 1.1, MIT Future License
2
+
3
+ ## Abbreviation
4
+ FSL-1.1-MIT
5
+
6
+ ## Notice
7
+ Copyright 2026 SwissTrip (F. Weinhappl)
8
+
9
+ ## Terms and Conditions
10
+
11
+ ### Licensor ("We")
12
+ The party offering the Software under these Terms and Conditions.
13
+
14
+ ### The Software
15
+ The "Software" is each version of the software that we make available under these Terms and Conditions, as indicated by our inclusion of these Terms and Conditions with the Software.
16
+
17
+ ### License Grant
18
+ Subject to your compliance with this License Grant and the Patents, Redistribution and Trademark clauses below, we hereby grant you the right to use, copy, modify, create derivative works, publicly perform, publicly display and redistribute the Software for any Permitted Purpose identified below.
19
+
20
+ ### Permitted Purpose
21
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use means making the Software available to others in a commercial product or service that:
22
+
23
+ 1. substitutes for the Software;
24
+ 2. substitutes for any other product or service we offer using the Software that exists as of the date we make the Software available; or
25
+ 3. offers the same or substantially similar functionality as the Software.
26
+
27
+ Permitted Purposes specifically include using the Software:
28
+
29
+ 1. for your internal use and access;
30
+ 2. for non-commercial education;
31
+ 3. for non-commercial research; and
32
+ 4. in connection with professional services that you provide to a licensee using the Software in accordance with these Terms and Conditions.
33
+
34
+ ### Patents
35
+ To the extent your use for a Permitted Purpose would necessarily infringe our patents, the license grant above includes a license under our patents. If you make a claim against any party that the Software infringes or contributes to the infringement of any patent, then your patent license to the Software ends immediately.
36
+
37
+ ### Redistribution
38
+ The Terms and Conditions apply to all copies, modifications and derivatives of the Software.
39
+
40
+ If you redistribute any copies, modifications or derivatives of the Software, you must include a copy of or a link to these Terms and Conditions and not remove any copyright notices provided in or with the Software.
41
+
42
+ ### Disclaimer
43
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
44
+
45
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
46
+
47
+ ### Trademarks
48
+ Except for displaying the License Details and identifying us as the origin of the Software, you have no right under these Terms and Conditions to use our trademarks, trade names, service marks or product names.
49
+
50
+ ## Grant of Future License
51
+ We hereby irrevocably grant you an additional license to use the Software under the MIT license that is effective on the second anniversary of the date we make the Software available. On or after that date, you may use the Software under the MIT license, in which case the following will apply:
52
+
53
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
54
+
55
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
56
+
57
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,232 +1,276 @@
1
- # sbb-mcp
2
-
3
- [![npm version](https://img.shields.io/npm/v/sbb-mcp.svg)](https://www.npmjs.com/package/sbb-mcp)
4
- [![License: FSL-1.1-MIT](https://img.shields.io/badge/License-FSL--1.1--MIT-blue.svg)](https://fsl.software/)
5
- [![smithery badge](https://smithery.ai/badge/fabsforward2-zhoi/sbb-mcp)](https://smithery.ai/servers/fabsforward2-zhoi/sbb-mcp)
6
-
7
- MCP server for **Swiss Federal Railways** (SBB/CFF/FFS) -- real-time train schedules, prices, and ticket purchase links for any AI assistant.
8
-
9
- Works with Claude Desktop, Claude Code, Cursor, Windsurf, VS Code Copilot, ChatGPT, and any MCP-compatible AI client.
10
-
11
- ## Features
12
-
13
- - **Search stations** -- find any Swiss train station by name
14
- - **Train connections** -- real-time schedules with departure/arrival times, platforms, transfers
15
- - **Ticket prices** -- 1st/2nd class with Half-Fare (Halbtax) and GA travelcard support
16
- - **Purchase links** -- direct deep links to buy tickets on SBB.ch
17
- - **Pagination** -- browse earlier/later connections
18
- - **Trip details** -- intermediate stops, occupancy, platform changes
19
- - **Journey planning** -- built-in prompt for end-to-end trip planning
20
- - **Mock mode** -- works without credentials for testing and demos
21
-
22
- ## Quick Start
23
-
24
- ### Claude Desktop
25
-
26
- Add to your `claude_desktop_config.json`:
27
-
28
- ```json
29
- {
30
- "mcpServers": {
31
- "sbb": {
32
- "command": "npx",
33
- "args": ["-y", "sbb-mcp"],
34
- "env": {
35
- "SMAPI_CLIENT_ID": "your-client-id",
36
- "SMAPI_CLIENT_SECRET": "your-secret",
37
- "SMAPI_SCOPE": "your-scope",
38
- "SMAPI_CONTRACT_ID": "your-contract-id"
39
- }
40
- }
41
- }
42
- }
43
- ```
44
-
45
- ### Claude Code
46
-
47
- ```bash
48
- claude mcp add sbb -- npx -y sbb-mcp
49
- ```
50
-
51
- ### Cursor
52
-
53
- Add to `.cursor/mcp.json`:
54
-
55
- ```json
56
- {
57
- "mcpServers": {
58
- "sbb": {
59
- "command": "npx",
60
- "args": ["-y", "sbb-mcp"],
61
- "env": {
62
- "SMAPI_CLIENT_ID": "your-client-id",
63
- "SMAPI_CLIENT_SECRET": "your-secret",
64
- "SMAPI_SCOPE": "your-scope",
65
- "SMAPI_CONTRACT_ID": "your-contract-id"
66
- }
67
- }
68
- }
69
- }
70
- ```
71
-
72
- ### Windsurf
73
-
74
- Add to `~/.codeium/windsurf/mcp_config.json`:
75
-
76
- ```json
77
- {
78
- "mcpServers": {
79
- "sbb": {
80
- "command": "npx",
81
- "args": ["-y", "sbb-mcp"],
82
- "env": {
83
- "SMAPI_CLIENT_ID": "your-client-id",
84
- "SMAPI_CLIENT_SECRET": "your-secret",
85
- "SMAPI_SCOPE": "your-scope",
86
- "SMAPI_CONTRACT_ID": "your-contract-id"
87
- }
88
- }
89
- }
90
- }
91
- ```
92
-
93
- ### VS Code Copilot
94
-
95
- Add to `.vscode/mcp.json`:
96
-
97
- ```json
98
- {
99
- "servers": {
100
- "sbb": {
101
- "command": "npx",
102
- "args": ["-y", "sbb-mcp"],
103
- "env": {
104
- "SMAPI_CLIENT_ID": "your-client-id",
105
- "SMAPI_CLIENT_SECRET": "your-secret",
106
- "SMAPI_SCOPE": "your-scope",
107
- "SMAPI_CONTRACT_ID": "your-contract-id"
108
- }
109
- }
110
- }
111
- }
112
- ```
113
-
114
- ### Smithery
115
-
116
- Install via [Smithery](https://smithery.ai/servers/fabsforward2-zhoi/sbb-mcp):
117
-
118
- ```bash
119
- npx @smithery/cli mcp add fabsforward2-zhoi/sbb-mcp
120
- ```
121
-
122
- ### Demo Mode (No Credentials)
123
-
124
- Run without any environment variables to use mock data:
125
-
126
- ```bash
127
- npx sbb-mcp
128
- ```
129
-
130
- This lets you test the MCP server with realistic Swiss station data without SBB API credentials.
131
-
132
- ## Tools
133
-
134
- ### search_stations
135
-
136
- Search for Swiss train stations by name. Returns station IDs needed for other tools.
137
-
138
- **Input:**
139
- - `query` (string, required) -- Station name, e.g. "Zurich", "Bern", "Interlaken"
140
- - `limit` (number, optional) -- Max results (default: 10)
141
-
142
- **Example:** "Find stations matching Luzern"
143
-
144
- ### search_connections
145
-
146
- Find train connections between two stations. Automatically resolves station names to IDs.
147
-
148
- **Input:**
149
- - `from` (string, required) -- Origin station name or ID (e.g. "Zurich HB" or "8503000")
150
- - `to` (string, required) -- Destination station name or ID
151
- - `date` (string, optional) -- Travel date YYYY-MM-DD
152
- - `time` (string, optional) -- Departure time HH:MM
153
- - `arrival_time` (boolean, optional) -- Treat time as arrival time
154
-
155
- **Example:** "Show me trains from Zurich to Bern tomorrow at 9am"
156
-
157
- ### get_trip_details
158
-
159
- Get detailed stop-by-stop information for a connection including intermediate stops, platforms, and occupancy forecasts.
160
-
161
- **Input:**
162
- - `trip_id` (string, required) -- Trip ID from search_connections
163
-
164
- ### get_more_connections
165
-
166
- Load earlier or later trains for a previous search.
167
-
168
- **Input:**
169
- - `collection_id` (string, required) -- Collection ID from search_connections
170
- - `direction` ("next" | "previous") -- Later or earlier trains
171
-
172
- ### get_prices
173
-
174
- Get ticket prices with Swiss reduction card support.
175
-
176
- **Input:**
177
- - `trip_ids` (string[], required) -- Trip IDs from search_connections
178
- - `traveler_type` ("ADULT" | "CHILD", default: "ADULT")
179
- - `reduction_card` ("HALF_FARE" | "GA" | "NONE", default: "HALF_FARE")
180
-
181
- **Example:** "How much is a ticket from Zurich to Zermatt with Half-Fare card?"
182
-
183
- ### get_ticket_link
184
-
185
- Get a direct purchase link to buy the ticket on SBB.ch. Only call when the user wants to buy.
186
-
187
- **Input:**
188
- - `trip_id` (string, required) -- Trip ID to purchase
189
- - `traveler_type` ("ADULT" | "CHILD", default: "ADULT")
190
- - `reduction_card` ("HALF_FARE" | "GA" | "NONE", default: "HALF_FARE")
191
-
192
- ## Prompts
193
-
194
- ### plan_journey
195
-
196
- End-to-end journey planning prompt. Searches connections, compares prices, and provides ticket links.
197
-
198
- **Input:**
199
- - `from` (string, required) -- Origin station
200
- - `to` (string, required) -- Destination station
201
- - `date` (string, optional) -- Travel date
202
-
203
- ## Environment Variables
204
-
205
- | Variable | Required | Description |
206
- |----------|----------|-------------|
207
- | `SMAPI_CLIENT_ID` | Yes* | OAuth 2.0 client ID from SBB Developer Portal |
208
- | `SMAPI_CLIENT_SECRET` | Yes* | OAuth 2.0 client secret |
209
- | `SMAPI_SCOPE` | Yes* | OAuth scope |
210
- | `SMAPI_CONTRACT_ID` | Yes* | SBB business contract ID |
211
- | `SMAPI_ENV` | No | `int` (default) or `prod` |
212
- | `SMAPI_TENANT_ID` | No | Azure AD tenant (defaults to SBB tenant) |
213
-
214
- *Without credentials, the server runs in mock mode with realistic demo data.
215
-
216
- ## Available on
217
-
218
- - [npm](https://www.npmjs.com/package/sbb-mcp)
219
- - [Official MCP Registry](https://registry.modelcontextprotocol.io)
220
- - [Smithery](https://smithery.ai/servers/fabsforward2-zhoi/sbb-mcp)
221
-
222
- Also available as: [sbb-mcp-official](https://www.npmjs.com/package/sbb-mcp-official) | [swiss-rail-mcp](https://www.npmjs.com/package/swiss-rail-mcp) | [sbb-cff-ffs-mcp](https://www.npmjs.com/package/sbb-cff-ffs-mcp) | [swiss-train-mcp](https://www.npmjs.com/package/swiss-train-mcp) | [swiss-railways-mcp](https://www.npmjs.com/package/swiss-railways-mcp)
223
-
224
- ## About
225
-
226
- Built on the official SBB Swiss Mobility API (SMAPI) with OSDM-compliant journey planning and pricing. Covers the entire Swiss public transport network including SBB, BLS, SOB, and regional operators.
227
-
228
- **SBB** (Schweizerische Bundesbahnen) / **CFF** (Chemins de fer federaux suisses) / **FFS** (Ferrovie federali svizzere) -- Swiss Federal Railways operates one of the densest rail networks in the world with over 10,000 daily connections.
229
-
230
- ## License
231
-
232
- [FSL-1.1-MIT](https://fsl.software/) -- Functional Source License. Free to use for any non-competing purpose. Converts to MIT after 2 years. See [LICENSE](LICENSE) for details.
1
+ # sbb-mcp
2
+
3
+ [![npm version](https://img.shields.io/npm/v/sbb-mcp.svg)](https://www.npmjs.com/package/sbb-mcp)
4
+ [![License: FSL-1.1-MIT](https://img.shields.io/badge/License-FSL--1.1--MIT-blue.svg)](https://fsl.software/)
5
+ [![smithery badge](https://smithery.ai/badge/fabsforward2-zhoi/sbb-mcp)](https://smithery.ai/servers/fabsforward2-zhoi/sbb-mcp)
6
+
7
+ MCP server for **Swiss Federal Railways** (SBB/CFF/FFS) -- real-time train schedules, prices, and ticket purchase links for any AI assistant.
8
+
9
+ Works with Claude Desktop, Claude Code, Cursor, Windsurf, VS Code Copilot, ChatGPT, and any MCP-compatible AI client.
10
+
11
+ ## Features
12
+
13
+ - **Search stations** -- find any Swiss train station by name
14
+ - **Train connections** -- real-time schedules with departure/arrival times, platforms, transfers
15
+ - **Ticket prices** -- 1st/2nd class with Half-Fare (Halbtax) and GA travelcard support
16
+ - **Purchase links** -- direct deep links to buy tickets on SBB.ch
17
+ - **Pagination** -- browse earlier/later connections
18
+ - **Trip details** -- intermediate stops, occupancy, platform changes
19
+ - **Journey planning** -- built-in prompt for end-to-end trip planning
20
+ - **Multi-traveler** -- family trip pricing when connected to SwissTrip (partner, kids, each with their own reduction card)
21
+ - **Mock mode** -- works without credentials for testing and demos
22
+
23
+ ## Quick Start
24
+
25
+ ### Claude Desktop
26
+
27
+ Add to your `claude_desktop_config.json`:
28
+
29
+ ```json
30
+ {
31
+ "mcpServers": {
32
+ "sbb": {
33
+ "command": "npx",
34
+ "args": ["-y", "sbb-mcp"],
35
+ "env": {
36
+ "SMAPI_CLIENT_ID": "your-client-id",
37
+ "SMAPI_CLIENT_SECRET": "your-secret",
38
+ "SMAPI_SCOPE": "your-scope",
39
+ "SMAPI_CONTRACT_ID": "your-contract-id"
40
+ }
41
+ }
42
+ }
43
+ }
44
+ ```
45
+
46
+ ### Claude Code
47
+
48
+ ```bash
49
+ claude mcp add sbb -- npx -y sbb-mcp
50
+ ```
51
+
52
+ ### Cursor
53
+
54
+ Add to `.cursor/mcp.json`:
55
+
56
+ ```json
57
+ {
58
+ "mcpServers": {
59
+ "sbb": {
60
+ "command": "npx",
61
+ "args": ["-y", "sbb-mcp"],
62
+ "env": {
63
+ "SMAPI_CLIENT_ID": "your-client-id",
64
+ "SMAPI_CLIENT_SECRET": "your-secret",
65
+ "SMAPI_SCOPE": "your-scope",
66
+ "SMAPI_CONTRACT_ID": "your-contract-id"
67
+ }
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
73
+ ### Windsurf
74
+
75
+ Add to `~/.codeium/windsurf/mcp_config.json`:
76
+
77
+ ```json
78
+ {
79
+ "mcpServers": {
80
+ "sbb": {
81
+ "command": "npx",
82
+ "args": ["-y", "sbb-mcp"],
83
+ "env": {
84
+ "SMAPI_CLIENT_ID": "your-client-id",
85
+ "SMAPI_CLIENT_SECRET": "your-secret",
86
+ "SMAPI_SCOPE": "your-scope",
87
+ "SMAPI_CONTRACT_ID": "your-contract-id"
88
+ }
89
+ }
90
+ }
91
+ }
92
+ ```
93
+
94
+ ### VS Code Copilot
95
+
96
+ Add to `.vscode/mcp.json`:
97
+
98
+ ```json
99
+ {
100
+ "servers": {
101
+ "sbb": {
102
+ "command": "npx",
103
+ "args": ["-y", "sbb-mcp"],
104
+ "env": {
105
+ "SMAPI_CLIENT_ID": "your-client-id",
106
+ "SMAPI_CLIENT_SECRET": "your-secret",
107
+ "SMAPI_SCOPE": "your-scope",
108
+ "SMAPI_CONTRACT_ID": "your-contract-id"
109
+ }
110
+ }
111
+ }
112
+ }
113
+ ```
114
+
115
+ ### Smithery
116
+
117
+ Install via [Smithery](https://smithery.ai/servers/fabsforward2-zhoi/sbb-mcp):
118
+
119
+ ```bash
120
+ npx @smithery/cli mcp add fabsforward2-zhoi/sbb-mcp
121
+ ```
122
+
123
+ ### Demo Mode (No Credentials)
124
+
125
+ Run without any environment variables to use mock data:
126
+
127
+ ```bash
128
+ npx sbb-mcp
129
+ ```
130
+
131
+ This lets you test the MCP server with realistic Swiss station data without SBB API credentials.
132
+
133
+ ## Tools
134
+
135
+ ### search_stations
136
+
137
+ Search for Swiss train stations by name. Returns station IDs needed for other tools.
138
+
139
+ **Input:**
140
+ - `query` (string, required) -- Station name, e.g. "Zurich", "Bern", "Interlaken"
141
+ - `limit` (number, optional) -- Max results (default: 10)
142
+
143
+ **Example:** "Find stations matching Luzern"
144
+
145
+ ### search_connections
146
+
147
+ Find train connections between two stations. Automatically resolves station names to IDs.
148
+
149
+ **Input:**
150
+ - `from` (string, required) -- Origin station name or ID (e.g. "Zurich HB" or "8503000")
151
+ - `to` (string, required) -- Destination station name or ID
152
+ - `date` (string, optional) -- Travel date YYYY-MM-DD
153
+ - `time` (string, optional) -- Departure time HH:MM
154
+ - `arrival_time` (boolean, optional) -- Treat time as arrival time
155
+
156
+ **Example:** "Show me trains from Zurich to Bern tomorrow at 9am"
157
+
158
+ ### get_trip_details
159
+
160
+ Get detailed stop-by-stop information for a connection including intermediate stops, platforms, and occupancy forecasts.
161
+
162
+ **Input:**
163
+ - `trip_id` (string, required) -- Trip ID from search_connections
164
+
165
+ ### get_more_connections
166
+
167
+ Load earlier or later trains for a previous search.
168
+
169
+ **Input:**
170
+ - `collection_id` (string, required) -- Collection ID from search_connections
171
+ - `direction` ("next" | "previous") -- Later or earlier trains
172
+
173
+ ### get_prices
174
+
175
+ Get ticket prices with Swiss reduction card support. Supports multi-traveler family pricing when connected to SwissTrip.
176
+
177
+ **Input:**
178
+ - `trip_ids` (string[], required) -- Trip IDs from search_connections
179
+ - `traveler_type` ("ADULT" | "CHILD", default: "ADULT") -- used when no traveler_names given
180
+ - `reduction_card` ("HALF_FARE" | "GA" | "NONE", default: "HALF_FARE") -- used when no traveler_names given
181
+ - `traveler_names` (string[], optional) -- SwissTrip traveler names for family pricing (requires `SWISSTRIP_TOKEN`)
182
+
183
+ **Example:** "How much for Zurich to Zermatt for Fabian and Anna?" (with SwissTrip connected, each traveler's reduction card is applied automatically)
184
+
185
+ ### get_ticket_link
186
+
187
+ Get a direct purchase link to buy the ticket on SBB.ch. On mobile with the SBB app installed, opens directly in the app with Halbtax/GA applied automatically. Supports multi-traveler tickets when connected to SwissTrip.
188
+
189
+ **Input:**
190
+ - `trip_id` (string, required) -- Trip ID to purchase
191
+ - `from_name` (string, required) -- Origin station name
192
+ - `from_id` (string, required) -- Origin station ID
193
+ - `to_name` (string, required) -- Destination station name
194
+ - `to_id` (string, required) -- Destination station ID
195
+ - `date` (string, required) -- Travel date YYYY-MM-DD
196
+ - `time` (string, required) -- Departure time HH:MM
197
+ - `traveler_type` ("ADULT" | "CHILD", default: "ADULT") -- used when no traveler_names given
198
+ - `reduction_card` ("HALF_FARE" | "GA" | "NONE", default: "HALF_FARE") -- used when no traveler_names given
199
+ - `traveler_names` (string[], optional) -- SwissTrip traveler names for family tickets (requires `SWISSTRIP_TOKEN`)
200
+
201
+ ### list_travelers
202
+
203
+ List all travelers in the user's SwissTrip account (self, partner, kids). Each traveler has their own reduction card. Requires `SWISSTRIP_TOKEN`.
204
+
205
+ **Example:** "Who are my travelers?" shows all saved travelers with their reduction cards
206
+
207
+ ## Prompts
208
+
209
+ ### plan_journey
210
+
211
+ End-to-end journey planning prompt. Searches connections, compares prices, and provides ticket links.
212
+
213
+ **Input:**
214
+ - `from` (string, required) -- Origin station
215
+ - `to` (string, required) -- Destination station
216
+ - `date` (string, optional) -- Travel date
217
+
218
+ ## Environment Variables
219
+
220
+ | Variable | Required | Description |
221
+ |----------|----------|-------------|
222
+ | `SMAPI_CLIENT_ID` | Yes* | OAuth 2.0 client ID from SBB Developer Portal |
223
+ | `SMAPI_CLIENT_SECRET` | Yes* | OAuth 2.0 client secret |
224
+ | `SMAPI_SCOPE` | Yes* | OAuth scope |
225
+ | `SMAPI_CONTRACT_ID` | Yes* | SBB business contract ID |
226
+ | `SMAPI_ENV` | No | `int` (default) or `prod` |
227
+ | `SMAPI_TENANT_ID` | No | Azure AD tenant (defaults to SBB tenant) |
228
+ | `SWISSTRIP_TOKEN` | No | SwissTrip auth token for cloud profiles and multi-traveler support |
229
+ | `SWISSTRIP_URL` | No | SwissTrip API base URL (defaults to `https://swisstrip.ch`) |
230
+
231
+ *Without SMAPI credentials, the server runs in mock mode with realistic demo data.
232
+
233
+ ## SwissTrip Integration (Optional)
234
+
235
+ Set `SWISSTRIP_TOKEN` to connect sbb-mcp to your [SwissTrip](https://swisstrip.ch) account. This enables:
236
+
237
+ - **Cloud-synced profiles** -- your travel profile (name, DOB, reduction card) syncs from SwissTrip instead of local `~/.sbb-mcp/profile.json`
238
+ - **Multi-traveler pricing** -- add your partner, kids, or travel companions on SwissTrip and get per-person pricing with correct reduction cards
239
+ - **Family tickets** -- pass `traveler_names` to `get_prices` and `get_ticket_link` for group pricing
240
+
241
+ ```json
242
+ {
243
+ "mcpServers": {
244
+ "sbb": {
245
+ "command": "npx",
246
+ "args": ["-y", "sbb-mcp"],
247
+ "env": {
248
+ "SMAPI_CLIENT_ID": "your-client-id",
249
+ "SMAPI_CLIENT_SECRET": "your-secret",
250
+ "SMAPI_SCOPE": "your-scope",
251
+ "SWISSTRIP_TOKEN": "your-swisstrip-auth-token"
252
+ }
253
+ }
254
+ }
255
+ }
256
+ ```
257
+
258
+ Without `SWISSTRIP_TOKEN`, sbb-mcp uses local file-based profiles as before -- no SwissTrip account required.
259
+
260
+ ## Available on
261
+
262
+ - [npm](https://www.npmjs.com/package/sbb-mcp)
263
+ - [Official MCP Registry](https://registry.modelcontextprotocol.io)
264
+ - [Smithery](https://smithery.ai/servers/fabsforward2-zhoi/sbb-mcp)
265
+
266
+ Also available as: [sbb-mcp-official](https://www.npmjs.com/package/sbb-mcp-official) | [swiss-rail-mcp](https://www.npmjs.com/package/swiss-rail-mcp) | [sbb-cff-ffs-mcp](https://www.npmjs.com/package/sbb-cff-ffs-mcp) | [swiss-train-mcp](https://www.npmjs.com/package/swiss-train-mcp) | [swiss-railways-mcp](https://www.npmjs.com/package/swiss-railways-mcp)
267
+
268
+ ## About
269
+
270
+ Built on the official SBB Swiss Mobility API (SMAPI) with OSDM-compliant journey planning and pricing. Covers the entire Swiss public transport network including SBB, BLS, SOB, and regional operators.
271
+
272
+ **SBB** (Schweizerische Bundesbahnen) / **CFF** (Chemins de fer federaux suisses) / **FFS** (Ferrovie federali svizzere) -- Swiss Federal Railways operates one of the densest rail networks in the world with over 10,000 daily connections.
273
+
274
+ ## License
275
+
276
+ [FSL-1.1-MIT](https://fsl.software/) -- Functional Source License. Free to use for any non-competing purpose. Converts to MIT after 2 years. See [LICENSE](LICENSE) for details.
package/dist/auth.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare function isSmapiConfigured(): boolean;
2
+ export declare function getAccessToken(): Promise<string>;