# Gitmcp Universal Repository Processor (`theguide/gitmcp-universal-repository-processor`) Actor

Turn any public or private GitHub repository into a ready-to-use knowledge pack you can hand to your favorite AI assistant in minutes.

- **URL**: https://apify.com/theguide/gitmcp-universal-repository-processor.md
- **Developed by:** [TheGuide](https://apify.com/theguide) (community)
- **Categories:** AI, MCP servers, Integrations
- **Features:** Full permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $500.00 / 1,000 repository processeds

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

## GitMCP Universal Repository Processor

Create a complete MCP-ready snapshot of any Git repository in one run. The actor clones the repository, filters content by scope (code, docs, issues, git history), and packages everything for downstream AI tooling.

### What you get after each run

- **Repository bundle** — A ZIP archive stored as `REPOSITORY_ZIP` in the key-value store.
- **Manifest** — `MANIFEST.json` summarising repository metadata, processed files, issues, and MCP integration hints.
- **Dataset records** — Structured entries for each processed file and issue to drive analytics or custom exports.
- **Optional git history** — Latest commits when `includeGitHistory` is true.

### Input parameters

Configure inputs via the Apify UI or `storage/key_value_stores/default/INPUT.json`. See `.actor/input_schema.json` for defaults and accepted values.

- **`repositoryUrl`** *(string, required)* — Git repository HTTPS/SSH URL.
- **`accessToken`** *(string, optional)* — Personal access token for private repositories (use Secret Storage).
- **`branch`** *(string, optional)* — Branch or tag to checkout after cloning.
- **`scopes`** *(array, optional)* — Any combination of `code`, `docs`, `issues` (default includes all).
- **`outputFormats`** *(array, optional)* — `mcp`, `json`, or both; controls dataset formatting.
- **`maxFileSizeMb`** *(number, optional)* — Skip files larger than this threshold (default `25`).
- **`includeGitHistory`** *(boolean, optional)* — Collect last 100 commits when true.
- **`runIdSuffix`** *(string, optional)* — Appended to dataset name for grouping runs.

#### Example input

```json
{
  "repositoryUrl": "https://github.com/apify/gitmcp-universal-repository-processor",
  "branch": "main",
  "scopes": ["code", "docs"],
  "includeGitHistory": true,
  "maxFileSizeMb": 20
}
```

### Output details

- **Dataset (`default`)** — Records tagged as `type="code"`, `type="doc"`, or `type="issue"` with fields such as `path`, `sizeBytes`, `lines`, `lang`, `url` (for issues).
- **Key-value store (`default`)**
  - `REPOSITORY_ZIP` — Downloadable ZIP of the processed repository snapshot.
  - `MANIFEST.json` — JSON manifest containing run metadata, file/issue counts, git history (if requested), and suggested MCP servers.
- **Logs** — Checkout warnings, GitHub API throttling, and charging information.

### Pricing and charging

When pay-per-event billing is active on Apify, the actor charges the `repository_processed` event after a successful run. Use test mode or local runs to avoid charges while prototyping.

### Tips

- Provide an access token with `repo` scope for private GitHub repositories.
- Limit `scopes` to speed up runs (e.g. `['docs']` for documentation-only dumps).
- Use `maxFileSizeMb` to skip large binaries the MCP server does not need.

### Running locally

```
npm install
npm run build
apify run
```

Place `INPUT.json` under `storage/key_value_stores/default/` and ensure Git and network access are available inside the Docker image or local environment.

# Actor input Schema

## `repositoryUrl` (type: `string`):

HTTPS URL of the Git repository (e.g. https://github.com/owner/repo.git)

## `accessToken` (type: `string`):

Token for private repos (e.g. GitHub PAT). Stored as secret input.

## `branch` (type: `string`):

Checkout a specific branch or tag after cloning.

## `scopes` (type: `array`):

What to process: code files, docs, and/or issues

## `outputFormats` (type: `array`):

Select output styles. 'mcp' keeps a bundle zip and manifest; 'json' provides structured dataset records.

## `maxFileSizeMb` (type: `integer`):

Files larger than this size (in MB) will be skipped during code/docs processing.

## `includeGitHistory` (type: `boolean`):

Include last 100 commits metadata (hash, date, message, author)

## `runIdSuffix` (type: `string`):

Append a suffix to dataset name if you want to keep multiple runs separate.

## Actor input object example

```json
{
  "scopes": [
    "code",
    "docs",
    "issues"
  ],
  "outputFormats": [
    "mcp",
    "json"
  ],
  "maxFileSizeMb": 25,
  "includeGitHistory": false
}
```

# 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 = {
    "scopes": [
        "code",
        "docs",
        "issues"
    ],
    "outputFormats": [
        "mcp",
        "json"
    ],
    "maxFileSizeMb": 25,
    "includeGitHistory": false
};

// Run the Actor and wait for it to finish
const run = await client.actor("theguide/gitmcp-universal-repository-processor").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 = {
    "scopes": [
        "code",
        "docs",
        "issues",
    ],
    "outputFormats": [
        "mcp",
        "json",
    ],
    "maxFileSizeMb": 25,
    "includeGitHistory": False,
}

# Run the Actor and wait for it to finish
run = client.actor("theguide/gitmcp-universal-repository-processor").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 '{
  "scopes": [
    "code",
    "docs",
    "issues"
  ],
  "outputFormats": [
    "mcp",
    "json"
  ],
  "maxFileSizeMb": 25,
  "includeGitHistory": false
}' |
apify call theguide/gitmcp-universal-repository-processor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,theguide/gitmcp-universal-repository-processor"
        }
    }
}
```

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/BlQmysZ8KgPDwPzwi/builds/f6uIf28q1nZXpwhAd/openapi.json
