Railway-Account-mcp-server

ARJ999/Railway-Account-mcp-server

3.2

If you are the rightful owner of Railway-Account-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 henry@mcphub.com.

The Railway Account MCP Server is a remote-accessible server designed for managing Railway projects using HTTP/SSE transport, allowing deployment and access from anywhere.

Tools
14
Resources
0
Prompts
0

Railway Account MCP Server

Remote MCP Server for Managing Railway Projects via HTTP/SSE Transport

A production-ready Model Context Protocol (MCP) server that enables comprehensive Railway infrastructure management through HTTP/SSE transport. This server can be deployed to Railway and accessed remotely by any MCP-compatible client.


๐ŸŒŸ Overview

The Railway Account MCP Server provides a remote-accessible interface for managing Railway projects, services, environments, and deployments. Unlike traditional STDIO-based MCP servers that run locally, this server uses HTTP/SSE (Server-Sent Events) transport, allowing it to be deployed to Railway and accessed from anywhere.

Key Features

  • โœ… Remote Access: Deploy once, access from multiple clients
  • โœ… HTTP/SSE Transport: Standard web protocols for broad compatibility
  • โœ… 14 Railway Tools: Complete Railway management capabilities
  • โœ… Railway-Ready: Optimized for Railway deployment with Dockerfile
  • โœ… CORS Enabled: Works with web-based MCP clients
  • โœ… Health Monitoring: Built-in health check endpoint
  • โœ… Production-Ready: Comprehensive error handling and logging

[!IMPORTANT] The MCP server doesn't include destructive actions by design, but you should still monitor which tools and commands are being executed.


๐Ÿš€ Quick Start

Prerequisites

  • Railway Account: Sign up at railway.app
  • Railway CLI: Install via npm install -g @railway/cli
  • Railway Token: Generate from Railway dashboard

Deploy to Railway

Option 1: Deploy from GitHub (Recommended)
  1. Fork or Clone this Repository

    git clone https://github.com/ARJ999/Railway-Account-mcp-server.git
    cd Railway-Account-mcp-server
    
  2. Login to Railway

    railway login
    
  3. Create a New Project

    railway init
    
  4. Set Environment Variables

    railway variables set RAILWAY_TOKEN=your_railway_token_here
    
  5. Deploy

    railway up
    
  6. Generate Domain

    railway domain
    
  7. Get Your Deployment URL

    railway status
    
Option 2: Deploy via Railway Dashboard
  1. Go to railway.app/new
  2. Select "Deploy from GitHub repo"
  3. Choose ARJ999/Railway-Account-mcp-server
  4. Add environment variable: RAILWAY_TOKEN with your Railway API token
  5. Deploy and wait for the build to complete
  6. Go to Settings โ†’ Networking โ†’ Generate Domain
  7. Copy your public domain URL

๐Ÿ”ง Configuration

Environment Variables

VariableRequiredDescription
RAILWAY_TOKENYesRailway API token for authentication
PORTNoServer port (default: 3000, Railway auto-assigns)

Getting Your Railway Token

  1. Go to railway.app/account/tokens
  2. Click "Create Token"
  3. Give it a descriptive name (e.g., "MCP Server")
  4. Copy the generated token
  5. Add it as an environment variable in your Railway project

๐Ÿ“ก API Endpoints

Once deployed, your server exposes the following endpoints:

EndpointMethodDescription
/healthGETHealth check and server status
/sseGETSSE endpoint for MCP communication
/messagePOSTMessage endpoint for client requests

Example URLs

If your Railway domain is railway-account-mcp-server-production.up.railway.app:

  • Health Check: https://railway-account-mcp-server-production.up.railway.app/health
  • SSE Endpoint: https://railway-account-mcp-server-production.up.railway.app/sse
  • Message Endpoint: https://railway-account-mcp-server-production.up.railway.app/message

๐Ÿ”Œ Connecting MCP Clients

Claude Desktop

Add to your Claude Desktop 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

{
  "mcpServers": {
    "railway-account": {
      "transport": {
        "type": "sse",
        "url": "https://your-railway-domain.up.railway.app/sse"
      }
    }
  }
}

Cursor

Add to .cursor/mcp.json in your project:

{
  "mcpServers": {
    "railway-account": {
      "transport": {
        "type": "sse",
        "url": "https://your-railway-domain.up.railway.app/sse"
      }
    }
  }
}

VS Code (with MCP Extension)

Add to .vscode/mcp.json:

{
  "servers": {
    "railway-account": {
      "type": "sse",
      "url": "https://your-railway-domain.up.railway.app/sse"
    }
  }
}

Generic MCP Client

For any MCP client that supports SSE transport:

{
  "transport": {
    "type": "sse",
    "url": "https://your-railway-domain.up.railway.app/sse"
  }
}

๐Ÿ› ๏ธ Available Tools

The server provides 14 comprehensive Railway management tools:

System Status

  1. check-railway-status - Verify Railway CLI installation and authentication

Project Management

  1. list-projects - List all Railway projects in your account
  2. create-project-and-link - Create a new Railway project

Service Management

  1. list-services - List all services in a project
  2. link-service - Link to a specific service
  3. deploy - Deploy a service to Railway
  4. deploy-template - Deploy from Railway template library

Environment Management

  1. create-environment - Create a new environment
  2. link-environment - Link to a specific environment

Configuration & Variables

  1. list-variables - List environment variables
  2. set-variables - Set environment variables
  3. generate-domain - Generate a railway.app domain

