@purplesquirrel/ibmcloud-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.
@@ -0,0 +1,21 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "npm"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ open-pull-requests-limit: 10
8
+ labels:
9
+ - "dependencies"
10
+ commit-message:
11
+ prefix: "chore(deps)"
12
+
13
+ - package-ecosystem: "github-actions"
14
+ directory: "/"
15
+ schedule:
16
+ interval: "weekly"
17
+ labels:
18
+ - "dependencies"
19
+ - "github-actions"
20
+ commit-message:
21
+ prefix: "chore(ci)"
@@ -0,0 +1,36 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+
13
+ strategy:
14
+ matrix:
15
+ node-version: [18.x, 20.x]
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Use Node.js ${{ matrix.node-version }}
21
+ uses: actions/setup-node@v4
22
+ with:
23
+ node-version: ${{ matrix.node-version }}
24
+ cache: 'npm'
25
+
26
+ - name: Install dependencies
27
+ run: npm ci
28
+
29
+ - name: Run linter
30
+ run: npm run lint --if-present
31
+
32
+ - name: Run tests
33
+ run: npm test --if-present
34
+
35
+ - name: Build
36
+ run: npm run build --if-present
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Purple Squirrel Media
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.
package/README.md ADDED
@@ -0,0 +1,238 @@
1
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
2
+ [![MCP](https://img.shields.io/badge/MCP-Server-blue)](https://modelcontextprotocol.io)
3
+ [![IBM Cloud](https://img.shields.io/badge/IBM-Cloud-052FAD)](https://cloud.ibm.com)
4
+ [![CI](https://github.com/PurpleSquirrelMedia/ibmcloud-mcp-server/actions/workflows/ci.yml/badge.svg)](https://github.com/PurpleSquirrelMedia/ibmcloud-mcp-server/actions/workflows/ci.yml)
5
+
6
+ # IBM Cloud CLI MCP Server
7
+
8
+ Comprehensive MCP server wrapping the IBM Cloud CLI for Claude Code. Provides 80+ tools covering all major IBM Cloud services and operations.
9
+
10
+ ## Features
11
+
12
+ - **Authentication** - Login, logout, target, regions
13
+ - **Resource Management** - Service instances, keys, resource groups
14
+ - **Cloud Foundry** - Apps, services, routes, marketplace
15
+ - **Kubernetes** - Clusters, workers, worker pools, zones
16
+ - **Container Registry** - Namespaces, images, quotas
17
+ - **IAM** - Users, API keys, service IDs, access groups
18
+ - **Catalog & Billing** - Service catalog, usage, billing
19
+
20
+ ## Tool Categories
21
+
22
+ ### Authentication (8 tools)
23
+ | Tool | Description |
24
+ |------|-------------|
25
+ | `ibmcloud_login` | Login with API key or SSO |
26
+ | `ibmcloud_logout` | Logout from IBM Cloud |
27
+ | `ibmcloud_target` | Set target region/resource group |
28
+ | `ibmcloud_api` | View/set API endpoint |
29
+ | `ibmcloud_regions` | List available regions |
30
+ | `ibmcloud_account_show` | Show current account |
31
+ | `ibmcloud_account_list` | List accessible accounts |
32
+ | `ibmcloud_config_list` | List CLI configuration |
33
+
34
+ ### Resource Management (14 tools)
35
+ | Tool | Description |
36
+ |------|-------------|
37
+ | `ibmcloud_resource_groups` | List resource groups |
38
+ | `ibmcloud_resource_group_create` | Create resource group |
39
+ | `ibmcloud_resource_service_instances` | List service instances |
40
+ | `ibmcloud_resource_service_instance` | Get instance details |
41
+ | `ibmcloud_resource_service_instance_create` | Create instance |
42
+ | `ibmcloud_resource_service_instance_delete` | Delete instance |
43
+ | `ibmcloud_resource_service_instance_update` | Update instance |
44
+ | `ibmcloud_resource_service_keys` | List service keys |
45
+ | `ibmcloud_resource_service_key` | Get key details |
46
+ | `ibmcloud_resource_service_key_create` | Create service key |
47
+ | `ibmcloud_resource_service_key_delete` | Delete service key |
48
+ | `ibmcloud_resource_search` | Search resources |
49
+ | `ibmcloud_resource_tags` | List tags |
50
+ | `ibmcloud_resource_tag_attach` | Attach tags |
51
+
52
+ ### Cloud Foundry (20 tools)
53
+ | Tool | Description |
54
+ |------|-------------|
55
+ | `ibmcloud_cf_orgs` | List organizations |
56
+ | `ibmcloud_cf_spaces` | List spaces |
57
+ | `ibmcloud_cf_apps` | List applications |
58
+ | `ibmcloud_cf_app` | Get app details |
59
+ | `ibmcloud_cf_push` | Deploy application |
60
+ | `ibmcloud_cf_start` | Start application |
61
+ | `ibmcloud_cf_stop` | Stop application |
62
+ | `ibmcloud_cf_restart` | Restart application |
63
+ | `ibmcloud_cf_delete` | Delete application |
64
+ | `ibmcloud_cf_logs` | View app logs |
65
+ | `ibmcloud_cf_env` | Show environment variables |
66
+ | `ibmcloud_cf_set_env` | Set environment variable |
67
+ | `ibmcloud_cf_scale` | Scale application |
68
+ | `ibmcloud_cf_routes` | List routes |
69
+ | `ibmcloud_cf_services` | List services |
70
+ | `ibmcloud_cf_marketplace` | List marketplace |
71
+ | `ibmcloud_cf_create_service` | Create service |
72
+ | `ibmcloud_cf_bind_service` | Bind service to app |
73
+ | `ibmcloud_cf_unbind_service` | Unbind service |
74
+
75
+ ### Kubernetes (15 tools)
76
+ | Tool | Description |
77
+ |------|-------------|
78
+ | `ibmcloud_ks_clusters` | List Kubernetes clusters |
79
+ | `ibmcloud_ks_cluster` | Get cluster details |
80
+ | `ibmcloud_ks_cluster_config` | Configure kubectl |
81
+ | `ibmcloud_ks_cluster_create` | Create cluster |
82
+ | `ibmcloud_ks_cluster_delete` | Delete cluster |
83
+ | `ibmcloud_ks_workers` | List worker nodes |
84
+ | `ibmcloud_ks_worker_pools` | List worker pools |
85
+ | `ibmcloud_ks_worker_pool_create` | Create worker pool |
86
+ | `ibmcloud_ks_worker_pool_resize` | Resize worker pool |
87
+ | `ibmcloud_ks_zones` | List available zones |
88
+ | `ibmcloud_ks_versions` | List K8s versions |
89
+ | `ibmcloud_ks_flavors` | List machine flavors |
90
+
91
+ ### Container Registry (5 tools)
92
+ | Tool | Description |
93
+ |------|-------------|
94
+ | `ibmcloud_cr_namespaces` | List namespaces |
95
+ | `ibmcloud_cr_namespace_add` | Create namespace |
96
+ | `ibmcloud_cr_images` | List images |
97
+ | `ibmcloud_cr_image_rm` | Remove image |
98
+ | `ibmcloud_cr_quota` | Get quota info |
99
+
100
+ ### IAM (18 tools)
101
+ | Tool | Description |
102
+ |------|-------------|
103
+ | `ibmcloud_iam_users` | List users |
104
+ | `ibmcloud_iam_user_invite` | Invite user |
105
+ | `ibmcloud_iam_api_keys` | List API keys |
106
+ | `ibmcloud_iam_api_key_create` | Create API key |
107
+ | `ibmcloud_iam_api_key_delete` | Delete API key |
108
+ | `ibmcloud_iam_service_ids` | List service IDs |
109
+ | `ibmcloud_iam_service_id` | Get service ID |
110
+ | `ibmcloud_iam_service_id_create` | Create service ID |
111
+ | `ibmcloud_iam_service_id_delete` | Delete service ID |
112
+ | `ibmcloud_iam_service_api_keys` | List service API keys |
113
+ | `ibmcloud_iam_service_api_key_create` | Create service API key |
114
+ | `ibmcloud_iam_access_groups` | List access groups |
115
+ | `ibmcloud_iam_access_group` | Get access group |
116
+ | `ibmcloud_iam_access_group_create` | Create access group |
117
+ | `ibmcloud_iam_access_group_users` | List group users |
118
+ | `ibmcloud_iam_access_group_user_add` | Add user to group |
119
+ | `ibmcloud_iam_access_group_policies` | List group policies |
120
+ | `ibmcloud_iam_access_group_policy_create` | Create policy |
121
+ | `ibmcloud_iam_roles` | List IAM roles |
122
+
123
+ ### Catalog & Billing (7 tools)
124
+ | Tool | Description |
125
+ |------|-------------|
126
+ | `ibmcloud_catalog_search` | Search service catalog |
127
+ | `ibmcloud_catalog_service` | Get service details |
128
+ | `ibmcloud_catalog_service_plans` | List service plans |
129
+ | `ibmcloud_billing_account_usage` | Get account usage |
130
+ | `ibmcloud_billing_resource_group_usage` | Get RG usage |
131
+ | `ibmcloud_billing_resource_instances_usage` | Get instance usage |
132
+ | `ibmcloud_billing_org_usage` | Get org usage |
133
+
134
+ ### Plugins (4 tools)
135
+ | Tool | Description |
136
+ |------|-------------|
137
+ | `ibmcloud_plugin_list` | List installed plugins |
138
+ | `ibmcloud_plugin_repo_plugins` | List available plugins |
139
+ | `ibmcloud_plugin_install` | Install a plugin |
140
+ | `ibmcloud_version` | Show CLI version |
141
+
142
+ ## Setup
143
+
144
+ ### 1. Prerequisites
145
+
146
+ Install IBM Cloud CLI:
147
+ ```bash
148
+ curl -fsSL https://clis.cloud.ibm.com/install/osx | sh
149
+ ```
150
+
151
+ ### 2. Install Dependencies
152
+
153
+ ```bash
154
+ cd ~/mcp-servers/ibmcloud-mcp
155
+ npm install
156
+ npm run build
157
+ ```
158
+
159
+ ### 3. Add to Claude Code
160
+
161
+ Add to `~/.claude.json`:
162
+
163
+ ```json
164
+ {
165
+ "mcpServers": {
166
+ "ibmcloud": {
167
+ "type": "stdio",
168
+ "command": "node",
169
+ "args": ["/Users/matthewkarsten/mcp-servers/ibmcloud-mcp/dist/index.js"]
170
+ }
171
+ }
172
+ }
173
+ ```
174
+
175
+ ## Architecture
176
+
177
+ ```
178
+ Claude Code (Opus 4.5)
179
+
180
+ └──▶ IBM Cloud MCP Server
181
+
182
+ └──▶ ibmcloud CLI
183
+
184
+ ├── Resource Controller
185
+ ├── Cloud Foundry API
186
+ ├── Kubernetes Service
187
+ ├── Container Registry
188
+ ├── IAM Service
189
+ └── Billing Service
190
+ ```
191
+
192
+ ## Usage Examples
193
+
194
+ ```
195
+ User: List my IBM Cloud Kubernetes clusters
196
+
197
+ Claude: [Uses ibmcloud_ks_clusters tool]
198
+ Result:
199
+ - mycluster (VPC Gen2, us-south, 1.28, 3 workers) - normal
200
+ - dev-cluster (Classic, dal10, 1.27, 2 workers) - normal
201
+
202
+ User: Create a new Cloud Object Storage instance
203
+
204
+ Claude: [Uses ibmcloud_resource_service_instance_create]
205
+ Created: my-cos-instance (cloud-object-storage, lite plan)
206
+ ```
207
+
208
+ ## IBM Cloud Services Supported
209
+
210
+ - **Watson AI**: watsonx.ai, Watson Studio, Watson ML
211
+ - **Storage**: Cloud Object Storage, Block Storage
212
+ - **Databases**: Db2, PostgreSQL, MongoDB, Redis
213
+ - **Containers**: Kubernetes, OpenShift, Container Registry
214
+ - **Serverless**: Cloud Functions, Code Engine
215
+ - **Networking**: VPC, Load Balancers, DNS
216
+ - **Security**: Key Protect, Secrets Manager, IAM
217
+ - **Integration**: API Connect, MQ, Event Streams
218
+
219
+ ## Files
220
+
221
+ ```
222
+ ibmcloud-mcp/
223
+ ├── src/
224
+ │ ├── index.ts # MCP server implementation
225
+ │ └── cli.ts # IBM Cloud CLI wrapper
226
+ ├── dist/ # Compiled JavaScript
227
+ ├── package.json
228
+ ├── tsconfig.json
229
+ └── README.md
230
+ ```
231
+
232
+ ## Author
233
+
234
+ Matthew Karsten
235
+
236
+ ## License
237
+
238
+ MIT
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@purplesquirrel/ibmcloud-mcp-server",
3
+ "version": "1.0.0",
4
+ "description": "MCP server for IBM Cloud CLI",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "ibmcloud-mcp": "./dist/index.js"
9
+ },
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "start": "node dist/index.js",
13
+ "watch": "tsc -w",
14
+ "clean": "rm -rf dist"
15
+ },
16
+ "dependencies": {
17
+ "@modelcontextprotocol/sdk": "^1.0.0"
18
+ },
19
+ "devDependencies": {
20
+ "@types/node": "^20.0.0",
21
+ "typescript": "^5.0.0"
22
+ },
23
+ "engines": {
24
+ "node": ">=18"
25
+ },
26
+ "license": "MIT"
27
+ }
package/src/cli.ts ADDED
@@ -0,0 +1,103 @@
1
+ import { spawn } from "child_process";
2
+
3
+ export interface CLIResult {
4
+ success: boolean;
5
+ stdout: string;
6
+ stderr: string;
7
+ exitCode: number;
8
+ }
9
+
10
+ export async function executeIBMCloud(
11
+ args: string[],
12
+ options?: {
13
+ timeout?: number;
14
+ env?: Record<string, string>;
15
+ }
16
+ ): Promise<CLIResult> {
17
+ return new Promise((resolve) => {
18
+ const timeout = options?.timeout ?? 120000; // 2 minute default
19
+ const env = { ...process.env, ...options?.env };
20
+
21
+ // Add --output json flag if not already present and command supports it
22
+ const jsonCommands = [
23
+ "account",
24
+ "resource",
25
+ "iam",
26
+ "catalog",
27
+ "target",
28
+ "regions",
29
+ "api",
30
+ ];
31
+ const shouldAddJson =
32
+ args.length > 0 &&
33
+ jsonCommands.some((cmd) => args[0] === cmd) &&
34
+ !args.includes("--output") &&
35
+ !args.includes("-o");
36
+
37
+ const finalArgs = shouldAddJson ? [...args, "--output", "json"] : args;
38
+
39
+ const child = spawn("ibmcloud", finalArgs, {
40
+ env,
41
+ shell: true,
42
+ });
43
+
44
+ let stdout = "";
45
+ let stderr = "";
46
+
47
+ child.stdout.on("data", (data) => {
48
+ stdout += data.toString();
49
+ });
50
+
51
+ child.stderr.on("data", (data) => {
52
+ stderr += data.toString();
53
+ });
54
+
55
+ const timer = setTimeout(() => {
56
+ child.kill("SIGTERM");
57
+ resolve({
58
+ success: false,
59
+ stdout,
60
+ stderr: stderr + "\nCommand timed out",
61
+ exitCode: -1,
62
+ });
63
+ }, timeout);
64
+
65
+ child.on("close", (code) => {
66
+ clearTimeout(timer);
67
+ resolve({
68
+ success: code === 0,
69
+ stdout: stdout.trim(),
70
+ stderr: stderr.trim(),
71
+ exitCode: code ?? -1,
72
+ });
73
+ });
74
+
75
+ child.on("error", (err) => {
76
+ clearTimeout(timer);
77
+ resolve({
78
+ success: false,
79
+ stdout: "",
80
+ stderr: err.message,
81
+ exitCode: -1,
82
+ });
83
+ });
84
+ });
85
+ }
86
+
87
+ export function formatResult(result: CLIResult): string {
88
+ if (result.success) {
89
+ return result.stdout || "Command completed successfully";
90
+ } else {
91
+ let output = "";
92
+ if (result.stdout) {
93
+ output += result.stdout + "\n";
94
+ }
95
+ if (result.stderr) {
96
+ output += `Error: ${result.stderr}`;
97
+ }
98
+ if (!output) {
99
+ output = `Command failed with exit code ${result.exitCode}`;
100
+ }
101
+ return output;
102
+ }
103
+ }