← MCP server and skill grades

12306-mcp

Joooook/12306-mcp

A
Type
MCP server
Scanned
Nov 12, 2026
Version
ff6439da6f63
Files read
13

This MCP server searches public China Railway (12306) station directories, train schedules, and ticket availability without accessing personal accounts or local files. Its biggest risk is an optional HTTP and SSE server mode (--port) that has no authentication and omits its documented localhost default, allowing others on the network to send 12306 queries through the user's machine.

What it can reach

Network
Makes outbound HTTPS requests to www.12306.cn, kyfw.12306.cn, and search.12306.cn at startup and when tools are called to fetch public station lists, train routes, and ticket availability.
Network
Optionally listens on a TCP port to serve MCP over HTTP and SSE when started with --port or --host.

Findings

3 low
  1. LowHTTP mode runs without authentication and omits the documented localhost default

    src/index.ts:1610

    When started with --port or --host, the server opens an HTTP and SSE MCP endpoint with no password, token check, or Origin check. Although the --host help text states that the default is localhost, no default value is set in Commander, so options.host is passed as undefined (which in Node.js HTTP servers binds to all network interfaces rather than loopback only). Anyone on the local network, or potentially a webpage visited in the user's browser, can connect to the open port and trigger outbound 12306 queries from the user's IP address.

    Fix: Set '127.0.0.1' as the explicit default value for --host in Commander, verify Origin headers on incoming HTTP requests, and require bearer-token authentication when listening over the network.

  2. LowUnbounded pagination loop in get-interline-tickets

    src/index.ts:1133

    Although the get-interline-tickets description states that it only supports the first 10 results, the limitedNum parameter has no upper bound. If prompt injection tricks the agent into passing a very large limitedNum, or if 12306 returns an empty middleList while can_query remains active, the server sends repeated unthrottled requests to kyfw.12306.cn, which can stall the server or get the user's IP rate-limited.

    Fix: Add a maximum limit such as .max(10) or .max(50) to limitedNum in the Zod schema, cap total loop iterations, and break if middleList is empty.

  3. LowDockerfile installs unpinned npm package instead of building local source

    Dockerfile:3

    Users who clone the repository and build the Docker image do not actually run the local code they checked out; instead, the Dockerfile fetches whatever version of 12306-mcp is currently latest on the public npm registry with no version pin or lockfile, and runs the container as root.

    Fix: Copy the local repository source and lockfile into the image, build with tsc during docker build, and switch to the non-root node user with USER node.