-
Notifications
You must be signed in to change notification settings - Fork 108
[WIP]: Add support for an MCP to analyse and prioritise PRs #2701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
mcp_server/server.py
Outdated
| from mcp.server.fastmcp import FastMCP | ||
|
|
||
|
|
||
| GITHUB_TOKEN = os.getenv("GITHUB_TOKEN") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is GitHub Token necessary? What permissions does it require?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I must say I didn't try without, the important permissions are the repo ones. I think it's worth trying to use without, but I am not entirely sure the code can pick up the right permissions
Co-authored-by: Ivan Yashchuk <[email protected]>
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Before submitting
What does this PR do?
This PR adds a Model Context Protocol (MCP) server for intelligent PR analysis and prioritization in the Lightning-Thunder repository. The server enables maintainers and contributors to efficiently triage and review the PR queue using both heuristic analysis and LLM-powered insights.
Users can generate both heuristic and LLM-based evaluations of the PRs, to prioritize which PR need to be reviewed asap
After installing the MCP in Cursor as:
{ "mcpServers": { "thunder-dev-mcp": { "type":"stdio", "command": "PATH TO YOUR PYTHON BIN", "args": ["/PATH TO/lightning-thunder/mcp_server/server.py"], "env": { } } } }it's possible to run the following examples:
The last approach will return a summary like this:
Key Features
1. Multi-dimensional Heuristic Analysis
2. PR Metadata Tracking
3. LLM-Powered Analysis Tools
llm_batch_analysis: Generates comprehensive prompts for LLM-based prioritization of multiple PRs4. MCP Tool Suite
The server exposes 6 tools via the MCP protocol:
list_open_prs: Quick overview of open PRs with optional label filteringanalyze_single_pr: Deep analysis of a single PRprioritize_prs: Heuristic-based prioritization of all open PRsgenerate_llm_priority_prompt: Creates master prompts for manual LLM analysischeck_stale_prs: Identifies PRs that haven't been updated recentlyrisk_report: Generates risk breakdowns by categoryUse Cases
Technical Implementation
fastmcpandhttpxfor GitHub API integrationGITHUB_TOKENenvironment variable for API accessExample Usage
Fixes # (issue).
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
This is a developer tooling enhancement and doesn't affect the core Lightning-Thunder functionality.
Did you have fun?
Make sure you had fun coding 🙃
I love thunder!!!