sbb-mcp 0.5.2 → 0.6.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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +11 -53
  3. package/package.json +13 -21
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # sbb-mcp
2
2
 
3
- MCP client for the SwissTrip SBB MCP service. Connects AI assistants to live Swiss Federal Railways (SBB / CFF / FFS) data: train schedules, station search, ticket prices, and direct ticket purchase links.
3
+ Independent MCP client by SwissTrip connects AI assistants to Swiss Federal Railways (SBB / CFF / FFS) data: train schedules, station search, ticket prices, and direct ticket purchase links via SBB's SMAPI.
4
4
 
5
5
  The package is a thin client. All SBB API access, ticketing, and profile sync run on the hosted SwissTrip server at `https://mcp.swisstrip.app/mcp`.
6
6
 
package/dist/index.js CHANGED
@@ -1,55 +1,13 @@
1
1
  #!/usr/bin/env node
2
- /**
3
- * sbb-mcp — stdio→HTTPS proxy.
4
- *
5
- * Forwards every MCP request from a local stdio transport (Claude Desktop,
6
- * Cursor, etc.) to the hosted SwissTrip SBB MCP server. All SBB API access,
7
- * ticketing, profile sync, and rendering happen on the server. This client
8
- * holds no credentials and no business logic.
9
- *
10
- * Override the server URL with SBB_MCP_URL.
11
- * Pass an optional SwissTrip account token via SWISSTRIP_TOKEN to enable
12
- * cloud-synced profiles and multi-traveler pricing.
13
- */
14
- import { Client } from '@modelcontextprotocol/sdk/client/index.js';
15
- import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
16
- import { Server } from '@modelcontextprotocol/sdk/server/index.js';
17
- import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
18
- import { CallToolRequestSchema, GetPromptRequestSchema, ListPromptsRequestSchema, ListResourcesRequestSchema, ListResourceTemplatesRequestSchema, ListToolsRequestSchema, ReadResourceRequestSchema, SubscribeRequestSchema, UnsubscribeRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
19
- const REMOTE_URL = process.env.SBB_MCP_URL ?? 'https://mcp.swisstrip.app/mcp';
20
- const NAME = 'sbb-mcp';
21
- const VERSION = '0.5.2';
22
- async function main() {
23
- const headers = {};
24
- if (process.env.SWISSTRIP_TOKEN) {
25
- headers.Authorization = `Bearer ${process.env.SWISSTRIP_TOKEN}`;
26
- }
27
- // Upstream client — connects to the hosted MCP server over HTTPS.
28
- // Client capabilities advertise what THIS side supports; we don't expose
29
- // sampling or roots, so an empty bag is correct.
30
- const upstream = new Client({ name: `${NAME}-proxy`, version: VERSION }, { capabilities: {} });
31
- await upstream.connect(new StreamableHTTPClientTransport(new URL(REMOTE_URL), {
32
- requestInit: { headers },
33
- }));
34
- // Local stdio server — what Claude Desktop / Cursor talk to.
35
- const server = new Server({ name: NAME, version: VERSION }, { capabilities: { tools: {}, resources: { subscribe: true }, prompts: {} } });
36
- // Forward every MCP request type to the upstream server.
37
- server.setRequestHandler(ListToolsRequestSchema, () => upstream.listTools());
38
- server.setRequestHandler(CallToolRequestSchema, (req) => upstream.callTool(req.params));
39
- server.setRequestHandler(ListResourcesRequestSchema, () => upstream.listResources());
40
- server.setRequestHandler(ListResourceTemplatesRequestSchema, () => upstream.listResourceTemplates());
41
- server.setRequestHandler(ReadResourceRequestSchema, (req) => upstream.readResource(req.params));
42
- server.setRequestHandler(SubscribeRequestSchema, (req) => upstream.subscribeResource(req.params));
43
- server.setRequestHandler(UnsubscribeRequestSchema, (req) => upstream.unsubscribeResource(req.params));
44
- server.setRequestHandler(ListPromptsRequestSchema, () => upstream.listPrompts());
45
- server.setRequestHandler(GetPromptRequestSchema, (req) => upstream.getPrompt(req.params));
46
- // Forward upstream notifications (progress, list_changed, etc.) back to the agent.
47
- upstream.fallbackNotificationHandler = async (n) => {
48
- await server.notification(n);
49
- };
50
- await server.connect(new StdioServerTransport());
51
- }
52
- main().catch((err) => {
53
- console.error('[sbb-mcp]', err instanceof Error ? err.message : err);
54
- process.exit(1);
2
+ // This package is a brand-protective alias for swisstrip-mcp (canonical SwissTrip MCP client).
3
+ // Install `swisstrip-mcp` directly this alias just spawns it.
4
+ import { createRequire } from 'module';
5
+ import { spawn } from 'child_process';
6
+ import { dirname, resolve } from 'path';
7
+ const require = createRequire(import.meta.url);
8
+ const swissTripMcpPath = resolve(dirname(require.resolve('swisstrip-mcp/package.json')), 'dist', 'index.js');
9
+ const child = spawn('node', [swissTripMcpPath], {
10
+ stdio: 'inherit',
11
+ env: process.env,
55
12
  });
13
+ child.on('exit', (code) => process.exit(code ?? 0));
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "sbb-mcp",
3
- "version": "0.5.2",
4
- "mcpName": "io.github.Fabsbags/sbb-mcp",
5
- "description": "Independent MCP client for Swiss Federal Railways (SBB/CFF/FFS) — schedules, prices, and ticket links via SBB's SMAPI. Third-party implementation by SwissTrip; not the official SBB MCP.",
3
+ "version": "0.6.0",
4
+ "description": "Brand-protective alias for swisstrip-mcp. Independent MCP client by SwissTrip; not the official SBB MCP. Use swisstrip-mcp directly.",
6
5
  "type": "module",
7
6
  "main": "dist/index.js",
8
7
  "bin": {
@@ -23,35 +22,28 @@
23
22
  "cff",
24
23
  "ffs",
25
24
  "swiss-railways",
26
- "swiss-federal-railways",
27
- "train",
28
- "travel",
29
25
  "switzerland",
30
- "timetable",
31
- "public-transport",
32
26
  "ai",
33
- "claude",
34
- "cursor",
35
27
  "model-context-protocol"
36
28
  ],
37
29
  "author": "F. Weinhappl <fabsforward2@gmail.com>",
38
30
  "license": "SEE LICENSE IN LICENSE",
39
- "repository": {
40
- "type": "git",
41
- "url": "git+https://github.com/Fabsbags/sbb-mcp.git"
31
+ "dependencies": {
32
+ "swisstrip-mcp": "^0.6.0"
42
33
  },
43
- "homepage": "https://swisstrip.app",
44
- "bugs": {
45
- "url": "https://github.com/Fabsbags/sbb-mcp/issues"
34
+ "devDependencies": {
35
+ "@types/node": "^22.15.3",
36
+ "typescript": "^5.8.3"
46
37
  },
47
38
  "engines": {
48
39
  "node": ">=18"
49
40
  },
50
- "dependencies": {
51
- "@modelcontextprotocol/sdk": "^1.12.1"
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "git+https://github.com/Fabsbags/swisstrip-mcp.git"
52
44
  },
53
- "devDependencies": {
54
- "@types/node": "^22.15.3",
55
- "typescript": "^5.8.3"
45
+ "homepage": "https://swisstrip.app",
46
+ "bugs": {
47
+ "url": "https://github.com/Fabsbags/swisstrip-mcp/issues"
56
48
  }
57
49
  }