mcp-server-mturk 0.1.0__tar.gz
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.
- mcp_server_mturk-0.1.0/.claude/settings.local.json +14 -0
- mcp_server_mturk-0.1.0/.env.example +7 -0
- mcp_server_mturk-0.1.0/LICENSE +21 -0
- mcp_server_mturk-0.1.0/PKG-INFO +271 -0
- mcp_server_mturk-0.1.0/README.md +247 -0
- mcp_server_mturk-0.1.0/pyproject.toml +50 -0
- mcp_server_mturk-0.1.0/src/mturk_mcp/__init__.py +3 -0
- mcp_server_mturk-0.1.0/src/mturk_mcp/client.py +75 -0
- mcp_server_mturk-0.1.0/src/mturk_mcp/server.py +75 -0
- mcp_server_mturk-0.1.0/src/mturk_mcp/tools/__init__.py +5 -0
- mcp_server_mturk-0.1.0/src/mturk_mcp/tools/account.py +109 -0
- mcp_server_mturk-0.1.0/src/mturk_mcp/tools/assignments.py +329 -0
- mcp_server_mturk-0.1.0/src/mturk_mcp/tools/hits.py +384 -0
- mcp_server_mturk-0.1.0/src/mturk_mcp/tools/qualifications.py +341 -0
- mcp_server_mturk-0.1.0/src/mturk_mcp/tools/workers.py +359 -0
- mcp_server_mturk-0.1.0/uv.lock +821 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"mcp__mturk-sandbox__get_account_balance",
|
|
5
|
+
"mcp__mturk-sandbox__list_hits",
|
|
6
|
+
"mcp__mturk-sandbox__list_reviewable_hits",
|
|
7
|
+
"mcp__mturk-sandbox__list_blocked_workers",
|
|
8
|
+
"mcp__mturk-sandbox__list_qualification_types",
|
|
9
|
+
"mcp__mturk-sandbox__create_hit",
|
|
10
|
+
"mcp__mturk-sandbox__list_assignments",
|
|
11
|
+
"mcp__mturk-sandbox__approve_assignment"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 David McSharry
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcp-server-mturk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP server for Amazon Mechanical Turk - enables AI agents to create HITs, review assignments, manage workers, and access human intelligence
|
|
5
|
+
Project-URL: Homepage, https://github.com/davidmcsharry/mcp-server-mturk
|
|
6
|
+
Project-URL: Repository, https://github.com/davidmcsharry/mcp-server-mturk
|
|
7
|
+
Project-URL: Issues, https://github.com/davidmcsharry/mcp-server-mturk/issues
|
|
8
|
+
Author: David McSharry
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: ai-agents,amazon,crowdsourcing,human-intelligence,llm,mcp,mechanical-turk,model-context-protocol,mturk
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Requires-Dist: boto3>=1.35.0
|
|
21
|
+
Requires-Dist: mcp>=1.0.0
|
|
22
|
+
Requires-Dist: pydantic>=2.0.0
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# mcp-server-mturk
|
|
26
|
+
|
|
27
|
+
An MCP (Model Context Protocol) server that enables AI agents to interact with Amazon Mechanical Turk. This allows AI systems to request human intelligence for surveys, data labeling, content moderation, and any other MTurk-supported task.
|
|
28
|
+
|
|
29
|
+
## Features
|
|
30
|
+
|
|
31
|
+
- **24 tools** covering the full MTurk API
|
|
32
|
+
- **HIT Management**: Create, list, update, and delete Human Intelligence Tasks
|
|
33
|
+
- **Assignment Workflow**: Review, approve, reject, and bulk-approve worker submissions
|
|
34
|
+
- **Qualification System**: Create custom qualifications to filter workers
|
|
35
|
+
- **Worker Management**: Block/unblock workers, send notifications, pay bonuses
|
|
36
|
+
- **Account Management**: Check balance, list reviewable HITs
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
### Using uvx (recommended)
|
|
41
|
+
|
|
42
|
+
No installation needed. Run directly:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
uvx mcp-server-mturk
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Using pip
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install mcp-server-mturk
|
|
52
|
+
python -m mturk_mcp.server
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Configuration
|
|
56
|
+
|
|
57
|
+
### Environment Variables
|
|
58
|
+
|
|
59
|
+
| Variable | Required | Description |
|
|
60
|
+
|----------|----------|-------------|
|
|
61
|
+
| `AWS_ACCESS_KEY_ID` | Yes | Your AWS access key with MTurk permissions |
|
|
62
|
+
| `AWS_SECRET_ACCESS_KEY` | Yes | Your AWS secret key |
|
|
63
|
+
| `MTURK_SANDBOX` | No | Set to `true` for sandbox mode (testing) |
|
|
64
|
+
|
|
65
|
+
### AWS Credentials Setup
|
|
66
|
+
|
|
67
|
+
1. Go to [AWS IAM Console](https://console.aws.amazon.com/iam/)
|
|
68
|
+
2. Create a new user with `AmazonMechanicalTurkFullAccess` policy
|
|
69
|
+
3. Generate access keys for the user
|
|
70
|
+
|
|
71
|
+
### MTurk Account Setup
|
|
72
|
+
|
|
73
|
+
1. Create an [MTurk Requester account](https://requester.mturk.com/)
|
|
74
|
+
2. For testing, also register for the [MTurk Sandbox](https://requestersandbox.mturk.com/)
|
|
75
|
+
|
|
76
|
+
## Usage with AI Clients
|
|
77
|
+
|
|
78
|
+
### Claude Code
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Sandbox mode (recommended for testing)
|
|
82
|
+
claude mcp add mturk-sandbox \
|
|
83
|
+
--env AWS_ACCESS_KEY_ID=your_key \
|
|
84
|
+
--env AWS_SECRET_ACCESS_KEY=your_secret \
|
|
85
|
+
--env MTURK_SANDBOX=true \
|
|
86
|
+
-- uvx mcp-server-mturk
|
|
87
|
+
|
|
88
|
+
# Production mode (uses real money!)
|
|
89
|
+
claude mcp add mturk \
|
|
90
|
+
--env AWS_ACCESS_KEY_ID=your_key \
|
|
91
|
+
--env AWS_SECRET_ACCESS_KEY=your_secret \
|
|
92
|
+
-- uvx mcp-server-mturk
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Claude Desktop
|
|
96
|
+
|
|
97
|
+
Add to your `claude_desktop_config.json`:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"mcpServers": {
|
|
102
|
+
"mturk-sandbox": {
|
|
103
|
+
"command": "uvx",
|
|
104
|
+
"args": ["mcp-server-mturk"],
|
|
105
|
+
"env": {
|
|
106
|
+
"AWS_ACCESS_KEY_ID": "your_key",
|
|
107
|
+
"AWS_SECRET_ACCESS_KEY": "your_secret",
|
|
108
|
+
"MTURK_SANDBOX": "true"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Config file locations:
|
|
116
|
+
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
117
|
+
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
118
|
+
|
|
119
|
+
### Cursor
|
|
120
|
+
|
|
121
|
+
Add to Cursor's MCP settings:
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
{
|
|
125
|
+
"mcpServers": {
|
|
126
|
+
"mturk": {
|
|
127
|
+
"command": "uvx",
|
|
128
|
+
"args": ["mcp-server-mturk"],
|
|
129
|
+
"env": {
|
|
130
|
+
"AWS_ACCESS_KEY_ID": "your_key",
|
|
131
|
+
"AWS_SECRET_ACCESS_KEY": "your_secret",
|
|
132
|
+
"MTURK_SANDBOX": "true"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Using pip instead of uvx
|
|
140
|
+
|
|
141
|
+
Replace `"command": "uvx", "args": ["mcp-server-mturk"]` with:
|
|
142
|
+
|
|
143
|
+
```json
|
|
144
|
+
{
|
|
145
|
+
"command": "python",
|
|
146
|
+
"args": ["-m", "mturk_mcp.server"]
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Available Tools
|
|
151
|
+
|
|
152
|
+
### HIT Operations (6 tools)
|
|
153
|
+
|
|
154
|
+
| Tool | Description |
|
|
155
|
+
|------|-------------|
|
|
156
|
+
| `create_hit` | Create a new Human Intelligence Task with HTML form |
|
|
157
|
+
| `get_hit` | Get details and status of a specific HIT |
|
|
158
|
+
| `list_hits` | List all HITs for your account |
|
|
159
|
+
| `delete_hit` | Delete a HIT (must have no pending assignments) |
|
|
160
|
+
| `update_hit_expiration` | Extend or expire a HIT |
|
|
161
|
+
| `create_additional_assignments` | Add more worker slots to an existing HIT |
|
|
162
|
+
|
|
163
|
+
### Assignment Management (5 tools)
|
|
164
|
+
|
|
165
|
+
| Tool | Description |
|
|
166
|
+
|------|-------------|
|
|
167
|
+
| `list_assignments` | Get all worker submissions for a HIT |
|
|
168
|
+
| `get_assignment` | Get details including worker's answer |
|
|
169
|
+
| `approve_assignment` | Approve and pay for completed work |
|
|
170
|
+
| `reject_assignment` | Reject unsatisfactory work (use sparingly) |
|
|
171
|
+
| `approve_all_submitted_assignments` | Bulk approve all pending assignments |
|
|
172
|
+
|
|
173
|
+
### Qualification Management (5 tools)
|
|
174
|
+
|
|
175
|
+
| Tool | Description |
|
|
176
|
+
|------|-------------|
|
|
177
|
+
| `create_qualification_type` | Create a custom worker qualification |
|
|
178
|
+
| `list_qualification_types` | List available qualifications |
|
|
179
|
+
| `assign_qualification` | Grant a qualification to a worker |
|
|
180
|
+
| `revoke_qualification` | Remove a qualification from a worker |
|
|
181
|
+
| `get_qualification_score` | Check a worker's qualification value |
|
|
182
|
+
|
|
183
|
+
### Worker Management (6 tools)
|
|
184
|
+
|
|
185
|
+
| Tool | Description |
|
|
186
|
+
|------|-------------|
|
|
187
|
+
| `block_worker` | Block a worker from all your HITs |
|
|
188
|
+
| `unblock_worker` | Remove a worker block |
|
|
189
|
+
| `list_blocked_workers` | List all blocked workers |
|
|
190
|
+
| `notify_workers` | Send email to workers |
|
|
191
|
+
| `send_bonus` | Send bonus payment to a worker |
|
|
192
|
+
| `list_bonus_payments` | List bonus payments made |
|
|
193
|
+
|
|
194
|
+
### Account & Utility (2 tools)
|
|
195
|
+
|
|
196
|
+
| Tool | Description |
|
|
197
|
+
|------|-------------|
|
|
198
|
+
| `get_account_balance` | Check your MTurk account balance |
|
|
199
|
+
| `list_reviewable_hits` | Find HITs with work ready for review |
|
|
200
|
+
|
|
201
|
+
## Example Prompts
|
|
202
|
+
|
|
203
|
+
Once connected, you can ask your AI assistant things like:
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
"Check my MTurk account balance"
|
|
207
|
+
|
|
208
|
+
"Create a survey HIT asking 100 people their favorite programming language, paying $0.10 each"
|
|
209
|
+
|
|
210
|
+
"List all my HITs and show which ones have pending assignments"
|
|
211
|
+
|
|
212
|
+
"Show me the submitted assignments for HIT abc123"
|
|
213
|
+
|
|
214
|
+
"Approve all submitted assignments for HIT abc123 with the message 'Thank you!'"
|
|
215
|
+
|
|
216
|
+
"Send a $0.50 bonus to worker xyz789 for their detailed response"
|
|
217
|
+
|
|
218
|
+
"Create a 'Trusted Worker' qualification and assign it to workers who did good work"
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## Sandbox vs Production
|
|
222
|
+
|
|
223
|
+
| Mode | Environment Variable | Use For |
|
|
224
|
+
|------|---------------------|---------|
|
|
225
|
+
| **Sandbox** | `MTURK_SANDBOX=true` | Testing, development, no real money |
|
|
226
|
+
| **Production** | `MTURK_SANDBOX=false` (or unset) | Real HITs, real workers, real payments |
|
|
227
|
+
|
|
228
|
+
**Always test with sandbox first!** Production mode uses real money and interacts with real workers.
|
|
229
|
+
|
|
230
|
+
## Development
|
|
231
|
+
|
|
232
|
+
### Running locally
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
# Clone and install
|
|
236
|
+
git clone https://github.com/davidmcsharry/mcp-server-mturk
|
|
237
|
+
cd mcp-server-mturk
|
|
238
|
+
uv sync
|
|
239
|
+
|
|
240
|
+
# Run the server
|
|
241
|
+
uv run python -m mturk_mcp.server
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Testing with MCP Inspector
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
npx @modelcontextprotocol/inspector uvx mcp-server-mturk
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Building
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
uv build
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Publishing to PyPI
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
uv publish
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## License
|
|
263
|
+
|
|
264
|
+
MIT
|
|
265
|
+
|
|
266
|
+
## Links
|
|
267
|
+
|
|
268
|
+
- [Model Context Protocol](https://modelcontextprotocol.io/)
|
|
269
|
+
- [MTurk API Documentation](https://docs.aws.amazon.com/AWSMechTurk/latest/AWSMturkAPI/Welcome.html)
|
|
270
|
+
- [MTurk Requester Portal](https://requester.mturk.com/)
|
|
271
|
+
- [MTurk Sandbox](https://requestersandbox.mturk.com/)
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# mcp-server-mturk
|
|
2
|
+
|
|
3
|
+
An MCP (Model Context Protocol) server that enables AI agents to interact with Amazon Mechanical Turk. This allows AI systems to request human intelligence for surveys, data labeling, content moderation, and any other MTurk-supported task.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **24 tools** covering the full MTurk API
|
|
8
|
+
- **HIT Management**: Create, list, update, and delete Human Intelligence Tasks
|
|
9
|
+
- **Assignment Workflow**: Review, approve, reject, and bulk-approve worker submissions
|
|
10
|
+
- **Qualification System**: Create custom qualifications to filter workers
|
|
11
|
+
- **Worker Management**: Block/unblock workers, send notifications, pay bonuses
|
|
12
|
+
- **Account Management**: Check balance, list reviewable HITs
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
### Using uvx (recommended)
|
|
17
|
+
|
|
18
|
+
No installation needed. Run directly:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
uvx mcp-server-mturk
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Using pip
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install mcp-server-mturk
|
|
28
|
+
python -m mturk_mcp.server
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Configuration
|
|
32
|
+
|
|
33
|
+
### Environment Variables
|
|
34
|
+
|
|
35
|
+
| Variable | Required | Description |
|
|
36
|
+
|----------|----------|-------------|
|
|
37
|
+
| `AWS_ACCESS_KEY_ID` | Yes | Your AWS access key with MTurk permissions |
|
|
38
|
+
| `AWS_SECRET_ACCESS_KEY` | Yes | Your AWS secret key |
|
|
39
|
+
| `MTURK_SANDBOX` | No | Set to `true` for sandbox mode (testing) |
|
|
40
|
+
|
|
41
|
+
### AWS Credentials Setup
|
|
42
|
+
|
|
43
|
+
1. Go to [AWS IAM Console](https://console.aws.amazon.com/iam/)
|
|
44
|
+
2. Create a new user with `AmazonMechanicalTurkFullAccess` policy
|
|
45
|
+
3. Generate access keys for the user
|
|
46
|
+
|
|
47
|
+
### MTurk Account Setup
|
|
48
|
+
|
|
49
|
+
1. Create an [MTurk Requester account](https://requester.mturk.com/)
|
|
50
|
+
2. For testing, also register for the [MTurk Sandbox](https://requestersandbox.mturk.com/)
|
|
51
|
+
|
|
52
|
+
## Usage with AI Clients
|
|
53
|
+
|
|
54
|
+
### Claude Code
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Sandbox mode (recommended for testing)
|
|
58
|
+
claude mcp add mturk-sandbox \
|
|
59
|
+
--env AWS_ACCESS_KEY_ID=your_key \
|
|
60
|
+
--env AWS_SECRET_ACCESS_KEY=your_secret \
|
|
61
|
+
--env MTURK_SANDBOX=true \
|
|
62
|
+
-- uvx mcp-server-mturk
|
|
63
|
+
|
|
64
|
+
# Production mode (uses real money!)
|
|
65
|
+
claude mcp add mturk \
|
|
66
|
+
--env AWS_ACCESS_KEY_ID=your_key \
|
|
67
|
+
--env AWS_SECRET_ACCESS_KEY=your_secret \
|
|
68
|
+
-- uvx mcp-server-mturk
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Claude Desktop
|
|
72
|
+
|
|
73
|
+
Add to your `claude_desktop_config.json`:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"mcpServers": {
|
|
78
|
+
"mturk-sandbox": {
|
|
79
|
+
"command": "uvx",
|
|
80
|
+
"args": ["mcp-server-mturk"],
|
|
81
|
+
"env": {
|
|
82
|
+
"AWS_ACCESS_KEY_ID": "your_key",
|
|
83
|
+
"AWS_SECRET_ACCESS_KEY": "your_secret",
|
|
84
|
+
"MTURK_SANDBOX": "true"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Config file locations:
|
|
92
|
+
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
93
|
+
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
94
|
+
|
|
95
|
+
### Cursor
|
|
96
|
+
|
|
97
|
+
Add to Cursor's MCP settings:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"mcpServers": {
|
|
102
|
+
"mturk": {
|
|
103
|
+
"command": "uvx",
|
|
104
|
+
"args": ["mcp-server-mturk"],
|
|
105
|
+
"env": {
|
|
106
|
+
"AWS_ACCESS_KEY_ID": "your_key",
|
|
107
|
+
"AWS_SECRET_ACCESS_KEY": "your_secret",
|
|
108
|
+
"MTURK_SANDBOX": "true"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Using pip instead of uvx
|
|
116
|
+
|
|
117
|
+
Replace `"command": "uvx", "args": ["mcp-server-mturk"]` with:
|
|
118
|
+
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"command": "python",
|
|
122
|
+
"args": ["-m", "mturk_mcp.server"]
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Available Tools
|
|
127
|
+
|
|
128
|
+
### HIT Operations (6 tools)
|
|
129
|
+
|
|
130
|
+
| Tool | Description |
|
|
131
|
+
|------|-------------|
|
|
132
|
+
| `create_hit` | Create a new Human Intelligence Task with HTML form |
|
|
133
|
+
| `get_hit` | Get details and status of a specific HIT |
|
|
134
|
+
| `list_hits` | List all HITs for your account |
|
|
135
|
+
| `delete_hit` | Delete a HIT (must have no pending assignments) |
|
|
136
|
+
| `update_hit_expiration` | Extend or expire a HIT |
|
|
137
|
+
| `create_additional_assignments` | Add more worker slots to an existing HIT |
|
|
138
|
+
|
|
139
|
+
### Assignment Management (5 tools)
|
|
140
|
+
|
|
141
|
+
| Tool | Description |
|
|
142
|
+
|------|-------------|
|
|
143
|
+
| `list_assignments` | Get all worker submissions for a HIT |
|
|
144
|
+
| `get_assignment` | Get details including worker's answer |
|
|
145
|
+
| `approve_assignment` | Approve and pay for completed work |
|
|
146
|
+
| `reject_assignment` | Reject unsatisfactory work (use sparingly) |
|
|
147
|
+
| `approve_all_submitted_assignments` | Bulk approve all pending assignments |
|
|
148
|
+
|
|
149
|
+
### Qualification Management (5 tools)
|
|
150
|
+
|
|
151
|
+
| Tool | Description |
|
|
152
|
+
|------|-------------|
|
|
153
|
+
| `create_qualification_type` | Create a custom worker qualification |
|
|
154
|
+
| `list_qualification_types` | List available qualifications |
|
|
155
|
+
| `assign_qualification` | Grant a qualification to a worker |
|
|
156
|
+
| `revoke_qualification` | Remove a qualification from a worker |
|
|
157
|
+
| `get_qualification_score` | Check a worker's qualification value |
|
|
158
|
+
|
|
159
|
+
### Worker Management (6 tools)
|
|
160
|
+
|
|
161
|
+
| Tool | Description |
|
|
162
|
+
|------|-------------|
|
|
163
|
+
| `block_worker` | Block a worker from all your HITs |
|
|
164
|
+
| `unblock_worker` | Remove a worker block |
|
|
165
|
+
| `list_blocked_workers` | List all blocked workers |
|
|
166
|
+
| `notify_workers` | Send email to workers |
|
|
167
|
+
| `send_bonus` | Send bonus payment to a worker |
|
|
168
|
+
| `list_bonus_payments` | List bonus payments made |
|
|
169
|
+
|
|
170
|
+
### Account & Utility (2 tools)
|
|
171
|
+
|
|
172
|
+
| Tool | Description |
|
|
173
|
+
|------|-------------|
|
|
174
|
+
| `get_account_balance` | Check your MTurk account balance |
|
|
175
|
+
| `list_reviewable_hits` | Find HITs with work ready for review |
|
|
176
|
+
|
|
177
|
+
## Example Prompts
|
|
178
|
+
|
|
179
|
+
Once connected, you can ask your AI assistant things like:
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
"Check my MTurk account balance"
|
|
183
|
+
|
|
184
|
+
"Create a survey HIT asking 100 people their favorite programming language, paying $0.10 each"
|
|
185
|
+
|
|
186
|
+
"List all my HITs and show which ones have pending assignments"
|
|
187
|
+
|
|
188
|
+
"Show me the submitted assignments for HIT abc123"
|
|
189
|
+
|
|
190
|
+
"Approve all submitted assignments for HIT abc123 with the message 'Thank you!'"
|
|
191
|
+
|
|
192
|
+
"Send a $0.50 bonus to worker xyz789 for their detailed response"
|
|
193
|
+
|
|
194
|
+
"Create a 'Trusted Worker' qualification and assign it to workers who did good work"
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Sandbox vs Production
|
|
198
|
+
|
|
199
|
+
| Mode | Environment Variable | Use For |
|
|
200
|
+
|------|---------------------|---------|
|
|
201
|
+
| **Sandbox** | `MTURK_SANDBOX=true` | Testing, development, no real money |
|
|
202
|
+
| **Production** | `MTURK_SANDBOX=false` (or unset) | Real HITs, real workers, real payments |
|
|
203
|
+
|
|
204
|
+
**Always test with sandbox first!** Production mode uses real money and interacts with real workers.
|
|
205
|
+
|
|
206
|
+
## Development
|
|
207
|
+
|
|
208
|
+
### Running locally
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
# Clone and install
|
|
212
|
+
git clone https://github.com/davidmcsharry/mcp-server-mturk
|
|
213
|
+
cd mcp-server-mturk
|
|
214
|
+
uv sync
|
|
215
|
+
|
|
216
|
+
# Run the server
|
|
217
|
+
uv run python -m mturk_mcp.server
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Testing with MCP Inspector
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
npx @modelcontextprotocol/inspector uvx mcp-server-mturk
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Building
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
uv build
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Publishing to PyPI
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
uv publish
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## License
|
|
239
|
+
|
|
240
|
+
MIT
|
|
241
|
+
|
|
242
|
+
## Links
|
|
243
|
+
|
|
244
|
+
- [Model Context Protocol](https://modelcontextprotocol.io/)
|
|
245
|
+
- [MTurk API Documentation](https://docs.aws.amazon.com/AWSMechTurk/latest/AWSMturkAPI/Welcome.html)
|
|
246
|
+
- [MTurk Requester Portal](https://requester.mturk.com/)
|
|
247
|
+
- [MTurk Sandbox](https://requestersandbox.mturk.com/)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "mcp-server-mturk"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "MCP server for Amazon Mechanical Turk - enables AI agents to create HITs, review assignments, manage workers, and access human intelligence"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
requires-python = ">=3.10"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name = "David McSharry" }
|
|
10
|
+
]
|
|
11
|
+
keywords = [
|
|
12
|
+
"mcp",
|
|
13
|
+
"model-context-protocol",
|
|
14
|
+
"mturk",
|
|
15
|
+
"mechanical-turk",
|
|
16
|
+
"amazon",
|
|
17
|
+
"crowdsourcing",
|
|
18
|
+
"human-intelligence",
|
|
19
|
+
"ai-agents",
|
|
20
|
+
"llm",
|
|
21
|
+
]
|
|
22
|
+
classifiers = [
|
|
23
|
+
"Development Status :: 4 - Beta",
|
|
24
|
+
"Intended Audience :: Developers",
|
|
25
|
+
"License :: OSI Approved :: MIT License",
|
|
26
|
+
"Programming Language :: Python :: 3",
|
|
27
|
+
"Programming Language :: Python :: 3.10",
|
|
28
|
+
"Programming Language :: Python :: 3.11",
|
|
29
|
+
"Programming Language :: Python :: 3.12",
|
|
30
|
+
]
|
|
31
|
+
dependencies = [
|
|
32
|
+
"mcp>=1.0.0",
|
|
33
|
+
"boto3>=1.35.0",
|
|
34
|
+
"pydantic>=2.0.0",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
Homepage = "https://github.com/davidmcsharry/mcp-server-mturk"
|
|
39
|
+
Repository = "https://github.com/davidmcsharry/mcp-server-mturk"
|
|
40
|
+
Issues = "https://github.com/davidmcsharry/mcp-server-mturk/issues"
|
|
41
|
+
|
|
42
|
+
[project.scripts]
|
|
43
|
+
mcp-server-mturk = "mturk_mcp.server:main"
|
|
44
|
+
|
|
45
|
+
[build-system]
|
|
46
|
+
requires = ["hatchling"]
|
|
47
|
+
build-backend = "hatchling.build"
|
|
48
|
+
|
|
49
|
+
[tool.hatch.build.targets.wheel]
|
|
50
|
+
packages = ["src/mturk_mcp"]
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""AWS MTurk client wrapper with environment-based configuration."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
import boto3
|
|
6
|
+
from botocore.exceptions import ClientError, NoCredentialsError
|
|
7
|
+
|
|
8
|
+
_client = None
|
|
9
|
+
|
|
10
|
+
SANDBOX_ENDPOINT = "https://mturk-requester-sandbox.us-east-1.amazonaws.com"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def get_mturk_client():
|
|
14
|
+
"""Get or create the MTurk client singleton."""
|
|
15
|
+
global _client
|
|
16
|
+
if _client is None:
|
|
17
|
+
use_sandbox = os.environ.get("MTURK_SANDBOX", "false").lower() == "true"
|
|
18
|
+
endpoint_url = SANDBOX_ENDPOINT if use_sandbox else None
|
|
19
|
+
|
|
20
|
+
_client = boto3.client(
|
|
21
|
+
"mturk",
|
|
22
|
+
region_name="us-east-1",
|
|
23
|
+
endpoint_url=endpoint_url,
|
|
24
|
+
aws_access_key_id=os.environ.get("AWS_ACCESS_KEY_ID"),
|
|
25
|
+
aws_secret_access_key=os.environ.get("AWS_SECRET_ACCESS_KEY"),
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
# Log which environment we're using
|
|
29
|
+
env_name = "SANDBOX" if use_sandbox else "PRODUCTION"
|
|
30
|
+
print(f"[mturk-mcp] Connected to MTurk {env_name}", file=sys.stderr)
|
|
31
|
+
|
|
32
|
+
return _client
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def is_sandbox() -> bool:
|
|
36
|
+
"""Check if we're using the sandbox environment."""
|
|
37
|
+
return os.environ.get("MTURK_SANDBOX", "false").lower() == "true"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def wrap_html_question(html_content: str) -> str:
|
|
41
|
+
"""Wrap HTML content in MTurk's HTMLQuestion format."""
|
|
42
|
+
return f"""<?xml version="1.0" encoding="UTF-8"?>
|
|
43
|
+
<HTMLQuestion xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2011-11-11/HTMLQuestion.xsd">
|
|
44
|
+
<HTMLContent><![CDATA[
|
|
45
|
+
<!DOCTYPE html>
|
|
46
|
+
<html>
|
|
47
|
+
<head>
|
|
48
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
|
49
|
+
<script type="text/javascript" src="https://s3.amazonaws.com/mturk-public/externalHIT_v1.js"></script>
|
|
50
|
+
</head>
|
|
51
|
+
<body>
|
|
52
|
+
<form name="mturk_form" method="post" id="mturk_form" action="https://www.mturk.com/mturk/externalSubmit">
|
|
53
|
+
<input type="hidden" name="assignmentId" id="assignmentId" value="">
|
|
54
|
+
{html_content}
|
|
55
|
+
<p><input type="submit" id="submitButton" value="Submit"></p>
|
|
56
|
+
</form>
|
|
57
|
+
<script>
|
|
58
|
+
turkSetAssignmentID();
|
|
59
|
+
</script>
|
|
60
|
+
</body>
|
|
61
|
+
</html>
|
|
62
|
+
]]></HTMLContent>
|
|
63
|
+
<FrameHeight>600</FrameHeight>
|
|
64
|
+
</HTMLQuestion>"""
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def format_error(e: Exception) -> str:
|
|
68
|
+
"""Format AWS errors into user-friendly messages."""
|
|
69
|
+
if isinstance(e, NoCredentialsError):
|
|
70
|
+
return "AWS credentials not found. Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables."
|
|
71
|
+
if isinstance(e, ClientError):
|
|
72
|
+
error_code = e.response.get("Error", {}).get("Code", "Unknown")
|
|
73
|
+
error_msg = e.response.get("Error", {}).get("Message", str(e))
|
|
74
|
+
return f"MTurk API error ({error_code}): {error_msg}"
|
|
75
|
+
return f"Error: {str(e)}"
|