dev_leva1_mcp_github_server

dev_leva1_mcp_github_server

by dev-leva1
A server providing an interface to interact with GitHub repositories and manage files, branches, and commits.

GitHub API Integration Server

Overview

The GitHub API Integration Server provides a convenient interface for interacting with GitHub repositories. It simplifies the process of managing repositories, files, branches, and commits through a structured API.

Installation

  1. Clone the repository:
    bash git clone https://github.com/fills/mcp-github-server.git cd mcp-github-server
  2. Install dependencies:
    bash npm install
  3. Create a .env file in the root directory and add the following variables:
    PORT=3000 GITHUB_TOKEN=your_github_token_here
    To generate a GitHub token:
  4. Go to your GitHub account settings.
  5. Navigate to "Developer settings" -> "Personal access tokens" -> "Tokens (classic)".
  6. Click "Generate new token" and select the necessary permissions (recommended: repo, user).
  7. Copy the token and paste it into the .env file.

Usage

Running the Server

  • For development mode:
    bash npm run dev
  • For production mode:
    bash npm start

API Endpoints

Base Route

  • GET / - Check server status.

Repositories

  • GET /api/repos/:username - Get a list of user repositories.
  • GET /api/repos/:username/:repo - Get details of a specific repository.
  • POST /api/repos - Create a new repository.
  • Request body:
    json { "name": "repo-name", "description": "description", "private": false }

Files

  • GET /api/repos/:username/:repo/contents/:path - Get the contents of a file in a repository.
  • POST /api/repos/:username/:repo/contents/:path - Create a new file in a repository.
  • Request body:
    json { "content": "file content", "message": "commit message" }

Branches

  • GET /api/repos/:username/:repo/branches - Get a list of branches in a repository.
  • POST /api/repos/:username/:repo/branches - Create a new branch in a repository.
  • Request body:
    json { "name": "branch-name", "sha": "commit-sha" }

Commits

  • GET /api/repos/:username/:repo/commits - Get a list of commits in a repository.
  • Query parameters: sha, path, author, since, until, per_page, page.
  • POST /api/repos/:username/:repo/commits - Create a new commit.
  • Request body:
    json { "message": "commit message", "branch": "branch-name", "changes": { "path/to/file1.txt": "content of file1", "path/to/file2.txt": "content of file2" } }

Examples

Get a List of User Repositories

GET http://localhost:3000/api/repos/octocat

Create a New Repository

POST http://localhost:3000/api/repos
Content-Type: application/json

{
  "name": "test-repo",
  "description": "Тестовый репозиторий",
  "private": true
}

Create a File in a Repository

POST http://localhost:3000/api/repos/username/repo-name/contents/path/to/file.txt
Content-Type: application/json

{
  "content": "Содержимое файла",
  "message": "Добавлен новый файл"
}

Create a New Branch

POST http://localhost:3000/api/repos/username/repo-name/branches
Content-Type: application/json

{
  "name": "feature-branch",
  "sha": "optional-commit-sha"
}

Create a Commit with Multiple Files

POST http://localhost:3000/api/repos/username/repo-name/commits
Content-Type: application/json

{
  "message": "Добавлены новые файлы",
  "branch": "feature-branch",
  "changes": {
    "file1.txt": "Содержимое файла 1",
    "dir/file2.txt": "Содержимое файла 2"
  }
}

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

0 forks

Languages

  • HTML 63.2%
  • JavaScript 36.8%

Features & Capabilities

Categories
mcp_server model_context_protocol github_api javascript html api_integration repository_management

Implementation Details

Stats

0 Views
1 GitHub Stars

Repository Info

dev-leva1 Organization

Similar MCP Servers

continuedev_continue by continuedev
25049
21423
9300