Skip to main content
Glama

MCP GitHub Repository Server

by loglmhq

MCP GitHub 存储库服务器

一个 MCP(模型上下文协议)服务器,提供对 GitHub 仓库内容的访问。该服务器允许 AI 助手浏览和读取指定 GitHub 仓库中的文件。

演示

演示

特征

资源

  • 通过 URI 访问 GitHub 存储库中的任何文件
  • 列出存储库内容并导航目录
  • 支持特定分支的文件访问
  • 文件内容以纯文本形式提供

资源 URI

  • 基本 URL 格式: https://api.github.com/repos/{owner}/{repo}/contents/{path}
  • 支持文件和目录
  • 文件以text/plain MIME 类型提供
  • 目录采用application/x-directory MIME 类型

配置

服务器需要以下环境变量:

GITHUB_PERSONAL_ACCESS_TOKEN=your_github_token GITHUB_OWNER=repository_owner GITHUB_REPO=repository_name GITHUB_BRANCH=branch_name # Optional

发展

安装依赖项:

npm install

构建服务器:

npm run build

对于使用自动重建的开发:

npm run watch

安装

要与 Claude Desktop 一起使用,请添加服务器配置:

配置位置

  • MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%/Claude/claude_desktop_config.json
{ "mcpServers": { "mcp-server-github-repo": { "command": "/path/to/mcp-server-github-repo/build/index.js" } } }

API 实现

该服务器实现了三个主要的 MCP 端点:

  1. ListResources列出存储库中的文件和目录
  2. ReadResource检索特定文件的内容

验证

服务器使用 GitHub 个人访问令牌进行身份验证。请确保您的令牌具有访问存储库内容的适当权限。

错误处理

服务器包括以下错误处理:

  • 缺少环境变量
  • GitHub API 错误
  • 无效路径(例如,尝试将目录读取为文件)
  • 身份验证失败

调试

由于 MCP 服务器通过 stdio 进行通信,调试起来可能比较困难。请使用 MCP Inspector 进行调试:

npm run inspector

这将提供一个 URL 来访问浏览器中的调试工具。

安全说明

  • 确保您的 GitHub 个人访问令牌安全
  • 考虑使用具有最低所需权限的令牌
  • 访问大型存储库时请注意存储库大小限制

执照

麻省理工学院

-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

允许 AI 助手浏览和读取指定 GitHub 存储库中的文件的服务器,通过模型上下文协议提供对存储库内容的访问。

  1. 演示
    1. 特征
      1. 资源
      2. 资源 URI
    2. 配置
      1. 发展
        1. 安装
          1. 配置位置
        2. API 实现
          1. 验证
          2. 错误处理
        3. 调试
          1. 安全说明
            1. 执照

              Related MCP Servers

              • -
                security
                A
                license
                -
                quality
                A Model Context Protocol server that enables AI agents to retrieve and understand entire codebases at once, providing tools to analyze local workspaces or remote GitHub repositories.
                Last updated -
                9
                TypeScript
                MIT License
                • Linux
                • Apple
              • A
                security
                F
                license
                A
                quality
                A Model Context Protocol server that enables AI models to interact with GitHub's API, allowing for repository creation and management with descriptions, topics, and website URLs through natural language commands.
                Last updated -
                1
                JavaScript
              • -
                security
                F
                license
                -
                quality
                A Model Context Protocol server that enables AI assistants like Claude to interact with GitHub repositories, issues, and pull requests.
                Last updated -
                129
                Python
              • -
                security
                F
                license
                -
                quality
                A Model Context Protocol server that enables AI assistants to perform GitHub operations including repository management, file operations, issue tracking, and pull request creation.
                Last updated -
                1
                TypeScript

              View all related MCP servers

              MCP directory API

              We provide all the information about MCP servers via our MCP API.

              curl -X GET 'https://glama.ai/api/mcp/v1/servers/loglmhq/mcp-server-github-repo'

              If you have feedback or need assistance with the MCP directory API, please join our Discord server