@muggleai/mcp-qa-gateway 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +185 -0
- package/dist/scripts/phase0-smoke.d.ts +7 -0
- package/dist/scripts/phase0-smoke.d.ts.map +1 -0
- package/dist/scripts/phase0-smoke.js +1712 -0
- package/dist/scripts/phase0-smoke.js.map +1 -0
- package/dist/scripts/types/phase0-smoke-types.d.ts +89 -0
- package/dist/scripts/types/phase0-smoke-types.d.ts.map +1 -0
- package/dist/scripts/types/phase0-smoke-types.js +3 -0
- package/dist/scripts/types/phase0-smoke-types.js.map +1 -0
- package/dist/src/__tests__/helpers/mock-setup.d.ts +28 -0
- package/dist/src/__tests__/helpers/mock-setup.d.ts.map +1 -0
- package/dist/src/__tests__/helpers/mock-setup.js +44 -0
- package/dist/src/__tests__/helpers/mock-setup.js.map +1 -0
- package/dist/src/__tests__/helpers/test-fixtures.d.ts +38 -0
- package/dist/src/__tests__/helpers/test-fixtures.d.ts.map +1 -0
- package/dist/src/__tests__/helpers/test-fixtures.js +62 -0
- package/dist/src/__tests__/helpers/test-fixtures.js.map +1 -0
- package/dist/src/__tests__/tools/artifact-tools.test.d.ts +9 -0
- package/dist/src/__tests__/tools/artifact-tools.test.d.ts.map +1 -0
- package/dist/src/__tests__/tools/artifact-tools.test.js +307 -0
- package/dist/src/__tests__/tools/artifact-tools.test.js.map +1 -0
- package/dist/src/__tests__/tools/prd-file-tools.test.d.ts +7 -0
- package/dist/src/__tests__/tools/prd-file-tools.test.d.ts.map +1 -0
- package/dist/src/__tests__/tools/prd-file-tools.test.js +278 -0
- package/dist/src/__tests__/tools/prd-file-tools.test.js.map +1 -0
- package/dist/src/__tests__/tools/project-tools.test.d.ts +7 -0
- package/dist/src/__tests__/tools/project-tools.test.d.ts.map +1 -0
- package/dist/src/__tests__/tools/project-tools.test.js +281 -0
- package/dist/src/__tests__/tools/project-tools.test.js.map +1 -0
- package/dist/src/__tests__/tools/recommendation-tools.test.d.ts +6 -0
- package/dist/src/__tests__/tools/recommendation-tools.test.d.ts.map +1 -0
- package/dist/src/__tests__/tools/recommendation-tools.test.js +193 -0
- package/dist/src/__tests__/tools/recommendation-tools.test.js.map +1 -0
- package/dist/src/__tests__/tools/report-tools.test.d.ts +7 -0
- package/dist/src/__tests__/tools/report-tools.test.d.ts.map +1 -0
- package/dist/src/__tests__/tools/report-tools.test.js +226 -0
- package/dist/src/__tests__/tools/report-tools.test.js.map +1 -0
- package/dist/src/__tests__/tools/secret-tools.test.d.ts +6 -0
- package/dist/src/__tests__/tools/secret-tools.test.d.ts.map +1 -0
- package/dist/src/__tests__/tools/secret-tools.test.js +243 -0
- package/dist/src/__tests__/tools/secret-tools.test.js.map +1 -0
- package/dist/src/__tests__/tools/test-case-prompt-tools.test.d.ts +6 -0
- package/dist/src/__tests__/tools/test-case-prompt-tools.test.d.ts.map +1 -0
- package/dist/src/__tests__/tools/test-case-prompt-tools.test.js +291 -0
- package/dist/src/__tests__/tools/test-case-prompt-tools.test.js.map +1 -0
- package/dist/src/__tests__/tools/tool-registry.test.d.ts +7 -0
- package/dist/src/__tests__/tools/tool-registry.test.d.ts.map +1 -0
- package/dist/src/__tests__/tools/tool-registry.test.js +205 -0
- package/dist/src/__tests__/tools/tool-registry.test.js.map +1 -0
- package/dist/src/__tests__/tools/use-case-tools.test.d.ts +7 -0
- package/dist/src/__tests__/tools/use-case-tools.test.d.ts.map +1 -0
- package/dist/src/__tests__/tools/use-case-tools.test.js +177 -0
- package/dist/src/__tests__/tools/use-case-tools.test.js.map +1 -0
- package/dist/src/__tests__/tools/workflow-tools.test.d.ts +15 -0
- package/dist/src/__tests__/tools/workflow-tools.test.d.ts.map +1 -0
- package/dist/src/__tests__/tools/workflow-tools.test.js +627 -0
- package/dist/src/__tests__/tools/workflow-tools.test.js.map +1 -0
- package/dist/src/config/index.d.ts +18 -0
- package/dist/src/config/index.d.ts.map +1 -0
- package/dist/src/config/index.js +76 -0
- package/dist/src/config/index.js.map +1 -0
- package/dist/src/index.d.ts +21 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +88 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/interfaces/caller-credentials.d.ts +10 -0
- package/dist/src/interfaces/caller-credentials.d.ts.map +1 -0
- package/dist/src/interfaces/caller-credentials.js +3 -0
- package/dist/src/interfaces/caller-credentials.js.map +1 -0
- package/dist/src/interfaces/gateway-config.d.ts +28 -0
- package/dist/src/interfaces/gateway-config.d.ts.map +1 -0
- package/dist/src/interfaces/gateway-config.js +3 -0
- package/dist/src/interfaces/gateway-config.js.map +1 -0
- package/dist/src/interfaces/index.d.ts +13 -0
- package/dist/src/interfaces/index.d.ts.map +1 -0
- package/dist/src/interfaces/index.js +7 -0
- package/dist/src/interfaces/index.js.map +1 -0
- package/dist/src/interfaces/mcp-tool-call-protocol.d.ts +61 -0
- package/dist/src/interfaces/mcp-tool-call-protocol.d.ts.map +1 -0
- package/dist/src/interfaces/mcp-tool-call-protocol.js +7 -0
- package/dist/src/interfaces/mcp-tool-call-protocol.js.map +1 -0
- package/dist/src/interfaces/pagination.d.ts +24 -0
- package/dist/src/interfaces/pagination.d.ts.map +1 -0
- package/dist/src/interfaces/pagination.js +6 -0
- package/dist/src/interfaces/pagination.js.map +1 -0
- package/dist/src/interfaces/tool-definition.d.ts +22 -0
- package/dist/src/interfaces/tool-definition.d.ts.map +1 -0
- package/dist/src/interfaces/tool-definition.js +6 -0
- package/dist/src/interfaces/tool-definition.js.map +1 -0
- package/dist/src/interfaces/tool-mapping.d.ts +20 -0
- package/dist/src/interfaces/tool-mapping.d.ts.map +1 -0
- package/dist/src/interfaces/tool-mapping.js +6 -0
- package/dist/src/interfaces/tool-mapping.js.map +1 -0
- package/dist/src/interfaces/upstream-call.d.ts +27 -0
- package/dist/src/interfaces/upstream-call.d.ts.map +1 -0
- package/dist/src/interfaces/upstream-call.js +3 -0
- package/dist/src/interfaces/upstream-call.js.map +1 -0
- package/dist/src/interfaces/upstream-response.d.ts +12 -0
- package/dist/src/interfaces/upstream-response.d.ts.map +1 -0
- package/dist/src/interfaces/upstream-response.js +3 -0
- package/dist/src/interfaces/upstream-response.js.map +1 -0
- package/dist/src/server/http-server.d.ts +13 -0
- package/dist/src/server/http-server.d.ts.map +1 -0
- package/dist/src/server/http-server.js +219 -0
- package/dist/src/server/http-server.js.map +1 -0
- package/dist/src/server/mcp-server.d.ts +11 -0
- package/dist/src/server/mcp-server.d.ts.map +1 -0
- package/dist/src/server/mcp-server.js +363 -0
- package/dist/src/server/mcp-server.js.map +1 -0
- package/dist/src/server/session-credentials.d.ts +8 -0
- package/dist/src/server/session-credentials.d.ts.map +1 -0
- package/dist/src/server/session-credentials.js +24 -0
- package/dist/src/server/session-credentials.js.map +1 -0
- package/dist/src/tools/constants.d.ts +6 -0
- package/dist/src/tools/constants.d.ts.map +1 -0
- package/dist/src/tools/constants.js +9 -0
- package/dist/src/tools/constants.js.map +1 -0
- package/dist/src/tools/index.d.ts +7 -0
- package/dist/src/tools/index.d.ts.map +1 -0
- package/dist/src/tools/index.js +23 -0
- package/dist/src/tools/index.js.map +1 -0
- package/dist/src/tools/schemas.d.ts +906 -0
- package/dist/src/tools/schemas.d.ts.map +1 -0
- package/dist/src/tools/schemas.js +386 -0
- package/dist/src/tools/schemas.js.map +1 -0
- package/dist/src/tools/tool-registry.d.ts +26 -0
- package/dist/src/tools/tool-registry.d.ts.map +1 -0
- package/dist/src/tools/tool-registry.js +1142 -0
- package/dist/src/tools/tool-registry.js.map +1 -0
- package/dist/src/types/index.d.ts +35 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/index.js +55 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/upstream/prompt-service-client.d.ts +62 -0
- package/dist/src/upstream/prompt-service-client.d.ts.map +1 -0
- package/dist/src/upstream/prompt-service-client.js +329 -0
- package/dist/src/upstream/prompt-service-client.js.map +1 -0
- package/dist/src/utils/logger.d.ts +17 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/dist/src/utils/logger.js +64 -0
- package/dist/src/utils/logger.js.map +1 -0
- package/dist/vitest.config.d.ts +3 -0
- package/dist/vitest.config.d.ts.map +1 -0
- package/dist/vitest.config.js +21 -0
- package/dist/vitest.config.js.map +1 -0
- package/package.json +66 -0
package/README.md
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# MCP QA Gateway
|
|
2
|
+
|
|
3
|
+
A hosted MCP (Model Context Protocol) server that exposes Muggle Test QA APIs as MCP tools. This gateway enables AI assistants and MCP clients to run end-to-end QA analysis workflows on websites.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **E2E URL Analysis**: Complete workflow from project setup to test report generation
|
|
8
|
+
- **Multi-tenant Auth**: Forwards caller credentials (Auth0 JWT or API key) to prompt-service
|
|
9
|
+
- **Streamable HTTP Transport**: Uses MCP's remote transport for hosted deployment
|
|
10
|
+
- **Rate Limiting**: Configurable rate limits per credential
|
|
11
|
+
- **Docker Ready**: Production-optimized container image
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
### Prerequisites
|
|
16
|
+
|
|
17
|
+
- Node.js 18+
|
|
18
|
+
- Access to Muggle AI prompt-service
|
|
19
|
+
- Valid API key or Auth0 credentials
|
|
20
|
+
|
|
21
|
+
### Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Install dependencies
|
|
25
|
+
npm install
|
|
26
|
+
|
|
27
|
+
# Copy and configure environment
|
|
28
|
+
cp .env.example .env
|
|
29
|
+
# Edit .env with your PROMPT_SERVICE_BASE_URL
|
|
30
|
+
|
|
31
|
+
# Build
|
|
32
|
+
npm run build
|
|
33
|
+
|
|
34
|
+
# Start
|
|
35
|
+
npm start
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Docker
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Build image
|
|
42
|
+
docker build -t mcp-qa-gateway .
|
|
43
|
+
|
|
44
|
+
# Run container
|
|
45
|
+
docker run -p 3002:3002 \
|
|
46
|
+
-e PROMPT_SERVICE_BASE_URL=https://promptservice.muggle-ai.com \
|
|
47
|
+
-e RATE_LIMIT_ENABLED=true \
|
|
48
|
+
mcp-qa-gateway
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Configuration
|
|
52
|
+
|
|
53
|
+
| Environment Variable | Description | Default |
|
|
54
|
+
| --------------------------- | -------------------------------------------- | ----------------------- |
|
|
55
|
+
| `PROMPT_SERVICE_BASE_URL` | Base URL of prompt-service (required) | - |
|
|
56
|
+
| `PORT` | Server port | `3002` |
|
|
57
|
+
| `MCP_PUBLIC_BASE_URL` | Public URL of this gateway | `http://localhost:3002` |
|
|
58
|
+
| `NODE_ENV` | Environment (development/staging/production) | `development` |
|
|
59
|
+
| `LOG_LEVEL` | Log level (debug/info/warn/error) | `info` |
|
|
60
|
+
| `RATE_LIMIT_ENABLED` | Enable rate limiting | `true` |
|
|
61
|
+
| `RATE_LIMIT_WINDOW_SECONDS` | Rate limit window | `60` |
|
|
62
|
+
| `RATE_LIMIT_MAX_REQUESTS` | Max requests per window | `60` |
|
|
63
|
+
| `REQUEST_TIMEOUT_MS` | Default request timeout | `30000` |
|
|
64
|
+
| `WORKFLOW_TIMEOUT_MS` | Workflow request timeout | `120000` |
|
|
65
|
+
|
|
66
|
+
## Authentication
|
|
67
|
+
|
|
68
|
+
The gateway requires authentication on every request. Provide one of:
|
|
69
|
+
|
|
70
|
+
- **Bearer Token**: `Authorization: Bearer <Auth0_JWT>`
|
|
71
|
+
- **API Key**: `x-api-key: mai_sk_...`
|
|
72
|
+
|
|
73
|
+
Credentials are forwarded unchanged to prompt-service, which enforces authorization.
|
|
74
|
+
|
|
75
|
+
## Available Tools
|
|
76
|
+
|
|
77
|
+
### Phase 0: E2E URL Analysis (Current)
|
|
78
|
+
|
|
79
|
+
#### Project Initialization
|
|
80
|
+
- `qa_project_create` - Create a new QA project
|
|
81
|
+
- `qa_project_get` - Get project details
|
|
82
|
+
- `qa_project_update` - Update project
|
|
83
|
+
- `qa_project_list` - List projects
|
|
84
|
+
- `qa_prd_file_upload` - Upload PRD document
|
|
85
|
+
- `qa_prd_file_list_by_project` - List PRD files
|
|
86
|
+
- `qa_workflow_start_prd_file_process` - Start PRD processing workflow
|
|
87
|
+
- `qa_workflow_get_prd_file_process_latest_run` - Get PRD processing status
|
|
88
|
+
- `qa_secret_create/get/update/delete/list` - Manage credentials
|
|
89
|
+
|
|
90
|
+
#### Use Case Discovery
|
|
91
|
+
- `qa_use_case_discovery_memory_get` - Get discovered use case candidates
|
|
92
|
+
- `qa_use_case_candidates_approve` - Approve candidates into use cases
|
|
93
|
+
- `qa_use_case_list/get` - List and view use cases
|
|
94
|
+
|
|
95
|
+
#### Workflow Execution
|
|
96
|
+
- `qa_workflow_start_website_scan` - Start website scan workflow
|
|
97
|
+
- `qa_workflow_start_test_case_detection` - Generate test cases
|
|
98
|
+
- `qa_workflow_start_test_script_generation` - Generate test scripts
|
|
99
|
+
- `qa_workflow_start_test_script_replay` - Execute test script
|
|
100
|
+
- `qa_workflow_start_test_script_replay_bulk` - Execute multiple scripts
|
|
101
|
+
- `qa_workflow_*_latest_run` - Get workflow status
|
|
102
|
+
- `qa_workflow_cancel_*` - Cancel workflows
|
|
103
|
+
|
|
104
|
+
#### Artifact Inspection
|
|
105
|
+
- `qa_test_case_list/get` - View test cases
|
|
106
|
+
- `qa_test_script_list/get` - View test scripts
|
|
107
|
+
- `qa_project_test_*_summary_get` - View summaries
|
|
108
|
+
|
|
109
|
+
#### Reports & Delivery
|
|
110
|
+
- `qa_report_stats_summary_get` - Get report statistics
|
|
111
|
+
- `qa_report_preferences_upsert` - Configure delivery (email/sms/webhook)
|
|
112
|
+
- `qa_report_final_generate` - Generate final report
|
|
113
|
+
|
|
114
|
+
#### Recommendations (No Side Effects)
|
|
115
|
+
- `qa_recommend_schedule` - Get scheduling recommendations
|
|
116
|
+
- `qa_recommend_cicd_setup` - Get CI/CD integration templates
|
|
117
|
+
|
|
118
|
+
## Typical Workflow
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
1. qa_project_create → Create project
|
|
122
|
+
2. qa_workflow_start_website_scan → Discover use cases from URL
|
|
123
|
+
3. qa_use_case_discovery_memory_get → Review candidates
|
|
124
|
+
4. qa_use_case_candidates_approve → Approve selected use cases
|
|
125
|
+
5. qa_workflow_start_test_case_detection → Generate test cases
|
|
126
|
+
6. qa_workflow_start_test_script_generation → Generate scripts
|
|
127
|
+
7. qa_workflow_start_test_script_replay_bulk → Run all tests
|
|
128
|
+
8. qa_report_final_generate → Generate report
|
|
129
|
+
9. qa_report_preferences_upsert → Configure delivery
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## MCP Endpoint
|
|
133
|
+
|
|
134
|
+
The MCP protocol endpoint is available at:
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
POST/GET/DELETE http://localhost:3002/mcp
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Headers:
|
|
141
|
+
- `Content-Type: application/json`
|
|
142
|
+
- `Authorization: Bearer <token>` or `x-api-key: <key>`
|
|
143
|
+
|
|
144
|
+
## Health Check
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
curl http://localhost:3002/health
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Development
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Watch mode
|
|
154
|
+
npm run dev
|
|
155
|
+
|
|
156
|
+
# Lint
|
|
157
|
+
npm run lint
|
|
158
|
+
|
|
159
|
+
# Build
|
|
160
|
+
npm run build
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Phase 0 Smoke Runner (scripts/phase0-smoke.ts)
|
|
164
|
+
|
|
165
|
+
Run an end-to-end Phase 0 workflow against the gateway and prompt-service.
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
cd mcp-gateway
|
|
169
|
+
MCP_GATEWAY_BASE_URL=http://localhost:3002 \
|
|
170
|
+
MCP_GATEWAY_AUTH_TOKEN="Bearer <jwt>" \ # or MCP_GATEWAY_API_KEY=mai_sk_...
|
|
171
|
+
MCP_QA_WEBSITE_URL=https://example.com \
|
|
172
|
+
MCP_QA_SCAN_DESCRIPTION="Smoke scan" \
|
|
173
|
+
MCP_QA_PROJECT_ID=<existing> \ # or set MCP_QA_PROJECT_NAME + MCP_QA_PROJECT_DESCRIPTION to create
|
|
174
|
+
npx tsx scripts/phase0-smoke.ts
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Optional env:
|
|
178
|
+
- `MCP_QA_TEST_REQUIREMENTS`
|
|
179
|
+
- `MCP_QA_ARCHIVE_UNAPPROVED=true`
|
|
180
|
+
- `MCP_QA_PRD_FILE_PATH` (+ `MCP_QA_PRD_CONTENT_TYPE`)
|
|
181
|
+
- `MCP_QA_REPORT_CHANNELS` (comma, e.g., `email,sms,webhook`) + `MCP_QA_REPORT_EMAILS`, `MCP_QA_REPORT_PHONES`, `MCP_QA_REPORT_WEBHOOK_URL`
|
|
182
|
+
|
|
183
|
+
## License
|
|
184
|
+
|
|
185
|
+
MIT
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SmokeTestResult } from "./types/phase0-smoke-types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Execute the Phase 0 MCP QA workflow end-to-end against the gateway.
|
|
4
|
+
* Returns a structured result instead of throwing errors.
|
|
5
|
+
*/
|
|
6
|
+
export declare function runPhase0SmokeAsync(): Promise<SmokeTestResult>;
|
|
7
|
+
//# sourceMappingURL=phase0-smoke.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phase0-smoke.d.ts","sourceRoot":"","sources":["../../scripts/phase0-smoke.ts"],"names":[],"mappings":"AAoBA,OAAO,EAMH,eAAe,EAWlB,MAAM,+BAA+B,CAAC;AA4SvC;;;GAGG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,eAAe,CAAC,CA6NpE"}
|