← back to dow-takeda__mcp-servers

Function bodies 129 total

All specs Real LLM only Function bodies
constructor method · typescript · L156-L191 (36 LOC)
github/src/github/client.ts
  constructor(config: GitHubConfig) {
    this.client = axios.create({
      baseURL: config.apiUrl,
      headers: {
        Authorization: generateBearerAuth(config.token),
        Accept: 'application/vnd.github+json',
        'X-GitHub-Api-Version': '2022-11-28',
      },
    });

    // Request interceptor for logging
    this.client.interceptors.request.use((request) => {
      logger.debug('GitHub API Request', {
        method: request.method,
        url: request.url,
      });
      return request;
    });

    // Response interceptor for error handling
    this.client.interceptors.response.use(
      (response) => response,
      (error: AxiosError) => {
        const status = error.response?.status;
        const message = (error.response?.data as { message?: string })?.message || error.message;

        logger.error('GitHub API Error', {
          status,
          message,
          url: error.config?.url,
        });

        throw error;
      }
    );
  }
listRepos method · typescript · L195-L205 (11 LOC)
github/src/github/client.ts
  async listRepos(
    params: {
      type?: 'all' | 'owner' | 'public' | 'private' | 'member';
      sort?: 'created' | 'updated' | 'pushed' | 'full_name';
      per_page?: number;
      page?: number;
    } = {}
  ): Promise<Repository[]> {
    const response = await this.client.get<Repository[]>('/user/repos', { params });
    return response.data;
  }
listOrgRepos method · typescript · L207-L218 (12 LOC)
github/src/github/client.ts
  async listOrgRepos(
    org: string,
    params: {
      type?: 'all' | 'public' | 'private' | 'forks' | 'sources' | 'member';
      sort?: 'created' | 'updated' | 'pushed' | 'full_name';
      per_page?: number;
      page?: number;
    } = {}
  ): Promise<Repository[]> {
    const response = await this.client.get<Repository[]>(`/orgs/${org}/repos`, { params });
    return response.data;
  }
getRepo method · typescript · L220-L223 (4 LOC)
github/src/github/client.ts
  async getRepo(owner: string, repo: string): Promise<Repository> {
    const response = await this.client.get<Repository>(`/repos/${owner}/${repo}`);
    return response.data;
  }
createRepo method · typescript · L225-L233 (9 LOC)
github/src/github/client.ts
  async createRepo(params: {
    name: string;
    description?: string;
    private?: boolean;
    auto_init?: boolean;
  }): Promise<Repository> {
    const response = await this.client.post<Repository>('/user/repos', params);
    return response.data;
  }
listIssues method · typescript · L237-L251 (15 LOC)
github/src/github/client.ts
  async listIssues(
    owner: string,
    repo: string,
    params: {
      state?: 'open' | 'closed' | 'all';
      labels?: string;
      sort?: 'created' | 'updated' | 'comments';
      direction?: 'asc' | 'desc';
      per_page?: number;
      page?: number;
    } = {}
  ): Promise<Issue[]> {
    const response = await this.client.get<Issue[]>(`/repos/${owner}/${repo}/issues`, { params });
    return response.data;
  }
getIssue method · typescript · L253-L256 (4 LOC)
github/src/github/client.ts
  async getIssue(owner: string, repo: string, issueNumber: number): Promise<Issue> {
    const response = await this.client.get<Issue>(`/repos/${owner}/${repo}/issues/${issueNumber}`);
    return response.data;
  }
