ai-coding-gym-mcp 0.1.1__tar.gz → 0.1.4__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.
- {ai_coding_gym_mcp-0.1.1 → ai_coding_gym_mcp-0.1.4}/PKG-INFO +70 -44
- {ai_coding_gym_mcp-0.1.1 → ai_coding_gym_mcp-0.1.4}/README.md +69 -43
- {ai_coding_gym_mcp-0.1.1 → ai_coding_gym_mcp-0.1.4}/ai_coding_gym_mcp.egg-info/PKG-INFO +70 -44
- {ai_coding_gym_mcp-0.1.1 → ai_coding_gym_mcp-0.1.4}/ai_coding_gym_mcp.egg-info/entry_points.txt +1 -0
- {ai_coding_gym_mcp-0.1.1 → ai_coding_gym_mcp-0.1.4}/pyproject.toml +2 -1
- {ai_coding_gym_mcp-0.1.1 → ai_coding_gym_mcp-0.1.4}/server.py +1 -21
- {ai_coding_gym_mcp-0.1.1 → ai_coding_gym_mcp-0.1.4}/setup.py +2 -1
- {ai_coding_gym_mcp-0.1.1 → ai_coding_gym_mcp-0.1.4}/ai_coding_gym_mcp.egg-info/SOURCES.txt +0 -0
- {ai_coding_gym_mcp-0.1.1 → ai_coding_gym_mcp-0.1.4}/ai_coding_gym_mcp.egg-info/dependency_links.txt +0 -0
- {ai_coding_gym_mcp-0.1.1 → ai_coding_gym_mcp-0.1.4}/ai_coding_gym_mcp.egg-info/requires.txt +0 -0
- {ai_coding_gym_mcp-0.1.1 → ai_coding_gym_mcp-0.1.4}/ai_coding_gym_mcp.egg-info/top_level.txt +0 -0
- {ai_coding_gym_mcp-0.1.1 → ai_coding_gym_mcp-0.1.4}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ai-coding-gym-mcp
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: MCP server for AI Coding Gym - fetch and submit coding challenges
|
|
5
5
|
Home-page: https://github.com/yourusername/ai-coding-gym-mcp
|
|
6
6
|
Author: AICodingGym Team
|
|
@@ -61,18 +61,45 @@ Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_
|
|
|
61
61
|
```json
|
|
62
62
|
{
|
|
63
63
|
"mcpServers": {
|
|
64
|
+
"ai-coding-gym": {
|
|
65
|
+
"command": "ai-coding-gym-mcp"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Configure VS Code (Copilot with MCP)
|
|
72
|
+
|
|
73
|
+
Add to your VS Code settings (`.vscode/settings.json` or User Settings):
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"github.copilot.chat.codeGeneration.instructions": [
|
|
78
|
+
{
|
|
79
|
+
"text": "Use AI Coding Gym MCP tools for problem solving"
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
"mcp.servers": {
|
|
64
83
|
"ai-coding-gym": {
|
|
65
84
|
"command": "python",
|
|
66
85
|
"args": ["-m", "server"],
|
|
67
|
-
"
|
|
68
|
-
"AI_CODING_GYM_SERVER": "https://your-server-url.com"
|
|
69
|
-
}
|
|
86
|
+
"cwd": "/path/to/ai-coding-gym-mcp"
|
|
70
87
|
}
|
|
71
88
|
}
|
|
72
89
|
}
|
|
73
90
|
```
|
|
74
91
|
|
|
75
|
-
|
|
92
|
+
Or if installed via pip, use the executable directly:
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"mcp.servers": {
|
|
97
|
+
"ai-coding-gym": {
|
|
98
|
+
"command": "ai-coding-gym-mcp"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
76
103
|
|
|
77
104
|
## Usage
|
|
78
105
|
|
|
@@ -86,30 +113,48 @@ python server.py
|
|
|
86
113
|
|
|
87
114
|
Or configure it in your MCP client settings (e.g., Claude Desktop).
|
|
88
115
|
|
|
116
|
+
### Tool: `/configure`
|
|
117
|
+
|
|
118
|
+
Configure the MCP server with your user ID. This generates an SSH key pair and registers it with the server.
|
|
119
|
+
|
|
120
|
+
**Parameters:**
|
|
121
|
+
- `user_id` (required): Your user ID for authentication
|
|
122
|
+
- `workspace_dir` (optional): Default workspace directory (default: `"./workspace"`)
|
|
123
|
+
|
|
124
|
+
**Example:**
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"user_id": "user_123",
|
|
128
|
+
"workspace_dir": "./workspace"
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**What it does:**
|
|
133
|
+
1. Generates an SSH key pair locally (stored in `~/.mcp-keys/`)
|
|
134
|
+
2. Sends the public key to the server
|
|
135
|
+
3. Receives your repository name
|
|
136
|
+
4. Stores configuration for future use
|
|
137
|
+
|
|
89
138
|
### Tool: `/fetch`
|
|
90
139
|
|
|
91
140
|
Fetches a problem from the backend and clones the repository locally.
|
|
92
141
|
|
|
93
142
|
**Parameters:**
|
|
94
143
|
- `problem_id` (required): Problem identifier (e.g., `"django__django-10097"`)
|
|
95
|
-
- `user_id` (
|
|
96
|
-
- `server_url` (optional): Backend server URL (default: `"https://api.example.com"`)
|
|
144
|
+
- `user_id` (optional): Your user ID (uses configured value if not provided)
|
|
97
145
|
- `workspace_dir` (optional): Local workspace directory (default: `"./workspace"`)
|
|
98
146
|
|
|
99
147
|
**Example:**
|
|
100
148
|
```json
|
|
101
149
|
{
|
|
102
|
-
"problem_id": "django__django-10097"
|
|
103
|
-
"user_id": "user_123",
|
|
104
|
-
"server_url": "https://ai-coding-gym.example.com"
|
|
150
|
+
"problem_id": "django__django-10097"
|
|
105
151
|
}
|
|
106
152
|
```
|
|
107
153
|
|
|
108
154
|
**What it does:**
|
|
109
|
-
1.
|
|
110
|
-
2. Clones the
|
|
111
|
-
3.
|
|
112
|
-
4. Saves the problem statement to `PROBLEM_STATEMENT.md`
|
|
155
|
+
1. Uses your SSH key from `/configure` to access the repository
|
|
156
|
+
2. Clones only the specific problem branch (shallow clone)
|
|
157
|
+
3. Sets up the workspace at `workspace/{problem_id}/`
|
|
113
158
|
|
|
114
159
|
### Tool: `/submit`
|
|
115
160
|
|
|
@@ -117,15 +162,13 @@ Submits your solution by committing changes and pushing to the remote repository
|
|
|
117
162
|
|
|
118
163
|
**Parameters:**
|
|
119
164
|
- `problem_id` (required): Problem identifier
|
|
120
|
-
- `user_id` (
|
|
121
|
-
- `server_url` (optional): Backend server URL (default: `"https://api.example.com"`)
|
|
165
|
+
- `user_id` (optional): Your user ID (uses configured value if not provided)
|
|
122
166
|
- `commit_message` (optional): Custom commit message
|
|
123
167
|
|
|
124
168
|
**Example:**
|
|
125
169
|
```json
|
|
126
170
|
{
|
|
127
171
|
"problem_id": "django__django-10097",
|
|
128
|
-
"user_id": "user_123",
|
|
129
172
|
"commit_message": "Fixed the authentication bug"
|
|
130
173
|
}
|
|
131
174
|
```
|
|
@@ -138,25 +181,22 @@ Submits your solution by committing changes and pushing to the remote repository
|
|
|
138
181
|
|
|
139
182
|
## Backend API Endpoints
|
|
140
183
|
|
|
141
|
-
The MCP server
|
|
184
|
+
The MCP server connects to the hardcoded AI Coding Gym server and uses the following endpoints:
|
|
142
185
|
|
|
143
|
-
### POST `/api/
|
|
186
|
+
### POST `/api/configure`
|
|
144
187
|
|
|
145
188
|
**Request:**
|
|
146
189
|
```json
|
|
147
190
|
{
|
|
148
|
-
"
|
|
149
|
-
"
|
|
191
|
+
"user_id": "user_123",
|
|
192
|
+
"public_key": "ssh-rsa AAAAB3..."
|
|
150
193
|
}
|
|
151
194
|
```
|
|
152
195
|
|
|
153
196
|
**Response:**
|
|
154
197
|
```json
|
|
155
198
|
{
|
|
156
|
-
"
|
|
157
|
-
"branch": "django__django-10097-user_123",
|
|
158
|
-
"deploy_key": "-----BEGIN OPENSSH PRIVATE KEY-----\n...\n-----END OPENSSH PRIVATE KEY-----",
|
|
159
|
-
"problem_statement": "# Problem Description\n\n..."
|
|
199
|
+
"repo_name": "user_123-swebench"
|
|
160
200
|
}
|
|
161
201
|
```
|
|
162
202
|
|
|
@@ -183,23 +223,16 @@ The MCP server expects the following backend API endpoints:
|
|
|
183
223
|
|
|
184
224
|
## Security
|
|
185
225
|
|
|
186
|
-
-
|
|
187
|
-
- Keys are
|
|
226
|
+
- User SSH keys are stored in `~/.mcp-keys/` with 600 permissions
|
|
227
|
+
- Keys are generated locally and public key is shared with the server
|
|
188
228
|
- SSH host key checking is disabled for convenience (consider enabling in production)
|
|
189
|
-
-
|
|
190
|
-
|
|
191
|
-
## Configuration
|
|
192
|
-
|
|
193
|
-
Default server URL is `https://api.example.com`. You can override it by passing `server_url` parameter to each tool call, or set it via environment variable:
|
|
194
|
-
|
|
195
|
-
```bash
|
|
196
|
-
export AI_CODING_GYM_SERVER="https://your-server.com"
|
|
197
|
-
```
|
|
229
|
+
- Configuration is cached in memory during the MCP server session
|
|
198
230
|
|
|
199
231
|
## Troubleshooting
|
|
200
232
|
|
|
201
233
|
**"No credentials found for problem_id"**
|
|
202
|
-
- Run `/
|
|
234
|
+
- Run `/configure` first to set up your credentials
|
|
235
|
+
- Then run `/fetch` to download the problem
|
|
203
236
|
|
|
204
237
|
**"Git clone/push failed"**
|
|
205
238
|
- Check network connectivity
|
|
@@ -209,13 +242,6 @@ export AI_CODING_GYM_SERVER="https://your-server.com"
|
|
|
209
242
|
**"Directory already exists"**
|
|
210
243
|
- Remove the existing directory or use a different workspace location
|
|
211
244
|
|
|
212
|
-
## Publishing
|
|
213
|
-
|
|
214
|
-
See [PUBLISHING.md](PUBLISHING.md) for instructions on:
|
|
215
|
-
- Publishing to PyPI
|
|
216
|
-
- Publishing to GitHub
|
|
217
|
-
- Version management
|
|
218
|
-
- Release workflow
|
|
219
245
|
|
|
220
246
|
## Development
|
|
221
247
|
|
|
@@ -35,18 +35,45 @@ Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_
|
|
|
35
35
|
```json
|
|
36
36
|
{
|
|
37
37
|
"mcpServers": {
|
|
38
|
+
"ai-coding-gym": {
|
|
39
|
+
"command": "ai-coding-gym-mcp"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Configure VS Code (Copilot with MCP)
|
|
46
|
+
|
|
47
|
+
Add to your VS Code settings (`.vscode/settings.json` or User Settings):
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"github.copilot.chat.codeGeneration.instructions": [
|
|
52
|
+
{
|
|
53
|
+
"text": "Use AI Coding Gym MCP tools for problem solving"
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"mcp.servers": {
|
|
38
57
|
"ai-coding-gym": {
|
|
39
58
|
"command": "python",
|
|
40
59
|
"args": ["-m", "server"],
|
|
41
|
-
"
|
|
42
|
-
"AI_CODING_GYM_SERVER": "https://your-server-url.com"
|
|
43
|
-
}
|
|
60
|
+
"cwd": "/path/to/ai-coding-gym-mcp"
|
|
44
61
|
}
|
|
45
62
|
}
|
|
46
63
|
}
|
|
47
64
|
```
|
|
48
65
|
|
|
49
|
-
|
|
66
|
+
Or if installed via pip, use the executable directly:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"mcp.servers": {
|
|
71
|
+
"ai-coding-gym": {
|
|
72
|
+
"command": "ai-coding-gym-mcp"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
50
77
|
|
|
51
78
|
## Usage
|
|
52
79
|
|
|
@@ -60,30 +87,48 @@ python server.py
|
|
|
60
87
|
|
|
61
88
|
Or configure it in your MCP client settings (e.g., Claude Desktop).
|
|
62
89
|
|
|
90
|
+
### Tool: `/configure`
|
|
91
|
+
|
|
92
|
+
Configure the MCP server with your user ID. This generates an SSH key pair and registers it with the server.
|
|
93
|
+
|
|
94
|
+
**Parameters:**
|
|
95
|
+
- `user_id` (required): Your user ID for authentication
|
|
96
|
+
- `workspace_dir` (optional): Default workspace directory (default: `"./workspace"`)
|
|
97
|
+
|
|
98
|
+
**Example:**
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"user_id": "user_123",
|
|
102
|
+
"workspace_dir": "./workspace"
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**What it does:**
|
|
107
|
+
1. Generates an SSH key pair locally (stored in `~/.mcp-keys/`)
|
|
108
|
+
2. Sends the public key to the server
|
|
109
|
+
3. Receives your repository name
|
|
110
|
+
4. Stores configuration for future use
|
|
111
|
+
|
|
63
112
|
### Tool: `/fetch`
|
|
64
113
|
|
|
65
114
|
Fetches a problem from the backend and clones the repository locally.
|
|
66
115
|
|
|
67
116
|
**Parameters:**
|
|
68
117
|
- `problem_id` (required): Problem identifier (e.g., `"django__django-10097"`)
|
|
69
|
-
- `user_id` (
|
|
70
|
-
- `server_url` (optional): Backend server URL (default: `"https://api.example.com"`)
|
|
118
|
+
- `user_id` (optional): Your user ID (uses configured value if not provided)
|
|
71
119
|
- `workspace_dir` (optional): Local workspace directory (default: `"./workspace"`)
|
|
72
120
|
|
|
73
121
|
**Example:**
|
|
74
122
|
```json
|
|
75
123
|
{
|
|
76
|
-
"problem_id": "django__django-10097"
|
|
77
|
-
"user_id": "user_123",
|
|
78
|
-
"server_url": "https://ai-coding-gym.example.com"
|
|
124
|
+
"problem_id": "django__django-10097"
|
|
79
125
|
}
|
|
80
126
|
```
|
|
81
127
|
|
|
82
128
|
**What it does:**
|
|
83
|
-
1.
|
|
84
|
-
2. Clones the
|
|
85
|
-
3.
|
|
86
|
-
4. Saves the problem statement to `PROBLEM_STATEMENT.md`
|
|
129
|
+
1. Uses your SSH key from `/configure` to access the repository
|
|
130
|
+
2. Clones only the specific problem branch (shallow clone)
|
|
131
|
+
3. Sets up the workspace at `workspace/{problem_id}/`
|
|
87
132
|
|
|
88
133
|
### Tool: `/submit`
|
|
89
134
|
|
|
@@ -91,15 +136,13 @@ Submits your solution by committing changes and pushing to the remote repository
|
|
|
91
136
|
|
|
92
137
|
**Parameters:**
|
|
93
138
|
- `problem_id` (required): Problem identifier
|
|
94
|
-
- `user_id` (
|
|
95
|
-
- `server_url` (optional): Backend server URL (default: `"https://api.example.com"`)
|
|
139
|
+
- `user_id` (optional): Your user ID (uses configured value if not provided)
|
|
96
140
|
- `commit_message` (optional): Custom commit message
|
|
97
141
|
|
|
98
142
|
**Example:**
|
|
99
143
|
```json
|
|
100
144
|
{
|
|
101
145
|
"problem_id": "django__django-10097",
|
|
102
|
-
"user_id": "user_123",
|
|
103
146
|
"commit_message": "Fixed the authentication bug"
|
|
104
147
|
}
|
|
105
148
|
```
|
|
@@ -112,25 +155,22 @@ Submits your solution by committing changes and pushing to the remote repository
|
|
|
112
155
|
|
|
113
156
|
## Backend API Endpoints
|
|
114
157
|
|
|
115
|
-
The MCP server
|
|
158
|
+
The MCP server connects to the hardcoded AI Coding Gym server and uses the following endpoints:
|
|
116
159
|
|
|
117
|
-
### POST `/api/
|
|
160
|
+
### POST `/api/configure`
|
|
118
161
|
|
|
119
162
|
**Request:**
|
|
120
163
|
```json
|
|
121
164
|
{
|
|
122
|
-
"
|
|
123
|
-
"
|
|
165
|
+
"user_id": "user_123",
|
|
166
|
+
"public_key": "ssh-rsa AAAAB3..."
|
|
124
167
|
}
|
|
125
168
|
```
|
|
126
169
|
|
|
127
170
|
**Response:**
|
|
128
171
|
```json
|
|
129
172
|
{
|
|
130
|
-
"
|
|
131
|
-
"branch": "django__django-10097-user_123",
|
|
132
|
-
"deploy_key": "-----BEGIN OPENSSH PRIVATE KEY-----\n...\n-----END OPENSSH PRIVATE KEY-----",
|
|
133
|
-
"problem_statement": "# Problem Description\n\n..."
|
|
173
|
+
"repo_name": "user_123-swebench"
|
|
134
174
|
}
|
|
135
175
|
```
|
|
136
176
|
|
|
@@ -157,23 +197,16 @@ The MCP server expects the following backend API endpoints:
|
|
|
157
197
|
|
|
158
198
|
## Security
|
|
159
199
|
|
|
160
|
-
-
|
|
161
|
-
- Keys are
|
|
200
|
+
- User SSH keys are stored in `~/.mcp-keys/` with 600 permissions
|
|
201
|
+
- Keys are generated locally and public key is shared with the server
|
|
162
202
|
- SSH host key checking is disabled for convenience (consider enabling in production)
|
|
163
|
-
-
|
|
164
|
-
|
|
165
|
-
## Configuration
|
|
166
|
-
|
|
167
|
-
Default server URL is `https://api.example.com`. You can override it by passing `server_url` parameter to each tool call, or set it via environment variable:
|
|
168
|
-
|
|
169
|
-
```bash
|
|
170
|
-
export AI_CODING_GYM_SERVER="https://your-server.com"
|
|
171
|
-
```
|
|
203
|
+
- Configuration is cached in memory during the MCP server session
|
|
172
204
|
|
|
173
205
|
## Troubleshooting
|
|
174
206
|
|
|
175
207
|
**"No credentials found for problem_id"**
|
|
176
|
-
- Run `/
|
|
208
|
+
- Run `/configure` first to set up your credentials
|
|
209
|
+
- Then run `/fetch` to download the problem
|
|
177
210
|
|
|
178
211
|
**"Git clone/push failed"**
|
|
179
212
|
- Check network connectivity
|
|
@@ -183,13 +216,6 @@ export AI_CODING_GYM_SERVER="https://your-server.com"
|
|
|
183
216
|
**"Directory already exists"**
|
|
184
217
|
- Remove the existing directory or use a different workspace location
|
|
185
218
|
|
|
186
|
-
## Publishing
|
|
187
|
-
|
|
188
|
-
See [PUBLISHING.md](PUBLISHING.md) for instructions on:
|
|
189
|
-
- Publishing to PyPI
|
|
190
|
-
- Publishing to GitHub
|
|
191
|
-
- Version management
|
|
192
|
-
- Release workflow
|
|
193
219
|
|
|
194
220
|
## Development
|
|
195
221
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ai-coding-gym-mcp
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: MCP server for AI Coding Gym - fetch and submit coding challenges
|
|
5
5
|
Home-page: https://github.com/yourusername/ai-coding-gym-mcp
|
|
6
6
|
Author: AICodingGym Team
|
|
@@ -61,18 +61,45 @@ Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_
|
|
|
61
61
|
```json
|
|
62
62
|
{
|
|
63
63
|
"mcpServers": {
|
|
64
|
+
"ai-coding-gym": {
|
|
65
|
+
"command": "ai-coding-gym-mcp"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Configure VS Code (Copilot with MCP)
|
|
72
|
+
|
|
73
|
+
Add to your VS Code settings (`.vscode/settings.json` or User Settings):
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"github.copilot.chat.codeGeneration.instructions": [
|
|
78
|
+
{
|
|
79
|
+
"text": "Use AI Coding Gym MCP tools for problem solving"
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
"mcp.servers": {
|
|
64
83
|
"ai-coding-gym": {
|
|
65
84
|
"command": "python",
|
|
66
85
|
"args": ["-m", "server"],
|
|
67
|
-
"
|
|
68
|
-
"AI_CODING_GYM_SERVER": "https://your-server-url.com"
|
|
69
|
-
}
|
|
86
|
+
"cwd": "/path/to/ai-coding-gym-mcp"
|
|
70
87
|
}
|
|
71
88
|
}
|
|
72
89
|
}
|
|
73
90
|
```
|
|
74
91
|
|
|
75
|
-
|
|
92
|
+
Or if installed via pip, use the executable directly:
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"mcp.servers": {
|
|
97
|
+
"ai-coding-gym": {
|
|
98
|
+
"command": "ai-coding-gym-mcp"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
76
103
|
|
|
77
104
|
## Usage
|
|
78
105
|
|
|
@@ -86,30 +113,48 @@ python server.py
|
|
|
86
113
|
|
|
87
114
|
Or configure it in your MCP client settings (e.g., Claude Desktop).
|
|
88
115
|
|
|
116
|
+
### Tool: `/configure`
|
|
117
|
+
|
|
118
|
+
Configure the MCP server with your user ID. This generates an SSH key pair and registers it with the server.
|
|
119
|
+
|
|
120
|
+
**Parameters:**
|
|
121
|
+
- `user_id` (required): Your user ID for authentication
|
|
122
|
+
- `workspace_dir` (optional): Default workspace directory (default: `"./workspace"`)
|
|
123
|
+
|
|
124
|
+
**Example:**
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"user_id": "user_123",
|
|
128
|
+
"workspace_dir": "./workspace"
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**What it does:**
|
|
133
|
+
1. Generates an SSH key pair locally (stored in `~/.mcp-keys/`)
|
|
134
|
+
2. Sends the public key to the server
|
|
135
|
+
3. Receives your repository name
|
|
136
|
+
4. Stores configuration for future use
|
|
137
|
+
|
|
89
138
|
### Tool: `/fetch`
|
|
90
139
|
|
|
91
140
|
Fetches a problem from the backend and clones the repository locally.
|
|
92
141
|
|
|
93
142
|
**Parameters:**
|
|
94
143
|
- `problem_id` (required): Problem identifier (e.g., `"django__django-10097"`)
|
|
95
|
-
- `user_id` (
|
|
96
|
-
- `server_url` (optional): Backend server URL (default: `"https://api.example.com"`)
|
|
144
|
+
- `user_id` (optional): Your user ID (uses configured value if not provided)
|
|
97
145
|
- `workspace_dir` (optional): Local workspace directory (default: `"./workspace"`)
|
|
98
146
|
|
|
99
147
|
**Example:**
|
|
100
148
|
```json
|
|
101
149
|
{
|
|
102
|
-
"problem_id": "django__django-10097"
|
|
103
|
-
"user_id": "user_123",
|
|
104
|
-
"server_url": "https://ai-coding-gym.example.com"
|
|
150
|
+
"problem_id": "django__django-10097"
|
|
105
151
|
}
|
|
106
152
|
```
|
|
107
153
|
|
|
108
154
|
**What it does:**
|
|
109
|
-
1.
|
|
110
|
-
2. Clones the
|
|
111
|
-
3.
|
|
112
|
-
4. Saves the problem statement to `PROBLEM_STATEMENT.md`
|
|
155
|
+
1. Uses your SSH key from `/configure` to access the repository
|
|
156
|
+
2. Clones only the specific problem branch (shallow clone)
|
|
157
|
+
3. Sets up the workspace at `workspace/{problem_id}/`
|
|
113
158
|
|
|
114
159
|
### Tool: `/submit`
|
|
115
160
|
|
|
@@ -117,15 +162,13 @@ Submits your solution by committing changes and pushing to the remote repository
|
|
|
117
162
|
|
|
118
163
|
**Parameters:**
|
|
119
164
|
- `problem_id` (required): Problem identifier
|
|
120
|
-
- `user_id` (
|
|
121
|
-
- `server_url` (optional): Backend server URL (default: `"https://api.example.com"`)
|
|
165
|
+
- `user_id` (optional): Your user ID (uses configured value if not provided)
|
|
122
166
|
- `commit_message` (optional): Custom commit message
|
|
123
167
|
|
|
124
168
|
**Example:**
|
|
125
169
|
```json
|
|
126
170
|
{
|
|
127
171
|
"problem_id": "django__django-10097",
|
|
128
|
-
"user_id": "user_123",
|
|
129
172
|
"commit_message": "Fixed the authentication bug"
|
|
130
173
|
}
|
|
131
174
|
```
|
|
@@ -138,25 +181,22 @@ Submits your solution by committing changes and pushing to the remote repository
|
|
|
138
181
|
|
|
139
182
|
## Backend API Endpoints
|
|
140
183
|
|
|
141
|
-
The MCP server
|
|
184
|
+
The MCP server connects to the hardcoded AI Coding Gym server and uses the following endpoints:
|
|
142
185
|
|
|
143
|
-
### POST `/api/
|
|
186
|
+
### POST `/api/configure`
|
|
144
187
|
|
|
145
188
|
**Request:**
|
|
146
189
|
```json
|
|
147
190
|
{
|
|
148
|
-
"
|
|
149
|
-
"
|
|
191
|
+
"user_id": "user_123",
|
|
192
|
+
"public_key": "ssh-rsa AAAAB3..."
|
|
150
193
|
}
|
|
151
194
|
```
|
|
152
195
|
|
|
153
196
|
**Response:**
|
|
154
197
|
```json
|
|
155
198
|
{
|
|
156
|
-
"
|
|
157
|
-
"branch": "django__django-10097-user_123",
|
|
158
|
-
"deploy_key": "-----BEGIN OPENSSH PRIVATE KEY-----\n...\n-----END OPENSSH PRIVATE KEY-----",
|
|
159
|
-
"problem_statement": "# Problem Description\n\n..."
|
|
199
|
+
"repo_name": "user_123-swebench"
|
|
160
200
|
}
|
|
161
201
|
```
|
|
162
202
|
|
|
@@ -183,23 +223,16 @@ The MCP server expects the following backend API endpoints:
|
|
|
183
223
|
|
|
184
224
|
## Security
|
|
185
225
|
|
|
186
|
-
-
|
|
187
|
-
- Keys are
|
|
226
|
+
- User SSH keys are stored in `~/.mcp-keys/` with 600 permissions
|
|
227
|
+
- Keys are generated locally and public key is shared with the server
|
|
188
228
|
- SSH host key checking is disabled for convenience (consider enabling in production)
|
|
189
|
-
-
|
|
190
|
-
|
|
191
|
-
## Configuration
|
|
192
|
-
|
|
193
|
-
Default server URL is `https://api.example.com`. You can override it by passing `server_url` parameter to each tool call, or set it via environment variable:
|
|
194
|
-
|
|
195
|
-
```bash
|
|
196
|
-
export AI_CODING_GYM_SERVER="https://your-server.com"
|
|
197
|
-
```
|
|
229
|
+
- Configuration is cached in memory during the MCP server session
|
|
198
230
|
|
|
199
231
|
## Troubleshooting
|
|
200
232
|
|
|
201
233
|
**"No credentials found for problem_id"**
|
|
202
|
-
- Run `/
|
|
234
|
+
- Run `/configure` first to set up your credentials
|
|
235
|
+
- Then run `/fetch` to download the problem
|
|
203
236
|
|
|
204
237
|
**"Git clone/push failed"**
|
|
205
238
|
- Check network connectivity
|
|
@@ -209,13 +242,6 @@ export AI_CODING_GYM_SERVER="https://your-server.com"
|
|
|
209
242
|
**"Directory already exists"**
|
|
210
243
|
- Remove the existing directory or use a different workspace location
|
|
211
244
|
|
|
212
|
-
## Publishing
|
|
213
|
-
|
|
214
|
-
See [PUBLISHING.md](PUBLISHING.md) for instructions on:
|
|
215
|
-
- Publishing to PyPI
|
|
216
|
-
- Publishing to GitHub
|
|
217
|
-
- Version management
|
|
218
|
-
- Release workflow
|
|
219
245
|
|
|
220
246
|
## Development
|
|
221
247
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "ai-coding-gym-mcp"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.4"
|
|
4
4
|
description = "MCP server for AI Coding Gym - fetch and submit coding challenges"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|
|
@@ -29,3 +29,4 @@ Issues = "https://github.com/yourusername/ai-coding-gym-mcp/issues"
|
|
|
29
29
|
|
|
30
30
|
[project.scripts]
|
|
31
31
|
ai-coding-gym-mcp = "server:main"
|
|
32
|
+
ai_coding_gym_mcp = "server:main"
|
|
@@ -66,10 +66,6 @@ FETCH_TOOL = Tool(
|
|
|
66
66
|
"type": "string",
|
|
67
67
|
"description": "Your user ID (optional if configured globally via /configure)"
|
|
68
68
|
},
|
|
69
|
-
"server_url": {
|
|
70
|
-
"type": "string",
|
|
71
|
-
"description": "Backend server URL (optional if configured globally)"
|
|
72
|
-
},
|
|
73
69
|
"workspace_dir": {
|
|
74
70
|
"type": "string",
|
|
75
71
|
"description": "Local directory to clone the repository into (optional)"
|
|
@@ -94,10 +90,6 @@ SUBMIT_TOOL = Tool(
|
|
|
94
90
|
"type": "string",
|
|
95
91
|
"description": "Your user ID (optional if configured globally via /configure)"
|
|
96
92
|
},
|
|
97
|
-
"server_url": {
|
|
98
|
-
"type": "string",
|
|
99
|
-
"description": "Backend server URL (optional if configured globally)"
|
|
100
|
-
},
|
|
101
93
|
"commit_message": {
|
|
102
94
|
"type": "string",
|
|
103
95
|
"description": "Custom commit message (optional)"
|
|
@@ -225,7 +217,6 @@ async def configure(
|
|
|
225
217
|
|
|
226
218
|
# Store configuration
|
|
227
219
|
config_store["user_id"] = user_id
|
|
228
|
-
config_store["server_url"] = server_url
|
|
229
220
|
config_store["repo_name"] = repo_name
|
|
230
221
|
config_store["private_key_path"] = str(private_key_path)
|
|
231
222
|
|
|
@@ -235,7 +226,6 @@ async def configure(
|
|
|
235
226
|
return f"""Configuration saved successfully!
|
|
236
227
|
|
|
237
228
|
User ID: {user_id}
|
|
238
|
-
Server URL: {server_url}
|
|
239
229
|
Repository: {repo_name}
|
|
240
230
|
Workspace: {workspace_dir or 'Default (./workspace)'}
|
|
241
231
|
SSH Key: {private_key_path}
|
|
@@ -253,7 +243,6 @@ You can now use /fetch and /submit without passing these parameters.
|
|
|
253
243
|
async def fetch_problem(
|
|
254
244
|
problem_id: str,
|
|
255
245
|
user_id: Optional[str] = None,
|
|
256
|
-
server_url: Optional[str] = None,
|
|
257
246
|
workspace_dir: Optional[str] = None
|
|
258
247
|
) -> str:
|
|
259
248
|
"""
|
|
@@ -262,7 +251,6 @@ async def fetch_problem(
|
|
|
262
251
|
try:
|
|
263
252
|
# Use configured values if not provided
|
|
264
253
|
user_id = user_id or config_store.get("user_id") or infer_user_id_from_keys()
|
|
265
|
-
server_url = server_url or config_store.get("server_url") or DEFAULT_SERVER_URL
|
|
266
254
|
workspace_dir = workspace_dir or config_store.get("workspace_dir", "./workspace")
|
|
267
255
|
repo_name = config_store.get("repo_name")
|
|
268
256
|
|
|
@@ -294,7 +282,6 @@ async def fetch_problem(
|
|
|
294
282
|
"repo_url": repo_url,
|
|
295
283
|
"branch": branch,
|
|
296
284
|
"user_id": user_id,
|
|
297
|
-
"server_url": server_url,
|
|
298
285
|
"private_key_path": private_key_path
|
|
299
286
|
}
|
|
300
287
|
|
|
@@ -349,7 +336,6 @@ You can now start working on the solution!
|
|
|
349
336
|
async def submit_solution(
|
|
350
337
|
problem_id: str,
|
|
351
338
|
user_id: Optional[str] = None,
|
|
352
|
-
server_url: Optional[str] = None,
|
|
353
339
|
commit_message: Optional[str] = None
|
|
354
340
|
) -> str:
|
|
355
341
|
"""
|
|
@@ -358,15 +344,11 @@ async def submit_solution(
|
|
|
358
344
|
try:
|
|
359
345
|
# Use configured values if not provided
|
|
360
346
|
user_id = user_id or config_store.get("user_id") or infer_user_id_from_keys()
|
|
361
|
-
server_url = server_url or config_store.get("server_url") or DEFAULT_SERVER_URL
|
|
362
347
|
commit_message = commit_message or ""
|
|
363
348
|
|
|
364
349
|
if not user_id:
|
|
365
350
|
return "Error: Could not determine user_id. Please run /configure first to set up your credentials."
|
|
366
351
|
|
|
367
|
-
if not server_url:
|
|
368
|
-
return "Error: server_url is required. Please run /configure first or pass it as a parameter."
|
|
369
|
-
|
|
370
352
|
# Check if we have cached credentials
|
|
371
353
|
if problem_id not in credentials_store:
|
|
372
354
|
return f"Error: No credentials found for {problem_id}. Please run /fetch first."
|
|
@@ -423,7 +405,7 @@ async def submit_solution(
|
|
|
423
405
|
return f"Error: Git push failed:\n{result.stderr}"
|
|
424
406
|
|
|
425
407
|
# Notify backend server
|
|
426
|
-
api_endpoint = f"{
|
|
408
|
+
api_endpoint = f"{DEFAULT_SERVER_URL}/api/submit"
|
|
427
409
|
payload = {
|
|
428
410
|
"problem_id": problem_id,
|
|
429
411
|
"user_id": user_id,
|
|
@@ -473,7 +455,6 @@ async def call_tool(name: str, arguments: Any) -> list[TextContent]:
|
|
|
473
455
|
result = await fetch_problem(
|
|
474
456
|
problem_id=arguments["problem_id"],
|
|
475
457
|
user_id=arguments.get("user_id"),
|
|
476
|
-
server_url=arguments.get("server_url"),
|
|
477
458
|
workspace_dir=arguments.get("workspace_dir")
|
|
478
459
|
)
|
|
479
460
|
return [TextContent(type="text", text=result)]
|
|
@@ -482,7 +463,6 @@ async def call_tool(name: str, arguments: Any) -> list[TextContent]:
|
|
|
482
463
|
result = await submit_solution(
|
|
483
464
|
problem_id=arguments["problem_id"],
|
|
484
465
|
user_id=arguments.get("user_id"),
|
|
485
|
-
server_url=arguments.get("server_url"),
|
|
486
466
|
commit_message=arguments.get("commit_message")
|
|
487
467
|
)
|
|
488
468
|
return [TextContent(type="text", text=result)]
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name="ai-coding-gym-mcp",
|
|
8
|
-
version="0.1.
|
|
8
|
+
version="0.1.4",
|
|
9
9
|
author="AICodingGym Team",
|
|
10
10
|
author_email="datasmithlab@gmail.com",
|
|
11
11
|
description="MCP server for AI Coding Gym - fetch and submit AI coding challenges",
|
|
@@ -21,6 +21,7 @@ setup(
|
|
|
21
21
|
entry_points={
|
|
22
22
|
"console_scripts": [
|
|
23
23
|
"ai-coding-gym-mcp=server:main",
|
|
24
|
+
"ai_coding_gym_mcp=server:main",
|
|
24
25
|
],
|
|
25
26
|
},
|
|
26
27
|
classifiers=[
|
|
File without changes
|
{ai_coding_gym_mcp-0.1.1 → ai_coding_gym_mcp-0.1.4}/ai_coding_gym_mcp.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{ai_coding_gym_mcp-0.1.1 → ai_coding_gym_mcp-0.1.4}/ai_coding_gym_mcp.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|