Back to MCP Servers

Railway MCP Server

Official Railway MCP server for managing projects, services, environments, variables, deployments, and logs through natural language via the Railway CLI.

Developer Tools by Railway Railway CLI authentication active
Overview

The Railway MCP Server is the official Model Context Protocol server maintained by Railway for interacting with your Railway account from AI agents like Claude, Cursor, and VS Code. It provides a set of opinionated workflows that wrap the Railway CLI, letting agents create projects, deploy templates and services, manage environments, set variables, generate domains, and fetch logs through structured tool calls.

The server can be used in two ways: as a local stdio server via the @railway/mcp-server npm package (which shells out to your authenticated Railway CLI), or as a remote hosted server at https://mcp.railway.com installed via railway mcp install --remote. Either way, authentication is handled through the Railway CLI, so users must be logged into Railway before the tools work.

Destructive operations (like deleting projects or services) are intentionally excluded from the server by design, making it safer to give AI agents access. The server is open source under the official railwayapp GitHub organization and is the canonical way to give AI assistants access to Railway infrastructure.

Tools

Tool Description
check-railway-status Verifies that the Railway CLI is installed and the user is authenticated.
list-projects Enumerate all Railway projects for the authenticated user.
create-project-and-link Create a new Railway project and link it to the current working directory.
list-services Display services within a given project.
link-service Associate a Railway service with the current directory.
deploy Push service updates to Railway from the current directory.
deploy-template Deploy a template from the Railway template library.
create-environment Create a new environment within a project.
link-environment Connect an existing environment to the current directory.
list-variables Display environment variables for the linked service or environment.
set-variables Set environment variables on a service or environment.
generate-domain Generate a railway.app domain for a service.
get-logs Fetch build or deployment logs. With Railway CLI v4.9.0+ supports line limits and filtering; older versions stream logs without filtering.
Setup Guide

Prerequisites

  • Railway CLI installed and authenticated (railway login)
  • Node.js (for the npx runner)

Quick install

The fastest path uses the Railway CLI helper:

bash <(curl -fsSL cli.new) --agents -y

If you already have the CLI:

railway mcp install

For the hosted remote server at https://mcp.railway.com:

railway mcp install --remote

Cursor

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "railway-mcp-server": {
      "command": "npx",
      "args": ["-y", "@railway/mcp-server"]
    }
  }
}

VS Code

Add to .vscode/mcp.json:

{
  "servers": {
    "railway-mcp-server": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@railway/mcp-server"]
    }
  }
}

Claude Code

claude mcp add railway-mcp-server -- npx -y @railway/mcp-server

GitHub Copilot

Add to ~/.copilot/mcp-config.json:

{
  "mcpServers": {
    "Railway": {
      "type": "local",
      "command": "npx",
      "args": ["-y", "@railway/mcp-server"],
      "tools": ["*"]
    }
  }
}

Notes

  • The server shells out to the Railway CLI, so auth is whatever account is logged in via railway login.
  • Some features in get-logs require Railway CLI v4.9.0 or newer.
Use Cases
  • Spin up a new Railway project from a repo and deploy a template (e.g. Postgres, Redis) without leaving your editor.
  • Have an AI agent fetch deployment logs and diagnose why a build failed.
  • Bulk set environment variables across multiple environments when promoting a release.
  • Generate a public railway.app domain for a freshly deployed service.
  • Audit all projects, services, and environments tied to a Railway account from one chat session.
Example Prompts
  • "List all my Railway projects and show which services are in the staging environment."
  • "Deploy the Postgres template into my current project and link it to the production environment."
  • "Set STRIPE_API_KEY and SENTRY_DSN on the api service in the production environment."
  • "Pull the last 200 lines of logs for the worker service and tell me why the build is failing."
  • "Create a new preview environment for this project and generate a railway.app domain for the web service."
Pros
  • Officially maintained by Railway under the railwayapp GitHub organization.
  • Available as both a local stdio server and a hosted remote server at mcp.railway.com.
  • Destructive operations are intentionally excluded, reducing risk of agents wiping infrastructure.
  • One-command install paths for Cursor, VS Code, Claude Code, and GitHub Copilot.
Limitations
  • Requires the Railway CLI to be installed and authenticated locally; not purely API-based.
  • No destructive actions means deletes and teardown must be done manually outside the agent.
  • Some log features depend on Railway CLI v4.9.0 or newer.
Alternatives