Documentation
¶
Overview ¶
WHO: CommonsManager WHAT: Shared types and utilities WHEN: Throughout GitHub MCP operations WHERE: GitHub MCP Server WHY: To provide shared functionality across components HOW: By defining common types and helper functions EXTENT: All GitHub MCP components
WHO: GitHubMCPBridge WHAT: GitHub API Integration Package WHEN: MCP bridge initialization WHERE: MCP Bridge Layer WHY: To provide API access to GitHub HOW: By implementing MCP protocol handlers EXTENT: All GitHub API operations
WHO: GitHubMCPServer WHAT: GitHub API Server Implementation WHEN: During request processing WHERE: MCP Bridge Layer WHY: To handle GitHub API integration HOW: Using MCP protocol handlers EXTENT: All GitHub API operations
Index ¶
- Constants
- func AddIssueComment(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func BridgeHealthCheck() (bool, error)
- func ConnectMCPChannels(bridgeMode string) error
- func CreateBranch(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func CreateIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func CreateOrUpdateFile(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func CreatePullRequest(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func CreatePullRequestReview(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func CreateRepository(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func ForkRepository(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func GetCodeScanningAlert(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func GetCommit(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func GetFileContents(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func GetIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func GetIssueComments(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func GetMe(getClient GetClientFn, t TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc)
- func GetPullRequest(getClient GetClientFn, t TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc)
- func GetPullRequestComments(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func GetPullRequestFiles(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func GetPullRequestReviews(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func GetPullRequestStatus(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func GetRepositoryResourceBranchContent(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.ResourceTemplate, server.ResourceTemplateHandlerFunc)
- func GetRepositoryResourceCommitContent(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.ResourceTemplate, server.ResourceTemplateHandlerFunc)
- func GetRepositoryResourceContent(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.ResourceTemplate, server.ResourceTemplateHandlerFunc)
- func GetRepositoryResourcePrContent(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.ResourceTemplate, server.ResourceTemplateHandlerFunc)
- func GetRepositoryResourceTagContent(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.ResourceTemplate, server.ResourceTemplateHandlerFunc)
- func InitializeMCPBridge(enableCompression bool) error
- func ListBranches(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func ListCodeScanningAlerts(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func ListCommits(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func ListIssues(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func ListPullRequests(getClient GetClientFn, t TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc)
- func MergePullRequest(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func NewServer(getClient GetClientFn, version string, readOnly bool, t TranslationHelperFunc, ...) *server.MCPServer
- func OptionalIntParam(r mcp.CallToolRequest, p string) (int, error)
- func OptionalIntParamWithDefault(r mcp.CallToolRequest, p string, d int) (int, error)
- func OptionalParam[T any](r mcp.CallToolRequest, p string) (T, error)
- func OptionalParamOK[T any](r mcp.CallToolRequest, p string) (value T, ok bool, err error)
- func OptionalParamWithDefault[T any](request mcp.CallToolRequest, name string, defaultValue T) (T, error)
- func OptionalStringArrayParam(r mcp.CallToolRequest, p string) ([]string, error)
- func ParseResourceURI(uri string) (map[string]string, error)
- func Ptr[T any](v T) *T
- func PushFiles(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func RepositoryResourceContentsHandler(getClient GetClientFn) ...
- func RequiredInt(r mcp.CallToolRequest, p string) (int, error)
- func SearchCode(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func SearchIssues(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func SearchRepositories(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func SearchUsers(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func StartMCPEventMonitor(logger *log.Logger) error
- func UpdateIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func UpdatePullRequest(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func UpdatePullRequestBranch(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func WithPagination() mcp.ToolOption
- type APIError
- type BinaryFile
- type Branch
- type BridgeStats
- type Client
- func (c *Client) CreateIssue(ctx context.Context, owner, repo string, issue map[string]interface{}) (map[string]interface{}, error)
- func (c *Client) CreatePullRequest(ctx context.Context, owner, repo string, pr map[string]interface{}) (map[string]interface{}, error)
- func (c *Client) GetBranches(ctx context.Context, owner, repo string) ([]map[string]interface{}, error)
- func (c *Client) GetCodeScanningAlerts(ctx context.Context, owner, repo string) ([]map[string]interface{}, error)
- func (c *Client) GetCommit(ctx context.Context, owner, repo, sha string) (map[string]interface{}, error)
- func (c *Client) GetDirectoryContent(ctx context.Context, owner, repo, path, ref string) ([]map[string]interface{}, error)
- func (c *Client) GetFileContent(ctx context.Context, owner, repo, path, ref string) ([]byte, map[string]interface{}, error)
- func (c *Client) GetRepositoryByName(ctx context.Context, owner, repo string) (map[string]interface{}, error)
- func (c *Client) SearchCode(ctx context.Context, query string, options map[string]string) (map[string]interface{}, error)
- func (c *Client) SetContext(context *translations.ContextVector7D)
- func (c *Client) UpdateIssue(ctx context.Context, owner, repo string, number int, ...) (map[string]interface{}, error)
- type ClientCompatibilityAdapter
- func (a *ClientCompatibilityAdapter) ApplyMobiusCompression(data interface{}) (map[string]interface{}, error)
- func (a *ClientCompatibilityAdapter) CreateContext(what, why string, extent float64) ContextVector7D
- func (a *ClientCompatibilityAdapter) CreateIssue(owner, repo, title, body string, assignees []string) (*Issue, error)
- func (a *ClientCompatibilityAdapter) GetContext() ContextVector7D
- func (a *ClientCompatibilityAdapter) GetFileContent(owner, repo, path, ref string) (*RepoContent, error)
- func (a *ClientCompatibilityAdapter) GetRepository(owner, repo string) (*Repository, error)
- func (a *ClientCompatibilityAdapter) GetUser(username string) (*User, error)
- func (a *ClientCompatibilityAdapter) ListRepositoryContents(owner, repo, path, ref string) ([]*DirectoryEntry, error)
- func (a *ClientCompatibilityAdapter) ParseResourceURI(uri string) (*ResourceURI, error)
- func (a *ClientCompatibilityAdapter) WithContext(ctx ContextVector7D) *ClientCompatibilityAdapter
- type ClientOptions
- type CodeScanAlert
- type Commit
- type ContextTranslator
- func (ct *ContextTranslator) CompressContext(context map[string]interface{}) (map[string]interface{}, error)
- func (ct *ContextTranslator) GetTranslationStats() map[string]interface{}
- func (t *ContextTranslator) TranslateFromTNOS(tnosContext map[string]interface{}) map[string]interface{}
- func (ct *ContextTranslator) TranslateGitHubToTNOS(githubContext *ContextVector7D) (*translations.ContextVector7D, error)
- func (ct *ContextTranslator) TranslateMapToTNOS(contextMap map[string]interface{}) (*translations.ContextVector7D, error)
- func (ct *ContextTranslator) TranslateTNOSToGitHub(tnosContext *translations.ContextVector7D) (*ContextVector7D, error)
- func (ct *ContextTranslator) TranslateTNOSToMap(tnosContext *translations.ContextVector7D) (map[string]interface{}, error)
- func (t *ContextTranslator) TranslateToTNOS(githubContext map[string]interface{}) map[string]interface{}
- type ContextVector7D
- type DetailedAPIError
- type DirectoryEntry
- type ExtendedCodeScanningAlert
- type ExtendedIssue
- type ExtendedPullRequest
- type ExtendedRepository
- type ExtendedUser
- type GetClientFn
- type Issue
- type LegacyClientAdapter
- type Logger
- type MCPBridge
- func (b *MCPBridge) GetState() MCPBridgeState
- func (b *MCPBridge) GetStats() BridgeStats
- func (b *MCPBridge) HealthCheck() (bool, error)
- func (b *MCPBridge) SendOperation(operation string, data map[string]interface{}, context map[string]interface{}) error
- func (b *MCPBridge) Start() error
- func (b *MCPBridge) Stop() error
- func (b *MCPBridge) SyncContext(context map[string]interface{}) error
- type MCPBridgeOptions
- type MCPBridgeState
- type OrganizationMember
- type PaginationParams
- type PullRequest
- type RateLimit
- type Release
- type RepoContent
- type Repository
- type ResourceURI
- type SearchQueryBuilder
- type SearchResult
- type TeamMember
- type TranslationHelperFunc
- type User
- type UserService
- func (s *UserService) Get(username string) (*User, error)
- func (s *UserService) GetAuthenticated() (*User, error)
- func (s *UserService) GetContext() map[string]interface{}
- func (s *UserService) ListFollowers(username string) ([]User, error)
- func (s *UserService) ListFollowing(username string) ([]User, error)
- type WorkflowJob
- type WorkflowRun
Constants ¶
const ( BaseURL = "https://api.github.com" ReposEndpoint = "/repos" IssuesEndpoint = "/issues" PullsEndpoint = "/pulls" SearchEndpoint = "/search" CodeScanEndpoint = "/code-scanning" UserEndpoint = "/user" OrganizationsEndpoint = "/organizations" TeamsEndpoint = "/teams" )
API endpoint constants
const ( APIVersion = "2022-11-28" MCPVersion = "3.0" ProtocolVersion = "3.0" )
Version information
const ( BridgeModeDirect = "direct" BridgeModeProxied = "proxied" BridgeModeAsync = "async" )
MCP bridge modes
const ( RepoContentsURITemplate = "repo://%s/%s/contents%s" RepoBranchURITemplate = "repo://%s/%s/refs/heads/%s/contents%s" RepoCommitURITemplate = "repo://%s/%s/sha/%s/contents%s" RepoIssueURITemplate = "repo://%s/%s/issues/%d" RepoPullRequestURITemplate = "repo://%s/%s/pulls/%d" RepoCodeScanningURITemplate = "repo://%s/%s/code-scanning/alerts" )
Resource URI templates
const ( ErrorAuthFailed = "auth_failed" ErrorNotFound = "not_found" ErrorPermissionDenied = "permission_denied" ErrorRateLimit = "rate_limit" ErrorServerError = "server_error" ErrorBadRequest = "bad_request" ErrorBridgeFailed = "bridge_failed" ErrorContextInvalid = "context_invalid" )
Error codes
const ( ConstRepoOwnerDesc = "Repository owner" ConstRepoNameDesc = "Repository name" )
Parameter descriptions
const ( ErrMsgGetGitHubClient = "failed to get GitHub client: %w" ErrMsgReadResponseBody = "failed to read response body: %w" ErrMsgMarshalIssue = "failed to marshal issue: %w" ErrMsgMarshalComment = "failed to marshal comment: %w" ErrMsgMarshalPR = "failed to marshal pull request: %w" ErrMsgMarshalSearchRes = "failed to marshal search results: %w" ErrMsgMarshalUser = "failed to marshal user: %w" ErrMsgMarshalComments = "failed to marshal comments: %w" ErrMsgMarshalIssues = "failed to marshal issues: %w" )
Error message templates
const ( EventTypeRepository = "repository" EventTypeIssue = "issue" EventTypePR = "pull_request" EventTypeRelease = "release" EventTypeWorkflow = "workflow" )
Event type constants
const ( PRActionOpened = "opened" PRActionClosed = "closed" PRActionMerged = "merged" PRActionReopened = "reopened" PRActionSynchronize = "synchronize" )
Pull request action constants
const ( SearchTypeCode = "code" SearchTypeCommits = "commits" SearchTypeIssues = "issues" SearchTypePRs = "pull_requests" SearchTypeRepositories = "repositories" SearchTypeUsers = "users" )
Search type constants
const ( DefaultAPIBaseURL = "https://api.github.com" DefaultGraphQLBaseURL = "https://api.github.com/graphql" DefaultAcceptHeader = "application/vnd.github.v3+json" DefaultUserAgent = "TNOS-GitHub-MCP-Client" DefaultTimeout = 30 * time.Second DefaultCacheTimeout = 5 * time.Minute )
DefaultAPI constants
const ( ResourceTypeUser = "user" ResourceTypeRepo = "repo" ResourceTypeIssue = "issue" ResourceTypePR = "pr" ResourceTypeComment = "comment" ResourceTypeContent = "content" ResourceTypeRef = "ref" ResourceTypeCommit = "commit" ResourceTypeBranch = "branch" ResourceTypeWorkflow = "workflow" ResourceTypeRelease = "release" ResourceTypeTag = "tag" ResourceTypeCodeScan = "codescan" ResourceTypeDependency = "dependency" ResourceTypeSecret = "secret" ResourceTypeAction = "action" )
Resource type constants
const ( // Parameter descriptions RepositoryOwnerDesc = "Repository owner" RepositoryNameDesc = "Repository name" // Error messages ErrGetGitHubClient = "failed to get GitHub client: %w" ErrReadResponseBody = "failed to read response body: %w" ErrMarshalIssue = "failed to marshal issue: %w" ErrMarshalComment = "failed to marshal comment: %w" ErrMarshalPR = "failed to marshal pull request: %w" ErrMarshalSearchRes = "failed to marshal search results: %w" ErrMarshalUser = "failed to marshal user: %w" ErrMarshalComments = "failed to marshal comments: %w" ErrMarshalIssues = "failed to marshal issues: %w" )
WHO: ConstantsManager WHAT: String Constants Definition WHEN: Compilation time WHERE: GitHub MCP Server WHY: To avoid string duplication HOW: By defining reusable constants EXTENT: All shared string literals
Variables ¶
This section is empty.
Functions ¶
func AddIssueComment ¶
func AddIssueComment(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
AddIssueComment creates a tool to add a comment to an issue.
func BridgeHealthCheck ¶
BridgeHealthCheck performs a health check on the MCP bridge
func ConnectMCPChannels ¶
ConnectMCPChannels establishes bidirectional channels between GitHub and TNOS MCP
func CreateBranch ¶
func CreateBranch(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
CreateBranch creates a tool to create a new branch.
func CreateIssue ¶
func CreateIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
CreateIssue creates a tool to create a new issue in a GitHub repository.
func CreateOrUpdateFile ¶
func CreateOrUpdateFile(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
CreateOrUpdateFile creates a tool to create or update a file in a GitHub repository.
func CreatePullRequest ¶
func CreatePullRequest(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
CreatePullRequest creates a tool to create a new pull request.
func CreatePullRequestReview ¶
func CreatePullRequestReview(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
CreatePullRequestReview creates a tool to submit a review on a pull request.
func CreateRepository ¶
func CreateRepository(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
CreateRepository creates a tool to create a new GitHub repository.
func ForkRepository ¶
func ForkRepository(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
ForkRepository creates a tool to fork a repository.
func GetCodeScanningAlert ¶
func GetCodeScanningAlert(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
func GetCommit ¶
func GetCommit(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
func GetFileContents ¶
func GetFileContents(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
GetFileContents creates a tool to get the contents of a file or directory from a GitHub repository.
func GetIssue ¶
func GetIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
GetIssue creates a tool to get details of a specific issue in a GitHub repository.
func GetIssueComments ¶
func GetIssueComments(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
GetIssueComments creates a tool to get comments for a GitHub issue.
func GetMe ¶
func GetMe(getClient GetClientFn, t TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc)
WHO: UserInfoTool WHAT: Authenticated User Tool WHEN: During user info request WHERE: GitHub MCP Server WHY: To provide user identity information HOW: By fetching authenticated user details from GitHub EXTENT: User identification
func GetPullRequest ¶
func GetPullRequest(getClient GetClientFn, t TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc)
WHO: PRRetrievalTool WHAT: Pull Request Details Tool WHEN: During tool invocation WHERE: GitHub MCP Server WHY: To access details of a specific pull request HOW: By querying GitHub API with PR number EXTENT: Single PR details
func GetPullRequestComments ¶
func GetPullRequestComments(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
GetPullRequestComments creates a tool to get the review comments on a pull request.
func GetPullRequestFiles ¶
func GetPullRequestFiles(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
GetPullRequestFiles creates a tool to get the list of files changed in a pull request.
func GetPullRequestReviews ¶
func GetPullRequestReviews(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
GetPullRequestReviews creates a tool to get the reviews on a pull request.
func GetPullRequestStatus ¶
func GetPullRequestStatus(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
GetPullRequestStatus creates a tool to get the combined status of all status checks for a pull request.
func GetRepositoryResourceBranchContent ¶
func GetRepositoryResourceBranchContent(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.ResourceTemplate, server.ResourceTemplateHandlerFunc)
GetRepositoryResourceBranchContent defines the resource template and handler for getting repository content for a branch.
func GetRepositoryResourceCommitContent ¶
func GetRepositoryResourceCommitContent(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.ResourceTemplate, server.ResourceTemplateHandlerFunc)
GetRepositoryResourceCommitContent defines the resource template and handler for getting repository content for a commit.
func GetRepositoryResourceContent ¶
func GetRepositoryResourceContent(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.ResourceTemplate, server.ResourceTemplateHandlerFunc)
GetRepositoryResourceContent defines the resource template and handler for getting repository content.
func GetRepositoryResourcePrContent ¶
func GetRepositoryResourcePrContent(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.ResourceTemplate, server.ResourceTemplateHandlerFunc)
GetRepositoryResourcePrContent defines the resource template and handler for getting repository content for a pull request.
func GetRepositoryResourceTagContent ¶
func GetRepositoryResourceTagContent(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.ResourceTemplate, server.ResourceTemplateHandlerFunc)
GetRepositoryResourceTagContent defines the resource template and handler for getting repository content for a tag.
func InitializeMCPBridge ¶
InitializeMCPBridge sets up the MCP bridge between GitHub and TNOS MCP
func ListBranches ¶
func ListBranches(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
ListBranches creates a tool to list branches in a GitHub repository.
func ListCodeScanningAlerts ¶
func ListCodeScanningAlerts(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
func ListCommits ¶
func ListCommits(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
ListCommits creates a tool to get commits of a branch in a repository.
func ListIssues ¶
func ListIssues(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
ListIssues creates a tool to list and filter repository issues
func ListPullRequests ¶
func ListPullRequests(getClient GetClientFn, t TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc)
WHO: PRListingTool WHAT: Pull Request Listing Tool WHEN: During tool invocation WHERE: GitHub MCP Server WHY: To provide a list of repository pull requests HOW: By calling GitHub API with proper pagination EXTENT: All repository pull requests
func MergePullRequest ¶
func MergePullRequest(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
MergePullRequest creates a tool to merge a pull request.
func NewServer ¶
func NewServer(getClient GetClientFn, version string, readOnly bool, t TranslationHelperFunc, opts ...server.ServerOption) *server.MCPServer
WHO: ServerInitializer WHAT: MCP Server Configuration WHEN: System startup WHERE: GitHub Bridge WHY: To configure all available GitHub MCP tools HOW: By registering resource templates and tools EXTENT: All GitHub API functionality
func OptionalIntParam ¶
func OptionalIntParam(r mcp.CallToolRequest, p string) (int, error)
WHO: ParameterHelper WHAT: Optional Integer Extraction WHEN: During parameter processing WHERE: GitHub MCP Server WHY: To safely extract optional integer parameters HOW: By checking parameter existence and type EXTENT: All integer parameter processing
func OptionalIntParamWithDefault ¶
WHO: ParameterHelper WHAT: Optional Integer with Default WHEN: During parameter processing WHERE: GitHub MCP Server WHY: To extract integer parameters with defaults HOW: By checking parameter and providing default if needed EXTENT: All integer parameter processing
func OptionalParam ¶
func OptionalParam[T any](r mcp.CallToolRequest, p string) (T, error)
WHO: ParameterHelper WHAT: Optional Parameter Extraction WHEN: During parameter processing WHERE: GitHub MCP Server WHY: To safely extract optional parameters HOW: By checking parameter existence and type EXTENT: All tool parameter processing
func OptionalParamOK ¶
WHO: ParameterHelper WHAT: Optional Parameter Extraction WHEN: During parameter processing WHERE: GitHub MCP Server WHY: To safely extract optional parameters HOW: By checking parameter existence and type EXTENT: All tool parameter processing
func OptionalParamWithDefault ¶
func OptionalParamWithDefault[T any](request mcp.CallToolRequest, name string, defaultValue T) (T, error)
OptionalParamWithDefault gets an optional parameter with a default value
func OptionalStringArrayParam ¶
func OptionalStringArrayParam(r mcp.CallToolRequest, p string) ([]string, error)
WHO: ParameterHelper WHAT: Optional String Array Extraction WHEN: During parameter processing WHERE: GitHub MCP Server WHY: To safely extract optional string array parameters HOW: By checking parameter existence and converting types EXTENT: All string array parameter processing
func ParseResourceURI ¶
ParseResourceURI parses a GitHub resource URI
func PushFiles ¶
func PushFiles(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
PushFiles creates a tool to push multiple files in a single commit to a GitHub repository.
func RepositoryResourceContentsHandler ¶
func RepositoryResourceContentsHandler(getClient GetClientFn) func(ctx context.Context, request mcp.ReadResourceRequest) ([]mcp.ResourceContents, error)
RepositoryResourceContentsHandler returns a handler function for repository content requests.
func RequiredInt ¶
func RequiredInt(r mcp.CallToolRequest, p string) (int, error)
WHO: ParameterHelper WHAT: Required Integer Extraction WHEN: During parameter processing WHERE: GitHub MCP Server WHY: To safely extract required integer parameters HOW: By checking parameter existence, type, and value EXTENT: All integer parameter processing
func SearchCode ¶
func SearchCode(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
SearchCode creates a tool to search for code across GitHub repositories.
func SearchIssues ¶
func SearchIssues(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
SearchIssues creates a tool to search for issues and pull requests.
func SearchRepositories ¶
func SearchRepositories(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
WHO: SearchRepositoriesTool WHAT: GitHub Repository Search WHEN: Tool invocation WHERE: GitHub MCP Server WHY: To find repositories matching search criteria HOW: By querying GitHub Search API EXTENT: All public and authorized GitHub repositories
func SearchUsers ¶
func SearchUsers(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
SearchUsers creates a tool to search for GitHub users.
func StartMCPEventMonitor ¶
StartMCPEventMonitor starts monitoring MCP events
func UpdateIssue ¶
func UpdateIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
UpdateIssue creates a tool to update an existing issue in a GitHub repository.
func UpdatePullRequest ¶
func UpdatePullRequest(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
UpdatePullRequest creates a tool to update an existing pull request.
func UpdatePullRequestBranch ¶
func UpdatePullRequestBranch(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
UpdatePullRequestBranch creates a tool to update a pull request branch with the latest changes from the base branch.
func WithPagination ¶
func WithPagination() mcp.ToolOption
WHO: ToolOptionProvider WHAT: Pagination Option Provider WHEN: During tool definition WHERE: GitHub MCP Server WHY: To add standardized pagination parameters HOW: By adding page and perPage parameters to tool EXTENT: All paginated tools
Types ¶
type APIError ¶
type APIError struct {
Message string `json:"message"`
DocumentationURL string `json:"documentation_url"`
Errors []struct {
Resource string `json:"resource"`
Field string `json:"field"`
Code string `json:"code"`
} `json:"errors,omitempty"`
}
APIError represents an error from the GitHub API
type BinaryFile ¶
type BinaryFile struct {
Name string // File name
Path string // File path
Data []byte // Raw binary data
Size int // File size
Encoding string // File encoding
SHA string // File SHA
}
BinaryFile represents a binary file from the repository
type Branch ¶
type Branch struct {
Name string `json:"name"`
Commit Commit `json:"commit"`
Protected bool `json:"protected"`
}
Branch represents a Git branch
type BridgeStats ¶
type BridgeStats struct {
// Number of messages sent to TNOS
MessagesSent int64
// Number of messages received from TNOS
MessagesReceived int64
// Number of reconnection attempts
ReconnectionAttempts int64
// Timestamp of the last successful message send
LastMessageSent int64
// Timestamp of the last successful message receive
LastMessageReceived int64
// Map of operation counts by type
OperationCounts map[string]int64
// Context translation statistics
ContextTranslations struct {
Success int64
Failure int64
}
}
BridgeStats contains statistics about the MCP bridge
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a GitHub API client
func NewAdvancedClient ¶
func NewAdvancedClient(options ClientOptions) (*Client, error)
NewAdvancedClient creates a new GitHub client with advanced options This is renamed from NewClient to avoid conflicts with the legacy client
func (*Client) CreateIssue ¶
func (c *Client) CreateIssue(ctx context.Context, owner, repo string, issue map[string]interface{}) (map[string]interface{}, error)
CreateIssue creates a new issue in a repository
func (*Client) CreatePullRequest ¶
func (c *Client) CreatePullRequest(ctx context.Context, owner, repo string, pr map[string]interface{}) (map[string]interface{}, error)
CreatePullRequest creates a new pull request
func (*Client) GetBranches ¶
func (c *Client) GetBranches(ctx context.Context, owner, repo string) ([]map[string]interface{}, error)
GetBranches fetches branches from a repository
func (*Client) GetCodeScanningAlerts ¶
func (c *Client) GetCodeScanningAlerts(ctx context.Context, owner, repo string) ([]map[string]interface{}, error)
GetCodeScanningAlerts fetches code scanning alerts
func (*Client) GetCommit ¶
func (c *Client) GetCommit(ctx context.Context, owner, repo, sha string) (map[string]interface{}, error)
GetCommit fetches a specific commit
func (*Client) GetDirectoryContent ¶
func (c *Client) GetDirectoryContent(ctx context.Context, owner, repo, path, ref string) ([]map[string]interface{}, error)
GetDirectoryContent fetches directory content from a repository
func (*Client) GetFileContent ¶
func (c *Client) GetFileContent(ctx context.Context, owner, repo, path, ref string) ([]byte, map[string]interface{}, error)
GetFileContent fetches file content from a repository
func (*Client) GetRepositoryByName ¶
func (c *Client) GetRepositoryByName(ctx context.Context, owner, repo string) (map[string]interface{}, error)
GetRepositoryByName fetches repository information
func (*Client) SearchCode ¶
func (c *Client) SearchCode(ctx context.Context, query string, options map[string]string) (map[string]interface{}, error)
SearchCode searches for code in repositories
func (*Client) SetContext ¶
func (c *Client) SetContext(context *translations.ContextVector7D)
SetContext updates the client context
type ClientCompatibilityAdapter ¶
type ClientCompatibilityAdapter struct {
// contains filtered or unexported fields
}
ClientCompatibilityAdapter adapts the advanced GitHub client implementation to provide compatibility with the older, simpler client interface
func NewClientCompatibilityAdapter ¶
func NewClientCompatibilityAdapter(token string, logger Logger) *ClientCompatibilityAdapter
NewClientCompatibilityAdapter creates a new adapter for the legacy client
func (*ClientCompatibilityAdapter) ApplyMobiusCompression ¶
func (a *ClientCompatibilityAdapter) ApplyMobiusCompression(data interface{}) (map[string]interface{}, error)
ApplyMobiusCompression applies Möbius compression to data
func (*ClientCompatibilityAdapter) CreateContext ¶
func (a *ClientCompatibilityAdapter) CreateContext(what, why string, extent float64) ContextVector7D
CreateContext creates a new context with the given values
func (*ClientCompatibilityAdapter) CreateIssue ¶
func (a *ClientCompatibilityAdapter) CreateIssue(owner, repo, title, body string, assignees []string) (*Issue, error)
CreateIssue creates a new issue in a GitHub repository
func (*ClientCompatibilityAdapter) GetContext ¶
func (a *ClientCompatibilityAdapter) GetContext() ContextVector7D
GetContext returns the current context
func (*ClientCompatibilityAdapter) GetFileContent ¶
func (a *ClientCompatibilityAdapter) GetFileContent(owner, repo, path, ref string) (*RepoContent, error)
GetFileContent returns the content of a file from a GitHub repository
func (*ClientCompatibilityAdapter) GetRepository ¶
func (a *ClientCompatibilityAdapter) GetRepository(owner, repo string) (*Repository, error)
GetRepository returns information about a GitHub repository
func (*ClientCompatibilityAdapter) GetUser ¶
func (a *ClientCompatibilityAdapter) GetUser(username string) (*User, error)
GetUser returns information about a GitHub user
func (*ClientCompatibilityAdapter) ListRepositoryContents ¶
func (a *ClientCompatibilityAdapter) ListRepositoryContents(owner, repo, path, ref string) ([]*DirectoryEntry, error)
ListRepositoryContents lists the contents of a directory in a GitHub repository
func (*ClientCompatibilityAdapter) ParseResourceURI ¶
func (a *ClientCompatibilityAdapter) ParseResourceURI(uri string) (*ResourceURI, error)
ParseResourceURI parses a resource URI into a ResourceURI struct
func (*ClientCompatibilityAdapter) WithContext ¶
func (a *ClientCompatibilityAdapter) WithContext(ctx ContextVector7D) *ClientCompatibilityAdapter
WithContext creates a copy of the client with updated context
type ClientOptions ¶
type ClientOptions struct {
Token string
APIBaseURL string
GraphQLBaseURL string
AcceptHeader string
UserAgent string
Timeout time.Duration
Logger *log.Logger
EnableCache bool
CacheTimeout time.Duration
RateLimitBuffer int
}
ClientOptions configures the GitHub client
type CodeScanAlert ¶
type CodeScanAlert struct {
Number int `json:"number"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
State string `json:"state"`
DismissedAt string `json:"dismissed_at,omitempty"`
DismissedBy User `json:"dismissed_by,omitempty"`
Rule struct {
ID string `json:"id"`
Severity string `json:"severity"`
Security string `json:"security_severity_level,omitempty"`
Description string `json:"description"`
} `json:"rule"`
Tool struct {
Name string `json:"name"`
Version string `json:"version,omitempty"`
} `json:"tool"`
MostRecentInstance struct {
Ref string `json:"ref"`
AnalysisKey string `json:"analysis_key"`
Location struct {
Path string `json:"path"`
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
StartColumn int `json:"start_column"`
EndColumn int `json:"end_column"`
} `json:"location"`
Message struct {
Text string `json:"text"`
} `json:"message"`
} `json:"most_recent_instance"`
}
CodeScanAlert represents a security alert from code scanning
type Commit ¶
type Commit struct {
SHA string `json:"sha"`
URL string `json:"url"`
Author User `json:"author,omitempty"`
Committer User `json:"committer,omitempty"`
Message string `json:"message,omitempty"`
}
Commit represents a Git commit
type ContextTranslator ¶
type ContextTranslator struct {
EnableCompression bool
EnableLogging bool
DebugMode bool
Logger *log.Logger
}
ContextTranslator provides bidirectional translation between GitHub context and TNOS 7D context
func NewContextTranslator ¶
func NewContextTranslator(logger *log.Logger, enableCompression, enableLogging, debugMode bool) *ContextTranslator
NewContextTranslator creates a new context translator instance
func (*ContextTranslator) CompressContext ¶
func (ct *ContextTranslator) CompressContext( context map[string]interface{}, ) (map[string]interface{}, error)
CompressContext applies Möbius compression to a context map
func (*ContextTranslator) GetTranslationStats ¶
func (ct *ContextTranslator) GetTranslationStats() map[string]interface{}
GetTranslationStats returns statistics about the translator
func (*ContextTranslator) TranslateFromTNOS ¶
func (t *ContextTranslator) TranslateFromTNOS(tnosContext map[string]interface{}) map[string]interface{}
TranslateFromTNOS converts TNOS 7D context to GitHub context
func (*ContextTranslator) TranslateGitHubToTNOS ¶
func (ct *ContextTranslator) TranslateGitHubToTNOS( githubContext *ContextVector7D, ) (*translations.ContextVector7D, error)
TranslateGitHubToTNOS translates GitHub context to TNOS context
func (*ContextTranslator) TranslateMapToTNOS ¶
func (ct *ContextTranslator) TranslateMapToTNOS( contextMap map[string]interface{}, ) (*translations.ContextVector7D, error)
TranslateMapToTNOS converts a map context to TNOS context
func (*ContextTranslator) TranslateTNOSToGitHub ¶
func (ct *ContextTranslator) TranslateTNOSToGitHub( tnosContext *translations.ContextVector7D, ) (*ContextVector7D, error)
TranslateTNOSToGitHub translates TNOS context to GitHub context
func (*ContextTranslator) TranslateTNOSToMap ¶
func (ct *ContextTranslator) TranslateTNOSToMap( tnosContext *translations.ContextVector7D, ) (map[string]interface{}, error)
TranslateTNOSToMap converts a TNOS context to a map
func (*ContextTranslator) TranslateToTNOS ¶
func (t *ContextTranslator) TranslateToTNOS(githubContext map[string]interface{}) map[string]interface{}
TranslateToTNOS converts GitHub context to TNOS 7D context
type ContextVector7D ¶
type ContextVector7D struct {
Who string `json:"who"`
What string `json:"what"`
When int64 `json:"when"`
Where string `json:"where"`
Why string `json:"why"`
How string `json:"how"`
Extent float64 `json:"extent"`
Meta map[string]interface{} `json:"meta,omitempty"`
}
ContextVector7D represents the 7-dimensional context vector used in GitHub MCP
func DefaultContextVector7D ¶
func DefaultContextVector7D() ContextVector7D
DefaultContextVector7D creates a default context vector with standard values
type DetailedAPIError ¶
type DetailedAPIError struct {
Message string `json:"message"`
StatusCode int `json:"status_code"`
RequestID string `json:"request_id"`
URL string `json:"url"`
}
DetailedAPIError represents a detailed error returned from the GitHub API This is separate from the APIError in models.go
func (*DetailedAPIError) Error ¶
func (e *DetailedAPIError) Error() string
Error implements the error interface for DetailedAPIError
type DirectoryEntry ¶
type DirectoryEntry struct {
Name string // Entry name
Path string // Entry path
Type string // Entry type (file, dir, symlink)
Size int // Entry size (for files)
SHA string // Entry SHA
URL string // API URL
HTMLURL string // Web URL
DownloadURL string // Download URL (for files)
}
DirectoryEntry represents an entry in a directory listing
type ExtendedCodeScanningAlert ¶
type ExtendedCodeScanningAlert struct {
CodeScanAlert // Embed base CodeScanAlert struct from models.go
InstancesCount int `json:"instances_count"`
FixedAt string `json:"fixed_at,omitempty"`
}
ExtendedCodeScanningAlert represents a code scanning alert with detailed information
type ExtendedIssue ¶
type ExtendedIssue struct {
Issue // Embed base Issue struct from models.go
Comments int `json:"comments"`
Assignees []User `json:"assignees"`
Labels []struct {
Name string `json:"name"`
Color string `json:"color"`
Description string `json:"description"`
} `json:"labels"`
Milestone struct {
Title string `json:"title"`
Description string `json:"description"`
DueOn string `json:"due_on"`
} `json:"milestone"`
ClosedAt string `json:"closed_at"`
}
ExtendedIssue represents a GitHub issue with extended information
type ExtendedPullRequest ¶
type ExtendedPullRequest struct {
PullRequest // Embed base PullRequest struct
Merged bool `json:"merged"`
MergedAt string `json:"merged_at"`
MergedBy User `json:"merged_by"`
Comments int `json:"comments"`
ReviewComments int `json:"review_comments"`
Commits int `json:"commits"`
Additions int `json:"additions"`
Deletions int `json:"deletions"`
ChangedFiles int `json:"changed_files"`
MaintainerCanModify bool `json:"maintainer_can_modify"`
}
ExtendedPullRequest represents a GitHub PR with extended information
type ExtendedRepository ¶
type ExtendedRepository struct {
Repository // Embed base Repository struct from models.go
ForksCount int `json:"forks_count"`
StargazersCount int `json:"stargazers_count"`
WatchersCount int `json:"watchers_count"`
OpenIssuesCount int `json:"open_issues_count"`
Topics []string `json:"topics"`
Language string `json:"language"`
HasIssues bool `json:"has_issues"`
HasProjects bool `json:"has_projects"`
HasWiki bool `json:"has_wiki"`
}
ExtendedRepository represents a GitHub repository with extended information
type ExtendedUser ¶
type ExtendedUser struct {
User // Embed base User struct from models.go
Following int `json:"following"`
Followers int `json:"followers"`
SiteAdmin bool `json:"site_admin"`
}
User represents a GitHub user Note: This extends the base User model from models.go with additional fields
type GetClientFn ¶
GetClientFn defines a function type to obtain GitHub clients
type Issue ¶
type Issue struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
URL string `json:"url"`
Number int `json:"number"`
Title string `json:"title"`
State string `json:"state"`
Locked bool `json:"locked"`
User User `json:"user"`
Body string `json:"body"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
HTMLURL string `json:"html_url"`
}
Issue represents a GitHub issue
type LegacyClientAdapter ¶
type LegacyClientAdapter struct {
// contains filtered or unexported fields
}
LegacyClientAdapter adapts the advanced client to the legacy interface
func NewLegacyClient ¶
func NewLegacyClient(token string, logger *log.Logger) *LegacyClientAdapter
NewLegacyClient creates a new legacy client adapter
func NewLegacyClientAdapter ¶
func NewLegacyClientAdapter(token string, logger *log.Logger) *LegacyClientAdapter
NewLegacyClientAdapter creates a new legacy client adapter with default context
type Logger ¶
type Logger interface {
Debug(msg string, args ...interface{})
Info(msg string, args ...interface{})
Error(msg string, args ...interface{})
}
Logger defines a custom logger interface that supports structured logging
type MCPBridge ¶
type MCPBridge struct {
// contains filtered or unexported fields
}
MCPBridge implements the bridge between GitHub MCP and TNOS MCP
func NewMCPBridge ¶
func NewMCPBridge(options MCPBridgeOptions) (*MCPBridge, error)
NewMCPBridge creates a new MCP bridge
func (*MCPBridge) GetState ¶
func (b *MCPBridge) GetState() MCPBridgeState
GetState returns the current state of the MCP bridge
func (*MCPBridge) GetStats ¶
func (b *MCPBridge) GetStats() BridgeStats
GetStats returns statistics about the MCP bridge
func (*MCPBridge) HealthCheck ¶
HealthCheck performs a health check on the MCP bridge
func (*MCPBridge) SendOperation ¶
func (b *MCPBridge) SendOperation( operation string, data map[string]interface{}, context map[string]interface{}, ) error
SendOperation sends an operation to TNOS MCP
func (*MCPBridge) SyncContext ¶
SyncContext synchronizes context between GitHub and TNOS
type MCPBridgeOptions ¶
type MCPBridgeOptions struct {
// URL of the TNOS MCP server
TNOSMCPURL string
// Authentication token for GitHub API
GithubToken string
// Logger instance
Logger *log.Logger
// Whether to enable context compression
EnableCompression bool
// Whether to preserve metadata during context translation
PreserveMetadata bool
// Whether to enforce strict context mapping
StrictMapping bool
// Interval to attempt reconnection on disconnect
ReconnectInterval time.Duration
// Heartbeat interval for keepalive
HeartbeatInterval time.Duration
// Timeout for operations
OperationTimeout time.Duration
}
MCPBridgeOptions represents configuration options for the MCP bridge
func DefaultMCPBridgeOptions ¶
func DefaultMCPBridgeOptions() MCPBridgeOptions
DefaultMCPBridgeOptions returns default options for the MCP bridge
type MCPBridgeState ¶
type MCPBridgeState string
MCPBridgeState represents the state of the MCP bridge
const ( // MCPBridgeStateInitializing indicates the bridge is initializing MCPBridgeStateInitializing MCPBridgeState = "initializing" // MCPBridgeStateConnecting indicates the bridge is connecting MCPBridgeStateConnecting MCPBridgeState = "connecting" // MCPBridgeStateConnected indicates the bridge is connected MCPBridgeStateConnected MCPBridgeState = "connected" // MCPBridgeStateReconnecting indicates the bridge is reconnecting MCPBridgeStateReconnecting MCPBridgeState = "reconnecting" // MCPBridgeStateDisconnected indicates the bridge is disconnected MCPBridgeStateDisconnected MCPBridgeState = "disconnected" // MCPBridgeStateStopping indicates the bridge is stopping MCPBridgeStateStopping MCPBridgeState = "stopping" // MCPBridgeStateError indicates the bridge has an error MCPBridgeStateError MCPBridgeState = "error" )
type OrganizationMember ¶
type OrganizationMember struct {
Login string `json:"login"`
ID int64 `json:"id"`
AvatarURL string `json:"avatar_url"`
HTMLURL string `json:"html_url"`
Role string `json:"role"`
}
OrganizationMember represents a member of a GitHub organization
type PaginationParams ¶
type PaginationParams struct {
// contains filtered or unexported fields
}
WHO: PaginationManager WHAT: Pagination Parameter Structure WHEN: During parameter processing WHERE: GitHub MCP Server WHY: To standardize pagination parameter handling HOW: By grouping pagination parameters in a struct EXTENT: All paginated requests
func OptionalPaginationParams ¶
func OptionalPaginationParams(r mcp.CallToolRequest) (PaginationParams, error)
WHO: PaginationHelper WHAT: Pagination Parameter Extraction WHEN: During parameter processing WHERE: GitHub MCP Server WHY: To safely extract pagination parameters HOW: By checking parameters and providing defaults EXTENT: All paginated requests
type PullRequest ¶
type PullRequest struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
Number int `json:"number"`
State string `json:"state"`
Title string `json:"title"`
Body string `json:"body"`
User User `json:"user"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
HTMLURL string `json:"html_url"`
URL string `json:"url"`
Head struct {
Ref string `json:"ref"`
SHA string `json:"sha"`
Repo Repository `json:"repo"`
} `json:"head"`
Base struct {
Ref string `json:"ref"`
SHA string `json:"sha"`
Repo Repository `json:"repo"`
} `json:"base"`
}
PullRequest represents a GitHub pull request
type RateLimit ¶
type RateLimit struct {
Limit int `json:"limit"`
Remaining int `json:"remaining"`
Reset int64 `json:"reset"`
Used int `json:"used"`
}
RateLimit represents GitHub API rate limit information
type Release ¶
type Release struct {
ID int64 `json:"id"`
TagName string `json:"tag_name"`
Target string `json:"target_commitish"`
Name string `json:"name"`
Body string `json:"body"`
Draft bool `json:"draft"`
Prerelease bool `json:"prerelease"`
CreatedAt string `json:"created_at"`
PublishedAt string `json:"published_at"`
Author User `json:"author"`
Assets []struct {
ID int64 `json:"id"`
Name string `json:"name"`
Label string `json:"label"`
ContentType string `json:"content_type"`
State string `json:"state"`
Size int `json:"size"`
DownloadCount int `json:"download_count"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
BrowserDownloadURL string `json:"browser_download_url"`
} `json:"assets"`
}
Release represents a GitHub release
type RepoContent ¶
type RepoContent struct {
Name string `json:"name"`
Path string `json:"path"`
SHA string `json:"sha"`
Size int `json:"size"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
GitURL string `json:"git_url"`
DownloadURL string `json:"download_url"`
Type string `json:"type"`
Content string `json:"content"`
Encoding string `json:"encoding"`
}
RepoContent represents content retrieved from a repository
type Repository ¶
type Repository struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
Name string `json:"name"`
FullName string `json:"full_name"`
Description string `json:"description"`
Private bool `json:"private"`
Owner User `json:"owner"`
HTMLURL string `json:"html_url"`
URL string `json:"url"`
DefaultBranch string `json:"default_branch"`
}
Repository represents a GitHub repository
type ResourceURI ¶
type ResourceURI struct {
Scheme string // e.g., 'repo'
Owner string // Repository owner
Repo string // Repository name
Type string // Resource type (e.g., 'contents', 'refs', 'sha')
Reference string // Branch name, SHA, etc.
Path string // File/directory path
Query map[string]string // Query parameters
Fragment string // Fragment identifier
}
ResourceURI represents a parsed GitHub resource URI
type SearchQueryBuilder ¶
type SearchQueryBuilder struct {
// contains filtered or unexported fields
}
SearchQueryBuilder helps construct GitHub search queries
func NewSearchQueryBuilder ¶
func NewSearchQueryBuilder(type_ string) *SearchQueryBuilder
NewSearchQueryBuilder creates a new search query builder for the specified type
func (*SearchQueryBuilder) AddLanguage ¶
func (b *SearchQueryBuilder) AddLanguage(language string) *SearchQueryBuilder
AddLanguage adds a language filter to the search
func (*SearchQueryBuilder) AddRepoFilter ¶
func (b *SearchQueryBuilder) AddRepoFilter(owner, repo string) *SearchQueryBuilder
AddRepoFilter adds a repository filter to the search
func (*SearchQueryBuilder) AddTerm ¶
func (b *SearchQueryBuilder) AddTerm(term string) *SearchQueryBuilder
AddTerm adds a search term to the builder
func (*SearchQueryBuilder) Build ¶
func (b *SearchQueryBuilder) Build() string
Build builds the final search query string
type SearchResult ¶
type SearchResult struct {
TotalCount int `json:"total_count"`
IncompleteResults bool `json:"incomplete_results"`
Items []interface{} `json:"items"`
ItemsTyped map[string][]interface{} // Typed items by resource type
}
SearchResult represents a GitHub search result
type TeamMember ¶
type TeamMember struct {
Login string `json:"login"`
ID int64 `json:"id"`
AvatarURL string `json:"avatar_url"`
HTMLURL string `json:"html_url"`
Role string `json:"role"`
}
TeamMember represents a member of a GitHub team
type TranslationHelperFunc ¶
TranslationHelperFunc defines a function type for translations
type User ¶
type User struct {
Login string `json:"login"`
ID int64 `json:"id"`
NodeID string `json:"node_id"`
AvatarURL string `json:"avatar_url"`
HTMLURL string `json:"html_url"`
Name string `json:"name"`
Email string `json:"email"`
URL string `json:"url"`
Type string `json:"type"`
}
User represents a GitHub user
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
UserService provides methods for working with GitHub users
func NewUserService ¶
func NewUserService(client *Client) *UserService
NewUserService creates a new user service
func (*UserService) Get ¶
func (s *UserService) Get(username string) (*User, error)
Get retrieves a user by username
func (*UserService) GetAuthenticated ¶
func (s *UserService) GetAuthenticated() (*User, error)
GetAuthenticated retrieves the authenticated user
func (*UserService) GetContext ¶
func (s *UserService) GetContext() map[string]interface{}
GetContext retrieves the 7D context for user operations
func (*UserService) ListFollowers ¶
func (s *UserService) ListFollowers(username string) ([]User, error)
ListFollowers retrieves followers for a user
func (*UserService) ListFollowing ¶
func (s *UserService) ListFollowing(username string) ([]User, error)
ListFollowing retrieves users that a user is following
type WorkflowJob ¶
type WorkflowJob struct {
ID int64 `json:"id"`
RunID int64 `json:"run_id"`
Name string `json:"name"`
Status string `json:"status"`
Conclusion string `json:"conclusion"`
StartedAt string `json:"started_at"`
CompletedAt string `json:"completed_at"`
Steps []struct {
Name string `json:"name"`
Status string `json:"status"`
Conclusion string `json:"conclusion"`
Number int `json:"number"`
} `json:"steps"`
}
WorkflowJob represents a job within a GitHub Actions workflow
type WorkflowRun ¶
type WorkflowRun struct {
ID int64 `json:"id"`
Name string `json:"name"`
HeadBranch string `json:"head_branch"`
HeadSHA string `json:"head_sha"`
RunNumber int `json:"run_number"`
Event string `json:"event"`
Status string `json:"status"`
Conclusion string `json:"conclusion"`
WorkflowID int64 `json:"workflow_id"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
WorkflowRun represents a GitHub Actions workflow run