github-token-mcp
github-token-mcp
spec.md의 구현. devcontainer 내의 에이전트에게 GitHub App installation access token을 매번 발급하는 호스트 전용 MCP 서버.
기술 구성
MCP server:
@modelcontextprotocol/serverv2 (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_installedpermissions 부분 집합 검증 →
permission_escalation_denied1Password를 통한 비밀 키 획득 →
key_unavailable@octokit/auth-app으로의 토큰 발행 위임 →github_api_errorStreamable 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配信)This server cannot be deployed
Maintenance
Related MCP Connectors
Operate GitHub from your AI assistant: repos, PRs, issues, Actions. Previews and read-only mode.
Access the GitHub API, enabling file operations, repository management, search functionality, and…
Manage repositories, users, releases, and automate GitHub workflows
Issue, rotate and revoke scoped API-key passes for 25+ providers — the agent never sees a real key
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables 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.-
- FlicenseNot gradedqualityDmaintenanceMints short-lived, scoped GitHub App installation tokens on demand for AI agents to access git repositories or the GitHub API.-
- FlicenseNot gradedqualityCmaintenanceProvides GitHub App authentication for Git and API operations, enabling temporary token generation for private repository access.-
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to access private GitHub repositories, organizations, issues, pull requests, and file contents via OAuth authentication.391 npmMIT