Skip to main content
Glama

ekigraph 🚉

English | 日本語

An MCP server that lets AI answer questions about Japan's railway network correctly. It gives the AI on-the-spot access to which stations are connected by track — all 9,043 stations nationwide.

Why I built this

When I'm heading out or planning a trip, I often want to know something about train stations. I could search for it, but that's a hassle — so I just ask an AI.

The problem: when the topic is trains, AI often lies without hesitation.

Here's a case that actually happened.

I asked an AI "which station is next to Shin-Shibaura?", and it replied:

Shin-Shibaura is a new station on the Tōkaidō Freight Line; the next stop is Hama-Kawasaki.

This is completely false. Shin-Shibaura is on the Tsurumi Line, and its neighbors are Asano and Umi-Shibaura.

The AI didn't say "I don't know." It fabricated an answer, nonexistent railway line included.

For major stations like Shinjuku or Shibuya, the answers are usually accurate. But for minor stations and local lines like this one, the odds of hallucination go up.

Related MCP server: IndianRailwaysMCP

What you get

Connect ekigraph, and the AI answers from correct data instead of its own memory.

ekigraph is built on open data, so anyone can use it.

  • 9,043 stations and 593 lines nationwide — from shinkansen to subways, local private railways, and trams

  • The data comes from the Japanese government's official open data (MLIT National Land Numerical Information)

  • It ships as a bundled 2 MB file — no API key, free, works offline

How to use

# Claude Code — one line
claude mcp add ekigraph -- uvx --from git+https://github.com/yataro-fujinaga/ekigraph ekigraph

For Claude Desktop or any other MCP client, add this to your config:

{ "ekigraph": { "command": "uvx", "args": ["--from", "git+https://github.com/yataro-fujinaga/ekigraph", "ekigraph"] } }

After that, just talk normally and the AI returns correct answers.

Even a casual question like "what was next to Urawa again?" gets a proper answer, backed by ekigraph.

Tools

  • neighbors(station) — returns the stations connected by track, with line names

  • subgraph(station, radius) — returns the raw track data around a station, as-is

Out of scope

  • Timetables, fares, express-stop patterns, and delay information are not covered.

  • ekigraph holds one thing only: how the tracks connect.

  • Station aggregation (counting Shibuya's JR, Metro, Tokyu and Keio as one station) follows MLIT's official cross-operator station group codes.

About the data

  • Source: National Land Numerical Information (Railway Data, N02-24) by MLIT Japan, processed and redistributed under the Government of Japan Standard Terms of Use v2.0 (CC BY 4.0 compatible)

  • To rebuild it yourself: uv run python etl/build_graph_n02.py (downloads the source data, derives the adjacency, and validates it — fully automatic)

License

Code: MIT. For the bundled data's attribution, see LICENSE.

Available Tools

2 tools
neighborsA

駅の線路上の隣接駅(グラフのエッジ)を返す。路線名つき。注意: 線路の隣接であり、特定の列車(急行等)が停まるかは分からない。

Inputs: station (required).

subgraphA

駅の周辺の生グラフ(半径N駅のエッジ一覧・種別つき)をそのまま返す。neighbors で足りない構造の問いはこれを読んで自分で辿る。

Inputs: station (required), radius.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 2 tools

    Disambiguation4/5

    The two tools serve distinct purposes: neighbors provides direct adjacent stations on railway lines, while subgraph returns a broader local graph structure. Descriptions clearly delineate their use cases, minimizing confusion despite some overlap in domain.

    Naming Consistency4/5

    Both tool names are single lowercase nouns, following a consistent style (neighbors, subgraph). While not verb_noun, the convention is uniform and predictable, making it easy to understand their roles.

    Tool Count3/5

    With only two tools, the server feels thin but is appropriate for a very focused purpose of querying station graph adjacency. It sits at the lower end of acceptable, lacking broader functionality but not being excessively sparse.

    Completeness2/5

    The tools cover only graph traversal (direct neighbors and subgraph), but lack basic station metadata retrieval, pathfinding, or line-specific queries. This creates significant gaps for common tasks, limiting the server's usefulness.

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to query real-time Indian Railways data including train schedules, live status, PNR status, seat availability, fares, and coach positions via the Model Context Protocol.
      -
    • A
      license
      A
      quality
      C
      maintenance
      Provides read-only access to structured Japanese railway data, enabling station searches without an API key and live Shinkansen timetable, fare, seat class, and stop queries with an Ekispert API key.
      7
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Provides AI assistants with live Indian Railways data, including trains between stations, real-time seat availability, fares, PNR status, and timetables, without requiring an API key.
      10
      8
      75 npm
      MIT