Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,40 @@ The following sets of tools are available:

<summary><picture><source media="(prefers-color-scheme: dark)" srcset="pkg/octicons/icons/workflow-dark.png"><source media="(prefers-color-scheme: light)" srcset="pkg/octicons/icons/workflow-light.png"><img src="pkg/octicons/icons/workflow-light.png" width="20" height="20" alt="workflow"></picture> Actions</summary>

- **actions_get** - Get details of GitHub Actions resources (workflows, workflow runs, jobs, and artifacts)
- `method`: The method to execute (string, required)
- `owner`: Repository owner (string, required)
- `repo`: Repository name (string, required)
- `resource_id`: The unique identifier of the resource. This will vary based on the "method" provided, so ensure you provide the correct ID:
- Provide a workflow ID or workflow file name (e.g. ci.yaml) for 'get_workflow' method.
- Provide a workflow run ID for 'get_workflow_run', 'get_workflow_run_usage', and 'get_workflow_run_logs_url' methods.
- Provide an artifact ID for 'download_workflow_run_artifact' method.
- Provide a job ID for 'get_workflow_job' method.
(string, required)

- **actions_list** - List GitHub Actions workflows in a repository
- `method`: The action to perform (string, required)
- `owner`: Repository owner (string, required)
- `page`: Page number for pagination (default: 1) (number, optional)
- `per_page`: Results per page for pagination (default: 30, max: 100) (number, optional)
- `repo`: Repository name (string, required)
- `resource_id`: The unique identifier of the resource. This will vary based on the "method" provided, so ensure you provide the correct ID:
- Do not provide any resource ID for 'list_workflows' method.
- Provide a workflow ID or workflow file name (e.g. ci.yaml) for 'list_workflow_runs' method.
- Provide a workflow run ID for 'list_workflow_jobs' and 'list_workflow_run_artifacts' methods.
(string, optional)
- `workflow_jobs_filter`: Filters for workflow jobs. **ONLY** used when method is 'list_workflow_jobs' (object, optional)
- `workflow_runs_filter`: Filters for workflow runs. **ONLY** used when method is 'list_workflow_runs' (object, optional)

- **actions_run_trigger** - Trigger GitHub Actions workflow actions
- `inputs`: Inputs the workflow accepts. Only used for 'run_workflow' method. (object, optional)
- `method`: The method to execute (string, required)
- `owner`: Repository owner (string, required)
- `ref`: The git reference for the workflow. The reference can be a branch or tag name. Required for 'run_workflow' method. (string, optional)
- `repo`: Repository name (string, required)
- `run_id`: The ID of the workflow run. Required for all methods except 'run_workflow'. (number, optional)
- `workflow_id`: The workflow ID (numeric) or workflow file name (e.g., main.yml, ci.yaml). Required for 'run_workflow' method. (string, optional)

- **cancel_workflow_run** - Cancel workflow run
- `owner`: Repository owner (string, required)
- `repo`: Repository name (string, required)
Expand All @@ -514,6 +548,15 @@ The following sets of tools are available:
- `run_id`: Workflow run ID (required when using failed_only) (number, optional)
- `tail_lines`: Number of lines to return from the end of the log (number, optional)

- **get_job_logs** - Get GitHub Actions workflow job logs
- `failed_only`: When true, gets logs for all failed jobs in the workflow run specified by run_id. Requires run_id to be provided. (boolean, optional)
- `job_id`: The unique identifier of the workflow job. Required when getting logs for a single job. (number, optional)
- `owner`: Repository owner (string, required)
- `repo`: Repository name (string, required)
- `return_content`: Returns actual log content instead of URLs (boolean, optional)
- `run_id`: The unique identifier of the workflow run. Required when failed_only is true to get logs for all failed jobs in the run. (number, optional)
- `tail_lines`: Number of lines to return from the end of the log (number, optional)

