64b646666f7259d1ef783e905c2ce248dbb81c10
BUGFS: Method-Level Bug Localization by Counting Method Modifications of Similar Bug Reports
📖 Overview
BUGFS (BUG location recommendation using method Frequency of Similar bug reports) is a novel approach for method-level bug localization.
It combines semantic similarity between bug reports and the historical frequency of method modifications to recommend the most likely buggy methods.
🧠 Key idea:
If a method was frequently modified in similar past bug reports, it is likely to require modification again for a new bug.
Compared to state-of-the-art methods such as FineLocator and MblShl, BUGFS achieves:
- 1.5× higher Precision@10, 1.2× higher Recall@10
- 3.0× higher MAP, 3.4× higher MRR
- Consistent performance across Java (Ant, AspectJ, Maven) and Python (Django, Flask, Pandas) projects.
⚙️ MCP Bug Localization Server
The new bug_locator_mcp_server.py exposes a Model Context Protocol (MCP) server that automates everything from crawling issues to recommending buggy methods:
| Tool | Purpose |
|---|---|
crawl_repo |
Uses crawl_issues_With_diffs.py to download GitHub issues plus their fixing commit patches. |
embed_repo |
Reuses embedding.py logic to embed each issue’s title/body with OpenAI embeddings. |
run_BUGFS |
Implements the run_rq1 methodology to retrieve similar issues and rank file:function locations by vote frequency. |
Setup
pip install modelcontextprotocol openai python-dotenv requests numpy- Add
OPENAI_API_KEYandGITHUB_TOKENto your environment (or a.envfile).
Running locally
python bug_locator_mcp_server.py
Once the server is running you can add it to any MCP-compatible client. Typical workflow:
crawl_repo(owner="pallets", repo="flask")embed_repo(owner="pallets", repo="flask", model="text-embedding-3-small")run_BUGFS(owner="pallets", repo="flask", title="Bug title", body="Bug body...")
Languages
Python
88.6%
Jupyter Notebook
10.1%
Dockerfile
1.3%
