ARJ999/Railway-Account-mcp-server
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.
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)
-
Fork or Clone this Repository
git clone https://github.com/ARJ999/Railway-Account-mcp-server.git cd Railway-Account-mcp-server
-
Login to Railway
railway login
-
Create a New Project
railway init
-
Set Environment Variables
railway variables set RAILWAY_TOKEN=your_railway_token_here
-
Deploy
railway up
-
Generate Domain
railway domain
-
Get Your Deployment URL
railway status
Option 2: Deploy via Railway Dashboard
- Go to railway.app/new
- Select "Deploy from GitHub repo"
- Choose
ARJ999/Railway-Account-mcp-server
- Add environment variable:
RAILWAY_TOKEN
with your Railway API token - Deploy and wait for the build to complete
- Go to Settings โ Networking โ Generate Domain
- Copy your public domain URL
๐ง Configuration
Environment Variables
Variable | Required | Description |
---|---|---|
RAILWAY_TOKEN | Yes | Railway API token for authentication |
PORT | No | Server port (default: 3000, Railway auto-assigns) |
Getting Your Railway Token
- Go to railway.app/account/tokens
- Click "Create Token"
- Give it a descriptive name (e.g., "MCP Server")
- Copy the generated token
- Add it as an environment variable in your Railway project
๐ก API Endpoints
Once deployed, your server exposes the following endpoints:
Endpoint | Method | Description |
---|---|---|
/health | GET | Health check and server status |
/sse | GET | SSE endpoint for MCP communication |
/message | POST | Message 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
- check-railway-status - Verify Railway CLI installation and authentication
Project Management
- list-projects - List all Railway projects in your account
- create-project-and-link - Create a new Railway project
Service Management
- list-services - List all services in a project
- link-service - Link to a specific service
- deploy - Deploy a service to Railway
- deploy-template - Deploy from Railway template library
Environment Management
- create-environment - Create a new environment
- link-environment - Link to a specific environment
Configuration & Variables
- list-variables - List environment variables
- set-variables - Set environment variables
- generate-domain - Generate a railway.app domain
Monitoring & Deployment
- list-deployments - List all deployments
- 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:
- Uses
create-project-and-link
to create the project - Uses
deploy
to deploy the service - Uses
generate-domain
to create a public URL - Reports the deployment URL
Example 2: Manage Environment Variables
User: "Set DATABASE_URL for my backend service"
AI Workflow:
- Uses
list-services
to find services - Uses
link-service
to target the backend - Uses
set-variables
to set DATABASE_URL - Uses
list-variables
to confirm
Example 3: Monitor Deployments
User: "Show me the logs for my latest deployment"
AI Workflow:
- Uses
list-deployments
to find recent deployments - Uses
get-logs
to retrieve logs - 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
- Protect Your Railway Token: Never commit tokens to version control
- Use Environment Variables: Always use Railway's environment variable system
- Monitor Access: Review Railway dashboard regularly
- Rotate Tokens: Periodically regenerate Railway API tokens
- 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:
- Check if your Railway service is running:
railway status
- Verify your domain is correctly configured
- Check Railway logs:
railway logs
๐ Development
Local Development
-
Clone the repository
git clone https://github.com/ARJ999/Railway-Account-mcp-server.git cd Railway-Account-mcp-server
-
Install dependencies
pnpm install
-
Set environment variables
export RAILWAY_TOKEN=your_token_here export PORT=3000
-
Run in development mode
pnpm dev
-
Build for production
pnpm build
-
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
- GitHub Issues: Report bugs or request features
- Railway Documentation: docs.railway.com
- MCP Specification: modelcontextprotocol.io
๐ Acknowledgments
Based on the official Railway MCP Server by the Railway team.
- Original Repository: railwayapp/railway-mcp-server
- Railway: railway.app
- Model Context Protocol: Anthropic
Author: ARJ999
Version: 1.0.0
Last Updated: October 12, 2025