MCP GitHub 服务端
用于与 GitHub API 交互的便捷服务器接口,支持仓库管理操作。
快速入门
-
克隆项目: git clone https://github.com/fills/mcp-github-server.git cd mcp-github-server
-
安装依赖: npm install
-
配置环境变量: 创建
.env
文件并添加以下内容: PORT=3000 GITHUB_TOKEN=your_github_token_here -
启动开发模式: npm run dev
-
或启动生产模式: npm start
示例 API 调用
- 获取用户仓库列表: GET http://localhost:3000/api/repos/username
- 创建新仓库: POST http://localhost:3000/api/repos 请求体:{"name": "test-repo", "description": "测试仓库"}
- 添加文件到仓库: POST http://localhost:3000/api/repos/username/repo/contents/path/to/file.txt 请求体:{"content": "文件内容", "message": "提交消息"}