Version: 2.0 - Unified Documentation System Last Updated: 2025-09-06 Purpose: Optimize GitHub MCP usage for repository management and CI/CD integration
GitHub MCP server provides comprehensive repository management and CI/CD monitoring capabilities. It's the most heavily used MCP server and serves as the backbone for development workflow integration.
- Current Usage: 90 tool uses (heavily utilized)
- Usage Pattern: Primarily CI/CD monitoring and artifact analysis
- Primary Value: Development workflow automation and monitoring
// Read repository files
get_file_contents({
owner: "ElliotBadinger",
repo: "echo",
path: "build.gradle.kts"
})
// Create/update files (USE CAUTION - see synchronization rules)
create_or_update_file({
owner: "ElliotBadinger",
repo: "echo",
path: "docs/project-state/current-status.md",
content: "...",
message: "Update project status documentation"
})// Get repository details
get_repository({
owner: "ElliotBadinger",
repo: "echo"
})
// List repository contents
list_repository_contents({
owner: "ElliotBadinger",
repo: "echo",
path: "docs"
})// Monitor CI workflow status
list_workflow_runs({
owner: "ElliotBadinger",
repo: "echo",
workflow_id: "android-ci.yml",
per_page: 5
})
// Get specific workflow run details
get_workflow_run({
owner: "ElliotBadinger",
repo: "echo",
run_id: 12345
})// Analyze failed jobs
get_job_logs({
owner: "ElliotBadinger",
repo: "echo",
run_id: 12345,
failed_only: true,
return_content: true
})
// Get job timing information
get_workflow_run_usage({
owner: "ElliotBadinger",
repo: "echo",
run_id: 12345
})// Download test artifacts
download_workflow_run_artifact({
owner: "ElliotBadinger",
repo: "echo",
artifact_id: 67890
})
// List workflow artifacts
list_workflow_run_artifacts({
owner: "ElliotBadinger",
repo: "echo",
run_id: 12345
})- Always check remote CI/CD status first and address failures before beginning local TIER 1 work.
- Why: Remote CI validates a clean environment and protects the mainline; resolving remote failures first prevents divergence and wasted local effort.
- list_workflows β identify CI workflow(s)
- list_workflow_runs β inspect latest run(s)
- If failure: get_job_logs (failed_only=true, return_content=true) β identify error
- Fix or open an issue/PR to address the failure
- Re-run failed jobs or workflow as needed
Once remote CI is green, proceed to local TIER 1 (build/test on your machine).
// Check current CI status before making changes
list_workflow_runs({
owner: "ElliotBadinger",
repo: "echo",
workflow_id: "android-ci.yml",
per_page: 3
})// Monitor CI after pushing changes
const monitorCI = async () => {
const runs = await list_workflow_runs({
owner: "ElliotBadinger",
repo: "echo",
workflow_id: "android-ci.yml",
per_page: 1
});
const latestRun = runs[0];
if (latestRun.status === 'completed') {
if (latestRun.conclusion === 'success') {
console.log('β
CI passed successfully');
} else {
// Get failure details
const logs = await get_job_logs({
owner: "ElliotBadinger",
repo: "echo",
run_id: latestRun.id,
failed_only: true,
return_content: true
});
console.log('β CI failed:', logs);
}
}
};// Track CI performance over time
get_workflow_run_usage({
owner: "ElliotBadinger",
repo: "echo",
run_id: 12345
})
// Returns: billable time, run duration, etc.// β
SAFE: Read operations
get_file_contents({
owner: "ElliotBadinger",
repo: "echo",
path: "README.md"
})
// β AVOID: Direct write operations (use manual git)
create_or_update_file({
owner: "ElliotBadinger",
repo: "echo",
path: "source.kt",
content: "..."
})- NEVER use GitHub MCP push_files() - Creates commits bypassing local git
- ALWAYS coordinate with user before using GitHub MCP write operations
- Use manual git commands for all commits and pushes
- Document any GitHub MCP usage for transparency
- Primary Usage: CI/CD monitoring and artifact analysis
- Secondary Usage: Repository content reading
- Effectiveness: High for workflow monitoring, variable for content management
- Integration Rate: Well-integrated into development workflow
- Increase Read Operations: Use more for repository analysis
- Improve CI Monitoring: Automate CI status tracking
- Enhance Artifact Analysis: Better utilization of test artifacts
- Workflow Optimization: Use insights for CI/CD improvements
// Implement automated CI status checking
const monitorImplementation = async (commitSha) => {
// Wait for CI to start
await waitForWorkflowStart(commitSha);
// Monitor progress
const status = await pollWorkflowStatus(commitSha);
// Analyze results
if (status === 'success') {
await analyzeSuccessfulBuild(commitSha);
} else {
await analyzeFailedBuild(commitSha);
}
};// Comprehensive failure analysis
const analyzeBuildFailure = async (runId) => {
// Get job logs
const logs = await get_job_logs({
owner: "ElliotBadinger",
repo: "echo",
run_id: runId,
failed_only: true,
return_content: true
});
// Download artifacts
const artifacts = await list_workflow_run_artifacts({
owner: "ElliotBadinger",
repo: "echo",
run_id: runId
});
// Analyze and report
const analysis = analyzeLogsAndArtifacts(logs, artifacts);
return analysis;
};// Use GitHub MCP to validate research implementation
const validateResearchImplementation = async () => {
// Push research-based changes
// Monitor CI for validation
const ciResult = await monitorCI();
// Analyze performance impact
if (ciResult.success) {
const performance = await get_workflow_run_usage({
owner: "ElliotBadinger",
repo: "echo",
run_id: ciResult.runId
});
// Document research effectiveness
documentResearchImpact(research, performance);
}
};// Validate Kotlin migration through CI
const validateKotlinMigration = async (convertedFile) => {
// Push converted Kotlin file
// Monitor CI compilation
const compilationResult = await monitorCI();
// Check for Kotlin-specific issues
if (compilationResult.success) {
// Verify Kotlin best practices
const kotlinAnalysis = analyzeKotlinCode(convertedFile);
// Update migration progress
updateMigrationStatus(convertedFile, kotlinAnalysis);
}
};// Use CI for performance validation
const validatePerformanceOptimizations = async () => {
// Run performance tests in CI
const performanceResults = await runPerformanceTests();
// Download performance artifacts
const artifacts = await download_workflow_run_artifact({
owner: "ElliotBadinger",
repo: "echo",
artifact_id: performanceResults.artifactId
});
// Analyze performance improvements
const analysis = analyzePerformanceData(artifacts);
// Update performance metrics
updatePerformanceMetrics(analysis);
};// Implement comprehensive CI monitoring
class CIMonitor {
constructor(owner, repo) {
this.owner = owner;
this.repo = repo;
}
async monitorWorkflow(workflowId) {
const runs = await list_workflow_runs({
owner: this.owner,
repo: this.repo,
workflow_id: workflowId,
per_page: 10
});
return runs.map(run => ({
id: run.id,
status: run.status,
conclusion: run.conclusion,
created_at: run.created_at,
updated_at: run.updated_at
}));
}
async getFailureDetails(runId) {
const logs = await get_job_logs({
owner: this.owner,
repo: this.repo,
run_id: runId,
failed_only: true,
return_content: true
});
return parseFailureLogs(logs);
}
}// Analyze repository structure and quality
const analyzeRepository = async () => {
// Get repository contents
const contents = await list_repository_contents({
owner: "ElliotBadinger",
repo: "echo",
path: ""
});
// Analyze structure
const structure = analyzeProjectStructure(contents);
// Check for quality indicators
const quality = assessCodeQuality(structure);
return { structure, quality };
};// Monitor branch status and activity
const monitorBranches = async () => {
const branches = await list_branches({
owner: "ElliotBadinger",
repo: "echo"
});
const branchStatus = await Promise.all(
branches.map(async (branch) => {
const commits = await list_commits({
owner: "ElliotBadinger",
repo: "echo",
sha: branch.commit.sha,
per_page: 5
});
return {
name: branch.name,
last_commit: commits[0],
status: analyzeBranchHealth(commits)
};
})
);
return branchStatus;
};- Issue: GitHub MCP commits bypass local git
- Solution: Always coordinate with user before GitHub MCP operations
- Prevention: Use manual git for all commits and pushes
- Issue: GitHub API rate limiting
- Solution: Implement request throttling and caching
- Prevention: Monitor usage and implement efficient querying
- Issue: CI workflow not starting after push
- Solution: Check workflow configuration and trigger conditions
- Prevention: Validate workflow setup before pushing changes
- Issue: Unable to download CI artifacts
- Solution: Check artifact retention policies and availability
- Prevention: Download artifacts immediately after CI completion
- Batch Requests: Group related API calls to reduce overhead
- Cache Results: Cache frequently accessed repository data
- Selective Monitoring: Monitor only relevant workflows and branches
- Efficient Queries: Use specific filters to reduce result sets
- CI Monitoring Coverage: Percentage of builds monitored
- Failure Detection Speed: Time to detect and analyze failures
- Artifact Utilization: Percentage of available artifacts downloaded
- Workflow Optimization: Improvements in CI/CD efficiency
- Development Velocity: Impact on development speed
- Issue Resolution: Effectiveness in debugging and fixing issues
- Process Automation: Level of workflow automation achieved
- Team Productivity: Overall impact on development productivity
// Implement comprehensive monitoring
const createMonitoringDashboard = async () => {
const dashboard = {
ci_status: await monitorCIStatus(),
repository_health: await analyzeRepositoryHealth(),
workflow_performance: await analyzeWorkflowPerformance(),
artifact_utilization: await trackArtifactUsage()
};
return dashboard;
};// Generate weekly GitHub MCP usage reports
const generateWeeklyReport = async () => {
const report = {
period: getCurrentWeek(),
ci_runs_monitored: await countCIMonitored(),
failures_analyzed: await countFailuresAnalyzed(),
artifacts_downloaded: await countArtifactsDownloaded(),
time_saved: calculateTimeSaved(),
effectiveness_rating: calculateEffectiveness()
};
return report;
};- Read Operations First: Use read operations extensively for analysis
- Coordinate Write Operations: Always coordinate with user for write operations
- Monitor CI Actively: Implement comprehensive CI monitoring
- Analyze Failures Thoroughly: Use detailed job logs and artifacts
- Track Performance: Monitor workflow performance and optimization opportunities
- Validate Results: Always verify GitHub MCP results
- Handle Errors Gracefully: Implement proper error handling
- Document Usage: Record GitHub MCP usage for transparency
- Optimize Queries: Use efficient querying patterns
- Monitor API Limits: Track and manage API usage
- Framework Integration: Use GitHub MCP across all development frameworks
- Automation Focus: Automate repetitive monitoring and analysis tasks
- Quality Metrics: Track and improve effectiveness metrics
- Process Documentation: Document successful integration patterns
- Continuous Improvement: Regularly review and optimize usage
- Optimize CI monitoring workflows
- Implement automated failure analysis
- Improve artifact utilization
- Enhance repository analysis capabilities
- Achieve comprehensive CI coverage
- Implement automated performance tracking
- Develop advanced workflow analytics
- Create repository health monitoring
- GitHub MCP as central development workflow tool
- Comprehensive automation of development processes
- Advanced analytics and predictive insights
- Seamless integration with all development frameworks
This guide optimizes GitHub MCP usage for development workflow integration. For Brave Search research, see docs/mcp-integration/brave-search-guide.md. For general MCP integration, see docs/mcp-integration/mcp-optimization.md.