code-engine-mcp-server 1.0.4 → 1.0.7

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 CHANGED
@@ -5,32 +5,43 @@
5
5
  Model Context Protocol (MCP) server for IBM Code Engine and Docker/Podman integration.
6
6
  It enables AI assistants to build, run, push, and deploy containerized workloads with a single MCP server.
7
7
 
8
- [![MCP](https://img.shields.io/badge/MCP-Server-blue)](#)
9
- [![IBM Cloud](https://img.shields.io/badge/IBM%20Cloud-Code%20Engine-1261FE)](#)
8
+ [![MCP](https://img.shields.io/badge/MCP-Server-blue)](https://github.com/markusvankempen/code-engine-mcp-server)
9
+ [![IBM Cloud](https://img.shields.io/badge/IBM%20Cloud-Code%20Engine-1261FE)](https://cloud.ibm.com/codeengine/overview)
10
10
  [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D18-339933?logo=nodedotjs&logoColor=white)](#prerequisites)
11
11
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
12
+ [![VS Code Marketplace](https://img.shields.io/badge/VS%20Code-Marketplace-007ACC?logo=visualstudiocode&logoColor=white)](https://marketplace.visualstudio.com/items?itemName=MarkusvanKempen.code-engine-mcp)
13
+ [![Open VSX](https://img.shields.io/badge/Open%20VSX-Registry-C160EF?logo=eclipseide&logoColor=white)](https://open-vsx.org/extension/markusvankempen/code-engine-mcp)
14
+ [![npm](https://img.shields.io/badge/npm-code--engine--mcp--server-CB3837?logo=npm&logoColor=white)](https://www.npmjs.com/package/code-engine-mcp-server)
15
+
16
+ ## How It Works
17
+
18
+ ```mermaid
19
+ flowchart TD
20
+ A([AI Assistant\nCopilot / Claude / Cline]) -->|MCP JSON-RPC| B[Code Engine MCP Server]
21
+
22
+ B --> C{Tool Category}
23
+
24
+ C -->|Container Tools| D[Docker / Podman]
25
+ C -->|Registry Tools| E[IBM Container Registry\nus.icr.io]
26
+ C -->|Code Engine Tools| F[IBM Code Engine\nREST API]
27
+ C -->|Procedures| G[Multi-step Workflows]
28
+
29
+ D -->|build / push / validate| E
30
+ E -->|image reference| F
31
+
32
+ G -->|proc_build_push_deploy| D
33
+ G -->|proc_build_run_and_deploy| F
34
+
35
+ F --> H[(Projects\nApps\nBuilds\nJobs\nSecrets\nDomains)]
36
+
37
+ H -->|ready| I([Live App\nhttps://app.region.codeengine.appdomain.cloud])
38
+
39
+ style A fill:#1261FE,color:#fff
40
+ style B fill:#0f3460,color:#fff
41
+ style G fill:#7b2d8b,color:#fff
42
+ style I fill:#198038,color:#fff
43
+ ```
12
44
 
13
- ## 📚 Table of Contents
14
-
15
- - [What You Get](#what-you-get)
16
- - [Quick Start](#quick-start)
17
- - [Deploy Your First App](#deploy-your-first-app)
18
- - [Documentation](#documentation)
19
- - [Project Structure](#project-structure)
20
- - [Features](#features)
21
- - [Configuration](#configuration)
22
- - [npm and MCP Registry](#npm-and-mcp-registry)
23
- - [Example Prompts](#example-prompts)
24
- - [Available Tools](#available-tools)
25
- - [Environment Variables](#environment-variables)
26
- - [Prerequisites](#prerequisites)
27
- - [Development](#development)
28
- - [Troubleshooting](#troubleshooting)
29
- - [Security](#security)
30
- - [License](#license)
31
- - [Contributing](#contributing)
32
- - [Author](#author)
33
- - [Support](#support)
34
45
 
35
46
  ## ✨ What You Get
36
47
 
@@ -55,7 +66,29 @@ node build/index.js
55
66
 
56
67
  Then configure your MCP client using one of the examples in the Configuration section below.
57
68
 
58
- ## Deploy Your First App
69
+ ## 🤖 The Agentic Experience (No Docker/Code Engine Lingo Needed)
70
+
71
+ The true power of this MCP server is that **you don't need to know Docker or Code Engine commands**. You can simply state your goal, and the LLM will discover the environment, run the pipeline, and fix issues autonomously.
72
+
73
+ Here is an example interaction from a real session:
74
+
75
+ **User:**
76
+ > "I have an app in the `developer-splash` folder. Deploy it to my Code Engine project."
77
+
78
+ **Assistant's Autonomous Thought Process:**
79
+ 1. *Discovery:* "Let me check what projects and namespaces exist... Found project `markus-app-v2-toronto` and namespace `mvk-code-engine`."
80
+ 2. *Prerequisites:* "No pull secret in this project yet. I'll get the API key from the `.env` file and create the secret `icr-pull-secret`."
81
+ 3. *Execution:* "Now I'll run the full pipeline: build → push → deploy → wait."
82
+ 4. *Validation:* "It's deployed but stuck at 'deploying'. Let me check the logs... The container is running but the readiness probe is failing."
83
+ 5. *Self-Correction:* "Ah, the `sed` pattern in the Dockerfile didn't match nginx alpine's default config format for port 80. I'll fix the Dockerfile with a regex-safe `sed` and rebuild."
84
+ 6. *Completion:* "App is live! 🎉 Status: ready."
85
+
86
+ **Assistant Response to User:**
87
+ > "Your app is deployed and live at: `https://developer-splash.29m5mrru3s3n.ca-tor.codeengine.appdomain.cloud`. I had to fix a minor port configuration issue in your Dockerfile, but it is successfully running now!"
88
+
89
+ With this MCP server, the AI acts as an expert DevOps engineer pairing with you.
90
+
91
+ ## Deploy Your First App
59
92
 
60
93
  This walks through deploying the included [Star Wars splash page example](./examples/starwars-splash/) — a static nginx container — entirely through the MCP server.
61
94
 
@@ -301,14 +334,216 @@ push it, then deploy it to Code Engine project <project-id> with pull secret icr
301
334
  Tell me the public URL and confirm the instance is running.
302
335
  ```
303
336
 
304
- ## �📖 Documentation
337
+ ---
338
+
339
+ ## 🌐 Host Any MCP Server on Code Engine
340
+
341
+ You can use **this** MCP server to deploy **another** MCP server to Code Engine — no CLI, no Dockerfile, no YAML. The key ingredient is [`supergateway`](https://github.com/supercorp-ai/supergateway): a tiny bridge that wraps any STDIO-based MCP server as an HTTP + SSE endpoint, making it accessible to any remote client.
342
+
343
+ > Credit: [Jeremias Werner & Enrico Regge — IBM Cloud Code Engine](https://community.ibm.com/community/user/blogs/jeremias-werner/2025/04/30/code-engine-mcp-server)
344
+
345
+ ```
346
+ Your AI Assistant
347
+ │ MCP JSON-RPC (STDIO, local)
348
+
349
+ code-engine-mcp-server ──► ce_create_application
350
+
351
+
352
+ Code Engine App
353
+ image: docker.io/supercorp/supergateway
354
+ args: --stdio "npx -y <any-mcp-server>"
355
+ --outputTransport sse
356
+ │ HTTPS + SSE (public URL)
357
+
358
+ Any remote MCP client
359
+ (Claude Desktop, Cursor, VS Code, …)
360
+ ```
361
+
362
+ Any STDIO MCP server becomes a remotely accessible, auto-scaling cloud service — with no custom infrastructure.
363
+
364
+ This example deploys [`@tokenizin/mcp-npx-fetch`](https://www.npmjs.com/package/@tokenizin/mcp-npx-fetch), an MCP server that lets an AI assistant fetch content from public URLs.
365
+
366
+ The example files live in [examples/mcp-server-supergateway/](./examples/mcp-server-supergateway/).
367
+
368
+ ### Step 1 — Deploy the hosted MCP server
369
+
370
+ Ask your assistant:
371
+ ```
372
+ Deploy a hosted MCP fetch server to my Code Engine project <project-id>.
373
+ Use image docker.io/supercorp/supergateway on port 8000.
374
+ Startup args: --stdio "npx -y @tokenizin/mcp-npx-fetch" --outputTransport sse
375
+ Name it "mcp-fetch-server". No pull secret needed.
376
+ ```
377
+
378
+ This calls `ce_create_application`:
379
+ ```json
380
+ {
381
+ "project_id": "<your-project-id>",
382
+ "name": "mcp-fetch-server",
383
+ "image": "docker.io/supercorp/supergateway",
384
+ "port": 8000,
385
+ "run_args": ["--stdio", "npx -y @tokenizin/mcp-npx-fetch", "--outputTransport", "sse"]
386
+ }
387
+ ```
388
+
389
+ **MCP response — `ce_create_application`:**
390
+ ```json
391
+ {
392
+ "name": "mcp-fetch-server",
393
+ "resource_type": "app_v2",
394
+ "status": "deploying",
395
+ "image_reference": "docker.io/supercorp/supergateway",
396
+ "image_port": 8000,
397
+ "scale_min_instances": 0,
398
+ "scale_max_instances": 10,
399
+ "endpoint": "https://mcp-fetch-server.<subdomain>.<region>.codeengine.appdomain.cloud",
400
+ "status_details": {
401
+ "latest_created_revision": "mcp-fetch-server-00001",
402
+ "latest_ready_revision": null
403
+ }
404
+ }
405
+ ```
406
+
407
+ > No pull secret is needed — `docker.io/supercorp/supergateway` is a public image. Code Engine scales to zero when idle; you pay only for actual requests.
408
+
409
+ ### Step 2 — Wait for the app to be ready
410
+
411
+ Ask your assistant:
412
+ ```
413
+ Wait for mcp-fetch-server in project <project-id> to be ready
414
+ ```
415
+
416
+ This calls `ce_wait_for_app_ready`:
417
+ ```json
418
+ {
419
+ "project_id": "<your-project-id>",
420
+ "app_name": "mcp-fetch-server",
421
+ "timeout_seconds": 120
422
+ }
423
+ ```
424
+
425
+ **MCP response — `ce_wait_for_app_ready`:**
426
+ ```json
427
+ {
428
+ "app_name": "mcp-fetch-server",
429
+ "status": "ready",
430
+ "endpoint": "https://mcp-fetch-server.<subdomain>.<region>.codeengine.appdomain.cloud",
431
+ "elapsed_seconds": 34,
432
+ "poll_history": [
433
+ { "attempt": 1, "status": "deploying", "elapsed_seconds": 10 },
434
+ { "attempt": 2, "status": "deploying", "elapsed_seconds": 20 },
435
+ { "attempt": 3, "status": "ready", "elapsed_seconds": 34 }
436
+ ]
437
+ }
438
+ ```
439
+
440
+ ### Step 3 — Verify the running instance
441
+
442
+ Ask your assistant:
443
+ ```
444
+ List the running instances of mcp-fetch-server in project <project-id>
445
+ ```
446
+
447
+ This calls `ce_list_app_instances`:
448
+
449
+ **MCP response — `ce_list_app_instances`:**
450
+ ```json
451
+ {
452
+ "instances": [
453
+ {
454
+ "name": "mcp-fetch-server-00001-deployment-abc123",
455
+ "revision": "mcp-fetch-server-00001",
456
+ "status": "running",
457
+ "restart_count": 0,
458
+ "started_at": "2026-05-09T12:01:44Z"
459
+ }
460
+ ]
461
+ }
462
+ ```
463
+
464
+ ### Step 4 — Connect your MCP client
465
+
466
+ Use [`mcp-remote`](https://www.npmjs.com/package/mcp-remote) to bridge the HTTP+SSE endpoint back to STDIO for local clients.
467
+
468
+ **VS Code `mcp.json`:**
469
+ ```json
470
+ {
471
+ "servers": {
472
+ "fetch": {
473
+ "command": "npx",
474
+ "args": [
475
+ "mcp-remote",
476
+ "https://mcp-fetch-server.<subdomain>.<region>.codeengine.appdomain.cloud/sse"
477
+ ]
478
+ }
479
+ }
480
+ }
481
+ ```
482
+
483
+ **Claude Desktop `claude_desktop_config.json`:**
484
+ ```json
485
+ {
486
+ "mcpServers": {
487
+ "fetch": {
488
+ "command": "npx",
489
+ "args": [
490
+ "mcp-remote",
491
+ "https://mcp-fetch-server.<subdomain>.<region>.codeengine.appdomain.cloud/sse"
492
+ ]
493
+ }
494
+ }
495
+ }
496
+ ```
497
+
498
+ ### Step 5 — Test the endpoint
499
+
500
+ Verify the server is live and streaming:
501
+ ```bash
502
+ curl -N https://mcp-fetch-server.<subdomain>.<region>.codeengine.appdomain.cloud/sse
503
+ ```
504
+
505
+ Or open it in the [MCP Inspector](https://github.com/modelcontextprotocol/inspector):
506
+ ```bash
507
+ npx @modelcontextprotocol/inspector
508
+ # Connect via SSE → paste the Code Engine URL
509
+ ```
510
+
511
+ Once connected, you will see the `fetch` tool listed and can invoke it directly from the inspector.
512
+
513
+ ### Full one-shot prompt
514
+
515
+ ```
516
+ Deploy a hosted MCP fetch server to my Code Engine project <project-id>.
517
+ Use image docker.io/supercorp/supergateway on port 8000 with no pull secret.
518
+ run_args: --stdio "npx -y @tokenizin/mcp-npx-fetch" --outputTransport sse
519
+ Name it "mcp-fetch-server", wait for it to be ready, and give me the /sse URL
520
+ so I can add it to my mcp.json.
521
+ ```
522
+
523
+ See [examples/mcp-server-supergateway/](./examples/mcp-server-supergateway/) for the ready-to-use client config file.
305
524
 
525
+ ### Deploy any other STDIO MCP server
526
+
527
+ The same pattern works for any `npx`-runnable MCP server — just swap the `--stdio` argument:
528
+
529
+ | MCP Server | `--stdio` argument |
530
+ |---|---|
531
+ | Fetch | `npx -y @tokenizin/mcp-npx-fetch` |
532
+ | Filesystem | `npx -y @modelcontextprotocol/server-filesystem /data` |
533
+ | Brave Search | `npx -y @modelcontextprotocol/server-brave-search` |
534
+ | Your own server | `node /app/server.js` |
535
+
536
+ ---
537
+
538
+ ## Documentation
539
+
540
+ - [Setup Instructions](./docs/SETUP_INSTRUCTIONS.md)
541
+ - [MCP Inspector Troubleshooting](./docs/MCP_INSPECTOR_TROUBLESHOOTING.md)
306
542
  - [Code Engine API Reference](./docs/CODE_ENGINE_API_REFERENCE.md)
307
543
  - [API Call Scenarios](./docs/API_CALL_SCENARIOS.md)
308
- - [Setup Instructions](./docs/SETUP_INSTRUCTIONS.md)
309
544
  - [Client README](./docs/CLIENT_README.md)
310
545
  - [Cline MCP Config Example](./docs/CLINE_CONFIG_EXAMPLE.json)
311
- - [VS Code MCP extension](./vscode-extension/README.md) (registers this server via settings; no `mcp.json` required for the default `npx` flow)
546
+ - [VS Code MCP extension](./vscode-extension/README.md)
312
547
  - [Code of Conduct](./docs/CODE_OF_CONDUCT.md)
313
548
  - [Contributing Guide](./docs/CONTRIBUTING.md)
314
549
  - [Maintainers](./docs/MAINTAINERS.md)
@@ -317,20 +552,27 @@ Tell me the public URL and confirm the instance is running.
317
552
 
318
553
  ```text
319
554
  code-engine-mcp-server/
320
- ├── api/
321
- │ └── code-engine-openapi.yaml # OpenAPI reference used for API coverage
555
+ ├── api/ # OpenAPI reference used for API coverage
322
556
  ├── build/ # Compiled JavaScript output
323
- ├── docs/ # API references and setup guides
324
- ├── internal/ # Internal release/publishing notes
557
+ ├── docs/ # API references, client guides, community files
558
+ ├── API_CALL_SCENARIOS.md
559
+ │ ├── CODE_ENGINE_API_REFERENCE.md
560
+ │ ├── MCP_INSPECTOR_TROUBLESHOOTING.md
561
+ │ ├── SETUP_INSTRUCTIONS.md
562
+ │ ├── CODE_OF_CONDUCT.md
563
+ │ ├── CONTRIBUTING.md
564
+ │ └── MAINTAINERS.md
565
+ ├── examples/
566
+ │ ├── developer-splash/ # nginx static container example
567
+ │ ├── starwars-splash/ # nginx Star Wars crawl example
568
+ │ └── mcp-server-supergateway/ # Host any MCP server on Code Engine via supergateway
569
+ ├── internal/ # Internal release notes
325
570
  ├── src/ # Main TypeScript source code
326
571
  ├── CHANGELOG.md # Release history
327
- ├── CODE_OF_CONDUCT.md # Community guidelines
328
- ├── CONTRIBUTING.md # Contribution workflow
329
572
  ├── LICENSE # Project license
330
- ├── MAINTAINERS.md # Maintainer list
331
573
  ├── README.md # Project overview and usage
332
574
  ├── mcp.example.json # Example MCP client configuration
333
- ├── vscode-extension/ # Optional VS Code extension (MCP definition provider)
575
+ ├── vscode-extension/ # Optional VS Code extension
334
576
  ├── package.json # npm package metadata and scripts
335
577
  ├── server.json # MCP Registry metadata
336
578
  └── tsconfig.json # TypeScript configuration
@@ -367,6 +609,7 @@ code-engine-mcp-server/
367
609
  - ✅ TLS secrets from Let's Encrypt / certbot PEM files (`ce_create_tls_secret_from_pem`)
368
610
  - ✅ TLS cert renewal in-place without disrupting domain mappings (`ce_renew_tls_secret_from_pem`)
369
611
  - ✅ Update any secret in-place (`ce_update_secret`)
612
+ - ✅ Refresh ICR pull secret with current API key credentials (`ce_refresh_icr_pull_secret`) — fixes `no_revision_ready` failures caused by stale registry credentials without needing the CLI
370
613
  - ✅ Wait for app deployment or build run to complete (`ce_wait_for_app_ready`, `ce_wait_for_build_run`)
371
614
  - ✅ IAM token info and diagnostics (`iam_get_token_info`)
372
615
  - ✅ Create ICR namespaces via REST API (`icr_create_namespace`)
@@ -378,79 +621,188 @@ code-engine-mcp-server/
378
621
 
379
622
  ## ⚙️ Configuration
380
623
 
381
- ### VS Code IBM Code Engine MCP extension (optional)
624
+ ### Getting an IBM Cloud API key
625
+
626
+ All Code Engine and ICR operations require an IBM Cloud API key. Get one at:
627
+ **[IBM Cloud IAM → API keys](https://cloud.ibm.com/iam/apikeys)** → **Create an IBM Cloud API key**.
628
+
629
+ Store the key somewhere safe (password manager). You will paste it into one of the configuration paths below.
630
+
631
+ ---
632
+
633
+ ### Path A — VS Code extension (recommended)
634
+
635
+ The [IBM Code Engine MCP extension](https://marketplace.visualstudio.com/items?itemName=MarkusvanKempen.code-engine-mcp) handles everything: server startup, API key storage, and MCP registration — no manual `mcp.json` editing required.
636
+
637
+ **Install from the Marketplace:**
638
+
639
+ | IDE / Platform | Install link |
640
+ |---|---|
641
+ | VS Code | [marketplace.visualstudio.com](https://marketplace.visualstudio.com/items?itemName=MarkusvanKempen.code-engine-mcp) |
642
+ | Cursor / Theia / Gitpod / Codium | [open-vsx.org](https://open-vsx.org/extension/markusvankempen/code-engine-mcp) |
643
+ | From a local `.vsix` | **Command Palette** → **Extensions: Install from VSIX…** |
644
+
645
+ **Set your API key (required before any tool works):**
382
646
 
383
- The extension in `vscode-extension/` registers this MCP server with VS Code using the **MCP server definition provider** API (VS Code **1.101+**). You do **not** need a workspace `.vscode/mcp.json` entry for the default flow: the server is started with `npx -y code-engine-mcp-server` and your API key from settings.
647
+ 1. Open the **IBM Code Engine MCP** sidebar panel (cloud icon in the Activity Bar)
648
+ 2. Paste your IBM Cloud API key and click **Save**
649
+ _(The key is stored in VS Code global settings — encrypted by the OS keychain, never in a plaintext file)_
650
+ 3. Optionally change the region (default: `us-south`) in the same panel
651
+ 4. Click **Configure MCP** — this writes the server entry to the global `mcp.json` and restarts VS Code's MCP server list
652
+ 5. Click **Run Diagnostics** to confirm everything is wired up:
653
+ - ✅ Node.js found on PATH
654
+ - ✅ API key configured
655
+ - ✅ MCP server registered
656
+ - ✅ Tool list discovered
384
657
 
385
- 1. Install the extension (from a `.vsix` built with `npm run package` inside `vscode-extension/`, or from the Marketplace when published).
386
- 2. Ensure **Node.js** is installed and `npx` is on your `PATH`.
387
- 3. Open **Settings** and search for **IBM Code Engine MCP**, or edit `settings.json` directly:
388
- - `codeEngineMcp.apiKey` — your IBM Cloud API key (**required**; until this is set, the extension contributes no MCP server).
389
- - `codeEngineMcp.region` — IBM Cloud region (optional, default `us-south`). Passed as `IBMCLOUD_REGION` to the server.
658
+ After step 4 you can open GitHub Copilot Chat and immediately ask:
659
+ > *"List all my Code Engine projects"*
390
660
 
391
- The extension sets `IBMCLOUD_API_KEY` and `IBMCLOUD_REGION` for the spawned process. Use GitHub Copilot and MCP in VS Code as described in the [Copilot documentation](https://code.visualstudio.com/docs/copilot/copilot-chat).
661
+ > **Tip:** If Copilot can't see the tools after installing, run **Command Palette Reload Window** once.
392
662
 
393
663
  More detail: [vscode-extension/README.md](./vscode-extension/README.md).
394
664
 
395
665
  ---
396
666
 
397
- ### 1) GitHub Copilot (VS Code) `mcp.json` (workspace)
667
+ ### Path B Pure MCP config (no extension)
668
+
669
+ Use this path with **any** MCP-capable client: GitHub Copilot without the extension, Cline, Claude Desktop, Cursor, etc.
670
+
671
+ #### Where to put the API key (choose one approach)
672
+
673
+ **Option 1 — Shell environment variable (most secure)**
674
+
675
+ Copy the provided template and fill in your key:
676
+
677
+ ```bash
678
+ cp .env.example .env # copy template (already in .gitignore)
679
+ # edit .env → set IBMCLOUD_API_KEY=your-key
680
+ source .env # load into current shell session
681
+ ```
398
682
 
399
- Copy `mcp.example.json` to `.vscode/mcp.json` in your workspace root:
683
+ Or add the export permanently to your shell profile so every new terminal has it:
400
684
 
401
685
  ```bash
402
- cp mcp.example.json ../.vscode/mcp.json
686
+ # ~/.zshrc or ~/.bash_profile
687
+ export IBMCLOUD_API_KEY="your-ibm-cloud-api-key-here"
688
+ ```
689
+
690
+ See [.env.example](.env.example) for all available variables (`IBMCLOUD_REGION`, `CONTAINER_RUNTIME`, `DEBUG`).
691
+
692
+ Then reference the variable in the MCP config without embedding the value:
693
+
694
+ ```json
695
+ {
696
+ "servers": {
697
+ "code-engine": {
698
+ "type": "stdio",
699
+ "command": "npx",
700
+ "args": ["-y", "code-engine-mcp-server@latest"],
701
+ "env": {
702
+ "IBMCLOUD_API_KEY": "${env:IBMCLOUD_API_KEY}",
703
+ "IBMCLOUD_REGION": "us-south"
704
+ }
705
+ }
706
+ }
707
+ }
708
+ ```
709
+
710
+ > `${env:VARIABLE}` is VS Code's input substitution syntax — it reads the value from your shell environment at startup so your API key is never stored in the file.
711
+
712
+ **Option 2 — VS Code input variable (prompted on connect)**
713
+
714
+ VS Code can prompt you for the API key when it starts the server — great for shared machines:
715
+
716
+ ```json
717
+ {
718
+ "inputs": [
719
+ {
720
+ "id": "ibmcloud-api-key",
721
+ "type": "promptString",
722
+ "description": "IBM Cloud API key",
723
+ "password": true
724
+ }
725
+ ],
726
+ "servers": {
727
+ "code-engine": {
728
+ "type": "stdio",
729
+ "command": "npx",
730
+ "args": ["-y", "code-engine-mcp-server@latest"],
731
+ "env": {
732
+ "IBMCLOUD_API_KEY": "${input:ibmcloud-api-key}",
733
+ "IBMCLOUD_REGION": "us-south"
734
+ }
735
+ }
736
+ }
737
+ }
403
738
  ```
404
739
 
405
- Then edit `.vscode/mcp.json` and replace the placeholder with your IBM Cloud API key:
740
+ **Option 3 Inline value (simplest, least secure)**
741
+
742
+ Paste the key directly. **Never commit this file to git.**
406
743
 
407
744
  ```json
408
745
  {
409
- "servers": {
410
- "code-engine": {
411
- "type": "stdio",
412
- "command": "node",
413
- "args": [
414
- "${workspaceFolder}/code-engine-mcp-server/build/index.js"
415
- ],
416
- "env": {
417
- "IBMCLOUD_API_KEY": "your-ibm-cloud-api-key-here"
418
- }
419
- }
746
+ "servers": {
747
+ "code-engine": {
748
+ "type": "stdio",
749
+ "command": "npx",
750
+ "args": ["-y", "code-engine-mcp-server@latest"],
751
+ "env": {
752
+ "IBMCLOUD_API_KEY": "your-ibm-cloud-api-key-here",
753
+ "IBMCLOUD_REGION": "us-south"
754
+ }
420
755
  }
756
+ }
421
757
  }
422
758
  ```
423
759
 
424
- Restart the server: **Cmd+Shift+P** -> **"MCP: Restart Server"** -> `code-engine`.
760
+ > **Security:** Add the config file to `.gitignore`. For workspace configs, use `${env:...}` or `${input:...}` instead of inline values.
425
761
 
426
- > **Security:** Add `.vscode/mcp.json` to your `.gitignore` to avoid committing your API key.
762
+ ---
763
+
764
+ #### 1) GitHub Copilot (VS Code) — workspace `mcp.json`
765
+
766
+ Create `.vscode/mcp.json` in your workspace root (or copy `mcp.example.json`):
767
+
768
+ ```bash
769
+ cp mcp.example.json .vscode/mcp.json
770
+ echo '.vscode/mcp.json' >> .gitignore
771
+ ```
427
772
 
428
- Get your API key at [IBM Cloud IAM API keys](https://cloud.ibm.com/iam/apikeys).
773
+ Paste one of the API key options above. Then restart the server:
774
+ **Cmd+Shift+P** → **MCP: Restart Server** → `code-engine`.
775
+
776
+ Alternatively, use the **global** MCP config at `~/Library/Application Support/Code/User/mcp.json` (macOS) so the server is available in every workspace without a per-project file.
429
777
 
430
778
  ---
431
779
 
432
- ### 2) Cline (VS Code Extension)
780
+ #### 2) Cline (VS Code Extension)
433
781
 
434
- 1. Open VSCode Settings (Cmd/Ctrl + ,)
435
- 2. Search for "Cline: MCP Settings"
436
- 3. Click "Edit in settings.json"
437
- 4. Add the configuration:
782
+ 1. Open VS Code Settings (`Cmd+,`)
783
+ 2. Search for **Cline: MCP Settings** → **Edit in settings.json**
784
+ 3. Add:
438
785
 
439
786
  ```json
440
787
  {
441
788
  "cline.mcpServers": {
442
789
  "code-engine": {
443
- "command": "node",
444
- "args": ["/absolute/path/to/code-engine-mcp-server/build/index.js"],
790
+ "command": "npx",
791
+ "args": ["-y", "code-engine-mcp-server@latest"],
445
792
  "env": {
446
- "IBMCLOUD_API_KEY": "your-api-key-here"
793
+ "IBMCLOUD_API_KEY": "your-api-key-here",
794
+ "IBMCLOUD_REGION": "us-south"
447
795
  }
448
796
  }
449
797
  }
450
798
  }
451
799
  ```
452
800
 
453
- ### 3) Claude Desktop
801
+ > Prefer `${env:IBMCLOUD_API_KEY}` if your shell exports the key, so it never appears in `settings.json`.
802
+
803
+ ---
804
+
805
+ #### 3) Claude Desktop
454
806
 
455
807
  Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
456
808
 
@@ -458,22 +810,29 @@ Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
458
810
  {
459
811
  "mcpServers": {
460
812
  "code-engine": {
461
- "command": "node",
462
- "args": ["/absolute/path/to/code-engine-mcp-server/build/index.js"],
813
+ "command": "npx",
814
+ "args": ["-y", "code-engine-mcp-server@latest"],
463
815
  "env": {
464
- "IBMCLOUD_API_KEY": "your-api-key-here"
816
+ "IBMCLOUD_API_KEY": "your-api-key-here",
817
+ "IBMCLOUD_REGION": "us-south"
465
818
  }
466
819
  }
467
820
  }
468
821
  }
469
822
  ```
470
823
 
471
- ## npm and MCP Registry
824
+ > Restart Claude Desktop after saving. The server starts on demand when Claude needs a tool.
825
+
826
+ ## Install & Registry Links
472
827
 
473
- Use the published package from npm or browse the MCP Registry listing:
828
+ | Platform | Link |
829
+ |---|---|
830
+ | **npm** (MCP server package) | [code-engine-mcp-server](https://www.npmjs.com/package/code-engine-mcp-server) |
831
+ | **VS Code Marketplace** (extension) | [MarkusvanKempen.code-engine-mcp](https://marketplace.visualstudio.com/items?itemName=MarkusvanKempen.code-engine-mcp) |
832
+ | **Open VSX Registry** (Theia / Gitpod / Cursor) | [markusvankempen.code-engine-mcp](https://open-vsx.org/extension/markusvankempen/code-engine-mcp) |
833
+ | **MCP Registry** | [io.github.markusvankempen/code-engine-mcp-server](https://registry.modelcontextprotocol.io/v0.1/servers?search=io.github.markusvankempen%2Fcode-engine-mcp-server) |
474
834
 
475
- - [npm package: code-engine-mcp-server](https://www.npmjs.com/package/code-engine-mcp-server)
476
- - [MCP Registry entry: io.github.markusvankempen/code-engine-mcp-server](https://registry.modelcontextprotocol.io/v0.1/servers?search=io.github.markusvankempen%2Fcode-engine-mcp-server)
835
+ The **VS Code extension** is the easiest starting point — it handles server startup, API key storage, and MCP registration automatically. Use the **npm package** directly if you prefer a manual MCP config (Cline, Claude Desktop, Cursor, or any other client).
477
836
 
478
837
  ## 💬 Example Prompts
479
838
 
@@ -537,7 +896,7 @@ Tell me what CNAME value to set in DNS.
537
896
 
538
897
  ## 🛠️ Available Tools
539
898
 
540
- 62 tools total: 9 container tools + 4 ICR tools + 45 Code Engine tools + 1 IAM tool + 3 procedures.
899
+ 63 tools total: 9 container tools + 4 ICR tools + 46 Code Engine tools + 1 IAM tool + 3 procedures.
541
900
 
542
901
  > **Procedures** bundle multiple tools into a single call. Use them for common end-to-end workflows.
543
902
 
@@ -579,8 +938,8 @@ Tell me what CNAME value to set in DNS.
579
938
  |------|-------------|----------------|
580
939
  | `ce_list_applications` | List applications in a project | `project_id` |
581
940
  | `ce_get_application` | Get application details and public URL | `project_id`, `app_name` |
582
- | `ce_create_application` | Deploy a new application | `project_id`, `name`, `image`, `image_secret`, `port`, `env_vars` |
583
- | `ce_update_application` | Update image, scaling, env, pull secret | `project_id`, `app_name`, `image`, `image_secret`, `scale_*` |
941
+ | `ce_create_application` | Deploy a new application | `project_id`, `name`, `image`, `image_secret`, `port`, `env_vars`, `run_args`, `run_commands` |
942
+ | `ce_update_application` | Update image, scaling, env, pull secret, run args | `project_id`, `app_name`, `image`, `image_secret`, `scale_*`, `run_args`, `run_commands` |
584
943
  | `ce_delete_application` | Delete an application | `project_id`, `app_name` |
585
944
  | `ce_list_app_instances` | List all running instances with status | `project_id`, `app_name` |
586
945
  | `ce_get_app_instance` | Get status details for a specific instance | `project_id`, `app_name`, `instance_name` |
@@ -614,7 +973,7 @@ Tell me what CNAME value to set in DNS.
614
973
  | `ce_create_job_run` | Submit a job run | `project_id`, `job_name` |
615
974
  | `ce_delete_job_run` | Delete a job run | `project_id`, `job_run_name` |
616
975
 
617
- ### Code Engine: Secrets (7)
976
+ ### Code Engine: Secrets (8)
618
977
 
619
978
  | Tool | Description | Key Parameters |
620
979
  |------|-------------|----------------|
@@ -623,6 +982,7 @@ Tell me what CNAME value to set in DNS.
623
982
  | `ce_create_secret` | Create a secret | `project_id`, `name`, `format`, `data` |
624
983
  | `ce_update_secret` | Update an existing secret in-place (PATCH) | `project_id`, `secret_name`, `data` |
625
984
  | `ce_delete_secret` | Delete a secret | `project_id`, `secret_name` |
985
+ | `ce_refresh_icr_pull_secret` | Delete and recreate an ICR registry pull secret using the server's own API key — fixes stale-credential failures without needing the CLI | `project_id`, `secret_name` (default: `icr-pull-secret`), `icr_host` |
626
986
  | `ce_create_tls_secret_from_pem` | Create a TLS secret from PEM files | `project_id`, `secret_name`, `cert_pem_path`, `key_pem_path` |
627
987
  | `ce_renew_tls_secret_from_pem` | Renew an existing TLS secret from updated PEM files | `project_id`, `secret_name`, `cert_pem_path`, `key_pem_path` |
628
988