@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.
91 lines (90 loc) • 2.57 kB
JavaScript
export class GitHubRepository {
client;
constructor(client) {
this.client = client;
}
async checkRepoAccess(fullRepoName) {
const query = `
query gitHubRepoAccessAvailable($fullRepoName: String!) {
gitHubRepoAccessAvailable(fullRepoName: $fullRepoName) {
hasAccess
isPublic
}
}
`;
const data = await this.client.request(query, { fullRepoName });
return data.gitHubRepoAccessAvailable;
}
async listRepos() {
const query = `
query githubRepos {
githubRepos {
id
name
fullName
defaultBranch
isPrivate
installationId
}
}
`;
const data = await this.client.request(query);
return data.githubRepos || [];
}
async getRepo(fullRepoName) {
const query = `
query githubRepo($fullRepoName: String!) {
githubRepo(fullRepoName: $fullRepoName) {
id
name
fullName
defaultBranch
isPrivate
}
}
`;
const data = await this.client.request(query, { fullRepoName });
return data.githubRepo;
}
async listBranches(owner, repo) {
const query = `
query githubRepoBranches($owner: String!, $repo: String!) {
githubRepoBranches(owner: $owner, repo: $repo) {
name
}
}
`;
const data = await this.client.request(query, { owner, repo });
return data.githubRepoBranches || [];
}
async deployRepo(input) {
const query = `
mutation githubRepoDeploy($input: GitHubRepoDeployInput!) {
githubRepoDeploy(input: $input)
}
`;
const data = await this.client.request(query, { input });
return data.githubRepoDeploy;
}
async connectServiceToRepo(serviceId, input) {
const query = `
mutation serviceConnect($id: String!, $input: ServiceConnectInput!) {
serviceConnect(id: $id, input: $input) {
id
name
}
}
`;
const data = await this.client.request(query, { id: serviceId, input });
return !!data.serviceConnect.id;
}
async checkRepoNameAvailability(fullRepoName) {
const query = `
query githubIsRepoNameAvailable($fullRepoName: String!) {
githubIsRepoNameAvailable(fullRepoName: $fullRepoName)
}
`;
const data = await this.client.request(query, { fullRepoName });
return data.githubIsRepoNameAvailable;
}
}