Spaces:
Paused
Paused
Merge remote-tracking branch 'origin/main' into feat/mcp-prompts-revise
Browse files
README.md
CHANGED
|
@@ -10,53 +10,88 @@ short_description: Defect Solver - MCP Server
|
|
| 10 |
|
| 11 |
# Defect Solver MCP Server
|
| 12 |
|
| 13 |
-
This project implements a Model Context Protocol (MCP) server for defect solver bug localization using FastMCP. It
|
| 14 |
|
| 15 |
## Features
|
| 16 |
-
- Exposes
|
| 17 |
-
-
|
| 18 |
-
-
|
|
|
|
|
|
|
|
|
|
| 19 |
- Uses async HTTP requests and robust error handling
|
|
|
|
| 20 |
|
| 21 |
## Requirements
|
| 22 |
- Python >= 3.13
|
| 23 |
- See `pyproject.toml` for dependencies:
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
|
| 31 |
## Setup
|
| 32 |
1. Clone the repository:
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
2. Install dependencies using uv:
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
3. Configure environment variables:
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
## Usage
|
| 45 |
Run the MCP server:
|
| 46 |
```sh
|
| 47 |
python main.py
|
| 48 |
```
|
| 49 |
-
The server will start and expose the
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
## Configuration
|
| 52 |
-
- API base URL and
|
| 53 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
## Project Structure
|
| 56 |
```
|
| 57 |
-
main.py # Entry point and MCP server
|
| 58 |
-
utils/config.py # API configuration
|
| 59 |
-
utils/model.py # Pydantic models for
|
| 60 |
pyproject.toml # Project metadata and dependencies
|
| 61 |
README.md # Project documentation
|
| 62 |
.env.example # Example environment configuration
|
|
|
|
| 10 |
|
| 11 |
# Defect Solver MCP Server
|
| 12 |
|
| 13 |
+
This project implements a Model Context Protocol (MCP) server for defect solver bug localization using FastMCP. It provides multiple bug localization tools that forward bug report data to remote endpoints for prediction and analysis.
|
| 14 |
|
| 15 |
## Features
|
| 16 |
+
- Exposes three MCP tools for bug localization:
|
| 17 |
+
- `multi_module_bug_localization`: Localizes bugs across the entire microservice architecture
|
| 18 |
+
- `single_module_bug_localization`: Localizes bugs within a specific module
|
| 19 |
+
- `search_space_routing`: Identifies likely microservices (search spaces) for a reported bug
|
| 20 |
+
- Forwards issue data (key, summary, description, and optionally module) to configurable remote endpoints
|
| 21 |
+
- Returns predicted source code locations and detailed workflow prompts
|
| 22 |
- Uses async HTTP requests and robust error handling
|
| 23 |
+
- Includes workflow and prompt templates for end-to-end bug localization and resolution
|
| 24 |
|
| 25 |
## Requirements
|
| 26 |
- Python >= 3.13
|
| 27 |
- See `pyproject.toml` for dependencies:
|
| 28 |
+
- fastmcp
|
| 29 |
+
- httpx
|
| 30 |
+
- loguru
|
| 31 |
+
- pydantic
|
| 32 |
+
- dotenv
|
| 33 |
+
- uv
|
| 34 |
|
| 35 |
## Setup
|
| 36 |
1. Clone the repository:
|
| 37 |
+
```sh
|
| 38 |
+
git clone <your-repo-url>
|
| 39 |
+
cd defect_solver_mcp_server
|
| 40 |
+
```
|
| 41 |
2. Install dependencies using uv:
|
| 42 |
+
```sh
|
| 43 |
+
uv sync
|
| 44 |
+
```
|
| 45 |
3. Configure environment variables:
|
| 46 |
+
- Copy `.env.example` to `.env` and set the following as needed:
|
| 47 |
+
- `DS_API_BASE_URL`
|
| 48 |
+
- `DS_API_MULTIMODULE_ENDPOINT`
|
| 49 |
+
- `DS_API_SINGLEMODULE_ENDPOINT`
|
| 50 |
+
- `DS_API_SEARCHSPACE_ENDPOINT`
|
| 51 |
+
- `HF_ACCESS_TOKEN` (optional)
|
| 52 |
+
- `TIMEOUT` (optional)
|
| 53 |
|
| 54 |
## Usage
|
| 55 |
Run the MCP server:
|
| 56 |
```sh
|
| 57 |
python main.py
|
| 58 |
```
|
| 59 |
+
The server will start and expose the bug localization tools via MCP.
|
| 60 |
+
|
| 61 |
+
## Available Tools
|
| 62 |
+
- **multi_module_bug_localization**: Use when the responsible microservice is unknown. Returns likely microservices and localized files.
|
| 63 |
+
- **single_module_bug_localization**: Use when the affected module is known. Returns localized files within the specified module.
|
| 64 |
+
- **search_space_routing**: Use to identify the most likely microservices (search spaces) for a reported bug.
|
| 65 |
+
|
| 66 |
+
## Prompts & Workflow
|
| 67 |
+
The server provides prompt templates for:
|
| 68 |
+
- Tool selection and workflow planning
|
| 69 |
+
- Bug report augmentation
|
| 70 |
+
- Bug localization and result explanation
|
| 71 |
+
- Automated bug fixing and full resolution workflow
|
| 72 |
|
| 73 |
## Configuration
|
| 74 |
+
- API base URL and endpoints are configured in `utils/config.py` and via environment variables:
|
| 75 |
+
- `DS_API_BASE_URL`, `DS_API_MULTIMODULE_ENDPOINT`, `DS_API_SINGLEMODULE_ENDPOINT`, `DS_API_SEARCHSPACE_ENDPOINT`
|
| 76 |
+
- Timeout and HuggingFace access token are also configurable.
|
| 77 |
+
-
|
| 78 |
+
## MCP Inspector
|
| 79 |
+
The MCP Inspector is a tool to help you visualize and debug the interactions with the MCP server.
|
| 80 |
+
To use the MCP Inspector, simply run the command below in your terminal:
|
| 81 |
+
|
| 82 |
+
```sh
|
| 83 |
+
npx @modelcontextprotocol/inspector
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
The GUI will open in your default web browser, allowing you to monitor the communication with the MCP server in real-time:
|
| 87 |
+
|
| 88 |
+
<img src="https://raw.githubusercontent.com/modelcontextprotocol/inspector/main/mcp-inspector.png" alt="MCP Inspector">
|
| 89 |
|
| 90 |
## Project Structure
|
| 91 |
```
|
| 92 |
+
main.py # Entry point and MCP server with tool and prompt definitions
|
| 93 |
+
utils/config.py # API configuration and environment variable loading
|
| 94 |
+
utils/model.py # Pydantic models for request payloads
|
| 95 |
pyproject.toml # Project metadata and dependencies
|
| 96 |
README.md # Project documentation
|
| 97 |
.env.example # Example environment configuration
|