Skip to main content
Glama
nextDriveIoE

GitHub Action Trigger MCP Server

by nextDriveIoE

get_github_actions

Fetch available GitHub Actions from a repository by specifying the owner and repo. Use a GitHub personal access token for enhanced access if needed.

Instructions

Get available GitHub Actions for a repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYesOwner of the repository (username or organization)
repoYesName of the repository
tokenNoGitHub personal access token (optional)

Implementation Reference

  • The core handler function that fetches GitHub Actions workflows from the specified repository using the GitHub API. It retrieves workflow metadata and attempts to fetch the raw YAML content for each workflow.
    async function getGitHubActions(owner: string, repo: string, token?: string) { // Use provided token or fall back to config token const authToken = token || config.githubToken; try { const headers: Record<string, string> = { 'Accept': 'application/vnd.github+json', 'X-GitHub-Api-Version': '2022-11-28' }; if (authToken) { headers['Authorization'] = `Bearer ${authToken}`; } // Fetch workflows from the GitHub API const workflowsResponse = await axios.get( `https://api.github.com/repos/${owner}/${repo}/actions/workflows`, { headers } ); // Extract workflow information const workflows = workflowsResponse.data.workflows.map((workflow: any) => ({ id: workflow.id, name: workflow.name, path: workflow.path, state: workflow.state, url: workflow.html_url })); // For each workflow, get the associated jobs const workflowDetails = await Promise.all( workflows.map(async (workflow: any) => { try { // Get the raw workflow file content const contentResponse = await axios.get( `https://api.github.com/repos/${owner}/${repo}/contents/${workflow.path}`, { headers } ); const content = Buffer.from(contentResponse.data.content, 'base64').toString('utf-8'); return { ...workflow, content }; } catch (error) { // If we can't get the content, just return the workflow without it return workflow; } }) ); return workflowDetails; } catch (error) { if (axios.isAxiosError(error)) { throw new Error(`GitHub API error: ${error.response?.status} ${error.response?.statusText} - ${error.response?.data?.message || error.message}`); } throw error; } }
  • The input schema definition for the 'get_github_actions' tool, specifying parameters owner, repo (required), and optional token.
    { name: "get_github_actions", description: "Get available GitHub Actions for a repository", inputSchema: { type: "object", properties: { owner: { type: "string", description: "Owner of the repository (username or organization)" }, repo: { type: "string", description: "Name of the repository" }, token: { type: "string", description: "GitHub personal access token (optional)" } }, required: ["owner", "repo"] } },
  • src/index.ts:728-752 (registration)
    The registration and dispatch logic within the main CallToolRequestSchema handler that processes calls to 'get_github_actions', validates inputs, invokes the handler function, and formats the response.
    case "get_github_actions": { const owner = String(request.params.arguments?.owner); const repo = String(request.params.arguments?.repo); const token = request.params.arguments?.token ? String(request.params.arguments?.token) : undefined; if (!owner || !repo) { throw new Error("Owner and repo are required"); } try { const actions = await getGitHubActions(owner, repo, token); return { content: [{ type: "text", text: JSON.stringify(actions, null, 2) }] }; } catch (error) { if (error instanceof Error) { throw new Error(`Failed to get GitHub Actions: ${error.message}`); } throw error; } }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nextDriveIoE/github-action-trigger-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server