@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.
144 lines (143 loc) • 3.7 kB
JavaScript
export class TeamRepository {
client;
constructor(client) {
this.client = client;
}
async list() {
const query = `
query {
teams {
edges {
node {
id
name
avatar
isPersonal
createdAt
updatedAt
}
}
}
}
`;
const response = await this.client.request(query);
return response.teams.edges.map(edge => edge.node);
}
async get(teamId) {
const query = `
query getTeam($teamId: String!) {
team(id: $teamId) {
id
name
avatar
isPersonal
createdAt
updatedAt
}
}
`;
const response = await this.client.request(query, { teamId });
return response.team;
}
async create(input) {
const query = `
mutation teamCreate($input: TeamCreateInput!) {
teamCreate(input: $input) {
id
name
avatar
isPersonal
createdAt
updatedAt
}
}
`;
const response = await this.client.request(query, { input });
return response.teamCreate;
}
async update(teamId, input) {
const query = `
mutation teamUpdate($teamId: String!, $input: TeamUpdateInput!) {
teamUpdate(id: $teamId, input: $input) {
id
name
avatar
isPersonal
createdAt
updatedAt
}
}
`;
const response = await this.client.request(query, { teamId, input });
return response.teamUpdate;
}
async delete(teamId) {
const query = `
mutation teamDelete($teamId: String!) {
teamDelete(id: $teamId)
}
`;
const response = await this.client.request(query, { teamId });
return response.teamDelete;
}
async getMembers(teamId) {
const query = `
query getTeamMembers($teamId: String!) {
teamMembers(teamId: $teamId) {
edges {
node {
id
name
email
avatar
role
joinedAt
}
}
}
}
`;
const response = await this.client.request(query, { teamId });
return response.teamMembers.edges.map(edge => edge.node);
}
async invite(teamId, input) {
const query = `
mutation teamInviteUser($teamId: String!, $input: TeamInviteInput!) {
teamInviteUser(teamId: $teamId, input: $input) {
id
email
role
createdAt
expiresAt
}
}
`;
const response = await this.client.request(query, { teamId, input });
return response.teamInviteUser;
}
async removeMember(teamId, userId) {
const query = `
mutation teamRemoveMember($teamId: String!, $userId: String!) {
teamRemoveMember(teamId: $teamId, userId: $userId)
}
`;
const response = await this.client.request(query, { teamId, userId });
return response.teamRemoveMember;
}
async updateMemberRole(teamId, userId, role) {
const query = `
mutation teamUpdateMemberRole($teamId: String!, $userId: String!, $role: TeamRole!) {
teamUpdateMemberRole(teamId: $teamId, userId: $userId, role: $role) {
id
name
email
avatar
role
joinedAt
}
}
`;
const response = await this.client.request(query, { teamId, userId, role });
return response.teamUpdateMemberRole;
}
}