PD

paulvonberg/db-mcp-server

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

22 stars 4 forks 质量 62 趋势 10NOASSERTION

一个全面的模型上下文协议(MCP)服务器,提供对德国铁路(DB)和德国移动性API的统一访问。

概览

一个全面的模型上下文协议(MCP)服务器,提供对德国铁路(DB)和德国移动性API的统一访问。采用Python、FastAPI和FastMCP构建,实现与Claude Desktop及其他MCP客户端的无缝集成。 服务器已准备好进行本地和云部署。运行中的MCP服务器可以通过向你的MCP客户端添加URL:[服务器已解除——按描述托管你自己的部署]进行连接。 - :车站、时刻表、实时中断和停车 - :对工具、提示和资源的全面支持 - :安全头部、速率限制、输入验证 - :干净、易于维护的代码库结构 - :为 Google Cloud Run 部署设计 - :全面的指南和参考资料 - Python 3.11+ - 德国铁路 API 凭证(点击此处获取)- Google Cloud 账户(用于部署) 2. 接下来,用你的数据库API凭证编辑新的.env文件。关于每个变量的详细信息,请参见“配置”部分。

概述(AI 翻译)

一个全面的模型上下文协议(MCP)服务器,提供对德国铁路(DB)和德国移动性API的统一访问。采用Python、FastAPI和FastMCP构建,实现与Claude Desktop及其他MCP客户端的无缝集成。

服务器已准备好进行本地和云部署。运行中的MCP服务器可以通过添加地址到你的MCP客户端:[SERVER DECOMISSIONED - HOST YOUR OWN DEPLOYMENT AS DESCRIBED]进行连接。

🚀 特色

  • ** 🚄 完整铁路数据**:车站、时刻表、实时中断和停车情况
  • ** 🤖 MCP 协议**:对工具、提示和资源的全面支持
  • ** 🛡️ 生产准备**:安全头部、速率限制、输入验证
  • ** 🏗️ 模块化架构**:干净、易于维护的代码库结构
  • ** ☁️ 云原生**:专为 Google Cloud Run 部署设计
  • ** 📚 丰富的文档**:全面的指南和参考资料

📋 快速入门(开发者用 - 用户说明见下)

先决条件

  • Python 3.11+
  • 德国铁路 API 凭证(点击此处获取)
  • Google Cloud 账户(用于部署)

地方发展

  1. 克隆与设置:

  2. 配置环境:

接下来,编辑新的’。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Deutsche Bahn MCP Server

A comprehensive Model Context Protocol (MCP) server that provides unified access to Deutsche Bahn (DB) and German mobility APIs. Built with Python, FastAPI, and FastMCP for seamless integration with Claude Desktop and other MCP clients.

The server is ready for local and cloud deployment. A running MCP server is available to connect by adding the URL to your MCP Client: [SERVER DECOMISSIONED - HOST YOUR OWN DEPLOYMENT AS DESCRIBED].

🚀 Features

  • 🚄 Complete Railway Data: Stations, timetables, real-time disruptions, and parking
  • 🤖 MCP Protocol: Full support for tools, prompts, and resources
  • 🛡️ Production Ready: Security headers, rate limiting, input validation
  • 🏗️ Modular Architecture: Clean, maintainable codebase structure
  • ☁️ Cloud Native: Designed for Google Cloud Run deployment
  • 📚 Rich Documentation: Comprehensive guides and reference materials

📋 Quick Start (for developers - User instructions below)

Prerequisites

  • Python 3.11+
  • Deutsche Bahn API credentials (Get them here)
  • Google Cloud account (for deployment)

Local Development

  1. Clone and setup:

    git clone 
    cd deutsche-bahn-mcp-server
    python3 -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    pip install -r requirements.txt
    
  2. Configure environment:

    cp .env.example .env
    

    Next, edit the new .env file with your DB API credentials. See the “Configuration” section for details on each variable.

  3. Run the server:

    python main.py
    # Server available at http://localhost:8080
    

🎯 Live Server Usage Guide

[SERVER DECOMISSIONED - HOST YOUR OWN DEPLOYMENT AS DESCRIBED]

🖥️ Claude Desktop Setup

Step 1: Locate your configuration file

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\\Claude\\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

Step 2: Edit the configuration Open the file and add the Deutsche Bahn server:

{
  "mcpServers": {
    "deutschebahn": {
      "command": "npx",
      "args": [
        "-y", "mcp-remote",
        "https://[SERVER DECOMISSIONED - Use your URL]/mcp",
        "--transport", "http-only"
      ]
    }
  }
}

Step 3: Restart Claude Desktop

  • Close Claude Desktop completely
  • Reopen the application
  • You should see “Deutsche Bahn MCP Server” in the MCP section

Step 4: Test the connection Ask Claude: “What train stations are in Berlin?”

🌐 Claude.ai Web Usage

Step 1: Start a conversation Go to claude.ai and begin a new conversation.

Step 2: Add the MCP Server Click on “Search and Tools > Add connectors > Manage connectors” Select “Add custom connector” Enter a name, e.g.: “Deutsche Bahn MCP Server”

在 GitHub 查看完整 README

安装

npx -y mcp-remote https://[SERVER DECOMISSIONED - Use your URL
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "deutschebahn": { "command": "npx", "args": [ "-y", "mcp-remote", "https://[SERVER DECOMISSIONED - Use your URL]/mcp", "--transport", "http-only" ] } } }