Skip to main content
Glama
appare45

github-token-mcp

by appare45

github-token-mcp

Implementierung von spec.md. Ein dedizierter MCP-Server, der innerhalb eines Devcontainers als Host fungiert und bei Bedarf GitHub App-Installationszugriffstoken für den Agenten ausstellt.

Technische Architektur

  • MCP-Server: @modelcontextprotocol/server v2 (createMcpHandler + McpServer), bereitgestellt über Streamable HTTP

  • GitHub App-Authentifizierung: createAppAuth von @octokit/auth-app (JWT-Erstellung und Token-Austausch werden nicht selbst implementiert)

  • Privaten Schlüssel abrufen: DesktopAuth aus @1password/sdk – fordert bei jedem Mal eine biometrische Authentifizierung oder Systemauthentifizierung über die 1Password-Desktop-App an, anstatt die CLI zu verwenden

  • Bearer-Authentifizierung: requireBearerAuth von @modelcontextprotocol/express. Die Devcontainerseite präsentiert ein festes, gemeinsam genutztes Token

Related MCP server: Git Repo Auth MCP

Einrichtung

npm install
cp .env.example .env  # 値を埋める
  • GITHUB_APP_ID / GITHUB_APP_INSTALLATION_ID: Die entsprechende GitHub App / Installation

  • GITHUB_APP_PRIVATE_KEY_OP_REF: Die 1Password-Secret-Referenz für den privaten Schlüssel (op://vault/item/field)

  • OP_ACCOUNT_NAME: Der in der Seitenleiste der 1Password-Desktop-App angezeigte Kontoname (für DesktopAuth)

  • MCP_BEARER_TOKEN: Das gemeinsame Geheimnis, das die Devcontainerseite im Format Authorization: Bearer <token> präsentiert

Stellen Sie sicher, dass in der 1Password-Desktop-App unter Einstellungen > Entwickler > In andere Apps integrieren die Option aktiviert ist.

npm run dev    # tsx watch で起動
npm run build && npm start

Implementierungsstatus (Kern)

  • Typdefinition und Eingabevalidierung für das Tool get_installation_token

  • Überprüfung der Repos-Abdeckung → repo_not_installed

  • Überprüfung der Berechtigungsteilmengen → permission_escalation_denied

  • Abruf des privaten Schlüssels über 1Password → key_unavailable

  • Delegierung der Tokenausstellung an @octokit/auth-app → github_api_error

  • Bereitstellung über Streamable HTTP + Bearer-Authentifizierung

  • Funktionstest mit einer echten GitHub App / 1Password-Vault (erfordert manuelle Vorbereitung der Anmeldeinformationen)

  • Nutzungsmuster auf der Devcontainerseite (im spec.md explizit zurückgestellt)

Verzeichnisstruktur

src/
  config.ts                       環境変数ロード
  errors.ts                       spec.md の4種類のエラーコードに対応するTokenError
  op-secret.ts                    1Password DesktopAuth 経由の秘密鍵取得
  github-auth.ts                  installation repos/permissions 検証 + createAppAuth 呼び出し
  tools/get-installation-token.ts get_installation_token ツール本体
  server.ts                       McpServer ファクトリ(ツール登録)
  index.ts                        HTTPエントリポイント(bearer認証 + createMcpHandler配信)

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables access to GitHub repositories and data through the GitHub API. Supports retrieving repositories, issues, pull requests, and searching code across GitHub with authentication via personal access tokens.
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Mints short-lived, scoped GitHub App installation tokens on demand for AI agents to access git repositories or the GitHub API.
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    Provides GitHub App authentication for Git and API operations, enabling temporary token generation for private repository access.
    -