UNPKG

@crazyrabbitltc/railway-mcp

Version:

Railway MCP Server - 146+ tools with 100% Railway API coverage, comprehensive MCP testing framework, and real infrastructure management through AI assistants. Enhanced version with enterprise features, based on original work by Jason Tan.

109 lines (108 loc) 2.6 kB
export class TemplateRepository { client; constructor(client) { this.client = client; } async list() { const query = ` query templates { templates { edges { node { id name description code category tags languages image status isApproved isV2Template activeProjects createdAt } } } } `; const data = await this.client.request(query); return data.templates.edges.map(edge => edge.node); } async get(code) { const query = ` query template($code: String!) { template(code: $code) { id name description code category tags languages image readme status isApproved isV2Template activeProjects createdAt services { id name } } } `; const data = await this.client.request(query, { code }); return data.template; } async getUserTemplates() { const query = ` query userTemplates { userTemplates { id name description code category tags status createdAt } } `; const data = await this.client.request(query); return data.userTemplates || []; } async deploy(input) { const query = ` mutation templateDeploy($input: TemplateDeployInput!) { templateDeploy(input: $input) { projectId workflowId } } `; const data = await this.client.request(query, { input }); return data.templateDeploy; } async generate(projectId) { const query = ` mutation templateGenerate($input: TemplateGenerateInput!) { templateGenerate(input: $input) } `; const data = await this.client.request(query, { input: { projectId } }); return data.templateGenerate; } async searchByCategory(category) { const allTemplates = await this.list(); return allTemplates.filter(t => t.category === category); } async searchByTags(tags) { const allTemplates = await this.list(); return allTemplates.filter(t => t.tags && tags.some(tag => t.tags.includes(tag))); } }