@railway/mcp-server
Version:
Official Railway MCP server
36 lines (33 loc) • 1.47 kB
JavaScript
import { createRailwayProject } from "./projects-ENU6yIz7.js";
import { createToolResponse } from "./utils-Cvxm88Gr.js";
import z from "zod";
//#region src/tools/create-project-and-link.ts
const createProjectAndLinkTool = {
name: "create-project-and-link",
title: "Create Railway Project",
description: "Create a new Railway project and link it to the current directory",
inputSchema: {
projectName: z.string(),
workspacePath: z.string().describe("The path to the workspace to create the project in")
},
handler: async ({ projectName, workspacePath }) => {
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) {
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
return createToolResponse(`❌ Failed to create Railway project
**Error:** ${errorMessage}\n\n**Next Steps:**
• Ensure you are logged into Railway CLI (\`railway login\`)
• Check that the project name is valid and unique
• Verify you have permissions to create projects
• Ensure the workspace path is accessible`);
}
}
};
//#endregion
export { createProjectAndLinkTool };
//# sourceMappingURL=create-project-and-link-CmsLDh6h.js.map