rmv-mcp-server

CWACoderWithAttitude/rmv-mcp-server

3.2

If you are the rightful owner of rmv-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

The RMV MCP Server is designed to enable Language Model Models (LLMs) to access and utilize public transport data from RMV, Germany, by interfacing with the RMV API.

Tools
2
Resources
0
Prompts
0

= RMV MCP Server

Imagine you could ask questions about train connections, departure times, and station information using natural language. Like this one:

I'd like to go from Gross Gerau to the alt bischofsheim restaurant. 
tomorrow evening.

https://claude.ai/share/46422223-8b62-4a44-ae0f-49c4575c9d4f[Which gets you exactly the information you need. ]

== TL;DR

MCP servers are addons to LLMs that enable the users to ask questions on YOUR data (in DBs, APIs, fielsystems,...) with natural language. This MCP Server enables LLMs to use data on trains, stations and connections provided by RMV, Germany.

== What's this project about?

To be honest the above description does not tell the full story. The MCP inventor Anthropic has a https://www.anthropic.com/news/model-context-protocol[full blown explanation] on MCPs.

This MCP server enables you to query stations, connections and departures from an LLM like Claude. It is built using the https://gofastmcp.com/getting-started/welcome[FastMCP] framework.

== Prerequisites

This example is build upon python3.13 and UV 0.8.13.

It usese https://claude.com[Claude Desktop] as LLM client and chat interface.

To access station and connection data, you need to acquire an API key. It can be requested free of charge from RMV at the https://opendata.rmv.de/site/start.html[RMV Open Data Portal].

Copy DOTEnv to .env and add the API key there.

=== Running MCP Server in Dev Mode

FastMCP provides a development mode that allows us to run and test our MCP server locally.

Start the server in dev mode:

[source,bash]

uv run fastmcp dev main.py

This will start the MCP server and open the MCP Inspector in your browser. Allowing you to inspect and debug your MCP server.

  1. Connect to your MCP sever (left column)
  2. Select Tools from the top menu.
  3. Click List Tools below. It should reveal search_stations and get_connections. Select one of them.
  4. The right hand side enables you to run the tool and inspect the results.

How cool is that!

=== Overview MCP Server Architecture

graph TD
    subgraph RMV_MCP_Server
        A[rmv_stdio.py] --> B[RMVService]
        B[RMVService] --> C[RMV API]
    end

    subgraph Tests
        D[test_rmv_stdio.py] --> A[rmv_stdio.py]
        D[test_rmv_stdio.py] --> E[fastmcp.client.Client]
    end

    subgraph External_Services
        C[RMV API]
    end

    subgraph FastMCP_Framework
        A[rmv_stdio.py] --> F[FastMCP]
        E[fastmcp.client.Client] --> F[FastMCP]
    end

=== Claude Desktop Config

I'll show you how to run the RMV MCP server locally using UV and how to connect it to Claude Desktop. To make the service known to Claude Desktop you need to add its configuration to the Claude Desktop config file (see below).

Once you have it, you can enter it in Claude's config file.

Don't forget to update the file with your API key!

[source,json]

{
    "mcpServers": {

        "my_rmv-mcp-server": {
            "command": "/Users/volker/.local/bin/uv",
            "args": [
                "--directory", 
                "/Users/volker/Dev/mcp/fast_mcp/rmv-mcp-server",
                "run",
                "rmv_stdio.py"
            ],
            "env": {
                "RMV_API_KEY": "<YOUR_API_KEY>"
            }
        }
    }
}

After adding this restart Claude Desktop is needed.

You can tweak its settings and configuration in the Settings -> Connectors menu.

Links