code-engine-mcp-server 1.0.0
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/LICENSE +21 -0
- package/README.md +387 -0
- package/build/client.d.ts +3 -0
- package/build/client.d.ts.map +1 -0
- package/build/client.js +194 -0
- package/build/client.js.map +1 -0
- package/build/context-discovery.d.ts +86 -0
- package/build/context-discovery.d.ts.map +1 -0
- package/build/context-discovery.js +291 -0
- package/build/context-discovery.js.map +1 -0
- package/build/deploy-tool-enhanced.d.ts +42 -0
- package/build/deploy-tool-enhanced.d.ts.map +1 -0
- package/build/deploy-tool-enhanced.js +323 -0
- package/build/deploy-tool-enhanced.js.map +1 -0
- package/build/deploy-tool.d.ts +27 -0
- package/build/deploy-tool.d.ts.map +1 -0
- package/build/deploy-tool.js +213 -0
- package/build/deploy-tool.js.map +1 -0
- package/build/index.d.ts +11 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +1117 -0
- package/build/index.js.map +1 -0
- package/build/simple-client.d.ts +3 -0
- package/build/simple-client.d.ts.map +1 -0
- package/build/simple-client.js +275 -0
- package/build/simple-client.js.map +1 -0
- package/build/test-all-tools.d.ts +3 -0
- package/build/test-all-tools.d.ts.map +1 -0
- package/build/test-all-tools.js +254 -0
- package/build/test-all-tools.js.map +1 -0
- package/build/test-integration.d.ts +3 -0
- package/build/test-integration.d.ts.map +1 -0
- package/build/test-integration.js +484 -0
- package/build/test-integration.js.map +1 -0
- package/docs/API_CALL_SCENARIOS.md +594 -0
- package/docs/CLIENT_README.md +310 -0
- package/docs/CLINE_CONFIG_EXAMPLE.json +14 -0
- package/docs/CODE_ENGINE_API_REFERENCE.md +764 -0
- package/docs/CODE_OF_CONDUCT.md +46 -0
- package/docs/CONTRIBUTING.md +38 -0
- package/docs/MAINTAINERS.md +15 -0
- package/docs/SETUP_INSTRUCTIONS.md +218 -0
- package/package.json +44 -0
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
# Code Engine MCP Client
|
|
2
|
+
|
|
3
|
+
A standalone command-line client for interacting with IBM Code Engine and Docker/Podman through the MCP (Model Context Protocol) server.
|
|
4
|
+
|
|
5
|
+
## ✅ Successfully Tested
|
|
6
|
+
|
|
7
|
+
The client has been tested and works! It successfully detected Podman:
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"docker": null,
|
|
12
|
+
"podman": "podman version 5.5.1",
|
|
13
|
+
"available": "podman"
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
### 1. Setup (Already Done!)
|
|
20
|
+
|
|
21
|
+
The MCP server and client are already built and ready to use.
|
|
22
|
+
|
|
23
|
+
### 2. Run the Client
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
cd code-engine-mcp-server
|
|
27
|
+
./run-client.sh <command> [args]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Available Commands
|
|
31
|
+
|
|
32
|
+
### Docker/Podman Commands
|
|
33
|
+
|
|
34
|
+
#### Detect Container Runtime
|
|
35
|
+
```bash
|
|
36
|
+
./run-client.sh detect
|
|
37
|
+
```
|
|
38
|
+
Output: Shows which container runtime (Docker or Podman) is available
|
|
39
|
+
|
|
40
|
+
#### List Local Images
|
|
41
|
+
```bash
|
|
42
|
+
./run-client.sh images
|
|
43
|
+
```
|
|
44
|
+
Output: Lists all local container images
|
|
45
|
+
|
|
46
|
+
#### List Containers
|
|
47
|
+
```bash
|
|
48
|
+
./run-client.sh containers
|
|
49
|
+
```
|
|
50
|
+
Output: Lists all containers (running and stopped)
|
|
51
|
+
|
|
52
|
+
#### Build Container Image
|
|
53
|
+
```bash
|
|
54
|
+
./run-client.sh build <dockerfile_path> <image_name> <context_path>
|
|
55
|
+
```
|
|
56
|
+
Example:
|
|
57
|
+
```bash
|
|
58
|
+
./run-client.sh build ./Dockerfile myapp:latest .
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
#### Push Image to Registry
|
|
62
|
+
```bash
|
|
63
|
+
./run-client.sh push <image_name>
|
|
64
|
+
```
|
|
65
|
+
Example:
|
|
66
|
+
```bash
|
|
67
|
+
./run-client.sh push icr.io/namespace/myapp:latest
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
#### Test Container Locally
|
|
71
|
+
```bash
|
|
72
|
+
./run-client.sh test <image_name> [port_mapping]
|
|
73
|
+
```
|
|
74
|
+
Example:
|
|
75
|
+
```bash
|
|
76
|
+
./run-client.sh test myapp:latest 8080:8080
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### Get Container Logs
|
|
80
|
+
```bash
|
|
81
|
+
./run-client.sh logs <container_id>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
#### Stop Container
|
|
85
|
+
```bash
|
|
86
|
+
./run-client.sh stop <container_id>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Code Engine Commands
|
|
90
|
+
|
|
91
|
+
#### List Projects
|
|
92
|
+
```bash
|
|
93
|
+
./run-client.sh projects
|
|
94
|
+
```
|
|
95
|
+
Output: Lists all Code Engine projects
|
|
96
|
+
|
|
97
|
+
### Interactive Mode
|
|
98
|
+
|
|
99
|
+
Run without arguments for interactive mode:
|
|
100
|
+
```bash
|
|
101
|
+
./run-client.sh
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Then use commands interactively:
|
|
105
|
+
```
|
|
106
|
+
mcp> detect
|
|
107
|
+
mcp> images
|
|
108
|
+
mcp> help
|
|
109
|
+
mcp> exit
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Configuration
|
|
113
|
+
|
|
114
|
+
The client reads the IBM Cloud API key from `../.env` file:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# .env file (in parent directory)
|
|
118
|
+
IBMCLOUD_API_KEY=your-api-key-here
|
|
119
|
+
IBM_CLOUD_API_KEY=your-api-key-here
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Complete Workflow Example
|
|
123
|
+
|
|
124
|
+
### Build, Test, and Deploy
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# 1. Detect runtime
|
|
128
|
+
./run-client.sh detect
|
|
129
|
+
|
|
130
|
+
# 2. Build image
|
|
131
|
+
./run-client.sh build ./Dockerfile myapp:v1.0.0 .
|
|
132
|
+
|
|
133
|
+
# 3. Test locally
|
|
134
|
+
./run-client.sh test myapp:v1.0.0 3000:3000
|
|
135
|
+
|
|
136
|
+
# 4. Check logs
|
|
137
|
+
./run-client.sh logs <container_id>
|
|
138
|
+
|
|
139
|
+
# 5. Stop test container
|
|
140
|
+
./run-client.sh stop <container_id>
|
|
141
|
+
|
|
142
|
+
# 6. Push to registry
|
|
143
|
+
./run-client.sh push icr.io/namespace/myapp:v1.0.0
|
|
144
|
+
|
|
145
|
+
# 7. List Code Engine projects
|
|
146
|
+
./run-client.sh projects
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Architecture
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
┌─────────────────┐
|
|
153
|
+
│ MCP Client │ (simple-client.ts)
|
|
154
|
+
│ (CLI) │
|
|
155
|
+
└────────┬────────┘
|
|
156
|
+
│
|
|
157
|
+
│ spawns
|
|
158
|
+
▼
|
|
159
|
+
┌─────────────────┐
|
|
160
|
+
│ MCP Server │ (index.ts)
|
|
161
|
+
│ (stdio) │
|
|
162
|
+
└────────┬────────┘
|
|
163
|
+
│
|
|
164
|
+
├──► Docker/Podman CLI
|
|
165
|
+
│
|
|
166
|
+
└──► IBM Cloud CLI
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## How It Works
|
|
170
|
+
|
|
171
|
+
1. **Client** (`simple-client.ts`) - Command-line interface
|
|
172
|
+
2. **Server** (`index.ts`) - MCP server that executes commands
|
|
173
|
+
3. **Communication** - Client spawns server as subprocess, communicates via stdio
|
|
174
|
+
4. **Tools** - Server provides 8 Docker/Podman tools + 4 Code Engine tools
|
|
175
|
+
|
|
176
|
+
## Troubleshooting
|
|
177
|
+
|
|
178
|
+
### API Key Not Found
|
|
179
|
+
|
|
180
|
+
If you see:
|
|
181
|
+
```
|
|
182
|
+
❌ Error: IBM Cloud API key not found in .env file
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Solution:
|
|
186
|
+
1. Check `.env` file exists in parent directory
|
|
187
|
+
2. Verify it contains: `IBMCLOUD_API_KEY=your-key`
|
|
188
|
+
3. Or run with explicit env var:
|
|
189
|
+
```bash
|
|
190
|
+
IBMCLOUD_API_KEY="your-key" ./run-client.sh detect
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Docker/Podman Not Found
|
|
194
|
+
|
|
195
|
+
If commands fail, verify Docker or Podman is installed:
|
|
196
|
+
```bash
|
|
197
|
+
docker --version
|
|
198
|
+
# or
|
|
199
|
+
podman --version
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### IBM Cloud CLI Not Found
|
|
203
|
+
|
|
204
|
+
For Code Engine commands, verify IBM Cloud CLI is installed:
|
|
205
|
+
```bash
|
|
206
|
+
ibmcloud --version
|
|
207
|
+
ibmcloud plugin list # Should show code-engine plugin
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Development
|
|
211
|
+
|
|
212
|
+
### Build
|
|
213
|
+
```bash
|
|
214
|
+
npm run build
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Run in Development Mode
|
|
218
|
+
```bash
|
|
219
|
+
npm run client
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Test Specific Command
|
|
223
|
+
```bash
|
|
224
|
+
npm start detect
|
|
225
|
+
npm start images
|
|
226
|
+
npm start projects
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Available Tools
|
|
230
|
+
|
|
231
|
+
The MCP server provides these tools:
|
|
232
|
+
|
|
233
|
+
### Container Tools (8)
|
|
234
|
+
1. `detect_container_runtime` - Detect Docker/Podman
|
|
235
|
+
2. `build_container_image` - Build images
|
|
236
|
+
3. `push_container_image` - Push to registry
|
|
237
|
+
4. `list_local_images` - List images
|
|
238
|
+
5. `test_container_locally` - Run locally
|
|
239
|
+
6. `get_container_logs` - View logs
|
|
240
|
+
7. `stop_local_container` - Stop container
|
|
241
|
+
8. `list_local_containers` - List containers
|
|
242
|
+
|
|
243
|
+
### Code Engine Tools (4)
|
|
244
|
+
1. `ce_list_projects` - List projects
|
|
245
|
+
2. `ce_create_application` - Create app
|
|
246
|
+
3. `ce_list_applications` - List apps
|
|
247
|
+
4. `ce_get_application` - Get app details
|
|
248
|
+
|
|
249
|
+
## Examples
|
|
250
|
+
|
|
251
|
+
### Example 1: Check What's Available
|
|
252
|
+
```bash
|
|
253
|
+
./run-client.sh detect
|
|
254
|
+
./run-client.sh images
|
|
255
|
+
./run-client.sh containers
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Example 2: Build and Test
|
|
259
|
+
```bash
|
|
260
|
+
# Build
|
|
261
|
+
./run-client.sh build ./Dockerfile myapp:test .
|
|
262
|
+
|
|
263
|
+
# Test
|
|
264
|
+
./run-client.sh test myapp:test 8080:8080
|
|
265
|
+
|
|
266
|
+
# Get container ID from output, then check logs
|
|
267
|
+
./run-client.sh logs abc123
|
|
268
|
+
|
|
269
|
+
# Stop when done
|
|
270
|
+
./run-client.sh stop abc123
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Example 3: Deploy to Registry
|
|
274
|
+
```bash
|
|
275
|
+
# Build
|
|
276
|
+
./run-client.sh build ./Dockerfile myapp:v1.0.0 .
|
|
277
|
+
|
|
278
|
+
# Push
|
|
279
|
+
./run-client.sh push icr.io/my-namespace/myapp:v1.0.0
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Example 4: Code Engine
|
|
283
|
+
```bash
|
|
284
|
+
# List projects
|
|
285
|
+
./run-client.sh projects
|
|
286
|
+
|
|
287
|
+
# Output shows your Code Engine projects
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## Tips
|
|
291
|
+
|
|
292
|
+
1. **Use Tab Completion**: The shell script supports command completion
|
|
293
|
+
2. **Check Help**: Run `./run-client.sh help` for command list
|
|
294
|
+
3. **Interactive Mode**: Run without args for interactive prompt
|
|
295
|
+
4. **Environment Variables**: Can override any setting via env vars
|
|
296
|
+
|
|
297
|
+
## Next Steps
|
|
298
|
+
|
|
299
|
+
- Use the client to manage your containers
|
|
300
|
+
- Integrate with CI/CD pipelines
|
|
301
|
+
- Automate deployments to Code Engine
|
|
302
|
+
- Build custom workflows
|
|
303
|
+
|
|
304
|
+
## Support
|
|
305
|
+
|
|
306
|
+
For issues:
|
|
307
|
+
1. Check the troubleshooting section
|
|
308
|
+
2. Verify prerequisites are installed
|
|
309
|
+
3. Check `.env` file configuration
|
|
310
|
+
4. Review MCP_DOCKER_PODMAN_TOOLS.md for tool details
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cline.mcpServers": {
|
|
3
|
+
"code-engine": {
|
|
4
|
+
"command": "node",
|
|
5
|
+
"args": [
|
|
6
|
+
"/Users/markusvankempen/projects/code-engine/code-engine-mcp-server/build/index.js"
|
|
7
|
+
],
|
|
8
|
+
"env": {
|
|
9
|
+
"IBMCLOUD_API_KEY": "YOUR_IBM_CLOUD_API_KEY_HERE",
|
|
10
|
+
"IBMCLOUD_REGION": "us-south"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|