# github/github-mcp-server architecture

> Architecture diagram of the GitHub repository github/github-mcp-server, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/github/github-mcp-server
- Repository: https://github.com/github/github-mcp-server

## Overview

GitHub MCP Server exposes GitHub capabilities to AI hosts over stdio or HTTP, with optional OAuth/PAT authentication. Requests are served through MCP, filtered by tool inventory and scopes, then handled by GitHub tool/resource implementations. The README also documents repository, issue/PR, Actions, code-analysis, and collaboration use cases; their individual handlers are represented by their source directories because those files were not sampled. UI apps provide interactive issue and pull-request experiences. Edges reflect shown calls or documented product relationships; unsampled feature internals are not inferred.

Main entry points: [`cmd/github-mcp-server/main.go`](https://github.com/github/github-mcp-server/blob/main/cmd/github-mcp-server/main.go) (Server CLI), [`pkg/github/server.go`](https://github.com/github/github-mcp-server/blob/main/pkg/github/server.go) (GitHub MCP server), [`internal/ghmcp/server.go`](https://github.com/github/github-mcp-server/blob/main/internal/ghmcp/server.go) (Stdio MCP server), [`ui/src/apps/issue-write/App.tsx`](https://github.com/github/github-mcp-server/blob/main/ui/src/apps/issue-write/App.tsx) (Issue app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and authentication"]
  node_cli["Server CLI<br/>[main.go]"]
  node_oauth["OAuth flow<br/>[oauth.go]"]
end

subgraph group_protocol["MCP request serving"]
  node_httpserver["HTTP server<br/>[server.go]"]
  node_httphandler["HTTP MCP handler<br/>[handler.go]"]
  node_stdio["Stdio MCP server<br/>[server.go]"]
  node_inventory["Tool inventory<br/>[registry.go]"]
  node_githubserver["GitHub MCP server<br/>[server.go]"]
end

subgraph group_features["GitHub capabilities"]
  node_repository["Repository tools"]
  node_repositoryresource["Repository resources"]
  node_issues["Issue tools"]
  node_pullrequests["Pull request tools"]
  node_actions["Actions and workflows"]
  node_security["Security analysis"]
  node_collaboration["Team collaboration"]
end

subgraph group_apps["Interactive apps"]
  node_issueapp["Issue app<br/>[App.tsx]"]
  node_prwrite["PR creation app<br/>[App.tsx]"]
  node_predit["PR editing app<br/>[App.tsx]"]
  node_apphook["MCP app bridge<br/>[useMcpApp.ts]"]
  node_provider["App presentation<br/>[AppProvider.tsx]"]
end

node_host(("AI host"))
node_github(("GitHub platform"))

node_host -->|"starts server"| node_cli
node_cli -->|"runs stdio"| node_stdio
node_cli -->|"runs HTTP"| node_httpserver
node_cli -->|"configures login"| node_oauth
node_httpserver -->|"registers routes"| node_httphandler
node_httphandler -->|"creates server"| node_githubserver
node_stdio -->|"builds inventory"| node_inventory
node_stdio -->|"creates server"| node_githubserver
node_githubserver -->|"registers capabilities"| node_inventory
node_githubserver -->|"serves GitHub access"| node_github
node_repository -->|"queries platform"| node_github
node_repositoryresource -->|"fetches content"| node_github
node_issues -->|"manages issues"| node_github
node_pullrequests -->|"manages pull requests"| node_github
node_actions -->|"analyzes workflows"| node_github
node_security -->|"reads findings"| node_github
node_collaboration -->|"supports teamwork"| node_github
node_host -.->|"opens app"| node_issueapp
node_host -.->|"opens app"| node_prwrite
node_host -.->|"opens app"| node_predit
node_issueapp -->|"uses bridge"| node_apphook
node_prwrite -->|"uses bridge"| node_apphook
node_predit -->|"uses bridge"| node_apphook
node_issueapp -.->|"renders within"| node_provider
node_prwrite -->|"renders within"| node_provider
node_predit -->|"renders within"| node_provider

click node_cli "https://github.com/github/github-mcp-server/blob/main/cmd/github-mcp-server/main.go"
click node_oauth "https://github.com/github/github-mcp-server/blob/main/internal/ghmcp/oauth.go"
click node_httpserver "https://github.com/github/github-mcp-server/blob/main/pkg/http/server.go"
click node_httphandler "https://github.com/github/github-mcp-server/blob/main/pkg/http/handler.go"
click node_stdio "https://github.com/github/github-mcp-server/blob/main/internal/ghmcp/server.go"
click node_inventory "https://github.com/github/github-mcp-server/blob/main/pkg/inventory/registry.go"
click node_githubserver "https://github.com/github/github-mcp-server/blob/main/pkg/github/server.go"
click node_repository "https://github.com/github/github-mcp-server/tree/main/pkg/github"
click node_repositoryresource "https://github.com/github/github-mcp-server/blob/main/pkg/github/repository_resource.go"
click node_issues "https://github.com/github/github-mcp-server/tree/main/pkg/github"
click node_pullrequests "https://github.com/github/github-mcp-server/tree/main/pkg/github"
click node_actions "https://github.com/github/github-mcp-server/tree/main/pkg/github"
click node_security "https://github.com/github/github-mcp-server/tree/main/pkg/github"
click node_collaboration "https://github.com/github/github-mcp-server/tree/main/pkg/github"
click node_issueapp "https://github.com/github/github-mcp-server/blob/main/ui/src/apps/issue-write/App.tsx"
click node_prwrite "https://github.com/github/github-mcp-server/blob/main/ui/src/apps/pr-write/App.tsx"
click node_predit "https://github.com/github/github-mcp-server/blob/main/ui/src/apps/pr-edit/App.tsx"
click node_apphook "https://github.com/github/github-mcp-server/blob/main/ui/src/hooks/useMcpApp.ts"
click node_provider "https://github.com/github/github-mcp-server/blob/main/ui/src/components/AppProvider.tsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_oauth toneBlue
class node_httpserver,node_httphandler,node_stdio,node_inventory,node_githubserver toneAmber
class node_repository,node_repositoryresource,node_issues,node_pullrequests,node_actions,node_security,node_collaboration toneMint
class node_issueapp,node_prwrite,node_predit,node_apphook,node_provider toneRose
class node_host,node_github toneIndigo
```

## Components

### Entry and authentication

- [Server CLI](https://github.com/github/github-mcp-server/blob/main/cmd/github-mcp-server/main.go): `cmd/github-mcp-server/main.go`
- [OAuth flow](https://github.com/github/github-mcp-server/blob/main/internal/ghmcp/oauth.go): `internal/ghmcp/oauth.go`

### MCP request serving

- [HTTP server](https://github.com/github/github-mcp-server/blob/main/pkg/http/server.go): `pkg/http/server.go`
- [HTTP MCP handler](https://github.com/github/github-mcp-server/blob/main/pkg/http/handler.go): `pkg/http/handler.go`
- [Stdio MCP server](https://github.com/github/github-mcp-server/blob/main/internal/ghmcp/server.go): `internal/ghmcp/server.go`
- [Tool inventory](https://github.com/github/github-mcp-server/blob/main/pkg/inventory/registry.go): `pkg/inventory/registry.go`
- [GitHub MCP server](https://github.com/github/github-mcp-server/blob/main/pkg/github/server.go): `pkg/github/server.go`

### GitHub capabilities

- [Repository tools](https://github.com/github/github-mcp-server/tree/main/pkg/github): `pkg/github`
- [Repository resources](https://github.com/github/github-mcp-server/blob/main/pkg/github/repository_resource.go): `pkg/github/repository_resource.go`
- [Issue tools](https://github.com/github/github-mcp-server/tree/main/pkg/github): `pkg/github`
- [Pull request tools](https://github.com/github/github-mcp-server/tree/main/pkg/github): `pkg/github`
- [Actions and workflows](https://github.com/github/github-mcp-server/tree/main/pkg/github): `pkg/github`
- [Security analysis](https://github.com/github/github-mcp-server/tree/main/pkg/github): `pkg/github`
- [Team collaboration](https://github.com/github/github-mcp-server/tree/main/pkg/github): `pkg/github`

### Interactive apps

- [Issue app](https://github.com/github/github-mcp-server/blob/main/ui/src/apps/issue-write/App.tsx): `ui/src/apps/issue-write/App.tsx`
- [PR creation app](https://github.com/github/github-mcp-server/blob/main/ui/src/apps/pr-write/App.tsx): `ui/src/apps/pr-write/App.tsx`
- [PR editing app](https://github.com/github/github-mcp-server/blob/main/ui/src/apps/pr-edit/App.tsx): `ui/src/apps/pr-edit/App.tsx`
- [MCP app bridge](https://github.com/github/github-mcp-server/blob/main/ui/src/hooks/useMcpApp.ts): `ui/src/hooks/useMcpApp.ts`
- [App presentation](https://github.com/github/github-mcp-server/blob/main/ui/src/components/AppProvider.tsx): `ui/src/components/AppProvider.tsx`

### Other components

- **AI host**
- **GitHub platform**

## Connections

- AI host → Server CLI: starts server (evidence: `README.md`)
- Server CLI → Stdio MCP server: runs stdio (evidence: `cmd/github-mcp-server/main.go`)
- Server CLI → HTTP server: runs HTTP (evidence: `cmd/github-mcp-server/main.go`)
- Server CLI → OAuth flow: configures login (evidence: `cmd/github-mcp-server/main.go`)
- HTTP server → HTTP MCP handler: registers routes (evidence: `pkg/http/server.go`)
- HTTP MCP handler → GitHub MCP server: creates server (evidence: `pkg/http/handler.go`)
- Stdio MCP server → Tool inventory: builds inventory (evidence: `internal/ghmcp/server.go`)
- Stdio MCP server → GitHub MCP server: creates server (evidence: `internal/ghmcp/server.go`)
- GitHub MCP server → Tool inventory: registers capabilities (evidence: `pkg/github/server.go`)
- GitHub MCP server → GitHub platform: serves GitHub access (evidence: `README.md`)
- Repository tools → GitHub platform: queries platform (evidence: `README.md`)
- Repository resources → GitHub platform: fetches content (evidence: `pkg/github/repository_resource.go`)
- Issue tools → GitHub platform: manages issues (evidence: `README.md`)
- Pull request tools → GitHub platform: manages pull requests (evidence: `README.md`)
- Actions and workflows → GitHub platform: analyzes workflows (evidence: `README.md`)
- Security analysis → GitHub platform: reads findings (evidence: `README.md`)
- Team collaboration → GitHub platform: supports teamwork (evidence: `README.md`)
- AI host → Issue app: opens app
- AI host → PR creation app: opens app
- AI host → PR editing app: opens app
- Issue app → MCP app bridge: uses bridge (evidence: `ui/src/apps/issue-write/App.tsx`)
- PR creation app → MCP app bridge: uses bridge (evidence: `ui/src/apps/pr-write/App.tsx`)
- PR editing app → MCP app bridge: uses bridge (evidence: `ui/src/apps/pr-edit/App.tsx`)
- Issue app → App presentation: renders within (evidence: `ui/src/apps/issue-write/App.tsx`)
- PR creation app → App presentation: renders within (evidence: `ui/src/apps/pr-write/App.tsx`)
- PR editing app → App presentation: renders within (evidence: `ui/src/apps/pr-edit/App.tsx`)
