The Railway MCP Server provides a local Model Context Protocol interface for interacting with your Railway account. It offers opinionated workflows and tools for managing Railway resources through AI-powered assistance in compatible editors like Cursor and VS Code.
The Railway MCP Server requires the Railway CLI to function properly.
You can add the Railway MCP Server to Cursor by clicking the button below:
Alternatively, you can add the following configuration to .cursor/mcp.json
:
{
"mcpServers": {
"railway-mcp-server": {
"command": "npx",
"args": ["-y", "@railway/mcp-server"]
}
}
}
Add the following configuration to .vscode/mcp.json
:
{
"servers": {
"railway-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@railway/mcp-server"]
}
}
}
To create a new project, deploy it, and generate a domain, you can use natural language instructions like:
Create a Next.js app in this directory and deploy it to Railway. Make sure to also assign it a domain. Since we're starting from scratch, there is no need to pull information about the deployment or build for now
Deploy database systems or other services using templates with prompts like:
Deploy a Postgres database
Or for more specific requirements:
Deploy a single node Clickhouse database
You can browse all available templates at Railway Templates.
To pull environment variables for your project:
I would like to pull environment variables for my project and save them in a .env file
To create a new environment for testing:
I would like to create a new development environment called `development` where I can test my changes. This environment should duplicate production. Once the environment is created, I want to set it as my current linked environment
The Railway MCP Server provides the following tools for managing your Railway infrastructure:
check-railway-status
- Verifies CLI installation and authenticationlist-projects
- Lists all Railway projectscreate-project-and-link
- Creates a new project and links it to the current directorylist-services
- Lists all services in a projectlink-service
- Links a service to the current directorydeploy
- Deploys a servicedeploy-template
- Deploys a template from the template librarycreate-environment
- Creates a new environmentlink-environment
- Links an environment to the current directorylist-variables
- Lists environment variablesset-variables
- Sets environment variablesgenerate-domain
- Generates a railway.app domain for a projectget-logs
- Retrieves build or deployment logs for a serviceTo add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "railway-mcp-server" '{"command":"npx","args":["-y","@railway/mcp-server"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"railway-mcp-server": {
"command": "npx",
"args": [
"-y",
"@railway/mcp-server"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"railway-mcp-server": {
"command": "npx",
"args": [
"-y",
"@railway/mcp-server"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect