Skip to content

CWACoderWithAttitude/rmv-mcp-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

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 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 FastMCP framework.

Prerequisites

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

It usese 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 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:

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
Loading

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!

{
    "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 SettingsConnectors menu.

About

Enable your LLM (Claude Desktop in this case) to use station and trip data of Frankfurts RMV Net.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published