@runhuman/mcp-server 2.0.2 → 2.0.4

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/.env.example CHANGED
@@ -1,12 +1,12 @@
1
- # RunHuman API Configuration
2
-
3
- # API Base URL
4
- # For local development, use http://localhost:3400
5
- # For production, use your deployed API URL
6
- RUNHUMAN_API_URL=http://localhost:3400
7
-
8
- # API Key
9
- # Get this from the API dashboard at http://localhost:3400/app.html
10
- # Or use the default test key below for local development
11
- # Format: qa_live_xxxxxxxxxxxxxxxxxxxxx
12
- RUNHUMAN_API_KEY=qa_live_test_key_for_demo_purposes_only_12345
1
+ # RunHuman API Configuration
2
+
3
+ # API Base URL
4
+ # For local development, use http://localhost:3400
5
+ # For production, use your deployed API URL
6
+ RUNHUMAN_API_URL=http://localhost:3400
7
+
8
+ # API Key
9
+ # Get this from the API dashboard at http://localhost:3400/app.html
10
+ # Or use the default test key below for local development
11
+ # Format: qa_live_xxxxxxxxxxxxxxxxxxxxx
12
+ RUNHUMAN_API_KEY=qa_live_test_key_for_demo_purposes_only_12345
package/README.md CHANGED
@@ -1,240 +1,243 @@
1
- # RunHuman MCP Server
2
-
3
- A Model Context Protocol (MCP) server that allows AI agents to interact with the RunHuman QA testing service.
4
-
5
- ## Overview
6
-
7
- This MCP server provides tools for creating and managing human QA jobs through the RunHuman API. AI agents can use this server to:
8
-
9
- - Create new QA jobs with custom schemas
10
- - Check the status of running jobs
11
- - Retrieve completed job results
12
-
13
- ## Installation
14
-
15
- ### For Claude Desktop (Recommended)
16
-
17
- 1. Get your API key at: https://runhuman.com/app.html
18
-
19
- 2. Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on Mac):
20
-
21
- ```json
22
- {
23
- "mcpServers": {
24
- "runhuman": {
25
- "command": "npx",
26
- "args": ["-y", "@runhuman/mcp-server", "--api-key=qa_live_xxxxxxxxxxxxx"]
27
- }
28
- }
29
- }
30
- ```
31
-
32
- 3. Restart Claude Desktop
33
-
34
- That's it! The server will be automatically downloaded and run by Claude.
35
-
36
- ### For Development
37
-
38
- From the monorepo root:
39
-
40
- ```bash
41
- npm install
42
- npm run build --workspace=@runhuman/mcp-server
43
-
44
- # Run with API key
45
- node packages/mcp-server/dist/index.js --api-key=qa_live_xxxxx
46
- ```
47
-
48
- ### Available Tools
49
-
50
- #### `create_job`
51
- Create a new QA job with human testers.
52
-
53
- **Parameters:**
54
- - `url` (string): The URL to test
55
- - `description` (string): Instructions for the human tester describing what to test
56
- - `schema` (object): Expected result schema that the tester response will be extracted into
57
- - `targetDurationMinutes` (number, optional): Time limit for tester (default: 5, range: 1-60)
58
-
59
- #### `wait_for_result`
60
- Check status, wait, and retrieve results for a QA job in a single convenient call.
61
-
62
- **Parameters:**
63
- - `jobId` (string): The ID of the job to check
64
- - `waitSeconds` (number, optional): How long to wait before checking again (default: 30, range: 1-300)
65
-
66
- **Behavior:**
67
- - Checks status BEFORE waiting (returns immediately if already complete)
68
- - Waits for the specified duration
69
- - Checks status AFTER waiting
70
- - Returns results if complete, otherwise suggests calling again with longer wait time
71
-
72
- **Usage Pattern:**
73
- ```javascript
74
- // After creating a job, call repeatedly with increasing wait times:
75
- let result = await wait_for_result(jobId, { waitSeconds: 30 });
76
- if (result.status !== 'completed') {
77
- result = await wait_for_result(jobId, { waitSeconds: 45 });
78
- }
79
- if (result.status !== 'completed') {
80
- result = await wait_for_result(jobId, { waitSeconds: 60 });
81
- }
82
- ```
83
-
84
- **Returns:**
85
- - `result`: Structured test results extracted from tester's response
86
- - `status`: Job status (completed, failed, timeout, pending, claimed, in_progress)
87
- - `costUsd`: Exact cost in USD with full precision (e.g., 0.396)
88
- - `testDurationSeconds`: Time spent by tester in seconds (rounded up)
89
- - Additional metadata (timestamps, tester info, etc.)
90
-
91
- **Cost Calculation:**
92
- - Costs are calculated as: `duration × $0.0018/second` (general-use tier)
93
- - Duration is always rounded UP using Math.ceil (any partial second counts)
94
- - Costs are never $0 unless the tester never actually worked on it
95
- - Full precision maintained (not rounded to cents)
96
-
97
- ## Configuration
98
-
99
- The MCP server needs to be configured with your RunHuman API credentials.
100
-
101
- ### 1. Get an API Key
102
-
103
- **Option A: Via Dashboard**
104
- 1. Start the API server: `npm run dev --workspace=@runhuman/api`
105
- 2. Open http://localhost:3400/app.html
106
- 3. Go to "API Keys" tab
107
- 4. Click "Create API Key"
108
- 5. Copy the key (starts with `qa_live_`)
109
-
110
- **Option B: Use Default Test Key**
111
- - For local development, you can use: `qa_live_test_key_123`
112
- - This key exists in `packages/api/data/api-keys.json`
113
-
114
- ### 2. Configure Environment Variables
115
-
116
- Create a `.env` file in the MCP server directory:
117
-
118
- ```bash
119
- # For local development
120
- RUNHUMAN_API_URL=http://localhost:3400
121
- RUNHUMAN_API_KEY=qa_live_test_key_123
122
-
123
- # For production
124
- RUNHUMAN_API_URL=https://api.runhuman.com
125
- RUNHUMAN_API_KEY=qa_live_xxxxxxxxxxxxxxxxxxxxx
126
- ```
127
-
128
- **Important:** Never commit `.env` files to git! They're already in `.gitignore`.
129
-
130
- ### 3. Verify Configuration
131
-
132
- Test your API key works:
133
-
134
- ```bash
135
- curl http://localhost:3400/api/jobs \
136
- -H "Authorization: Bearer qa_live_test_key_123" \
137
- -H "Content-Type: application/json" \
138
- -d '{"url":"https://example.com","description":"test","outputSchema":{}}'
139
- ```
140
-
141
- Should return a job ID if authentication works.
142
-
143
- For more details, see [docs/API-AUTHENTICATION.md](docs/API-AUTHENTICATION.md)
144
-
145
- ## Testing
146
-
147
- The MCP server includes automated tests to verify it's working correctly:
148
-
149
- ```bash
150
- # Build first
151
- npm run build --workspace=@runhuman/mcp-server
152
-
153
- # Run simple automated test
154
- npm run test --workspace=@runhuman/mcp-server
155
-
156
- # Or use the MCP Inspector (interactive testing)
157
- npm run test:inspector --workspace=@runhuman/mcp-server
158
- ```
159
-
160
- The test script will:
161
- 1. ✅ Initialize a connection to the MCP server
162
- 2. ✅ List all available tools (create_job, wait_for_result)
163
- 3. Test calling the create_job tool
164
-
165
- ### Expected Test Output
166
-
167
- ```
168
- Server initialized successfully
169
- ✅ Tools listed: create_job, wait_for_result
170
- ✅ create_job tool called successfully
171
- ```
172
-
173
- ## Development
174
-
175
- ```bash
176
- # Watch mode (auto-rebuild on changes)
177
- npm run dev --workspace=@runhuman/mcp-server
178
-
179
- # Build
180
- npm run build --workspace=@runhuman/mcp-server
181
-
182
- # Test after building
183
- npm run test --workspace=@runhuman/mcp-server
184
- ```
185
-
186
- ## Integration with Claude Desktop
187
-
188
- To use this MCP server with Claude Desktop, add it to your configuration:
189
-
190
- ```json
191
- {
192
- "mcpServers": {
193
- "runhuman": {
194
- "command": "node",
195
- "args": ["/path/to/qa-experiment/packages/mcp-server/dist/index.js"]
196
- }
197
- }
198
- }
199
- ```
200
-
201
- ## Example Usage
202
-
203
- Once connected to an AI agent (like Claude), the agent can use these tools naturally:
204
-
205
- **User:** "Can someone test my checkout page at https://myapp.com/checkout?"
206
-
207
- **Agent uses create_job:**
208
- ```
209
- ✅ Job created successfully!
210
- Job ID: job_abc123
211
- Status: pending
212
- ...
213
- ```
214
-
215
- **Agent calls wait_for_result repeatedly until complete:**
216
- ```
217
- ⏳ Job Status: in_progress
218
- Waited 30s, job not complete yet.
219
- 💡 Suggestion: Call wait_for_result again with waitSeconds: 45
220
- ```
221
-
222
- **Finally:**
223
- ```
224
- ✅ Test completed!
225
- Results Summary:
226
- - Checkout Flow: ✅ Working
227
- - Payment Processing: ✅ Successful
228
- ...
229
- ```
230
-
231
- ## Developer Documentation
232
-
233
- For developers working on this MCP server:
234
- - [docs/HOW-AGENTS-USE-MCP.md](docs/HOW-AGENTS-USE-MCP.md) - How AI agents discover and use MCP servers
235
- - [docs/TOOL-RESPONSE-BEST-PRACTICES.md](docs/TOOL-RESPONSE-BEST-PRACTICES.md) - Best practices for tool responses
236
-
237
- ## Learn More
238
-
239
- - [Model Context Protocol Documentation](https://modelcontextprotocol.io/)
240
- - [RunHuman API Documentation](../api/README.md)
1
+ # RunHuman MCP Server
2
+
3
+ A Model Context Protocol (MCP) server that allows AI agents to interact with the RunHuman QA testing service.
4
+
5
+ ## Overview
6
+
7
+ This MCP server provides tools for creating and managing human QA jobs through the RunHuman API. AI agents can use this server to:
8
+
9
+ - Create new QA jobs with custom schemas
10
+ - Check the status of running jobs
11
+ - Retrieve completed job results
12
+
13
+ ## Installation
14
+
15
+ ### For Claude Desktop (Recommended)
16
+
17
+ 1. Get your API key at: https://runhuman.com/dashboard/api-keys
18
+
19
+ 2. Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on Mac):
20
+
21
+ ```json
22
+ {
23
+ "mcpServers": {
24
+ "runhuman": {
25
+ "command": "npx",
26
+ "args": ["-y", "@runhuman/mcp-server", "--api-key=qa_live_xxxxxxxxxxxxx"]
27
+ }
28
+ }
29
+ }
30
+ ```
31
+
32
+ 3. Restart Claude Desktop
33
+
34
+ That's it! The server will be automatically downloaded and run by Claude.
35
+
36
+ ### For Development
37
+
38
+ From the monorepo root:
39
+
40
+ ```bash
41
+ npm install
42
+ npm run build --workspace=@runhuman/mcp-server
43
+
44
+ # Run with API key
45
+ node packages/mcp-server/dist/index.js --api-key=qa_live_xxxxx
46
+ ```
47
+
48
+ ### Available Tools
49
+
50
+ #### `create_job`
51
+ Create a new QA job with human testers.
52
+
53
+ **Parameters:**
54
+ - `url` (string): The URL to test
55
+ - `description` (string): Instructions for the human tester describing what to test
56
+ - `schema` (object): Expected result schema that the tester response will be extracted into
57
+ - `targetDurationMinutes` (number, optional): Time limit for tester (default: 5, range: 1-60)
58
+
59
+ #### `wait_for_result`
60
+ Check status, wait, and retrieve results for a QA job in a single convenient call.
61
+
62
+ **Parameters:**
63
+ - `jobId` (string): The ID of the job to check
64
+ - `waitSeconds` (number, optional): How long to wait before checking again (default: 30, range: 1-300)
65
+
66
+ **Behavior:**
67
+ - Checks status BEFORE waiting (returns immediately if already complete)
68
+ - Waits for the specified duration
69
+ - Checks status AFTER waiting
70
+ - Returns results if complete, otherwise suggests calling again with longer wait time
71
+
72
+ **Usage Pattern:**
73
+ ```javascript
74
+ // After creating a job, call repeatedly with increasing wait times:
75
+ let result = await wait_for_result(jobId, { waitSeconds: 30 });
76
+ if (result.status !== 'completed') {
77
+ result = await wait_for_result(jobId, { waitSeconds: 45 });
78
+ }
79
+ if (result.status !== 'completed') {
80
+ result = await wait_for_result(jobId, { waitSeconds: 60 });
81
+ }
82
+ ```
83
+
84
+ **Returns:**
85
+ - `result`: Structured test results extracted from tester's response
86
+ - `status`: Job status (completed, failed, timeout, pending, claimed, in_progress)
87
+ - `costUsd`: Exact cost in USD with full precision (e.g., 0.396)
88
+ - `testDurationSeconds`: Time spent by tester in seconds (rounded up)
89
+ - `testerResponse`: Raw natural language feedback from the human tester
90
+ - `testerAlias`: Anonymized tester name (e.g., "Tester Alpha")
91
+ - `testerAvatarUrl`: Avatar image URL for UI display
92
+ - `testerColor`: Hex color code for theming (e.g., "#4A90E2")
93
+ - Additional metadata (timestamps, etc.)
94
+
95
+ **Cost Calculation:**
96
+ - Costs are calculated as: `duration × $0.0018/second` (general-use tier)
97
+ - Duration is always rounded UP using Math.ceil (any partial second counts)
98
+ - Costs are never $0 unless the tester never actually worked on it
99
+ - Full precision maintained (not rounded to cents)
100
+
101
+ ## Configuration
102
+
103
+ The MCP server needs to be configured with your RunHuman API credentials.
104
+
105
+ ### 1. Get an API Key
106
+
107
+ **Option A: Via Dashboard**
108
+ 1. Start the API server: `npm run dev --workspace=@runhuman/api`
109
+ 2. Open http://localhost:3400/api-keys
110
+ 3. Click "Create API Key"
111
+ 4. Copy the key (starts with `qa_live_`)
112
+
113
+ **Option B: Use Default Test Key**
114
+ - For local development, you can use: `qa_live_test_key_123`
115
+ - This key exists in `packages/api/data/api-keys.json`
116
+
117
+ ### 2. Configure Environment Variables
118
+
119
+ Create a `.env` file in the MCP server directory:
120
+
121
+ ```bash
122
+ # For local development
123
+ RUNHUMAN_API_URL=http://localhost:3400
124
+ RUNHUMAN_API_KEY=qa_live_test_key_123
125
+
126
+ # For production
127
+ RUNHUMAN_API_URL=https://api.runhuman.com
128
+ RUNHUMAN_API_KEY=qa_live_xxxxxxxxxxxxxxxxxxxxx
129
+ ```
130
+
131
+ **Important:** Never commit `.env` files to git! They're already in `.gitignore`.
132
+
133
+ ### 3. Verify Configuration
134
+
135
+ Test your API key works:
136
+
137
+ ```bash
138
+ curl http://localhost:3400/api/jobs \
139
+ -H "Authorization: Bearer qa_live_test_key_123" \
140
+ -H "Content-Type: application/json" \
141
+ -d '{"url":"https://example.com","description":"test","outputSchema":{}}'
142
+ ```
143
+
144
+ Should return a job ID if authentication works.
145
+
146
+ For more details, see [docs/API-AUTHENTICATION.md](docs/API-AUTHENTICATION.md)
147
+
148
+ ## Testing
149
+
150
+ The MCP server includes automated tests to verify it's working correctly:
151
+
152
+ ```bash
153
+ # Build first
154
+ npm run build --workspace=@runhuman/mcp-server
155
+
156
+ # Run simple automated test
157
+ npm run test --workspace=@runhuman/mcp-server
158
+
159
+ # Or use the MCP Inspector (interactive testing)
160
+ npm run test:inspector --workspace=@runhuman/mcp-server
161
+ ```
162
+
163
+ The test script will:
164
+ 1. ✅ Initialize a connection to the MCP server
165
+ 2. List all available tools (create_job, wait_for_result)
166
+ 3. ✅ Test calling the create_job tool
167
+
168
+ ### Expected Test Output
169
+
170
+ ```
171
+ ✅ Server initialized successfully
172
+ ✅ Tools listed: create_job, wait_for_result
173
+ create_job tool called successfully
174
+ ```
175
+
176
+ ## Development
177
+
178
+ ```bash
179
+ # Watch mode (auto-rebuild on changes)
180
+ npm run dev --workspace=@runhuman/mcp-server
181
+
182
+ # Build
183
+ npm run build --workspace=@runhuman/mcp-server
184
+
185
+ # Test after building
186
+ npm run test --workspace=@runhuman/mcp-server
187
+ ```
188
+
189
+ ## Integration with Claude Desktop
190
+
191
+ To use this MCP server with Claude Desktop, add it to your configuration:
192
+
193
+ ```json
194
+ {
195
+ "mcpServers": {
196
+ "runhuman": {
197
+ "command": "node",
198
+ "args": ["/path/to/qa-experiment/packages/mcp-server/dist/index.js"]
199
+ }
200
+ }
201
+ }
202
+ ```
203
+
204
+ ## Example Usage
205
+
206
+ Once connected to an AI agent (like Claude), the agent can use these tools naturally:
207
+
208
+ **User:** "Can someone test my checkout page at https://myapp.com/checkout?"
209
+
210
+ **Agent uses create_job:**
211
+ ```
212
+ ✅ Job created successfully!
213
+ Job ID: job_abc123
214
+ Status: pending
215
+ ...
216
+ ```
217
+
218
+ **Agent calls wait_for_result repeatedly until complete:**
219
+ ```
220
+ ⏳ Job Status: in_progress
221
+ Waited 30s, job not complete yet.
222
+ 💡 Suggestion: Call wait_for_result again with waitSeconds: 45
223
+ ```
224
+
225
+ **Finally:**
226
+ ```
227
+ Test completed!
228
+ Results Summary:
229
+ - Checkout Flow: ✅ Working
230
+ - Payment Processing: ✅ Successful
231
+ ...
232
+ ```
233
+
234
+ ## Developer Documentation
235
+
236
+ For developers working on this MCP server:
237
+ - [docs/HOW-AGENTS-USE-MCP.md](docs/HOW-AGENTS-USE-MCP.md) - How AI agents discover and use MCP servers
238
+ - [docs/TOOL-RESPONSE-BEST-PRACTICES.md](docs/TOOL-RESPONSE-BEST-PRACTICES.md) - Best practices for tool responses
239
+
240
+ ## Learn More
241
+
242
+ - [Model Context Protocol Documentation](https://modelcontextprotocol.io/)
243
+ - [RunHuman API Documentation](../api/README.md)
package/dist/index.d.ts CHANGED
@@ -1,12 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * RunHuman MCP Server
3
+ * RunHuman MCP Server - stdio entry point
4
4
  *
5
- * This MCP server provides tools for AI agents to interact with the RunHuman QA testing service.
6
- * It allows agents to:
7
- * - Create QA jobs
8
- * - Check job status
9
- * - Retrieve job results
5
+ * This is the CLI entry point for npx @runhuman/mcp-server.
6
+ * It uses stdio transport for communication with MCP clients like Claude Desktop.
10
7
  *
11
8
  * @see https://modelcontextprotocol.io/
12
9
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;GAUG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;GAOG"}