github-repo-structure-mcp
1.0.1
dotnet tool install --global github-repo-structure-mcp --version 1.0.1
dotnet new tool-manifest
dotnet tool install --local github-repo-structure-mcp --version 1.0.1
#tool dotnet:?package=github-repo-structure-mcp&version=1.0.1
nuke :add-package github-repo-structure-mcp --version 1.0.1
Help your AI agent understand any GitHub repository at a glance.
🌐 English | 한국어
github-repo-structure-mcp is a .NET global tool that fetches GitHub repository directory structures via the git/trees API and exposes them through a stdio MCP server. It lets AI coding agents see the layout of a repository without cloning it or browsing the web UI. A single API call returns the full recursive tree, rendered as an indented tree-style string.
Supports private repositories with a GitHub Personal Access Token.
Highlights
- Fetch GitHub repository directory structures through MCP tools from Codex, Claude Code, GitHub Copilot CLI, Gemini CLI, OpenCode, or any provider that supports stdio MCP servers.
- Register or remove the server with supported provider CLIs using
mcp-install,mcp-remove, ormcp-uninstall. - Edit arbitrary
mcp.jsonfiles directly for providers that do not have a built-in installer command. - Support for private repositories via GitHub Personal Access Token (interactive prompt,
--tokenoption, orGITHUB_PERSONAL_ACCESS_TOKENenv var). - Output a
tree-style string with├──and└──connectors, with configurable depth.
Install
dotnet tool install --global github-repo-structure-mcp
Update an existing install:
dotnet tool update --global github-repo-structure-mcp
Provider Setup
Use a supported provider CLI:
github-repo-structure-mcp mcp-install --provider codex
github-repo-structure-mcp mcp-install --provider claude
github-repo-structure-mcp mcp-install --provider copilot
github-repo-structure-mcp mcp-install --provider gemini
github-repo-structure-mcp mcp-install --provider opencode
github-repo-structure-mcp mcp-install --provider all
Remove the registration:
github-repo-structure-mcp mcp-remove --provider codex
github-repo-structure-mcp mcp-uninstall --provider claude
github-repo-structure-mcp mcp-remove --provider all
The default MCP server name is github-repo-structure. Override it when needed:
github-repo-structure-mcp mcp-install --provider codex --name github-repo-structure
The opencode provider edits ~/.config/opencode/opencode.json directly instead of using a CLI command.
GitHub Personal Access Token
To access private repositories or increase API rate limits, provide a GitHub Personal Access Token. The token is resolved in order:
--token <PAT>command-line optionGITHUB_PERSONAL_ACCESS_TOKENenvironment variable- Interactive console prompt (during
mcp-installonly)
When a token is provided during mcp-install, it is injected into the provider configuration as an environment variable so the MCP server can read it at runtime.
github-repo-structure-mcp mcp-install --provider codex --token ghp_xxxxxxxxxxxx
Custom mcp.json
For other providers, pass the target MCP config file directly:
github-repo-structure-mcp mcp-install --config "C:\path\to\mcp.json"
This adds:
{
"mcpServers": {
"github-repo-structure": {
"command": "github-repo-structure-mcp",
"args": []
}
}
}
With a token:
{
"mcpServers": {
"github-repo-structure": {
"command": "github-repo-structure-mcp",
"args": [],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxxxxxxxxxxx"
}
}
}
}
The config editor accepts JSON comments and trailing commas when reading. It writes standard formatted JSON and creates a .bak file before modifying an existing config.
MCP Tools
get_repo_structure: Fetches a GitHub repository directory structure as atree-style string.
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
owner |
string | — | Repository owner (e.g. github in github/github-mcp-server) |
repo |
string | — | Repository name (e.g. github-mcp-server in github/github-mcp-server) |
depth |
int | 3 | Depth limit for the tree output. Use 0 for unlimited depth. |
maxDepth |
int | 0 | Maximum depth override. When > 0, overrides the depth parameter. |
branch |
string? | null | Branch or commit SHA to fetch. Defaults to the repository's default branch. |
The tool uses the GitHub git/trees API with recursive=1 to fetch the full tree in a single call, then renders it as a tree string with ├── and └── connectors. Directories are listed first (alphabetically), followed by files.
Manual Server Command
Running without arguments starts the stdio MCP server:
github-repo-structure-mcp
Show CLI help:
github-repo-structure-mcp help
github-repo-structure-mcp --help
Package Development
dotnet restore
dotnet build
dotnet test
dotnet pack
License
github-repo-structure-mcp is licensed under the MIT License.
Author
Created by Howon Lee (airtaxi).
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.