@pipeworx/mcp-amtrak 0.1.0 → 0.1.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/LICENSE +1 -1
- package/README.md +67 -4
- package/bin/cli.js +17 -0
- package/package.json +15 -3
- package/server.json +1 -1
- package/src/index.ts +8 -0
- package/src/server.ts +45 -0
- package/tsconfig.json +5 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Amtrak MCP — live Amtrak train tracking via the community Amtraker API
|
|
4
4
|
|
|
5
|
-
Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to
|
|
5
|
+
Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 1679+ live data sources.
|
|
6
6
|
|
|
7
7
|
## Tools
|
|
8
8
|
|
|
9
9
|
| Tool | Description |
|
|
10
10
|
|------|-------------|
|
|
11
|
+
| `amtrak_train_status` | Live Amtrak train status and GPS tracking — "where is my Amtrak train", "is train 6 late", "track the California Zephyr". Accepts a train number ("6", "2150") or route name ("Coast Starlight", "Empire Builder"). Returns each active instance of that train: current GPS position, speed, heading, timeliness, next station with ETA and delay minutes, and origin/destination scheduled vs actual times. Data is a community mirror of Amtrak's own tracking feed (api-v3.amtraker.com); positions update about every few minutes. Example: amtrak_train_status({ train: "6" }) |
|
|
12
|
+
| `amtrak_station_board` | Amtrak station departures/arrivals board — upcoming trains at a station. "What trains are arriving at Chicago Union?", "next train at CHI", "station board for Denver". Accepts a 3-letter Amtrak station code ("CHI", "NYP", "LAX") or a station name ("Chicago", "Portland"). Returns trains currently en route to that station with route, scheduled vs estimated arrival, delay minutes, and status. Live community mirror of Amtrak tracking (api-v3.amtraker.com). Example: amtrak_station_board({ station: "CHI" }) |
|
|
13
|
+
| `amtrak_routes_active` | Summary of ALL currently active Amtrak trains grouped by route — "how many Amtrak trains are running right now", "which Amtrak routes have delays", national system overview. Returns per route: active train count, train numbers, and the worst delay in minutes. Compact; live from a community mirror of Amtrak's tracking feed. Example: amtrak_routes_active({}) |
|
|
14
|
+
| `amtrak_station_info` | Amtrak station lookup by code or name — station name, 3-letter code, city/state, street address, timezone, coordinates, and how many trains are currently inbound. "Where is the Amtrak station in Denver?", "what is station code NYP". Example: amtrak_station_info({ station: "Denver" }) |
|
|
11
15
|
|
|
12
16
|
## Quick Start
|
|
13
17
|
|
|
@@ -23,7 +27,25 @@ Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
|
|
|
23
27
|
}
|
|
24
28
|
```
|
|
25
29
|
|
|
26
|
-
|
|
30
|
+
### What this endpoint actually serves
|
|
31
|
+
|
|
32
|
+
`tools/list` at `https://gateway.pipeworx.io/amtrak/mcp` returns the tools in the table
|
|
33
|
+
above **plus the shared Pipeworx meta-tools** — `ask_pipeworx`,
|
|
34
|
+
`discover_tools`, `search_within`, `remember`/`recall` and the rest of the
|
|
35
|
+
gateway-wide set. So the tool count you see is larger than this table: a
|
|
36
|
+
single-pack endpoint currently lists roughly 30 shared tools alongside the
|
|
37
|
+
pack's own. The connection's `initialize` response states its exact scope, and
|
|
38
|
+
is the authoritative answer for a given day.
|
|
39
|
+
|
|
40
|
+
This is deliberate, not multiplexing by accident. The meta-tools are what let a
|
|
41
|
+
scoped connection answer a question this pack does not cover — via
|
|
42
|
+
`ask_pipeworx`, which routes across the whole catalog — without you adding a
|
|
43
|
+
second MCP server. There is currently no way to mount a pack endpoint without
|
|
44
|
+
them; if the extra schemas cost you more context than the routing is worth,
|
|
45
|
+
connect to the full gateway once rather than to several pack endpoints.
|
|
46
|
+
|
|
47
|
+
Or connect to the full Pipeworx gateway to get every pack's tools listed
|
|
48
|
+
directly, instead of just this one's:
|
|
27
49
|
|
|
28
50
|
```json
|
|
29
51
|
{
|
|
@@ -35,9 +57,50 @@ Or connect to the full Pipeworx gateway for access to all 1314+ data sources:
|
|
|
35
57
|
}
|
|
36
58
|
```
|
|
37
59
|
|
|
60
|
+
Both URLs reach the same gateway and the same 1679+ data sources. The
|
|
61
|
+
only difference is which pack's tools are listed **directly**; `ask_pipeworx`
|
|
62
|
+
reaches all of them from either one.
|
|
63
|
+
|
|
64
|
+
## No MCP client? Call it over HTTP
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
curl -X POST https://gateway.pipeworx.io/v1/tools/amtrak_train_status \
|
|
68
|
+
-H 'Content-Type: application/json' \
|
|
69
|
+
-d '{"train":"6"}'
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
No account needed for the first calls. Inspect any tool: `GET https://gateway.pipeworx.io/v1/tools/amtrak_train_status`. Find one: `POST https://gateway.pipeworx.io/v1/tools/search_packs` with `{"query":"..."}`.
|
|
73
|
+
|
|
74
|
+
## Standalone (no gateway account)
|
|
75
|
+
|
|
76
|
+
This package also runs as a local stdio MCP server — no Pipeworx account, no
|
|
77
|
+
gateway round-trip:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"mcpServers": {
|
|
82
|
+
"amtrak": {
|
|
83
|
+
"command": "npx",
|
|
84
|
+
"args": ["-y", "@pipeworx/mcp-amtrak"]
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Or run it directly to confirm it starts:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
npx -y @pipeworx/mcp-amtrak
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
It speaks MCP over stdin/stdout and answers `initialize`/`tools/list`/`tools/call`
|
|
97
|
+
for **only** this pack's tools — none of the shared meta-tools the gateway
|
|
98
|
+
connection above adds. Same source, same tools, no ask_pipeworx routing.
|
|
99
|
+
|
|
38
100
|
## Using with ask_pipeworx
|
|
39
101
|
|
|
40
|
-
Instead of calling tools directly, you can ask questions in plain English
|
|
102
|
+
Instead of calling tools directly, you can ask questions in plain English —
|
|
103
|
+
this works on the pack endpoint above as well as on the full gateway:
|
|
41
104
|
|
|
42
105
|
```
|
|
43
106
|
ask_pipeworx({ question: "your question about Amtrak data" })
|
|
@@ -47,7 +110,7 @@ The gateway picks the right tool and fills the arguments automatically.
|
|
|
47
110
|
|
|
48
111
|
## More
|
|
49
112
|
|
|
50
|
-
- [
|
|
113
|
+
- [Docs and guides](https://pipeworx.io/docs)
|
|
51
114
|
- [pipeworx.io](https://pipeworx.io)
|
|
52
115
|
|
|
53
116
|
## License
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
//
|
|
3
|
+
// Entry point for `npx @pipeworx/mcp-<slug>`.
|
|
4
|
+
//
|
|
5
|
+
// Packs ship as raw TypeScript (no build step — see publish-pack.sh for why:
|
|
6
|
+
// tsx sidesteps every extensionless-import / bare-JSON-import edge case a
|
|
7
|
+
// per-pack tsc build would have to solve one pack at a time). This file
|
|
8
|
+
// registers tsx's ESM loader programmatically, then hands off to src/server.ts,
|
|
9
|
+
// which wraps the pack's {tools, callTool} export in a stdio MCP server.
|
|
10
|
+
//
|
|
11
|
+
// Copied verbatim into every published pack repo by scripts/publish-pack.sh —
|
|
12
|
+
// edit this file, not a per-pack copy.
|
|
13
|
+
import { register } from 'tsx/esm/api';
|
|
14
|
+
|
|
15
|
+
register();
|
|
16
|
+
|
|
17
|
+
await import('../src/server.ts');
|
package/package.json
CHANGED
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipeworx/mcp-amtrak",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Amtrak MCP — live Amtrak train tracking via the community Amtraker API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"types": "src/index.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"mcp-amtrak": "bin/cli.js"
|
|
10
|
+
},
|
|
8
11
|
"keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "amtrak"],
|
|
9
12
|
"license": "MIT",
|
|
10
13
|
"repository": {
|
|
11
14
|
"type": "git",
|
|
12
|
-
"url": "https://github.com/pipeworx-io/mcp-amtrak"
|
|
15
|
+
"url": "git+https://github.com/pipeworx-io/mcp-amtrak.git"
|
|
13
16
|
},
|
|
14
17
|
"scripts": {
|
|
15
18
|
"typecheck": "tsc --noEmit"
|
|
16
19
|
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
22
|
+
"tsx": "^4.19.0"
|
|
23
|
+
},
|
|
17
24
|
"devDependencies": {
|
|
18
|
-
"typescript": "^5.
|
|
25
|
+
"typescript": "^5.9.3",
|
|
26
|
+
"@cloudflare/workers-types": "^4.20260405.1"
|
|
27
|
+
},
|
|
28
|
+
"pipeworx": {
|
|
29
|
+
"sourceHash": "v1-5eb7d11bab5cbae6f6ee5264427b0010688d3a2a038c7cd7ef354e02c7a1b954",
|
|
30
|
+
"sourceCommit": "60f04b68c347e970c6be94a53439d1364061fc06"
|
|
19
31
|
}
|
|
20
32
|
}
|
package/server.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "io.github.pipeworx-io/amtrak",
|
|
4
4
|
"title": "Amtrak",
|
|
5
5
|
"description": "Amtrak MCP — live Amtrak train tracking via the community Amtraker API",
|
|
6
|
-
"version": "0.1.
|
|
6
|
+
"version": "0.1.1",
|
|
7
7
|
"websiteUrl": "https://pipeworx.io/packs/amtrak",
|
|
8
8
|
"repository": {
|
|
9
9
|
"url": "https://github.com/pipeworx-io/mcp-amtrak",
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
interface McpToolDefinition {
|
|
2
2
|
name: string;
|
|
3
3
|
description: string;
|
|
4
|
+
/** Human-facing one-liner (fleet #1967). Optional; consumers fall back to
|
|
5
|
+
* description. Kept in step with shared/src/types.ts — scripts/lib/
|
|
6
|
+
* check-inlined-types.mjs reports drift at publish time. */
|
|
7
|
+
summary?: string;
|
|
4
8
|
inputSchema: {
|
|
5
9
|
type: 'object';
|
|
6
10
|
properties: Record<string, unknown>;
|
|
7
11
|
required?: string[];
|
|
12
|
+
anyOf?: Array<{ required: string[] }>;
|
|
13
|
+
oneOf?: Array<{ required: string[] }>;
|
|
14
|
+
allOf?: Array<{ required: string[] }>;
|
|
8
15
|
};
|
|
16
|
+
outputSchema?: Record<string, unknown>;
|
|
9
17
|
}
|
|
10
18
|
|
|
11
19
|
interface McpToolExport {
|
package/src/server.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stdio MCP server entry point for @pipeworx/mcp-amtrak.
|
|
3
|
+
* Generated by scripts/publish-pack.sh — do not hand-edit in the pack repo;
|
|
4
|
+
* edit scripts/publish-pack.sh (the server.ts heredoc) and republish instead.
|
|
5
|
+
*/
|
|
6
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
7
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
8
|
+
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
9
|
+
import pack from './index.js';
|
|
10
|
+
|
|
11
|
+
const server = new Server(
|
|
12
|
+
{ name: '@pipeworx/mcp-amtrak', version: '0.1.1' },
|
|
13
|
+
{ capabilities: { tools: {} } },
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
17
|
+
tools: pack.tools.map((t) => ({
|
|
18
|
+
name: t.name,
|
|
19
|
+
description: t.description,
|
|
20
|
+
inputSchema: t.inputSchema,
|
|
21
|
+
})),
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
25
|
+
const { name, arguments: args } = request.params;
|
|
26
|
+
try {
|
|
27
|
+
const result = await pack.callTool(name, (args ?? {}) as Record<string, unknown>);
|
|
28
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
29
|
+
} catch (err) {
|
|
30
|
+
return {
|
|
31
|
+
content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }],
|
|
32
|
+
isError: true,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
async function main() {
|
|
38
|
+
const transport = new StdioServerTransport();
|
|
39
|
+
await server.connect(transport);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
main().catch((err) => {
|
|
43
|
+
console.error('Fatal error running server:', err);
|
|
44
|
+
process.exit(1);
|
|
45
|
+
});
|
package/tsconfig.json
CHANGED
|
@@ -3,12 +3,16 @@
|
|
|
3
3
|
"target": "ES2022",
|
|
4
4
|
"module": "ESNext",
|
|
5
5
|
"moduleResolution": "bundler",
|
|
6
|
+
"lib": ["ES2022"],
|
|
7
|
+
"types": ["@cloudflare/workers-types"],
|
|
6
8
|
"strict": true,
|
|
7
9
|
"esModuleInterop": true,
|
|
8
10
|
"skipLibCheck": true,
|
|
11
|
+
"resolveJsonModule": true,
|
|
9
12
|
"outDir": "dist",
|
|
10
13
|
"rootDir": "src",
|
|
11
14
|
"declaration": true
|
|
12
15
|
},
|
|
13
|
-
"include": ["src"]
|
|
16
|
+
"include": ["src"],
|
|
17
|
+
"exclude": ["src/server.ts"]
|
|
14
18
|
}
|