github-token-mcp
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/serverv2 (createMcpHandler+McpServer), bereitgestellt über Streamable HTTPGitHub App-Authentifizierung:
createAppAuthvon@octokit/auth-app(JWT-Erstellung und Token-Austausch werden nicht selbst implementiert)Privaten Schlüssel abrufen:
DesktopAuthaus@1password/sdk– fordert bei jedem Mal eine biometrische Authentifizierung oder Systemauthentifizierung über die 1Password-Desktop-App an, anstatt die CLI zu verwendenBearer-Authentifizierung:
requireBearerAuthvon@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 / InstallationGITHUB_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ürDesktopAuth)MCP_BEARER_TOKEN: Das gemeinsame Geheimnis, das die Devcontainerseite im FormatAuthorization: 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 startImplementierungsstatus (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_deniedAbruf des privaten Schlüssels über 1Password →
key_unavailableDelegierung der Tokenausstellung an
@octokit/auth-app→github_api_errorBereitstellung ü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配信)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