Documentation
¶
Index ¶
- Constants
- func BoolPtr(b bool) *bool
- func Float64Ptr(f float64) *float64
- func IntPtr(i int) *int
- func Register[I, O any](s *mcp.Server, i ToolImpl[I, O])
- type Client
- func (c *Client) MyAddIssueDependency(owner, repo string, index int64, dependency MyIssueMeta) (*forgejo.Issue, error)
- func (c *Client) MyCreateIssueAttachment(owner, repo string, index int64, filename string, file io.Reader, name string, ...) (*forgejo.Attachment, error)
- func (c *Client) MyCreateWikiPage(owner, repo string, options MyCreateWikiPageOptions) (*MyWikiPage, error)
- func (c *Client) MyDeleteIssueAttachment(owner, repo string, index, attachmentID int64) error
- func (c *Client) MyDeleteWikiPage(owner, repo, pageName string) error
- func (c *Client) MyEditIssueAttachment(owner, repo string, index, attachmentID int64, options MyEditAttachmentOptions) (*forgejo.Attachment, error)
- func (c *Client) MyEditWikiPage(owner, repo, pageName string, options MyCreateWikiPageOptions) (*MyWikiPage, error)
- func (c *Client) MyGetWikiPage(owner, repo, pageName string) (*MyWikiPage, error)
- func (c *Client) MyListActionTasks(owner, repo string) (*MyActionTaskResponse, error)
- func (c *Client) MyListIssueAttachments(owner, repo string, index int64) ([]*forgejo.Attachment, error)
- func (c *Client) MyListIssueDependencies(owner, repo string, index int64) ([]*forgejo.Issue, error)
- func (c *Client) MyListWikiPages(owner, repo string) ([]*MyWikiPageMetaData, error)
- func (c *Client) MyRemoveIssueDependency(owner, repo string, index int64, dependency MyIssueMeta) (*forgejo.Issue, error)
- type MyActionTask
- type MyActionTaskResponse
- type MyCreateWikiPageOptions
- type MyEditAttachmentOptions
- type MyIssueMeta
- type MyWikiCommit
- type MyWikiPage
- type MyWikiPageMetaData
- type ToolImpl
Constants ¶
const UserAgent = "Forgejo-MCP/0.0.1"
Variables ¶
This section is empty.
Functions ¶
func BoolPtr ¶
BoolPtr creates a pointer to a bool value. This is useful for setting optional boolean fields in structs that will be serialized to JSON, such as in MCP tool definitions.
func Float64Ptr ¶
Float64Ptr creates a pointer to a float64 value. This is useful for setting optional number fields in structs that will be serialized to JSON, such as in MCP tool definitions.
Types ¶
type Client ¶
Client wraps the Forgejo SDK client with additional functionality for unsupported API endpoints. It provides methods for JSON requests and multipart file uploads with manual authentication.
func NewClient ¶
NewClient creates a new Client instance with extended functionality beyond the standard Forgejo SDK. This client supports custom API endpoints that are not available in the SDK, such as issue dependencies, wiki pages, and Forgejo Actions.
Parameters:
- base: Forgejo server base URL (e.g., "https://git.example.com")
- token: API access token for authentication
- version: Forgejo version string to skip version check, empty to auto-detect
- cl: HTTP client to use, nil for http.DefaultClient
The client uses manual token authentication for custom endpoints while preserving full SDK functionality for supported operations.
func (*Client) MyAddIssueDependency ¶
func (c *Client) MyAddIssueDependency(owner, repo string, index int64, dependency MyIssueMeta) (*forgejo.Issue, error)
MyAddIssueDependency adds a dependency to an issue. POST /repos/{owner}/{repo}/issues/{index}/dependencies
func (*Client) MyCreateIssueAttachment ¶
func (c *Client) MyCreateIssueAttachment(owner, repo string, index int64, filename string, file io.Reader, name string, updatedAt string) (*forgejo.Attachment, error)
MyCreateIssueAttachment creates a new attachment for an issue. POST /repos/{owner}/{repo}/issues/{index}/assets
func (*Client) MyCreateWikiPage ¶
func (c *Client) MyCreateWikiPage(owner, repo string, options MyCreateWikiPageOptions) (*MyWikiPage, error)
MyCreateWikiPage creates a new wiki page. POST /repos/{owner}/{repo}/wiki/new
func (*Client) MyDeleteIssueAttachment ¶
MyDeleteIssueAttachment deletes an attachment from an issue. DELETE /repos/{owner}/{repo}/issues/{index}/assets/{attachment_id}
func (*Client) MyDeleteWikiPage ¶
MyDeleteWikiPage deletes a wiki page. DELETE /repos/{owner}/{repo}/wiki/page/{pageName}
func (*Client) MyEditIssueAttachment ¶
func (c *Client) MyEditIssueAttachment(owner, repo string, index, attachmentID int64, options MyEditAttachmentOptions) (*forgejo.Attachment, error)
MyEditIssueAttachment edits an attachment of an issue. PATCH /repos/{owner}/{repo}/issues/{index}/assets/{attachment_id}
func (*Client) MyEditWikiPage ¶
func (c *Client) MyEditWikiPage(owner, repo, pageName string, options MyCreateWikiPageOptions) (*MyWikiPage, error)
MyEditWikiPage edits an existing wiki page. PATCH /repos/{owner}/{repo}/wiki/page/{pageName}
func (*Client) MyGetWikiPage ¶
func (c *Client) MyGetWikiPage(owner, repo, pageName string) (*MyWikiPage, error)
MyGetWikiPage gets a single wiki page by name. GET /repos/{owner}/{repo}/wiki/page/{pageName}
func (*Client) MyListActionTasks ¶
func (c *Client) MyListActionTasks(owner, repo string) (*MyActionTaskResponse, error)
MyListActionTasks lists all Forgejo Actions tasks in a repository. GET /repos/{owner}/{repo}/actions/tasks
func (*Client) MyListIssueAttachments ¶
func (c *Client) MyListIssueAttachments(owner, repo string, index int64) ([]*forgejo.Attachment, error)
MyListIssueAttachments lists all attachments of an issue. GET /repos/{owner}/{repo}/issues/{index}/assets
func (*Client) MyListIssueDependencies ¶
MyListIssueDependencies lists all dependencies of an issue. GET /repos/{owner}/{repo}/issues/{index}/dependencies
func (*Client) MyListWikiPages ¶
func (c *Client) MyListWikiPages(owner, repo string) ([]*MyWikiPageMetaData, error)
MyListWikiPages lists all wiki pages in a repository. GET /repos/{owner}/{repo}/wiki/pages
func (*Client) MyRemoveIssueDependency ¶
func (c *Client) MyRemoveIssueDependency(owner, repo string, index int64, dependency MyIssueMeta) (*forgejo.Issue, error)
MyRemoveIssueDependency removes a dependency from an issue. DELETE /repos/{owner}/{repo}/issues/{index}/dependencies
type MyActionTask ¶
type MyActionTask struct {
ID int64 `json:"id"`
Name string `json:"name"`
DisplayTitle string `json:"display_title"`
Status string `json:"status"`
Event string `json:"event"`
WorkflowID string `json:"workflow_id"`
HeadBranch string `json:"head_branch"`
HeadSHA string `json:"head_sha"`
RunNumber int64 `json:"run_number"`
URL string `json:"url"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
RunStartedAt time.Time `json:"run_started_at"`
}
MyActionTask represents a Forgejo Actions task.
type MyActionTaskResponse ¶
type MyActionTaskResponse struct {
TotalCount int64 `json:"total_count"`
WorkflowRuns []*MyActionTask `json:"workflow_runs"`
}
MyActionTaskResponse represents the response for listing action tasks.
type MyCreateWikiPageOptions ¶
type MyCreateWikiPageOptions struct {
Title string `json:"title"`
ContentBase64 string `json:"content_base64"`
Message string `json:"message,omitempty"`
}
MyCreateWikiPageOptions represents options for creating a wiki page.
type MyEditAttachmentOptions ¶
type MyEditAttachmentOptions struct {
Name string `json:"name,omitempty"`
DownloadURL string `json:"browser_download_url,omitempty"`
}
MyEditAttachmentOptions extends the SDK version with missing fields.
type MyIssueMeta ¶
type MyIssueMeta struct {
Index int64 `json:"index"`
Owner string `json:"owner,omitempty"`
Name string `json:"repo,omitempty"`
}
MyIssueMeta represents basic issue information for dependency operations. This type is not available in the Forgejo SDK.
type MyWikiCommit ¶
type MyWikiCommit struct {
ID string `json:"sha"`
Author *forgejo.CommitUser `json:"author"`
Committer *forgejo.CommitUser `json:"commiter"` // Note: API has typo "commiter"
Message string `json:"message"`
}
MyWikiCommit represents wiki page commit/revision information.
type MyWikiPage ¶
type MyWikiPage struct {
Title string `json:"title"`
HTMLURL string `json:"html_url"`
SubURL string `json:"sub_url"`
LastCommit *MyWikiCommit `json:"last_commit"`
ContentBase64 string `json:"content_base64"`
CommitCount int64 `json:"commit_count"`
Sidebar string `json:"sidebar"`
}
MyWikiPage represents a complete wiki page with content.
type MyWikiPageMetaData ¶
type MyWikiPageMetaData struct {
Title string `json:"title"`
HTMLURL string `json:"html_url"`
SubURL string `json:"sub_url"`
LastCommit *MyWikiCommit `json:"last_commit"`
}
MyWikiPageMetaData represents wiki page meta information.
type ToolImpl ¶
type ToolImpl[In, Out any] interface { // Definition returns the formal MCP tool definition, including its name, // description, and input schema. Definition() *mcp.Tool // Handler returns the function that contains the core logic of the tool. // This function is executed when the tool is called by an MCP client. Handler() mcp.ToolHandlerFor[In, Out] }
ToolImpl defines the interface that every tool implementation must satisfy. This interface standardizes how tools are defined and handled, ensuring they can be registered with the MCP server consistently.
The generic types In and Out represent the tool's input and output data structures.