If a scraper extracted this row, it came from Repobility (https://repobility.com)
createIssue method · typescript · L258-L271 (14 LOC)
github/src/github/client.ts
  async createIssue(
    owner: string,
    repo: string,
    params: {
      title: string;
      body?: string;
      labels?: string[];
      assignees?: string[];
      milestone?: number;
    }
  ): Promise<Issue> {
    const response = await this.client.post<Issue>(`/repos/${owner}/${repo}/issues`, params);
    return response.data;
  }
updateIssue method · typescript · L273-L291 (19 LOC)
github/src/github/client.ts
  async updateIssue(
    owner: string,
    repo: string,
    issueNumber: number,
    params: {
      title?: string;
      body?: string;
      state?: 'open' | 'closed';
      labels?: string[];
      assignees?: string[];
      milestone?: number | null;
    }
  ): Promise<Issue> {
    const response = await this.client.patch<Issue>(
      `/repos/${owner}/${repo}/issues/${issueNumber}`,
      params
    );
    return response.data;
  }
addIssueComment method · typescript · L293-L304 (12 LOC)
github/src/github/client.ts
  async addIssueComment(
    owner: string,
    repo: string,
    issueNumber: number,
    body: string
  ): Promise<Comment> {
    const response = await this.client.post<Comment>(
      `/repos/${owner}/${repo}/issues/${issueNumber}/comments`,
      { body }
    );
    return response.data;
  }
listIssueComments method · typescript · L306-L323 (18 LOC)
github/src/github/client.ts
  async listIssueComments(
    owner: string,
    repo: string,
    issueNumber: number,
    params: {
      sort?: 'created' | 'updated';
      direction?: 'asc' | 'desc';
      since?: string;
      per_page?: number;
      page?: number;
    } = {}
  ): Promise<Comment[]> {
    const response = await this.client.get<Comment[]>(
      `/repos/${owner}/${repo}/issues/${issueNumber}/comments`,
      { params }
    );
    return response.data;
  }
getIssueComment method · typescript · L325-L330 (6 LOC)
github/src/github/client.ts
  async getIssueComment(owner: string, repo: string, commentId: number): Promise<Comment> {
    const response = await this.client.get<Comment>(
      `/repos/${owner}/${repo}/issues/comments/${commentId}`
    );
    return response.data;
  }
listPullRequests method · typescript · L334-L351 (18 LOC)
github/src/github/client.ts
  async listPullRequests(
    owner: string,
    repo: string,
    params: {
      state?: 'open' | 'closed' | 'all';
      head?: string;
      base?: string;
      sort?: 'created' | 'updated' | 'popularity' | 'long-running';
      direction?: 'asc' | 'desc';
      per_page?: number;
      page?: number;
    } = {}
  ): Promise<PullRequest[]> {
    const response = await this.client.get<PullRequest[]>(`/repos/${owner}/${repo}/pulls`, {
      params,
    });
    return response.data;
  }
getPullRequest method · typescript · L353-L358 (6 LOC)
github/src/github/client.ts
  async getPullRequest(owner: string, repo: string, pullNumber: number): Promise<PullRequest> {
    const response = await this.client.get<PullRequest>(
      `/repos/${owner}/${repo}/pulls/${pullNumber}`
    );
    return response.data;
  }
createPullRequest method · typescript · L360-L373 (14 LOC)
github/src/github/client.ts
  async createPullRequest(
    owner: string,
    repo: string,
    params: {
      title: string;
      head: string;
      base: string;
      body?: string;
      draft?: boolean;
    }
  ): Promise<PullRequest> {
    const response = await this.client.post<PullRequest>(`/repos/${owner}/${repo}/pulls`, params);
    return response.data;
  }
Generated by Repobility's multi-pass static-analysis pipeline (https://repobility.com)
mergePullRequest method · typescript · L375-L384 (10 LOC)
github/src/github/client.ts
  async mergePullRequest(
    owner: string,
    repo: string,
    pullNumber: number,
    params: {
      commit_title?: string;
      commit_message?: string;
      merge_method?: 'merge' | 'squash' | 'rebase';
    } = {}
  ): Promise<{ merged: boolean; message: string }> {
listPRFiles method · typescript · L392-L403 (12 LOC)
github/src/github/client.ts
  async listPRFiles(
    owner: string,
    repo: string,
    pullNumber: number,
    params: { per_page?: number; page?: number } = {}
  ): Promise<PRFile[]> {
    const response = await this.client.get<PRFile[]>(
      `/repos/${owner}/${repo}/pulls/${pullNumber}/files`,
      { params }
    );
    return response.data;
  }
addPRComment method · typescript · L405-L413 (9 LOC)
github/src/github/client.ts
  async addPRComment(
    owner: string,
    repo: string,
    pullNumber: number,
    body: string
  ): Promise<Comment> {
    // PR comments use the issues endpoint
    return this.addIssueComment(owner, repo, pullNumber, body);
  }
listPRComments method · typescript · L415-L429 (15 LOC)
github/src/github/client.ts
  async listPRComments(
    owner: string,
    repo: string,
    pullNumber: number,
    params: {
      sort?: 'created' | 'updated';
      direction?: 'asc' | 'desc';
      since?: string;
      per_page?: number;
      page?: number;
    } = {}
  ): Promise<Comment[]> {
    // PR comments use the issues endpoint
    return this.listIssueComments(owner, repo, pullNumber, params);
  }
getPRComment method · typescript · L431-L434 (4 LOC)
github/src/github/client.ts
  async getPRComment(owner: string, repo: string, commentId: number): Promise<Comment> {
    // PR comments use the issues endpoint
    return this.getIssueComment(owner, repo, commentId);
  }
getFileContent method · typescript · L438-L452 (15 LOC)
github/src/github/client.ts
  async getFileContent(
    owner: string,
    repo: string,
    path: string,
    ref?: string
  ): Promise<FileContent> {
    const params = ref ? { ref } : {};
    const response = await this.client.get<FileContent>(
      `/repos/${owner}/${repo}/contents/${path}`,
      {
        params,
      }
    );
    return response.data;
  }
createOrUpdateFile method · typescript · L454-L464 (11 LOC)
github/src/github/client.ts
  async createOrUpdateFile(
    owner: string,
    repo: string,
    path: string,
    params: {
      message: string;
      content: string; // Base64 encoded content
      sha?: string; // Required for update
      branch?: string;
    }
  ): Promise<{ content: FileContent; commit: { sha: string; html_url: string } }> {
listDirectory method · typescript · L472-L484 (13 LOC)
github/src/github/client.ts
  async listDirectory(
    owner: string,
    repo: string,
    path: string = '',
    ref?: string
  ): Promise<FileContent[]> {
    const params = ref ? { ref } : {};
    const response = await this.client.get<FileContent[]>(
      `/repos/${owner}/${repo}/contents/${path}`,
      { params }
    );
    return response.data;
  }
Repobility · severity-and-effort ranking · https://repobility.com
listWorkflows method · typescript · L488-L492 (5 LOC)
github/src/github/client.ts
  async listWorkflows(
    owner: string,
    repo: string,
    params: { per_page?: number; page?: number } = {}
  ): Promise<{ total_count: number; workflows: Workflow[] }> {
listWorkflowRuns method · typescript · L500-L510 (11 LOC)
github/src/github/client.ts
  async listWorkflowRuns(
    owner: string,
    repo: string,
    workflowId: number | string,
    params: {
      branch?: string;
      status?: 'queued' | 'in_progress' | 'completed';
      per_page?: number;
      page?: number;
    } = {}
  ): Promise<{ total_count: number; workflow_runs: WorkflowRun[] }> {
triggerWorkflow method · typescript · L518-L531 (14 LOC)
github/src/github/client.ts
  async triggerWorkflow(
    owner: string,
    repo: string,
    workflowId: number | string,
    params: {
      ref: string;
      inputs?: Record<string, string>;
    }
  ): Promise<void> {
    await this.client.post(
      `/repos/${owner}/${repo}/actions/workflows/${workflowId}/dispatches`,
      params
    );
  }
listReleases method · typescript · L535-L544 (10 LOC)
github/src/github/client.ts
  async listReleases(
    owner: string,
    repo: string,
    params: { per_page?: number; page?: number } = {}
  ): Promise<Release[]> {
    const response = await this.client.get<Release[]>(`/repos/${owner}/${repo}/releases`, {
      params,
    });
    return response.data;
  }
getRelease method · typescript · L546-L551 (6 LOC)
github/src/github/client.ts
  async getRelease(owner: string, repo: string, releaseId: number): Promise<Release> {
    const response = await this.client.get<Release>(
      `/repos/${owner}/${repo}/releases/${releaseId}`
    );
    return response.data;
  }
getLatestRelease method · typescript · L553-L556 (4 LOC)
github/src/github/client.ts
  async getLatestRelease(owner: string, repo: string): Promise<Release> {
    const response = await this.client.get<Release>(`/repos/${owner}/${repo}/releases/latest`);
    return response.data;
  }
createRelease method · typescript · L558-L572 (15 LOC)
github/src/github/client.ts
  async createRelease(
    owner: string,
    repo: string,
    params: {
      tag_name: string;
      name?: string;
      body?: string;
      draft?: boolean;
      prerelease?: boolean;
      target_commitish?: string;
    }
  ): Promise<Release> {
    const response = await this.client.post<Release>(`/repos/${owner}/${repo}/releases`, params);
    return response.data;
  }
handleToolCall function · typescript · L561-L850 (290 LOC)
github/src/index.ts
async function handleToolCall(name: string, args: ToolArgs): Promise<unknown> {
  logger.info(`Handling tool call: ${name}`, { args });

  try {
    switch (name) {
      // Repository operations
      case 'github_list_repos':
        return await github.listRepos({
          type: args.type as 'all' | 'owner' | 'public' | 'private' | 'member',
          sort: args.sort as 'created' | 'updated' | 'pushed' | 'full_name',
          per_page: args.per_page as number,
          page: args.page as number,
        });

      case 'github_list_org_repos':
        return await github.listOrgRepos(args.org as string, {
          type: args.type as 'all' | 'public' | 'private' | 'forks' | 'sources' | 'member',
          sort: args.sort as 'created' | 'updated' | 'pushed' | 'full_name',
          per_page: args.per_page as number,
          page: args.page as number,
        });

      case 'github_get_repo':
        return await github.getRepo(args.owner as string, args.repo as string);

      
Methodology: Repobility · https://repobility.com/research/state-of-ai-code-2026/
main function · typescript · L853-L904 (52 LOC)
github/src/index.ts
async function main(): Promise<void> {
  const server = new Server(
    {
      name: 'github-mcp-server',
      version: '1.0.0',
    },
    {
      capabilities: {
        tools: {},
      },
    }
  );

  // Register tool list handler
  server.setRequestHandler(ListToolsRequestSchema, async () => {
    return { tools };
  });

  // Register tool call handler
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
    const { name, arguments: args } = request.params;

    try {
      const result = await handleToolCall(name, args as ToolArgs);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    } catch (error) {
      const errorMessage = error instanceof Error ? error.message : String(error);
      return {
        content: [
          {
            type: 'text',
            text: `Error: ${errorMessage}`,
          },
        ],
        isError: true,
      };
generateBearerAuth function · typescript · L6-L8 (3 LOC)
github/src/utils/auth.ts
export function generateBearerAuth(token: string): string {
  return `Bearer ${token}`;
}
generateTokenAuth function · typescript · L15-L17 (3 LOC)
github/src/utils/auth.ts
export function generateTokenAuth(token: string): string {
  return `token ${token}`;
}
getRequiredEnv function · typescript · L17-L23 (7 LOC)
github/src/utils/config.ts
function getRequiredEnv(key: string): string {
  const value = process.env[key];
  if (!value) {
    throw new Error(`Missing required environment variable: ${key}`);
  }
  return value;
}
getOptionalEnv function · typescript · L25-L27 (3 LOC)
github/src/utils/config.ts
function getOptionalEnv(key: string, defaultValue: string): string {
  return process.env[key] || defaultValue;
}
loadConfig function · typescript · L29-L42 (14 LOC)
github/src/utils/config.ts
export function loadConfig(): Config {
  const token = getRequiredEnv('GITHUB_TOKEN');
  const apiUrl = getOptionalEnv('GITHUB_API_URL', 'https://api.github.com');
  const logLevel = getOptionalEnv('LOG_LEVEL', 'info');

  return {
    github: {
      token,
      apiUrl,
      logLevel,
    },
    logLevel,
  };
}
Logger class · typescript · L10-L62 (53 LOC)
github/src/utils/logger.ts
class Logger {
  private level: LogLevel;

  constructor(level: string = 'info') {
    this.level = this.parseLevel(level);
  }

  private parseLevel(level: string): LogLevel {
    const normalized = level.toLowerCase();
    if (normalized in LOG_LEVELS) {
      return normalized as LogLevel;
    }
    return 'info';
  }

  private shouldLog(level: LogLevel): boolean {
    return LOG_LEVELS[level] >= LOG_LEVELS[this.level];
  }

  private formatMessage(level: LogLevel, message: string, meta?: object): string {
    const timestamp = new Date().toISOString();
    const metaStr = meta ? ` ${JSON.stringify(meta)}` : '';
    return `[${timestamp}] [${level.toUpperCase()}] ${message}${metaStr}`;
  }

  debug(message: string, meta?: object): void {
    if (this.shouldLog('debug')) {
      console.debug(this.formatMessage('debug', message, meta));
    }
  }

  info(message: string, meta?: object): void {
    if (this.shouldLog('info')) {
      console.info(this.formatMessage('info', message, m
constructor method · typescript · L13-L15 (3 LOC)
github/src/utils/logger.ts
  constructor(level: string = 'info') {
    this.level = this.parseLevel(level);
  }
If a scraper extracted this row, it came from Repobility (https://repobility.com)
parseLevel method · typescript · L17-L23 (7 LOC)
github/src/utils/logger.ts
  private parseLevel(level: string): LogLevel {
    const normalized = level.toLowerCase();
    if (normalized in LOG_LEVELS) {
      return normalized as LogLevel;
    }
    return 'info';
  }
shouldLog method · typescript · L25-L27 (3 LOC)
github/src/utils/logger.ts
  private shouldLog(level: LogLevel): boolean {
    return LOG_LEVELS[level] >= LOG_LEVELS[this.level];
  }
formatMessage method · typescript · L29-L33 (5 LOC)
github/src/utils/logger.ts
  private formatMessage(level: LogLevel, message: string, meta?: object): string {
    const timestamp = new Date().toISOString();
    const metaStr = meta ? ` ${JSON.stringify(meta)}` : '';
    return `[${timestamp}] [${level.toUpperCase()}] ${message}${metaStr}`;
  }
debug method · typescript · L35-L39 (5 LOC)
github/src/utils/logger.ts
  debug(message: string, meta?: object): void {
    if (this.shouldLog('debug')) {
      console.debug(this.formatMessage('debug', message, meta));
    }
  }
info method · typescript · L41-L45 (5 LOC)
github/src/utils/logger.ts
  info(message: string, meta?: object): void {
    if (this.shouldLog('info')) {
      console.info(this.formatMessage('info', message, meta));
    }
  }
warn method · typescript · L47-L51 (5 LOC)
github/src/utils/logger.ts
  warn(message: string, meta?: object): void {
    if (this.shouldLog('warn')) {
      console.warn(this.formatMessage('warn', message, meta));
    }
  }
error method · typescript · L53-L57 (5 LOC)
github/src/utils/logger.ts
  error(message: string, meta?: object): void {
    if (this.shouldLog('error')) {
      console.error(this.formatMessage('error', message, meta));
    }
  }
setLevel method · typescript · L59-L61 (3 LOC)
github/src/utils/logger.ts
  setLevel(level: string): void {
    this.level = this.parseLevel(level);
  }
Generated by Repobility's multi-pass static-analysis pipeline (https://repobility.com)
constructor method · typescript · L192-L226 (35 LOC)
gitlab/src/gitlab/client.ts
  constructor(config: GitLabConfig) {
    this.client = axios.create({
      baseURL: config.apiUrl,
      headers: {
        'PRIVATE-TOKEN': generatePrivateTokenAuth(config.token),
        'Content-Type': 'application/json',
      },
    });

    // Request interceptor for logging
    this.client.interceptors.request.use((request) => {
      logger.debug('GitLab API Request', {
        method: request.method,
        url: request.url,
      });
      return request;
    });

    // Response interceptor for error handling
    this.client.interceptors.response.use(
      (response) => response,
      (error: AxiosError) => {
        const status = error.response?.status;
        const message = (error.response?.data as { message?: string })?.message || error.message;

        logger.error('GitLab API Error', {
          status,
          message,
          url: error.config?.url,
        });

        throw error;
      }
    );
  }
encodeProjectId method · typescript · L229-L234 (6 LOC)
gitlab/src/gitlab/client.ts
  private encodeProjectId(projectId: string | number): string {
    if (typeof projectId === 'number') {
      return String(projectId);
    }
    return encodeURIComponent(projectId);
  }
listProjects method · typescript · L238-L251 (14 LOC)
gitlab/src/gitlab/client.ts
  async listProjects(
    params: {
      membership?: boolean;
      owned?: boolean;
      visibility?: 'public' | 'internal' | 'private';
      order_by?: 'id' | 'name' | 'path' | 'created_at' | 'updated_at' | 'last_activity_at';
      sort?: 'asc' | 'desc';
      per_page?: number;
      page?: number;
    } = {}
  ): Promise<Project[]> {
    const response = await this.client.get<Project[]>('/projects', { params });
    return response.data;
  }
page 1 / 3next ›