GitHub仓库管理服务

一个提供GitHub集成能力的模型上下文协议(MCP)服务器,支持仓库管理、文件操作和提交处理等功能。

  • by peterparker57
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 peterparker57/github-mcp-server

使用说明

# GitHub MCP服务器

提供GitHub集成功能的模型上下文协议(MCP)服务器。此服务器支持通过MCP工具与GitHub存储库进行交互,支持存储库管理、文件操作和提交处理等操作。

特性

  • 帐户管理和身份验证
  • 存储库创建和管理
  • 文件操作(读、写、推、拉)
  • 提交操作
  • 目录同步
  • 存储库比较和差异化

安装

ash npm install @modelcontextprotocol/server-github

配置

将服务器添加到MCP设置文件(cline_MCP_settings.json)中:

json { "mcpServers": { "github": { "command": "node", "args": ["/path/to/github-mcp-server/dist/index.js"], "env": { "GITHUB_TOKEN_1": "your-github-token", "GITHUB_OWNER_1": "your-github-username" }, "disabled": false, "alwaysAllow": [] } } }

可用工具

账户管理

list_计数

列出服务器中配置的可用GitHub帐户。

选择计数

选择一个GitHub帐户用于后续操作。

库管理

创建存储库

创建一个新的GitHub仓库。

ypescript { owner?: string; // Repository owner (optional if account selected) name: string; // Repository name description: string; // Repository description private?: boolean; // Whether repository is private }

clone_repository

将GitHub存储库克隆到本地目录。

ypescript { owner?: string; // Repository owner repo: string; // Repository name branch?: string; // Branch name (default: main) outputDir: string; // Local directory to clone into }

重命名存储

重命名现有的GitHub存储库。

ypescript { owner?: string; // Repository owner repo: string; // Current repository name new_name: string; // New repository name }

文件操作

push_file

将文件推送到GitHub存储库。

ypescript { owner?: string; // Repository owner repo: string; // Repository name path: string; // Target path in repository message: string; // Commit message sourcePath: string; // Local file to push }

pull_file

从GitHub存储库中提取文件。

ypescript { owner?: string; // Repository owner repo: string; // Repository name path: string; // File path in repository outputPath: string; // Local path to save file }

同步目录

本地和远程目录之间的双向同步。

ypescript { owner?: string; // Repository owner repo: string; // Repository name path: string; // Directory path in repository localPath: string; // Local directory path }

提交操作

创建提交

创建一个包含多个文件更改的提交。

ypescript { owner?: string; // Repository owner repo: string; // Repository name branch: string; // Branch name message: string; // Commit message changes: Array<{ path: string; // File path in repository sourcePath: string; // Local file path (for add/modify) operation: 'add' | 'modify' | 'delete'; }>; }

list_commits

列出存储库的提交。

ypescript { owner?: string; // Repository owner repo: string; // Repository name branch?: string; // Branch name author?: string; // Filter by author since?: string; // ISO 8601 date - commits after until?: string; // ISO 8601 date - commits before }

发展

要构建服务器,请执行以下操作:

ash npm install npm run build

环境变量

  • GITHUB令牌_:GitHub个人访问令牌
  • GITHUB所有者_:令牌的GitHub用户名
  • DEFAULT_OWNER:要使用的默认GitHub帐户

通过递增N(1、2等)可以配置多个帐户。

许可证

麻省理工学院