service_create_from_repo
Deploy applications from GitHub repositories by creating services with build processes. Specify project ID and repository URL to initiate deployment.
Instructions
[API] Create a new service from a GitHub repository
⚡️ Best for: ✓ Deploying applications from source code ✓ Services that need build processes ✓ GitHub-hosted projects
⚠️ Not for: × Pre-built Docker images (use service_create_from_image) × Database deployments (use database_deploy) × Static file hosting
→ Prerequisites: project_list
→ Alternatives: service_create_from_image, database_deploy
→ Next steps: variable_set, service_update
→ Related: deployment_trigger, service_info
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | ID of the project to create the service in | |
| repo | Yes | GitHub repository URL or name (e.g., 'owner/repo') | |
| name | No | Optional custom name for the service |
Implementation Reference
- src/tools/service.tool.ts:57-87 (registration)Tool definition, registration in serviceTools array, input schema (Zod), formatted description, and inline handler function delegating to serviceServicecreateTool( "service_create_from_repo", formatToolDescription({ type: 'API', description: "Create a new service from a GitHub repository", bestFor: [ "Deploying applications from source code", "Services that need build processes", "GitHub-hosted projects" ], notFor: [ "Pre-built Docker images (use service_create_from_image)", "Database deployments (use database_deploy)", "Static file hosting" ], relations: { prerequisites: ["project_list"], nextSteps: ["variable_set", "service_update"], alternatives: ["service_create_from_image", "database_deploy"], related: ["deployment_trigger", "service_info"] } }), { projectId: z.string().describe("ID of the project to create the service in"), repo: z.string().describe("GitHub repository URL or name (e.g., 'owner/repo')"), name: z.string().optional().describe("Optional custom name for the service") }, async ({ projectId, repo, name }) => { return serviceService.createServiceFromRepo(projectId, repo, name); } ),
- src/tools/service.tool.ts:84-86 (handler)The MCP tool handler function that extracts parameters and calls the service service methodasync ({ projectId, repo, name }) => { return serviceService.createServiceFromRepo(projectId, repo, name); }
- Core helper method in ServiceService that invokes the Railway client API to create a service from a GitHub repositoryasync createServiceFromRepo(projectId: string, repo: string, name?: string) { try { const service = await this.client.services.createService({ projectId, name, source: { repo, } }); return createSuccessResponse({ text: `Created new service "${service.name}" (ID: ${service.id}) from GitHub repo "${repo}"`, data: service }); } catch (error) { return createErrorResponse(`Error creating service: ${formatError(error)}`); } }
- src/tools/index.ts:32-36 (registration)Final MCP server registration where serviceTools (including service_create_from_repo) is spread into allTools and each tool is registered via server.toolallTools.forEach((tool) => { server.tool( ...tool ); });