@mseep/railway-mcp
Version:
Model Context Protocol server for Railway.app - Enables AI agents to manage Railway infrastructure through natural language
70 lines (69 loc) • 1.8 kB
JavaScript
export class VolumeRepository {
client;
constructor(client) {
this.client = client;
}
async createVolume(input) {
const data = await this.client.request(`
mutation volumeCreate($input: VolumeCreateInput!) {
volumeCreate(input: $input) {
createdAt
id
name
projectId
}
}
`, { input });
return data.volumeCreate;
}
async updateVolume(volumeId, input) {
const data = await this.client.request(`
mutation volumeUpdate($input: VolumeUpdateInput!, $volumeId: String!) {
volumeUpdate(input: $input, volumeId: $volumeId) {
createdAt
id
name
projectId
}
}
`, { input, volumeId });
return data.volumeUpdate;
}
async deleteVolume(volumeId) {
const data = await this.client.request(`
mutation volumeDelete($volumeId: String!) {
volumeDelete(volumeId: $volumeId)
}
`, { volumeId });
return data.volumeDelete;
}
async listVolumes(projectId) {
const data = await this.client.request(`
query project($projectId: String!) {
project(id: $projectId) {
volumes {
edges {
node {
createdAt
id
name
projectId
volumeInstances(first: 5) {
edges {
node {
createdAt
id
mountPath
state
}
}
}
}
}
}
}
}
`, { projectId });
return data.project.volumes.edges.map(edge => edge.node);
}
}