home / mcp / railway mcp server

Railway MCP Server

Provides direct access to manage Railway projects, deployments, and environment variables via an MCP client.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "allkindsxyz-railway-mcp-server": {
      "command": "node",
      "args": [
        "/absolute/path/to/railway-mcp-server/dist/index.js"
      ],
      "env": {
        "RAILWAY_TOKEN": "your-railway-token-here"
      }
    }
  }
}

You are about to run a Railway MCP Server that lets AI systems directly manage Railway projects, deployments, and services. This MCP server runs locally and communicates with Railway using your API token, giving you programmatic control over projects, deploys, environment variables, and real-time status monitoring.

How to use

After you configure an MCP client, you can interact with Railway resources through natural language commands. You can view all projects, inspect a specific project, fetch deployment logs, restart or redeploy services, and manage environment variables. Core actions include monitoring deployment status in real time, obtaining service URLs, and retrieving project and service metadata. Use the available commands to perform tasks like viewing projects, viewing a single project, viewing deployment logs, restarting services, and setting or updating environment variables.

How to install

Prerequisites you need before starting are Node.js 18+ and a Railway API token.

Step 1: Install prerequisites and clone the project.

# Clone the repository
git clone <your-repo-url>
cd railway-mcp-server

# Install dependencies
npm install

# Build the project
npm run build

Step 2: Obtain your Railway API token.

Follow these steps to generate a token in Railway: 1. Log in to Railway 2. Go to Account Settings → Tokens 3. Create a new token 4. Copy the token

Additional setup for clients

Configure your MCP client (Claude Desktop or Cursor) to connect to the local MCP server. You will run the MCP server locally and point the client to the local process so commands like viewing projects or updating variables are forwarded to Railway.

For Claude Desktop and Cursor you will specify the MCP server as a local stdio process with the node runtime and the built server entry point, plus your Railway token as an environment variable.

Testing and running locally

You can test and run the MCP server locally using the environment variable that holds your Railway API token and starting the server with Node.

Open a terminal and start the server after setting the token in the environment.

# Set the Railway token in your environment (example for bash)
export RAILWAY_TOKEN="your-token-here"

# Start the server
npm start

Configuration snippets for clients

{
  "mcpServers": {
    "railway": {
      "command": "node",
      "args": ["/absolute/path/to/railway-mcp-server/dist/index.js"],
      "env": {
        "RAILWAY_TOKEN": "your-railway-token-here"
      }
    }
  }
}

Configure Cursor similarly to connect to the local MCP server by specifying the same command and arguments, including the Railway token in the environment.

Security and maintenance

Tokens are stored only in environment variables. The MCP server runs locally to limit exposure. Actions that change state require confirmation, and each service runs in an isolated context to minimize cross-service impact.

Troubleshooting

Common issues and fixes include token validity, authorization errors, and missing tool configurations. Ensure the RAILWAY_TOKEN environment variable is set correctly and that the token has the required permissions.

If you encounter connectivity or permission problems, restart the client and verify that the MCP server process is running locally.

Testing with MCP Inspector

For interactive debugging, run the MCP Inspector and open the provided URL in your browser to exercise commands in a test environment.

# Run the inspector for debugging
npm run inspector

Available tools

get_projects

Fetches all Railway projects and their services.

get_project

Fetches detailed information about a specific project.

get_service

Fetches details for a specific service within a project.

get_deployment_logs

Retrieves logs for a specific deployment.

redeploy_service

Triggers a redeploy of a specified service.

cancel_deployment

Cancels an ongoing deployment.

restart_deployment

Restarts a deployment.

update_service_variable

Updates or creates an environment variable for a service.

delete_service_variable

Deletes an environment variable from a service.