| name | railway-mcp-server |
| description | Use Railway's MCP server to manage Railway projects, deployments, databases, and infrastructure through the Railway CLI |
| triggers | ["deploy my app to railway","create a railway project","check railway deployment status","manage railway database","configure railway environment variables","view railway service logs","set up railway mcp server","interact with railway infrastructure"] |
Railway MCP Server
Skill by ara.so — MCP Skills collection.
Railway MCP Server is an official Model Context Protocol server that enables AI assistants to interact with Railway infrastructure. It's now bundled directly into the Railway CLI, allowing you to manage Railway projects, deployments, databases, environment variables, and services programmatically.
Installation
Install Railway CLI
The Railway MCP server is bundled with the Railway CLI (v4.0.0+):
bash <(curl -fsSL https://railway.com/install.sh)
Configure MCP Client
Automatically configure supported MCP clients (Claude Desktop, Cline, etc.):
railway mcp install
For remote (hosted) MCP server instead of local stdio:
railway mcp install --remote
Manual Configuration
Add to your MCP client configuration (e.g., claude_desktop_config.json):
{
"mcpServers": {
"railway": {
"command": "railway",
"args": ["mcp"]
}
}
}
Authentication
Login to Railway before using MCP commands:
railway login
This opens a browser for authentication and stores credentials locally.
Core Capabilities
Project Management
List all projects:
railway projects
Create a new project:
railway init
Link current directory to a project:
railway link
Switch projects:
railway project
Service Deployment
Deploy current directory:
railway up
Deploy with specific Dockerfile:
railway up --dockerfile ./Dockerfile.prod
View deployment status:
railway status
List all services:
railway service
Environment Variables
Set environment variable:
railway variables set KEY=value
Set multiple variables:
railway variables set API_KEY=$API_KEY DB_HOST=postgres.railway.internal
List all variables:
railway variables
Delete a variable:
railway variables delete KEY
Database Management
Add a database (Postgres, MySQL, Redis, MongoDB):
railway add
Connect to database shell:
railway connect postgres
Get database connection string:
railway variables | grep DATABASE_URL
Logs and Monitoring
View service logs:
railway logs
Follow logs in real-time:
railway logs --follow
View logs for specific deployment:
railway logs --deployment <deployment-id>
Domains
Add custom domain:
railway domain
Generate Railway subdomain:
railway domain --generate
MCP Server Usage
When running through MCP, the Railway server exposes tools that AI assistants can invoke:
Available MCP Tools
railway_projects_list - List all Railway projects
railway_project_create - Create a new project
railway_services_list - List services in a project
railway_service_create - Create a new service
railway_deploy - Deploy a service
railway_deployments_list - List deployments
railway_deployment_status - Get deployment status
railway_variables_list - List environment variables
railway_variables_set - Set environment variables
railway_variables_delete - Delete environment variables
railway_logs_get - Retrieve service logs
railway_databases_add - Add a database service
railway_domains_list - List domains
railway_domains_add - Add a custom domain
Example MCP Interactions
AI Assistant Usage:
When an AI assistant has Railway MCP configured, users can make natural language requests:
User: "Deploy my Node.js app to Railway"
The AI will:
- Check if project is linked (
railway_project_status)
- Create project if needed (
railway_project_create)
- Deploy the service (
railway_deploy)
- Monitor deployment status (
railway_deployment_status)
- Return the deployment URL
User: "Add Postgres database and set DATABASE_URL"
The AI will:
- Add Postgres plugin (
railway_databases_add)
- Retrieve connection string (
railway_variables_list)
- Set DATABASE_URL if needed (
railway_variables_set)
Configuration Files
railway.json (Project Config)
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS",
"buildCommand": "npm run build"
},
"deploy": {
"startCommand": "npm start",
"healthcheckPath": "/health",
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
}
}
railway.toml (Multi-Service Config)
[build]
builder = "NIXPACKS"
buildCommand = "npm run build"
[deploy]
startCommand = "npm start"
healthcheckPath = "/health"
healthcheckTimeout = 300
restartPolicyType = "ON_FAILURE"
[[services]]
name = "frontend"
source = "./frontend"
[[services]]
name = "backend"
source = "./backend"
Common Patterns
Full Stack Deployment
railway init
railway add --database postgres
cd backend
railway up
cd ../frontend
railway up
railway variables set \
BACKEND_URL=https://backend.railway.app \
DATABASE_URL=$DATABASE_PRIVATE_URL
CI/CD Integration
GitHub Actions example:
name: Deploy to Railway
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Railway
run: bash <(curl -fsSL https://railway.com/install.sh)
- name: Deploy
run: railway up --service backend
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
Environment-Specific Variables
railway environment production
railway variables set NODE_ENV=production API_URL=https://api.prod.example.com
railway environment staging
railway variables set NODE_ENV=staging API_URL=https://api.staging.example.com
Troubleshooting
MCP Server Not Found
If railway mcp command fails:
railway --version
bash <(curl -fsSL https://railway.com/install.sh)
Authentication Issues
railway logout
railway login
railway whoami
Deployment Failures
railway logs --deployment <deployment-id>
railway logs --build
railway status
MCP Client Configuration Issues
Remove legacy @railway/mcp-server npm package configurations:
{
"mcpServers": {
"railway": {
"command": "npx",
"args": ["-y", "@railway/mcp-server"]
}
}
}
{
"mcpServers": {
"railway": {
"command": "railway",
"args": ["mcp"]
}
}
}
Connection String Access
railway variables | grep PRIVATE_URL
railway variables | grep DATABASE_URL
Documentation