Monitoring & Deployment

  1. list-deployments - List all deployments
  2. get-logs - Retrieve build or deployment logs

๐Ÿ“– Usage Examples

Example 1: Create and Deploy a New Project

User: "Create a new Railway project called 'my-api' and deploy it"

AI Workflow:

  1. Uses create-project-and-link to create the project
  2. Uses deploy to deploy the service
  3. Uses generate-domain to create a public URL
  4. Reports the deployment URL

Example 2: Manage Environment Variables

User: "Set DATABASE_URL for my backend service"

AI Workflow:

  1. Uses list-services to find services
  2. Uses link-service to target the backend
  3. Uses set-variables to set DATABASE_URL
  4. Uses list-variables to confirm

Example 3: Monitor Deployments

User: "Show me the logs for my latest deployment"

AI Workflow:

  1. Uses list-deployments to find recent deployments
  2. Uses get-logs to retrieve logs
  3. Displays formatted log output

๐Ÿ—๏ธ Architecture

Technology Stack

  • Protocol: Model Context Protocol (MCP) 1.0
  • Transport: HTTP/SSE (Server-Sent Events)
  • Framework: Express.js
  • Language: TypeScript/Node.js
  • SDK: @modelcontextprotocol/sdk v1.17.1+
  • CLI Integration: Railway CLI wrapper
  • API: GraphQL client for Railway API
  • Validation: Zod schema validation

Component Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚         MCP Client                  โ”‚
โ”‚  (Claude/Cursor/VS Code/etc.)       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
               โ”‚ HTTP/SSE
               โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚     Railway Account MCP Server       โ”‚
โ”‚     (Deployed on Railway)            โ”‚
โ”‚                                      โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚  โ”‚  Express.js HTTP Server        โ”‚ โ”‚
โ”‚  โ”‚  - CORS enabled                โ”‚ โ”‚
โ”‚  โ”‚  - Health check endpoint       โ”‚ โ”‚
โ”‚  โ”‚  - SSE transport               โ”‚ โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚                โ”‚                     โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚  โ”‚  14 MCP Tools                  โ”‚ โ”‚
โ”‚  โ”‚  - Project Management          โ”‚ โ”‚
โ”‚  โ”‚  - Service Management          โ”‚ โ”‚
โ”‚  โ”‚  - Environment Management      โ”‚ โ”‚
โ”‚  โ”‚  - Variables & Config          โ”‚ โ”‚
โ”‚  โ”‚  - Monitoring & Logs           โ”‚ โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚                โ”‚                     โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚  โ”‚  Railway CLI Wrapper           โ”‚ โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚                โ”‚                     โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚  โ”‚  GraphQL API Client            โ”‚ โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
               โ”‚
               โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚         Railway API                  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”’ Security

Built-in Safety Features

  • โœ… No Destructive Operations: Excludes delete/destroy commands by design
  • โœ… Token-Based Authentication: Uses Railway API tokens
  • โœ… CORS Protection: Configurable CORS headers
  • โœ… Environment Isolation: Each deployment has isolated environment
  • โœ… Secure Token Storage: Railway tokens stored as environment variables

Best Practices

  1. Protect Your Railway Token: Never commit tokens to version control
  2. Use Environment Variables: Always use Railway's environment variable system
  3. Monitor Access: Review Railway dashboard regularly
  4. Rotate Tokens: Periodically regenerate Railway API tokens
  5. Limit Permissions: Use tokens with minimum required permissions

๐Ÿงช Testing

Test Health Endpoint

curl https://your-railway-domain.up.railway.app/health

Expected response:

{
  "status": "healthy",
  "service": "Railway Account MCP Server",
  "version": "1.0.0",
  "timestamp": "2025-10-12T12:00:00.000Z"
}

Test SSE Connection

curl -N https://your-railway-domain.up.railway.app/sse

You should see SSE events streaming.


๐Ÿ› Troubleshooting

Issue: "Railway CLI not found"

Solution: The Railway CLI is installed in the Docker container. Ensure your Dockerfile includes:

RUN npm install -g @railway/cli

Issue: "Not authenticated with Railway"

Solution: Ensure you've set the RAILWAY_TOKEN environment variable in your Railway project.

Issue: "CORS errors in browser"

Solution: The server includes CORS headers. If you need to restrict origins, modify the CORS configuration in src/index.ts.

Issue: "Connection timeout"

Solution:

  1. Check if your Railway service is running: railway status
  2. Verify your domain is correctly configured
  3. Check Railway logs: railway logs

๐Ÿ“š Development

Local Development

  1. Clone the repository

    git clone https://github.com/ARJ999/Railway-Account-mcp-server.git
    cd Railway-Account-mcp-server
    
  2. Install dependencies

    pnpm install
    
  3. Set environment variables

    export RAILWAY_TOKEN=your_token_here
    export PORT=3000
    
  4. Run in development mode

    pnpm dev
    
  5. Build for production

    pnpm build
    
  6. Start production server

    pnpm start
    

Testing

# Run tests
pnpm test

# Run tests once
pnpm test:run

# Type checking
pnpm typecheck

# Linting
pnpm lint

# Formatting
pnpm format

๐Ÿ“„ License

MIT License - see file for details.


๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


๐Ÿ“ž Support


๐Ÿ™ Acknowledgments

Based on the official Railway MCP Server by the Railway team.


Author: ARJ999
Version: 1.0.0
Last Updated: October 12, 2025