- **get_workflow_run** - Get workflow run
- `owner`: Repository owner (string, required)
- `repo`: Repository name (string, required)
Expand Down
12 changes: 8 additions & 4 deletions cmd/github-mcp-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,18 @@ var (

// Parse tools (similar to toolsets)
var enabledTools []string
if err := viper.UnmarshalKey("tools", &enabledTools); err != nil {
return fmt.Errorf("failed to unmarshal tools: %w", err)
if viper.IsSet("tools") {
if err := viper.UnmarshalKey("tools", &enabledTools); err != nil {
return fmt.Errorf("failed to unmarshal tools: %w", err)
}
}

// Parse enabled features (similar to toolsets)
var enabledFeatures []string
if err := viper.UnmarshalKey("features", &enabledFeatures); err != nil {
return fmt.Errorf("failed to unmarshal features: %w", err)
if viper.IsSet("features") {
if err := viper.UnmarshalKey("features", &enabledFeatures); err != nil {
return fmt.Errorf("failed to unmarshal features: %w", err)
}
}

ttl := viper.GetDuration("repo-access-cache-ttl")
Expand Down
43 changes: 43 additions & 0 deletions pkg/github/__toolsnaps__/actions_get.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"annotations": {
"readOnlyHint": true,
"title": "Get details of GitHub Actions resources (workflows, workflow runs, jobs, and artifacts)"
},
"description": "Get details about specific GitHub Actions resources.\nUse this tool to get details about individual workflows, workflow runs, jobs, and artifacts by their unique IDs.\n",
"inputSchema": {
"type": "object",
"required": [
"method",
"owner",
"repo",
"resource_id"
],
"properties": {
"method": {
"type": "string",
"description": "The method to execute",
"enum": [
"get_workflow",
"get_workflow_run",
"get_workflow_job",
"download_workflow_run_artifact",
"get_workflow_run_usage",
"get_workflow_run_logs_url"
]
},
"owner": {
"type": "string",
"description": "Repository owner"
},
"repo": {
"type": "string",
"description": "Repository name"
},
"resource_id": {
"type": "string",
"description": "The unique identifier of the resource. This will vary based on the \"method\" provided, so ensure you provide the correct ID:\n- Provide a workflow ID or workflow file name (e.g. ci.yaml) for 'get_workflow' method.\n- Provide a workflow run ID for 'get_workflow_run', 'get_workflow_run_usage', and 'get_workflow_run_logs_url' methods.\n- Provide an artifact ID for 'download_workflow_run_artifact' method.\n- Provide a job ID for 'get_workflow_job' method.\n"
}
}
},
"name": "actions_get"
}
128 changes: 128 additions & 0 deletions pkg/github/__toolsnaps__/actions_list.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
{
"annotations": {
"readOnlyHint": true,
"title": "List GitHub Actions workflows in a repository"
},
"description": "Tools for listing GitHub Actions resources.\nUse this tool to list workflows in a repository, or list workflow runs, jobs, and artifacts for a specific workflow or workflow run.\n",
"inputSchema": {
"type": "object",
"required": [
"method",
"owner",
"repo"
],
"properties": {
"method": {
"type": "string",
"description": "The action to perform",
"enum": [
"list_workflows",
"list_workflow_runs",
"list_workflow_jobs",
"list_workflow_run_artifacts"
]
},
"owner": {
"type": "string",
"description": "Repository owner"
},
"page": {
"type": "number",
"description": "Page number for pagination (default: 1)",
"minimum": 1
},
"per_page": {
"type": "number",
"description": "Results per page for pagination (default: 30, max: 100)",
"minimum": 1,
"maximum": 100
},
"repo": {
"type": "string",
"description": "Repository name"
},
"resource_id": {
"type": "string",
"description": "The unique identifier of the resource. This will vary based on the \"method\" provided, so ensure you provide the correct ID:\n- Do not provide any resource ID for 'list_workflows' method.\n- Provide a workflow ID or workflow file name (e.g. ci.yaml) for 'list_workflow_runs' method.\n- Provide a workflow run ID for 'list_workflow_jobs' and 'list_workflow_run_artifacts' methods.\n"
},
"workflow_jobs_filter": {
"type": "object",
"description": "Filters for workflow jobs. **ONLY** used when method is 'list_workflow_jobs'",
"properties": {
"filter": {
"type": "string",
"description": "Filters jobs by their completed_at timestamp",
"enum": [
"latest",
"all"
]
}
}
},
"workflow_runs_filter": {
"type": "object",
"description": "Filters for workflow runs. **ONLY** used when method is 'list_workflow_runs'",
"properties": {
"actor": {
"type": "string",
"description": "Filter to a specific GitHub user's workflow runs."
},
"branch": {
"type": "string",
"description": "Filter workflow runs to a specific Git branch. Use the name of the branch."
},
"event": {
"type": "string",
"description": "Filter workflow runs to a specific event type",
"enum": [
"branch_protection_rule",
"check_run",
"check_suite",
"create",
"delete",
"deployment",
"deployment_status",
"discussion",
"discussion_comment",
"fork",
"gollum",
"issue_comment",
"issues",
"label",
"merge_group",
"milestone",
"page_build",
"public",
"pull_request",
"pull_request_review",
"pull_request_review_comment",
"pull_request_target",
"push",
"registry_package",
"release",
"repository_dispatch",
"schedule",
"status",
"watch",
"workflow_call",
"workflow_dispatch",
"workflow_run"
]
},
"status": {
"type": "string",
"description": "Filter workflow runs to only runs with a specific status",
"enum": [
"queued",
"in_progress",
"completed",
"requested",
"waiting"
]
}
}
}
}
},
"name": "actions_list"
}
53 changes: 53 additions & 0 deletions pkg/github/__toolsnaps__/actions_run_trigger.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"annotations": {
"destructiveHint": true,
"title": "Trigger GitHub Actions workflow actions"
},
"description": "Trigger GitHub Actions workflow operations, including running, re-running, cancelling workflow runs, and deleting workflow run logs.",
"inputSchema": {
"type": "object",
"required": [
"method",
"owner",
"repo"
],
"properties": {
"inputs": {
"type": "object",
"description": "Inputs the workflow accepts. Only used for 'run_workflow' method."
},
"method": {
"type": "string",
"description": "The method to execute",
"enum": [
"run_workflow",
"rerun_workflow_run",
"rerun_failed_jobs",
"cancel_workflow_run",
"delete_workflow_run_logs"
]
},
"owner": {
"type": "string",
"description": "Repository owner"
},
"ref": {
"type": "string",
"description": "The git reference for the workflow. The reference can be a branch or tag name. Required for 'run_workflow' method."
},
"repo": {
"type": "string",
"description": "Repository name"
},
"run_id": {
"type": "number",
"description": "The ID of the workflow run. Required for all methods except 'run_workflow'."
},
"workflow_id": {
"type": "string",
"description": "The workflow ID (numeric) or workflow file name (e.g., main.yml, ci.yaml). Required for 'run_workflow' method."
}
}
},
"name": "actions_run_trigger"
}
Loading