@jasontanswe/railway-mcp
Version:
Model Context Protocol server for Railway.app - Enables AI agents to manage Railway infrastructure through natural language
63 lines (62 loc) • 1.71 kB
JavaScript
export class TemplateRepository {
client;
constructor(client) {
this.client = client;
}
async listTemplates() {
const query = `
query {
templates {
edges {
node {
id
name
description
category
serializedConfig
projects
}
}
}
}
`;
const response = await this.client.request(query);
return response.templates.edges.map(edge => edge.node);
}
async deployTemplate(environmentId, projectId, serializedConfig, templateId, teamId) {
const query = `
mutation deployTemplate($environmentId: String, $projectId: String, $templateId: String!, $teamId: String, $serializedConfig: SerializedTemplateConfig!) {
templateDeployV2(input: {
environmentId: $environmentId,
projectId: $projectId,
templateId: $templateId,
teamId: $teamId,
serializedConfig: $serializedConfig
}) {
projectId
workflowId
}
}
`;
const response = await this.client.request(query, {
environmentId,
projectId,
templateId,
teamId,
serializedConfig,
});
return response.templateDeployV2;
}
async getWorkflowStatus(workflowId) {
const query = `
query workflowStatus($workflowId:String!){
workflowStatus(workflowId:$workflowId) {
status
error
}
}
`;
const response = await this.client.request(query, { workflowId });
return response.workflowStatus;
}
}