UNPKG

@noanswer/context-compose

Version:

Orchestrate complex AI interactions with Context Compose. A powerful CLI and server for building, validating, and managing context for large language models using the Model Context Protocol (MCP).

55 lines (47 loc) 1.8 kB
version: 1 kind: mcp name: github-api description: GitHub API integration for repository management and automation prompt: | Automate your GitHub workflows using the GitHub API and `gh` CLI. Manage repositories, branches, issues, and pull requests programmatically. This allows for powerful integrations, custom tooling, and streamlined development processes, directly from your command line or scripts. enhanced-prompt: | # 🐙 GitHub API Integration ## 1. Authentication First, ensure you are authenticated. Your `GITHUB_TOKEN` environment variable should be set for non-interactive use. ```bash # Check authentication status gh auth status ``` ## 2. Common Repository Operations **A. View Repository Info** ```bash gh repo view owner/repo ``` **B. Create a Branch** This requires getting the SHA of the base branch first. ```bash BASE_SHA=$(gh api repos/owner/repo/git/ref/heads/main -q '.object.sha') gh api repos/owner/repo/git/refs \ --method POST \ -f ref="refs/heads/new-feature" \ -f sha="$BASE_SHA" ``` ## 3. Issue & PR Management **A. Create an Issue** ```bash gh issue create --title "New Feature Request" --body "Details here." ``` **B. Create a Pull Request** ```bash gh pr create --title "Feature" --body "Implementation details." --base main ``` ## 4. Automation Best Practices - **Scoped Tokens:** Use tokens with the minimum required permissions. - **Error Handling:** Check exit codes and API responses for errors. - **Rate Limiting:** Be mindful of API rate limits in scripts. - **Idempotency:** Design scripts to be safely repeatable. - **Logging:** Keep a record of operations for auditing purposes. **🎯 Result:** Automated GitHub workflows with improved security and reliability.