Skip to main content
Glama
railwayapp

Railway MCP Server

Official
by railwayapp

Create Railway Project

create-project-and-link

Create a new Railway project and link it to your current directory for deployment and management.

Instructions

Create a new Railway project and link it to the current directory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectNameYes
workspacePathYesThe path to the workspace to create the project in

Implementation Reference

  • The MCP tool handler function that invokes the createRailwayProject helper, formats success/error responses using createToolResponse, and handles exceptions gracefully.
    handler: async ({ projectName, workspacePath }: CreateProjectOptions) => {
    	try {
    		const result = await createRailwayProject({
    			projectName,
    			workspacePath,
    		});
    		return createToolResponse(
    			`✅ Successfully created Railway project "${projectName}":\n\n${result}\n\nThis project is now linked and all commands will be run in the context of the newly created project. No need to run \`railway link\` again.`,
    		);
    	} catch (error: unknown) {
    		const errorMessage =
    			error instanceof Error ? error.message : "Unknown error occurred";
    		return createToolResponse(
    			"❌ Failed to create Railway project\n\n" +
    				`**Error:** ${errorMessage}\n\n` +
    				"**Next Steps:**\n" +
    				"• Ensure you are logged into Railway CLI (`railway login`)\n" +
    				"• Check that the project name is valid and unique\n" +
    				"• Verify you have permissions to create projects\n" +
    				"• Ensure the workspace path is accessible",
    		);
    	}
    },
  • Zod-based input schema defining required parameters: projectName (string) and workspacePath (string with description). Used for tool input validation.
    inputSchema: {
    	projectName: z.string(),
    	workspacePath: z
    		.string()
    		.describe("The path to the workspace to create the project in"),
    },
  • src/index.ts:21-31 (registration)
    Generic registration loop that registers all exported tools (including create-project-and-link) from ./tools into the McpServer instance.
    Object.values(tools).forEach((tool) => {
    	server.registerTool(
    		tool.name,
    		{
    			title: tool.title,
    			description: tool.description,
    			inputSchema: tool.inputSchema,
    		},
    		tool.handler,
    	);
    });
  • Core helper function that executes Railway CLI commands (`railway init` and `railway link`) to create and link a new project, checks for existing links, and handles CLI errors.
    export const createRailwayProject = async ({
    	projectName,
    	workspacePath,
    }: CreateProjectOptions): Promise<string> => {
    	try {
    		await checkRailwayCliStatus();
    
    		// Check if there's already a linked project
    		const linkedProjectResult = await getLinkedProjectInfo({ workspacePath });
    		if (linkedProjectResult.success && linkedProjectResult.project) {
    			return "A Railway project is already linked to this workspace. No new project created.";
    		}
    
    		const { output: initOutput } = await runRailwayCommand(
    			`railway init --name ${projectName}`,
    			workspacePath,
    		);
    		const { output: linkOutput } = await runRailwayCommand(
    			`railway link -p ${projectName}`,
    			workspacePath,
    		);
    
    		return `${initOutput}\n${linkOutput}`;
    	} catch (error: unknown) {
    		return analyzeRailwayError(error, `railway init --name ${projectName}`);
    	}
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions creation and linking but fails to detail critical aspects like permissions required, whether this is a destructive operation, error handling, or what happens if the project already exists. This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that efficiently conveys the core functionality without unnecessary words. It is front-loaded with the main action and avoids redundancy, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of creating and linking a project with no annotations, no output schema, and incomplete parameter documentation, the description is insufficient. It lacks details on outcomes, error conditions, or integration with sibling tools, making it incomplete for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 50% (only 'workspacePath' has a description), and the description does not add any parameter-specific details beyond what the schema provides. It implies parameters are needed but doesn't explain their roles or constraints, resulting in a baseline score due to moderate schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create a new Railway project') and includes an additional outcome ('and link it to the current directory'), which specifies the tool's purpose beyond just creation. However, it doesn't explicitly differentiate from sibling tools like 'create-environment' or 'link-service', which could involve similar concepts.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives such as 'list-projects' for checking existing ones or 'deploy-template' for starting from a template. It lacks context about prerequisites, timing, or exclusions, leaving usage decisions unclear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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