bug-sheet-mcp
Enables managing bugs and test cases in Google Sheets via Claude Code, with tools to list, search, filter failed, and update test cases.
README
bug-sheet-mcp
MCP Server cho phép Claude Code thao tác với Google Sheets để quản lý Bug / Testcase.
Tính năng
- Kết nối Google Sheets qua Service Account
- Đọc danh sách testcase
- Lọc testcase Fail
- Tra cứu testcase theo TC ID
- Tìm kiếm testcase theo từ khóa
- Cập nhật testcase (partial update)
- Cache dữ liệu trong RAM, tự động refresh sau khi update
Cài đặt
npm install
Google Service Account
- Truy cập Google Cloud Console
- Tạo project hoặc chọn project có sẵn
- Vào APIs & Services > Library
- Tìm và bật Google Sheets API
Tạo Service Account
- Vào APIs & Services > Credentials
- Chọn Create Credentials > Service Account
- Đặt tên, nhấn Create and Continue
- Không cần gán role, nhấn Done
- Chọn Service Account vừa tạo
- Vào tab Keys
- Chọn Add Key > Create New Key
- Chọn JSON → nhấn Create
- File JSON sẽ tự động tải về — đây là
GOOGLE_CREDENTIALS
Chia sẻ Sheet
Copy email của Service Account (dạng name@project.iam.gserviceaccount.com) và Share sheet với email đó với quyền Editor.
Cấu hình
Copy file .env.example thành .env:
cp .env.example .env
Điền các giá trị:
| Variable | Mô tả |
|---|---|
GOOGLE_SHEET_ID |
ID của Google Sheet (lấy từ URL) |
GOOGLE_WORKSHEET |
Tên worksheet (mặc định: Sheet1) |
GOOGLE_CREDENTIALS |
Đường dẫn file JSON hoặc nội dung JSON |
GOOGLE_EMAIL |
Email Service Account (dùng để share sheet) |
Build
npm run build
Run
npm run start
Khi chạy thành công sẽ thấy log:
[INFO] — Google Sheets client initialized
[INFO] — bug-sheet-mcp server running on stdio
Lưu ý: MCP Server dùng stdio transport, không phải HTTP. Server sẽ đợi JSON-RPC message từ stdin.
Test
Sử dụng pretty-printer để xem kết quả dạng table:
# List toàn bộ testcases
node scripts/test-pretty.mjs list_bugs
# Chỉ testcase Fail
node scripts/test-pretty.mjs list_failed_bugs
# Chi tiết 1 testcase
node scripts/test-pretty.mjs get_bug '{"tcId":"TC07"}'
# Tìm kiếm theo keyword
node scripts/test-pretty.mjs search_bug '{"keyword":"Authorization"}'
# Cập nhật (status, actual, note, description)
node scripts/test-pretty.mjs update_bug '{"tcId":"TC07","updates":{"status":"Pass","note":"Fixed"}}'
Output mẫu:
| TC ID | Group | Description | Status | Note |
|----------|--------------------|-------------------------------------|----------|---------------------------|
| TC01 | Happy path | Đăng ký individual hợp lệ | Pass | |
| TC07 | Authorization | Thiếu prefix Bearer | Fail | Security bug: cần enforce |
Kết quả nếu không tìm thấy:
{ "message": "Bug not found" }
Test với MCP Inspector (giao diện web)
npx @modelcontextprotocol/inspector node dist/index.js
Mở browser vào URL hiển thị để test từng tool bằng GUI.
MCP Config
Thêm vào claude.json hoặc settings.json của Claude Code:
{
"mcpServers": {
"bug-sheet": {
"command": "node",
"args": ["path/to/bug-sheet-mcp/dist/index.js"],
"env": {
"GOOGLE_SHEET_ID": "1VhfrSfBtFGCNhk2ENGBRzxDFQuRpeVq9ZrKFx0nEACM",
"GOOGLE_WORKSHEET": "BUG",
"GOOGLE_CREDENTIALS": "credentials/google-service-account.json"
}
}
}
}
Lưu ý:
GOOGLE_CREDENTIALShỗ trợ cả đường dẫn file (tính từ thư mục dự án) và nội dung JSON trực tiếp. Nếu dùng Claude Code ở thư mục khác, nên dùng đường dẫn tuyệt đối hoặc nội dung JSON.
## Format Google Sheet
Sheet cần có header (dòng đầu tiên). Header có thể ở bất kỳ thứ tự nào. Các cột hỗ trợ:
| Header | Field | Ghi chú |
|--------|-------|---------|
| TC ID | tcId | Mã testcase |
| Nhóm | group | Nhóm |
| Mô tả | description | Mô tả |
| Request Body | request | Request |
| Expected Result | expected | Kỳ vọng |
| Actual Result | actual | Thực tế |
| Status | status | Pass / Fail |
| Bug/Note | note | Ghi chú |
Các cột không nằm trong danh sách trên vẫn được lưu trong `raw`.
## Tools
| Tool | Input | Output |
|------|-------|--------|
| `list_bugs` | `{}` | Tất cả testcase |
| `list_failed_bugs` | `{}` | Testcase có Status = Fail |
| `get_bug` | `{ tcId }` | Chi tiết testcase |
| `search_bug` | `{ keyword }` | Kết quả tìm kiếm |
| `update_bug` | `{ tcId, updates }` | Cập nhật testcase |
## Sử dụng với Claude Code
Sau khi cấu hình MCP, a có thể yêu cầu Claude Code làm việc bằng tiếng Việt:
### 1. Xem danh sách bugs
Liệt kê tất cả testcase trong sheet
### 2. Xem bugs bị Fail
Những testcase nào đang bị Fail?
### 3. Tra cứu testcase cụ thể
Xem chi tiết TC07
### 4. Tìm kiếm testcase
Tìm testcase liên quan đến Authorization
### 5. Cập nhật kết quả test
Sau khi fix bug, yêu cầu Claude cập nhật:
Đã verify TC72 — API từ chối request thiếu Content-Type (trả về 415). Cập nhật status thành Pass, note: "Đã fix, yêu cầu Content-Type là bắt buộc"
Hoặc yêu cầu cụ thể:
Cập nhật TC07:
- status = Pass
- actual = API trả về 401 đúng
- note = Đã fix Bearer format
Claude sẽ tự động gọi tool `update_bug` để ghi vào Google Sheet.
### 6. Kiểm tra lại sau khi update
Cho xem lại TC07 để verify
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。