Skip to main content
Glama

deploy

Upload and deploy applications from a local directory to Railway cloud platform. Configure CI mode, environment, and service options for streamlined deployment processes.

Instructions

Upload and deploy from the current directory. Supports CI mode, environment, and service options.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ciNoStream build logs only, then exit (equivalent to setting $CI=true)
environmentNoEnvironment to deploy to (defaults to linked environment)
serviceNoService to deploy to (defaults to linked service)
workspacePathYesThe path to the workspace to deploy

Implementation Reference

  • The handler function for the 'deploy' tool that calls deployRailwayProject with provided options and handles success/error responses using createToolResponse.
    handler: async ({ workspacePath, ci, environment, service, }: DeployOptions) => { const { workspacePath: wsPath, ci: ciMode = false, environment: env, service: svc, } = { workspacePath, ci, environment, service }; try { const result = await deployRailwayProject({ workspacePath: wsPath, ci: ciMode, environment: env, service: svc, }); return createToolResponse( `✅ Successfully triggered a deployment for Railway project. This process will take some time to complete:\n\n${result}`, ); } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : "Unknown error occurred"; return createToolResponse( "❌ Failed to deploy Railway project\n\n" + `**Error:** ${errorMessage}\n\n` + "**Next Steps:**\n" + "• Ensure you have a Railway project linked\n" + "• Check that the environment and service exist\n" + "• Verify your project has the necessary files for deployment\n" + "• Check that you have permissions to deploy to this project", ); } },
  • Zod input schema defining parameters for the deploy tool: workspacePath, ci, environment, service.
    inputSchema: { workspacePath: z.string().describe("The path to the workspace to deploy"), ci: z .boolean() .optional() .describe( "Stream build logs only, then exit (equivalent to setting $CI=true)", ), environment: z .string() .optional() .describe("Environment to deploy to (defaults to linked environment)"), service: z .string() .optional() .describe("Service to deploy to (defaults to linked service)"), },
  • src/index.ts:21-31 (registration)
    Registration of all tools (including 'deploy') into the MCP server by iterating over exports from src/tools/index.ts.
    Object.values(tools).forEach((tool) => { server.registerTool( tool.name, { title: tool.title, description: tool.description, inputSchema: tool.inputSchema, }, tool.handler, ); });
  • Core helper function deployRailwayProject that executes the 'railway up' CLI command with options and handles service linking.
    export const deployRailwayProject = async ({ workspacePath, environment, service, ci, }: DeployOptions): Promise<string> => { try { await checkRailwayCliStatus(); const result = await getLinkedProjectInfo({ workspacePath }); if (!result.success) { throw new Error(result.error); } // Build the railway up command with options let command = "railway up"; if (ci) { command += " --ci"; } if (environment) { command += ` --environment ${environment}`; } if (service) { command += ` --service ${service}`; } const { output: deployOutput } = await runRailwayCommand( command, workspacePath ); // After deployment, try to link a service if none is linked try { // Check if there are any services available const servicesResult = await getRailwayServices({ workspacePath }); if ( servicesResult.success && servicesResult.services && servicesResult.services.length > 0 ) { // Link the first available service const firstService = servicesResult.services[0]; const { output: linkOutput } = await runRailwayCommand( `railway service ${firstService}`, workspacePath ); return `${deployOutput}\n\nService linked: ${firstService}\n${linkOutput}`; } } catch (linkError) { // If linking fails, just return the deployment output console.warn( "Warning: Could not automatically link service after deployment:", linkError ); } return deployOutput; } catch (error: unknown) { return analyzeRailwayError(error, "railway up"); } };

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/railwayapp/railway-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server