{"modulePath":"github.com/Arkestone/mcp","version":"v1.2.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package github\n\nPackage github provides a client for the GitHub Contents API. It fetches file contents and directory listings from repositories.\n\n## Functions\n\n```go\nfunc IsRateLimitError(err error) bool\n```\nIsRateLimitError reports whether err is a GitHub API rate-limit error.\n\n## Types\n\n```go\ntype Client struct {\n\tBaseURL    string       // defaults to \"https://api.github.com\"\n\tToken      string       // optional bearer token\n\tHTTPClient *http.Client // optional; falls back to http.DefaultClient\n}\n```\nClient accesses the GitHub Contents API.\n\n```go\nfunc (c *Client) FetchDir(ctx context.Context, owner, repo, ref, path string) ([]ContentEntry, error)\n```\nFetchDir lists the contents of a directory in a GitHub repository.\n\n```go\nfunc (c *Client) FetchDirRecursive(ctx context.Context, owner, repo, ref, root string) ([]ContentEntry, error)\n```\nFetchDirRecursive lists all files under root recursively using BFS. Directories are not included in the results. The initial call to root propagates errors; errors on individual subdirectories are silently skipped. Pass root=\"\" to start from the repository root.\n\n```go\nfunc (c *Client) FetchFile(ctx context.Context, owner, repo, ref, path string) (string, error)\n```\nFetchFile downloads the raw content of a file from a GitHub repository.\n\n```go\nfunc (c *Client) FetchZipAndExtract(ctx context.Context, owner, repo, ref, targetDir string) error\n```\nFetchZipAndExtract downloads the repository as a ZIP archive and extracts all files into targetDir, preserving the directory tree but stripping the top-level \"{repo}-{sha}/\" prefix that GitHub adds inside the archive.\n\nIt uses the GitHub zipball API endpoint which supports both authenticated and unauthenticated (public repos) requests. For public repos this bypasses the 60 req/hr Contents API rate limit — the zipball is served from codeload.github.com.\n\nref may be a branch, tag, or commit SHA; an empty ref uses the default branch.\n\n```go\ntype ContentEntry struct {\n\tName string `json:\"name\"`\n\tPath string `json:\"path\"`\n\tType string `json:\"type\"` // \"file\" or \"dir\"\n}\n```\nContentEntry represents a file or directory in a GitHub repository listing.\n\n","path":"github.com/Arkestone/mcp/pkg/github","name":"github","synopsis":"Package github provides a client for the GitHub Contents API.","isRedistributable":true}
