The GitHub Plugin is a tinystruct-based extension that provides seamless integration with Git and GitHub services. Built on the Machine Communication Protocol (MCP) framework, this plugin enables applications to perform Git operations and interact with GitHub APIs through a standardized JSON-RPC interface.
-
Git Operations
- Clone repositories to local storage
- Pull updates from remote repositories
- Push local changes to remote repositories
- Check repository status with detailed file tracking
-
GitHub Integration
- Fetch and manage repository issues
- List and interact with pull requests
- Access GitHub Actions workflows
- Java 8 or higher
- tinystruct framework
- Maven
-
Clone the repository:
git clone https://github.com/tinystruct/github-plugin.git
-
Install with Maven:
cd github-plugin mvn clean install -
Add the dependency to your project's
pom.xml:<dependency> <groupId>org.tinystruct</groupId> <artifactId>github-mcp</artifactId> <version>1.0.0</version> </dependency>
The plugin automatically creates a default directory named cloned-repos for storing cloned repositories. You can integrate the plugin with your tinystruct application by adding it to your application configuration.
The GitHub plugin follows the MCP initialization protocol:
// Initialize the GitHub MCP application
GitHub githubApp = new GitHub();
githubApp.init();All operations are accessible through the JSON-RPC endpoint at /github/rpc. Here are examples of the available operations:
{
"jsonrpc": "2.0",
"id": "request-1",
"method": "git.clone",
"params": {
"repository": "https://github.com/username/repo.git",
"branch": "main"
}
}{
"jsonrpc": "2.0",
"id": "request-2",
"method": "git.pull",
"params": {
"repository_path": "/path/to/local/repo",
"branch": "main"
}
}{
"jsonrpc": "2.0",
"id": "request-3",
"method": "git.push",
"params": {
"repository_path": "/path/to/local/repo",
"remote": "origin",
"branch": "main"
}
}{
"jsonrpc": "2.0",
"id": "request-4",
"method": "git.status",
"params": {
"repository_path": "/path/to/local/repo"
}
}{
"jsonrpc": "2.0",
"id": "request-5",
"method": "github.issues",
"params": {
"repository": "username/repo",
"token": "your-github-token",
"state": "open"
}
}{
"jsonrpc": "2.0",
"id": "request-6",
"method": "github.prs",
"params": {
"repository": "username/repo",
"token": "your-github-token",
"state": "open"
}
}{
"jsonrpc": "2.0",
"id": "request-7",
"method": "github.actions",
"params": {
"repository": "username/repo",
"token": "your-github-token"
}
}All responses follow the JSON-RPC 2.0 specification:
{
"jsonrpc": "2.0",
"id": "request-id",
"result": {
"status": "success",
"repository": "https://github.com/username/repo.git",
"branch": "main",
"target_path": "cloned-repos/repo"
}
}- For GitHub API operations, you need to provide a valid GitHub personal access token with appropriate permissions.
- For Git operations that require authentication, you'll need to configure your Git credentials separately.
The plugin follows the JSON-RPC 2.0 specification for error handling:
{
"jsonrpc": "2.0",
"id": "request-id",
"error": {
"code": -32603,
"message": "Git clone failed: Authentication failed"
}
}This plugin extends the MCPApplication class from the tinystruct framework, making it compatible with the standard tinystruct application lifecycle and configuration system.
git clone https://github.com/tinystruct/github-plugin.git
cd github-plugin
mvn clean packagemvn testThis project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
For support and questions, please open an issue on the GitHub repository.