Skip to main content
Glama
appare45

github-token-mcp

by appare45

github-token-mcp

spec.md의 구현. devcontainer 내의 에이전트에게 GitHub App installation access token을 매번 발급하는 호스트 전용 MCP 서버.

기술 구성

  • MCP server: @modelcontextprotocol/server v2 (createMcpHandler + McpServer)를 Streamable HTTP로 배포

  • GitHub App 인증: @octokit/auth-app의 createAppAuth (JWT 생성 및 토큰 교환은 자체 구현하지 않음)

  • 비밀 키 획득: @1password/sdk의 DesktopAuth — CLI 셸 아웃이 아닌 1Password desktop app에서의 생체 인증/시스템 인증 프롬프트를 매번 요구

  • Bearer 인증: @modelcontextprotocol/express의 requireBearerAuth. devcontainer 측은 고정된 공유 토큰을 제시

Related MCP server: Git Repo Auth MCP

설정

npm install
cp .env.example .env  # 値を埋める
  • GITHUB_APP_ID / GITHUB_APP_INSTALLATION_ID: 대상 GitHub App / 설치

  • GITHUB_APP_PRIVATE_KEY_OP_REF: 비밀 키의 1Password secret reference (op://vault/item/field)

  • OP_ACCOUNT_NAME: 1Password desktop app 사이드바에 표시되는 계정 이름 (DesktopAuth용)

  • MCP_BEARER_TOKEN: devcontainer 측이 Authorization: Bearer <token>으로 제시하는 공유 시크릿

1Password desktop app 측에서 Settings > Developer > Integrate with other apps를 활성화해 두어야 합니다.

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

구현 상태 (골자)

  • get_installation_token 도구의 타입 정의 및 입력 검증

  • repos 커버리지 검증 → repo_not_installed

  • permissions 부분 집합 검증 → permission_escalation_denied

  • 1Password를 통한 비밀 키 획득 → key_unavailable

  • @octokit/auth-app으로의 토큰 발행 위임 → github_api_error

  • Streamable HTTP + Bearer 인증을 통한 배포

  • 실제 GitHub App / 1Password vault에 대한 동작 확인 (인간의 인증 정보 준비 필요)

  • devcontainer 측의 사용 패턴 (spec.md에서 명시적으로 후순위로 미룸)

디렉토리 구성

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.
    -