MrJ-JMRI-MCP
Control your DCC model railroad by voice or chat through any MCP client, with dynamic discovery of layout elements from JMRI.
README
MrJ-JMRI-MCP
MCP (Model Context Protocol) server for JMRI — control your DCC model railroad by voice or chat, through any MCP client: xiaozhi voice assistants, Claude Desktop, Claude Code, etc.
Status: early development. The roadmap lives in the project board and the issues.
Goals
- Fully dynamic — no hardcoded layout data. Systems (power connections), roster, turnouts and sensors are discovered live from the JMRI server (
GET /json/power,{"list": ...}). - LLM-friendly — compact tool outputs (voice assistants have small contexts), honest
success/errorreporting, docstrings that tell the model when and how to use each tool. - One server, every client — pure stdio MCP server: consumed directly by Claude Desktop/Code, and bridged to xiaozhi via
mcp_pipe.py.
Architecture (target)
src/jmri_mcp/
├── config.py # env vars: JMRI_URL (e.g. http://10.0.20.20:12080)
├── client.py # persistent WebSocket client to ws://<jmri>/json/
│ # auto-reconnect, ping/pong, throttle registry
├── tools/
│ ├── power.py # discover systems, get/set power (state 2=ON, 4=OFF)
│ ├── throttle.py# acquire, speed, direction, stop, e-stop, F0–F28
│ ├── roster.py # compact list/search, name → DCC address resolution
│ └── layout.py # turnouts, sensors, lights
└── server.py # FastMCP entry point (stdio; logging → stderr only)
Requirements
- Python ≥ 3.10
- A running JMRI Web Server (tested against JMRI 5.4)
Configuration
| Variable | Default | Description |
|---|---|---|
JMRI_URL |
http://localhost:12080 |
Base URL of the JMRI Web Server |
Legacy
legacy/jmri_experimental.py is the original proof-of-concept (power on/off only). Kept for reference; do not extend it.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.