BugPilot MCP Server
Exposes 10 read-only tools for querying synthetic Jira bug data, metrics, trends, and risks via SQLite, enabling AI agents to analyze engineering bugs through a controlled sandboxed interface.
README
BugPilot
AI-Powered Engineering Bug Intelligence Agent
Core Architecture: BugPilot runs on a clean, end-to-end decoupled pipeline: React / Vite → FastAPI Backend → ReAct Orchestrator → Specialist Agents → MCP Client → MCP Server → 10 Read-Only Tools → SQLite Database (Synthetic Jira Data).
1. System Architecture
┌─────────────────────────────────────────────────────────────────────────────┐
│ React / Vite Frontend (TypeScript) │
└──────────────────────────────────────┬──────────────────────────────────────┘
│ HTTP REST API (JWT + RBAC + Tenant Isolation)
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ FastAPI Backend (Port 8000) │
└──────────────────────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ ReAct Orchestrator Agent │
│ Dynamic reasoning loop: Goal → LLM Decision → Tool Call → │
│ Observation → Next Decision → FINISH │
│ [Groq Primary API + Local Ollama Fallback] │
└───────────┬──────────────────────────┼──────────────────────────┬───────────┘
│ │ │
▼ ▼ ▼
┌──────────────────────┐ ┌──────────────────────┐ ┌──────────────────────┐
│ Bug Analyst Agent │ │ Trend Analyst Agent │ │ Risk Analyst Agent │
└───────────┬──────────┘ └──────────┬───────────┘ └──────────┬───────────┘
│ │ │
└──────────────────────────┼──────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ MCP Client │
│ Dynamic tool discovery, timeout & sandboxing │
└──────────────────────────────────────┬──────────────────────────────────────┘
│ stdio JSON-RPC Transport
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ MCP Server (mcp_server) │
│ Exposes 10 Strict READ-ONLY Tools │
└──────────────────────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ AnalyticsService │
│ Deterministic metric calculation & statistical trends │
└──────────────────────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ DataProvider Interface (SQLDataProvider / SQLite) │
│ Multi-tenant tenant isolation (`organization_id`) │
└──────────────────────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ SQLite Database (`sqlite:///./bugpilot.db`) │
│ Realistic Jira-style Defect Catalog, Sprints, Users & Audit Trails │
└─────────────────────────────────────────────────────────────────────────────┘
Strict Data Access Contract
✅ Agent → MCP Client → MCP Server → AnalyticsService → DataProvider → SQLite Data
❌ Agent → Direct Database Access (FORBIDDEN)
❌ Agent → Direct Data File Reading (FORBIDDEN)
❌ External Vector Database / RAG dependencies (FORBIDDEN)
Agents interact exclusively through dynamically discovered MCP tools, preserving sandboxing and full testability.
2. 10 MCP Tools Reference
All 10 tools are strictly read-only, tenant-scoped (org_id), and dynamically discovered via the MCP protocol:
| # | Tool Name | Required / Optional Parameters | Description & Evidence Returned |
|---|---|---|---|
| 1 | search_bugs |
query: str, limit: int = 20 |
Search bugs by keyword in issue key, title, summary, or description. |
| 2 | get_bug |
bug_id: str |
Retrieve complete details for a single bug (severity, priority, root cause, business impact, environment, reproduction steps, fix version). |
| 3 | get_bug_metrics |
sprint_id: Optional[str], component: Optional[str], project: Optional[str] |
Aggregated bug counts, open vs. resolved distributions, and severity breakdowns. |
| 4 | get_bug_trends |
sprint_id: Optional[str], component: Optional[str], project: Optional[str] |
Monthly creation vs. resolution trends and historical sprint completion velocity. |
| 5 | get_aging_bugs |
min_age_days: float = 0.0, limit: int = 50 |
Open defects sorted descending by age in days to highlight SLA risk. |
| 6 | get_reopened_bugs |
component: Optional[str], limit: int = 50 |
Defects that transitioned from Resolved/Closed back to Open/In Progress (reopen_count > 0). |
| 7 | get_component_risk |
component: Optional[str], project: Optional[str] |
Component-level risk scores (0–100), active open issue counts, and blast radius indicators. |
| 8 | get_release_risk |
release: Optional[str] |
Fix version / release readiness assessment, overall risk score, and deployment verdict. |
| 9 | get_bug_history |
bug_id: str |
Chronological status transition history, reopen timestamps, and developer discussion comments. |
| 10 | get_related_bugs |
bug_id: str, limit: int = 10 |
Related defects sharing component context, technical root cause, or explicit linked issue IDs. |
3. Dynamic ReAct Orchestration & Comparative Analysis
The Orchestrator Agent operates on a genuine Reasoning + Action (ReAct) loop:
- Intent & Out-of-Domain Guardrail — Early checks filter non-engineering queries without wasting LLM/tool invocations.
- Dynamic Tool Selection — LLM decides each action (
CALL_TOOL,DELEGATE, orFINISH) based on the query, dynamically discovered tools, and accumulated observations. - Iterative Multi-Candidate Inspection — For comparative and ranking queries ("analyze authentication bugs and identify the highest-risk issue"),
search_bugsdiscovers candidates, and the Orchestrator iteratively invokesget_bugon each candidate defect before allowingFINISH, ensuring full technical evidence (root cause, blast radius, reproduction steps) is gathered. - Differentiated Evidence-Grounded Risk Scoring — Evaluates severity, priority, status, production environment, security impact (e.g. SOC2/session hijacking), and technical root causes (e.g. race condition, crash). Generates non-saturating scores (0.0–99.5) to avoid artificial 100/100 ties.
- Reflection Agent Quality Evaluation — Validates generated reports against ground-truth MCP data to prevent hallucinations and confirm accurate reporting.
4. Multi-Tenancy & RBAC Security
- Tenant Isolation — Every database record (
issues,sprints,users,audit_logs) is strictly scoped byorganization_id(e.g.org-acme). Cross-organization data access is blocked at the repository and MCP layers. - Role-Based Access Control (RBAC):
- Admin — Full access, user management, and issue administration.
- Engineer / Developer — Create, update, transition, and analyze issues.
- Viewer — Read-only access to issues, analytics, and reports.
- Secrets Management — No secret keys or credentials are hardcoded. JWT secrets, API keys, and environment variables are strictly loaded from
.envand excluded from version control.
5. Technology Stack
| Layer | Component | Technology |
|---|---|---|
| Frontend | Interactive UI | React 18 + TypeScript + Vite |
| Backend API | REST API Server | FastAPI + Uvicorn + Pydantic v2 |
| Orchestration | Agent Loop | ReAct Agent Framework + Specialist Delegation |
| LLM Gateway | Inference Engine | Groq API (llama-3.3-70b-versatile) Primary + Local Ollama (llama3.1:8b) Fallback |
| Tool Protocol | Tooling Layer | Official Python MCP SDK (mcp>=1.0.0) via stdio |
| Data Layer | Persistent Database | SQLAlchemy 2.0 ORM + SQLite (sqlite:///./bugpilot.db) |
| Security | Auth & RBAC | PyJWT (HS256) + Passlib (bcrypt) + Header-based Tenant Scoping |
| Quality | Reflection & Test | Reflection Agent Grounding + Pytest (329 tests, 100% pass) |
6. Setup & Execution Guide
Prerequisites
- Python 3.12+
- Node.js 18+ (for frontend)
- A Groq API key (optional — the app runs without one, falling back to local Ollama or deterministic mode)
1. Backend Setup
# Clone and enter project
git clone <repo-url> bugpilot
cd bugpilot
# Create and activate virtual environment
python -m venv .venv
# Windows: .\.venv\Scripts\activate | macOS/Linux: source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Configure environment (defaults to SQLite with zero setup)
cp .env.example .env
# Optional: add your GROQ_API_KEY to .env for live LLM responses
2. Run Standalone MCP Server
# Windows
.\.venv\Scripts\python -m mcp_server.server
# macOS / Linux
.venv/bin/python -m mcp_server.server
3. Run FastAPI Backend
uvicorn backend.main:app --host 127.0.0.1 --port 8000 --reload
The database is created and seeded automatically on first startup — no migration step required. Verify it's healthy at http://127.0.0.1:8000/api/v1/health and http://127.0.0.1:8000/docs.
4. Build & Run Frontend
cd frontend
npm install
npm run dev
The Vite dev server proxies /api requests to the FastAPI backend on port 8000 (see vite.config.ts), so both services need to be running together.
5. Execute Test Suite
# Run all unit and integration tests (329 tests)
pytest tests/unit tests/integration -q
LLM calls are mocked during tests (see tests/conftest.py), so the suite runs deterministically without a Groq/Ollama connection. Because several tests spin up a fresh MCP server subprocess, the full suite takes a few minutes — this is expected, not a hang.
7. Evaluation & Quality Results
BugPilot ships with an automated evaluation harness (evaluation/) that scores the agent against a 23-query golden dataset across 11 dimensions — intent accuracy, tool selection, groundedness, hallucination rate, trajectory validity, instruction following, safety, and latency — without relying on manual grading. Run it yourself with:
python -m evaluation.run_eval
Latest committed results (evaluation_report.json):
| Metric | Result |
|---|---|
| Task success rate | 21 / 23 (91.3%) |
| Hallucination rate | 0.0% |
| Tool call success rate | 100% |
| Agent routing accuracy | 95.7% |
| Mean latency | 2.3s (P95: 4.6s) |
The two non-passing queries were intent-routing edge cases (e.g. a query classified as COMPONENT_ANALYSIS instead of METRIC), not hallucinations or failures — the agent never fabricated information in any of the 23 test cases.
A concurrency/load test (1–50 simultaneous users) is also included via evaluation/load_tester.py. At up to 25 concurrent users the system holds a 0% error rate; at 50 concurrent users, error rate rises to ~66%, indicating the current single-instance setup is not yet tuned for high-concurrency production traffic. See Known Limitations below.
Note on cost/token figures: the
estimated_total_cost_usdandaverage_tokens_per_queryvalues inevaluation_report.jsonare word-count-based estimates, not real Groq API usage data. Treat them as rough indicators, not billing figures.
8. Known Limitations
In the interest of transparency for reviewers:
- Concurrency ceiling — load testing shows a sharp rise in error rate at 50 simultaneous users (see above). Suitable for demo/small-team use as-is; would need connection pooling / async tuning for larger production traffic.
- Estimated (not measured) token/cost tracking — the evaluation report's cost figures are heuristic estimates based on word counts, not real API usage accounting.
- Small golden evaluation set — the automated evaluation covers 23 representative queries; broader coverage (more adversarial/prompt-injection cases, more edge cases) would strengthen confidence further.
generate_pdf.pyis a standalone documentation-export utility with a Windows-specific default output path; pass an explicit filename argument on macOS/Linux.
---.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。