Spaces:
Paused
Paused
Commit
·
5d4d4b2
1
Parent(s):
a0af3ad
style: apply markdown lint
Browse files
README.md
CHANGED
|
@@ -13,37 +13,44 @@ short_description: Defect Solver - MCP Server
|
|
| 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 |
-
|
| 18 |
-
|
| 19 |
-
|
| 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 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
|
| 35 |
-
### Note: The tools implemented in this server require a DEFECT SOLVER API KEY to send requests. To get your key, please contact [Lokum AI](https://github.com/lokumai)
|
| 36 |
|
| 37 |
## Setup
|
|
|
|
| 38 |
1. Clone the repository:
|
|
|
|
| 39 |
```sh
|
| 40 |
git clone <your-repo-url>
|
| 41 |
cd defect_solver_mcp_server
|
| 42 |
```
|
|
|
|
| 43 |
2. Install dependencies using uv:
|
|
|
|
| 44 |
```sh
|
| 45 |
uv sync
|
| 46 |
```
|
|
|
|
| 47 |
3. Configure environment variables:
|
| 48 |
- Copy `.env.example` to `.env` and set the following as needed:
|
| 49 |
- `DS_API_BASE_URL`
|
|
@@ -54,32 +61,41 @@ This project implements a Model Context Protocol (MCP) server for defect solver
|
|
| 54 |
- `TIMEOUT` (optional)
|
| 55 |
|
| 56 |
## Usage
|
|
|
|
| 57 |
Run the MCP server:
|
|
|
|
| 58 |
```sh
|
| 59 |
python main.py
|
| 60 |
```
|
|
|
|
| 61 |
The server will start and expose the bug localization tools via MCP.
|
| 62 |
|
| 63 |
## Available Tools
|
|
|
|
| 64 |
- **multi_module_bug_localization**: Use when the responsible microservice is unknown. Returns likely microservices and localized files.
|
| 65 |
- **single_module_bug_localization**: Use when the affected module is known. Returns localized files within the specified module.
|
| 66 |
- **search_space_routing**: Use to identify the most likely microservices (search spaces) for a reported bug.
|
| 67 |
|
| 68 |
## Prompts & Workflow
|
|
|
|
| 69 |
The server provides prompt templates for:
|
|
|
|
| 70 |
- Tool selection and workflow planning
|
| 71 |
- Bug report augmentation
|
| 72 |
- Bug localization and result explanation
|
| 73 |
- Automated bug fixing and full resolution workflow
|
| 74 |
|
| 75 |
-
### NOTE: There is a `chatmode.md` file personalized for DNext development that provides detailed instructions and rules on how to use the MCP server with chat-based interactions in IDEs like VSCode, Cursor, Windsurf and etc. Please refer to the [dnext-chatmode.md](https://github.com/pia-team/defect_solver_api/blob/main/.github/chatmodes/dnext-defect-solver.chatmode.md) for more information
|
| 76 |
|
| 77 |
## Configuration
|
|
|
|
| 78 |
- API base URL and endpoints are configured in `utils/config.py` and via environment variables:
|
| 79 |
-
|
| 80 |
- Timeout and HuggingFace access token are also configurable.
|
| 81 |
-
-
|
|
|
|
| 82 |
## MCP Inspector
|
|
|
|
| 83 |
The MCP Inspector is a tool to help you visualize and debug the interactions with the MCP server.
|
| 84 |
To use the MCP Inspector, simply run the command below in your terminal:
|
| 85 |
|
|
@@ -92,6 +108,7 @@ The GUI will open in your default web browser, allowing you to monitor the commu
|
|
| 92 |
<img src="https://raw.githubusercontent.com/modelcontextprotocol/inspector/main/mcp-inspector.png" alt="MCP Inspector">
|
| 93 |
|
| 94 |
## Project Structure
|
|
|
|
| 95 |
```
|
| 96 |
main.py # Entry point and MCP server with tool and prompt definitions
|
| 97 |
utils/config.py # API configuration and environment variable loading
|
|
@@ -102,9 +119,10 @@ README.md # Project documentation
|
|
| 102 |
```
|
| 103 |
|
| 104 |
## `mcp.json` Configuration Example for Client Usage
|
|
|
|
| 105 |
To use this MCP server in a client application that supports MCP, you add the config below to `mcp.json`.
|
| 106 |
|
| 107 |
-
#### PRIVATE MCP SERVER: This config is required for when deploying the MCP server in a private Hugging Face Space that requires authentication
|
| 108 |
|
| 109 |
```json
|
| 110 |
{
|
|
@@ -135,7 +153,7 @@ To use this MCP server in a client application that supports MCP, you add the co
|
|
| 135 |
}
|
| 136 |
```
|
| 137 |
|
| 138 |
-
#### PUBLIC MCP SERVER: For public spaces, you can omit the `hf-access-token` input or `Authorization` header
|
| 139 |
|
| 140 |
```json
|
| 141 |
{
|
|
@@ -157,4 +175,4 @@ To use this MCP server in a client application that supports MCP, you add the co
|
|
| 157 |
}
|
| 158 |
]
|
| 159 |
}
|
| 160 |
-
```
|
|
|
|
| 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 |
+
|
| 17 |
- Exposes three MCP tools for bug localization:
|
| 18 |
+
- `multi_module_bug_localization`: Localizes bugs across the entire microservice architecture
|
| 19 |
+
- `single_module_bug_localization`: Localizes bugs within a specific module
|
| 20 |
+
- `search_space_routing`: Identifies likely microservices (search spaces) for a reported bug
|
| 21 |
- Forwards issue data (key, summary, description, and optionally module) to configurable remote endpoints
|
| 22 |
- Returns predicted source code locations and detailed workflow prompts
|
| 23 |
- Uses async HTTP requests and robust error handling
|
| 24 |
- Includes workflow and prompt templates for end-to-end bug localization and resolution
|
| 25 |
|
| 26 |
## Requirements
|
| 27 |
+
|
| 28 |
- Python >= 3.13
|
| 29 |
- See `pyproject.toml` for dependencies:
|
| 30 |
+
- fastmcp
|
| 31 |
+
- httpx
|
| 32 |
+
- loguru
|
| 33 |
+
- pydantic
|
| 34 |
+
- dotenv
|
| 35 |
+
- uv
|
| 36 |
|
| 37 |
+
### Note: The tools implemented in this server require a DEFECT SOLVER API KEY to send requests. To get your key, please contact [Lokum AI](https://github.com/lokumai)
|
| 38 |
|
| 39 |
## Setup
|
| 40 |
+
|
| 41 |
1. Clone the repository:
|
| 42 |
+
|
| 43 |
```sh
|
| 44 |
git clone <your-repo-url>
|
| 45 |
cd defect_solver_mcp_server
|
| 46 |
```
|
| 47 |
+
|
| 48 |
2. Install dependencies using uv:
|
| 49 |
+
|
| 50 |
```sh
|
| 51 |
uv sync
|
| 52 |
```
|
| 53 |
+
|
| 54 |
3. Configure environment variables:
|
| 55 |
- Copy `.env.example` to `.env` and set the following as needed:
|
| 56 |
- `DS_API_BASE_URL`
|
|
|
|
| 61 |
- `TIMEOUT` (optional)
|
| 62 |
|
| 63 |
## Usage
|
| 64 |
+
|
| 65 |
Run the MCP server:
|
| 66 |
+
|
| 67 |
```sh
|
| 68 |
python main.py
|
| 69 |
```
|
| 70 |
+
|
| 71 |
The server will start and expose the bug localization tools via MCP.
|
| 72 |
|
| 73 |
## Available Tools
|
| 74 |
+
|
| 75 |
- **multi_module_bug_localization**: Use when the responsible microservice is unknown. Returns likely microservices and localized files.
|
| 76 |
- **single_module_bug_localization**: Use when the affected module is known. Returns localized files within the specified module.
|
| 77 |
- **search_space_routing**: Use to identify the most likely microservices (search spaces) for a reported bug.
|
| 78 |
|
| 79 |
## Prompts & Workflow
|
| 80 |
+
|
| 81 |
The server provides prompt templates for:
|
| 82 |
+
|
| 83 |
- Tool selection and workflow planning
|
| 84 |
- Bug report augmentation
|
| 85 |
- Bug localization and result explanation
|
| 86 |
- Automated bug fixing and full resolution workflow
|
| 87 |
|
| 88 |
+
### NOTE: There is a `chatmode.md` file personalized for DNext development that provides detailed instructions and rules on how to use the MCP server with chat-based interactions in IDEs like VSCode, Cursor, Windsurf and etc. Please refer to the [dnext-chatmode.md](https://github.com/pia-team/defect_solver_api/blob/main/.github/chatmodes/dnext-defect-solver.chatmode.md) for more information
|
| 89 |
|
| 90 |
## Configuration
|
| 91 |
+
|
| 92 |
- API base URL and endpoints are configured in `utils/config.py` and via environment variables:
|
| 93 |
+
- `DS_API_BASE_URL`, `DS_API_MULTIMODULE_ENDPOINT`, `DS_API_SINGLEMODULE_ENDPOINT`, `DS_API_SEARCHSPACE_ENDPOINT`
|
| 94 |
- Timeout and HuggingFace access token are also configurable.
|
| 95 |
+
-
|
| 96 |
+
|
| 97 |
## MCP Inspector
|
| 98 |
+
|
| 99 |
The MCP Inspector is a tool to help you visualize and debug the interactions with the MCP server.
|
| 100 |
To use the MCP Inspector, simply run the command below in your terminal:
|
| 101 |
|
|
|
|
| 108 |
<img src="https://raw.githubusercontent.com/modelcontextprotocol/inspector/main/mcp-inspector.png" alt="MCP Inspector">
|
| 109 |
|
| 110 |
## Project Structure
|
| 111 |
+
|
| 112 |
```
|
| 113 |
main.py # Entry point and MCP server with tool and prompt definitions
|
| 114 |
utils/config.py # API configuration and environment variable loading
|
|
|
|
| 119 |
```
|
| 120 |
|
| 121 |
## `mcp.json` Configuration Example for Client Usage
|
| 122 |
+
|
| 123 |
To use this MCP server in a client application that supports MCP, you add the config below to `mcp.json`.
|
| 124 |
|
| 125 |
+
#### PRIVATE MCP SERVER: This config is required for when deploying the MCP server in a private Hugging Face Space that requires authentication
|
| 126 |
|
| 127 |
```json
|
| 128 |
{
|
|
|
|
| 153 |
}
|
| 154 |
```
|
| 155 |
|
| 156 |
+
#### PUBLIC MCP SERVER: For public spaces, you can omit the `hf-access-token` input or `Authorization` header
|
| 157 |
|
| 158 |
```json
|
| 159 |
{
|
|
|
|
| 175 |
}
|
| 176 |
]
|
| 177 |
}
|
| 178 |
+
```
|