Skip to content

Github からリポジトリの情報を取得して構造化データを返すMCPサーバー

License

Notifications You must be signed in to change notification settings

taiki-ssss/github-structure-mcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub MCP Server

A Model Context Protocol (MCP) server that provides tools for interacting with GitHub repositories.

Features

This MCP server provides two main tools:

1. get_repository_tree

Get the file tree structure of a GitHub repository.

Parameters:

  • owner (string, required): GitHub repository owner
  • repo (string, required): GitHub repository name
  • branch (string, required): Branch name (defaults to 'main')

Returns: A string containing an ASCII tree representation of the repository structure, where directories are marked with / and files are shown without special markers.

Example Output:

my-repo/
├── src/
│   ├── index.ts
│   └── utils/
│       └── helper.ts
├── package.json
└── README.md

2. get_repository_content

Get file contents from a GitHub repository in YAML format.

Parameters:

  • owner (string, required): GitHub repository owner
  • repo (string, required): GitHub repository name
  • branch (string, required): Branch name (defaults to 'main')
  • extensions (array of strings, optional): File extensions to filter (e.g., [".ts", ".js"])
  • directories (array of strings, optional): Directories to include (e.g., ["src", "lib"])

Returns: YAML formatted content with:

  • files: Map of file paths to their content and type
  • metadata: Statistics including total files, lines, characters, and tokens

Supported File Types: The tool automatically detects file types based on extensions, supporting 40+ programming languages and file formats including JavaScript, TypeScript, Python, Java, C++, Go, Rust, and many more.

Configuration

Environment Variables

  • PERSONAL_ACCESS_TOKEN (optional): GitHub Personal Access Token for increased rate limits

Create a .env file:

PERSONAL_ACCESS_TOKEN=your_github_token_here

Rate Limiting

The server uses raw.githubusercontent.com for fetching file contents to avoid GitHub API rate limits. Repository structure still uses the GitHub API with these limits:

  • Without authentication: 60 requests/hour
  • With authentication: 5,000 requests/hour

Token Limits

The server enforces a maximum token limit of 200,000 tokens per request to ensure compatibility with Claude models.

About

Github からリポジトリの情報を取得して構造化データを返すMCPサーバー

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published