# GitHub MCP Wrapper — Model Context Protocol for GitHub Data (`apricot_blackberry/github-mcp-wrapper`) Actor

GitHub MCP Wrapper — Model Context Protocol for GitHub Data helps teams get quick, high-signal results with reliable output, clear fields, and fast setup.

- **URL**: https://apify.com/apricot_blackberry/github-mcp-wrapper.md
- **Developed by:** [Creator Fusion](https://apify.com/apricot_blackberry) (community)
- **Categories:** AI, Developer tools
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 mcp calls

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

![github-mcp-wrapper cover](https://placehold.co/1200x630/png?text=github-mcp-wrapper)

## GitHub MCP Wrapper

**Safe, secure wrapper for GitHub operations integrated with Claude's MCP protocol. Execute repository operations, manage files, handle issues and pull requests—all with environment-variable-protected credentials.**

This actor provides a safe interface for GitHub operations through Apify, designed specifically for AI agents and automated workflows. Rather than embedding GitHub tokens in your code, credentials are securely managed through environment variables, preventing accidental exposure in logs or version control systems.

### What Does GitHub MCP Wrapper Do?

The GitHub MCP Wrapper enables programmatic access to GitHub repositories and operations through a simple, secure interface. Whether you're automating repository management, creating pull requests, managing issues, or coordinating file operations across multiple repos, this wrapper handles it all without exposing sensitive credentials.

**Key Capabilities:**

- Repository creation and management (create, update, delete repositories)
- File operations (read, write, update, delete files within repositories)
- Pull request automation (create PRs, merge, close, manage reviews)
- Issue management (create, update, close, label, assign issues)
- Branch operations (create, delete, protect branches)
- Commit operations (create commits with multiple file changes)
- Webhook management for CI/CD integration
- Team and permission management
- Secure credential handling via environment variables only

### Key Features (8 Features)

1. **Secure Token Management** - GitHub tokens stored exclusively in environment variables, never exposed in input parameters or logs
2. **Multi-Operation Support** - Handle repositories, files, commits, PRs, issues, branches, and webhooks from a single interface
3. **Batch File Operations** - Modify multiple files in a single commit (useful for automated refactoring or documentation updates)
4. **Error Recovery** - Graceful handling of rate limits, network errors, and GitHub API failures with automatic retry logic
5. **MCP Compatible** - Integrates seamlessly with Claude's Model Context Protocol for AI-driven automation
6. **Comprehensive Logging** - Detailed operation logs for debugging and auditing without compromising security
7. **Branch Protection** - Enforce required reviews, status checks, and admissibility rules for production branches
8. **Webhook Integration** - Automate downstream processes by triggering webhooks on repository events

### How to Use (Step by Step)

#### Step 1: Set Up GitHub Token

Before running this actor, configure your GitHub Personal Access Token as an environment variable:

- Go to GitHub Settings → Developer settings → Personal access tokens
- Create a new token with `repo`, `workflow`, and `admin:repo_hook` scopes
- Set the token as an environment variable: `GITHUB_TOKEN=ghp_xxxxxx...`

#### Step 2: Define Your Operation

Prepare your input JSON specifying the operation and parameters:

```json
{
  "tool": "create_file",
  "toolInput": {
    "owner": "your-username",
    "repo": "your-repo",
    "path": "src/new-file.js",
    "content": "// New file content",
    "message": "Add new file via automation"
  }
}
```

#### Step 3: Run the Actor

Execute the actor with your prepared input. The actor will:

1. Validate your GitHub token exists in environment variables
2. Initialize the GitHub API client (Octokit)
3. Execute your specified operation
4. Return results in structured JSON format
5. Log all operations for audit purposes

#### Step 4: Handle Results

Process the returned JSON containing:

- Operation status (success/failure)
- Response data from GitHub API
- Any errors or warnings
- Rate limit information for future requests

### Input Parameters (Brief Table)

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `tool` | string | Yes | Operation to perform (e.g., `create_file`, `create_pr`, `create_issue`) |
| `toolInput` | object | Yes | Parameters specific to the operation being performed |
| `owner` | string | Yes\* | GitHub repository owner (username or org) |
| `repo` | string | Yes\* | Repository name |
| `path` | string | Yes\* | File path for file operations |
| `content` | string | Yes\* | File content for write operations |
| `message` | string | Yes\* | Commit message for file operations |
| `title` | string | Yes\* | Title for PR or issue creation |
| `body` | string | No | Description body for PR or issue |

\*Required depending on the specific operation

### Output Data (Brief Table)

| Field | Type | Description |
|-------|------|-------------|
| `success` | boolean | Whether the operation completed successfully |
| `data` | object | GitHub API response data for successful operations |
| `error` | string | Error message if operation failed |
| `rateLimit` | object | Current GitHub API rate limit status |
| `operationType` | string | The operation that was executed |
| `timestamp` | string | ISO timestamp of operation completion |

### Pricing & Performance

**Cost per operation:** Depends on operation complexity

- Simple file reads: ~$0.02
- File writes (commits): ~$0.05
- PR/Issue creation: ~$0.08
- Batch operations: ~$0.15

**Performance:**

- File operations: <2 seconds
- PR creation: <5 seconds
- Issue management: <3 seconds
- Rate limits: 5,000 requests/hour for authenticated users

**Recommendations:**

- Batch file modifications into single commits to avoid rate limiting
- Use caching to avoid redundant GitHub API calls
- Monitor rate limit headers in responses to pace requests appropriately

### FAQ (2-3 Questions)

**Q: Why must the GitHub token come from environment variables?**
A: Storing credentials in environment variables prevents accidental exposure in logs, version control history, or error messages. This follows security best practices for handling sensitive authentication tokens.

**Q: What GitHub operations are supported?**
A: All major operations are supported including: repository management, file I/O, commits, pull requests, issues, branches, teams, hooks, and releases. Complex workflows can be composed from individual operations.

**Q: How do I handle rate limiting?**
A: The actor respects GitHub's rate limits (5,000 requests/hour) and includes rate limit info in responses. For heavy workloads, either space out requests or use GitHub's GraphQL API for more efficient queries.

### Security Considerations

- **Credential Protection**: GitHub tokens are NEVER accepted as input parameters—only from environment variables
- **Scope Limitation**: Request tokens with minimal required permissions (`repo`, `workflow`, `admin:repo_hook`)
- **Audit Logging**: All operations are logged with timestamps for security auditing
- **Error Messages**: Never expose token or sensitive data in error messages or logs
- **Network Security**: All communication with GitHub API uses HTTPS encryption

### Integrations & Automation

**MCP Compatible**: Directly integrate with Claude and other AI agents for automated GitHub workflows.

**Webhook Triggers**: Configure GitHub webhooks to trigger downstream Apify actors on repository events.

**Slack Notifications**: Send alerts to Slack when important operations complete (PR merged, issue created, etc.).

**CI/CD Integration**: Trigger actor runs from GitHub Actions workflows to automate repository maintenance tasks.

### Works Great With

- **Code Quality Tools** - Automate code reviews by creating PRs with automated fixes
- **Documentation Generators** - Auto-commit generated documentation to `docs/` branches
- **Release Automation** - Create releases and tags automatically based on semantic versioning
- **Issue Automation** - Create and organize issues from external data sources

***

**Security First. Automation Ready. AI-Friendly.**

📧 [Support](https://docs.apify.com/support) · 🔗 [GitHub API Docs](https://docs.github.com/en/rest) · 🤖 [MCP Integration](https://docs.apify.com/platform/integrations/mcp) · 📡 [REST API](https://docs.apify.com/api/v2)

Built for secure automation workflows with Apify and Claude.

# Actor input Schema

## `githubToken` (type: `string`):

Your GitHub PAT with appropriate permissions

## `tool` (type: `string`):

The GitHub operation to perform

## `toolInput` (type: `object`):

Input parameters for the selected tool

## Actor input object example

```json
{
  "tool": "search_repositories",
  "toolInput": {
    "query": "apify actors language:typescript"
  }
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "toolInput": {
        "query": "apify actors language:typescript"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("apricot_blackberry/github-mcp-wrapper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "toolInput": { "query": "apify actors language:typescript" } }

# Run the Actor and wait for it to finish
run = client.actor("apricot_blackberry/github-mcp-wrapper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "toolInput": {
    "query": "apify actors language:typescript"
  }
}' |
apify call apricot_blackberry/github-mcp-wrapper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,apricot_blackberry/github-mcp-wrapper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/Ue8P4k2lrme0hVyaC/builds/Y6iRMdJBnME0E9Yl2/openapi.json
