ibmz-mcp-server 1.0.1

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 ADDED
@@ -0,0 +1,212 @@
1
+ # IBM Z MCP Server
2
+
3
+ MCP server for IBM Z mainframe integration with Claude Code. Provides access to enterprise-grade security and mainframe capabilities.
4
+
5
+ ## Features
6
+
7
+ - **Key Protect** - HSM-backed key management (FIPS 140-2 Level 3)
8
+ - **z/OS Connect** - REST APIs to mainframe programs (CICS, IMS, batch)
9
+
10
+ ## Available Tools
11
+
12
+ ### Key Protect (HSM Key Management)
13
+
14
+ | Tool | Description |
15
+ |------|-------------|
16
+ | `key_protect_list_keys` | List encryption keys in Key Protect |
17
+ | `key_protect_create_key` | Create root or standard keys |
18
+ | `key_protect_get_key` | Get key details and metadata |
19
+ | `key_protect_wrap_key` | Wrap (encrypt) DEKs with a root key |
20
+ | `key_protect_unwrap_key` | Unwrap (decrypt) wrapped DEKs |
21
+ | `key_protect_rotate_key` | Rotate a root key |
22
+ | `key_protect_delete_key` | Delete a key (irreversible) |
23
+ | `key_protect_get_key_policies` | Get key policies |
24
+
25
+ ### z/OS Connect (Mainframe Integration)
26
+
27
+ | Tool | Description |
28
+ |------|-------------|
29
+ | `zos_connect_list_services` | List available mainframe services |
30
+ | `zos_connect_get_service` | Get service details and OpenAPI spec |
31
+ | `zos_connect_call_service` | Call a mainframe service via REST |
32
+ | `zos_connect_list_apis` | List API requester configurations |
33
+ | `zos_connect_health` | Check z/OS Connect server health |
34
+
35
+ ## Setup
36
+
37
+ ### 1. Install Dependencies
38
+
39
+ ```bash
40
+ cd ~/ibmz-mcp-server
41
+ npm install
42
+ ```
43
+
44
+ ### 2. Configure Environment
45
+
46
+ **For Key Protect:**
47
+ ```bash
48
+ IBM_CLOUD_API_KEY=your-ibm-cloud-api-key
49
+ KEY_PROTECT_INSTANCE_ID=your-key-protect-instance-id
50
+ KEY_PROTECT_URL=https://us-south.kms.cloud.ibm.com
51
+ ```
52
+
53
+ **For z/OS Connect (requires mainframe access):**
54
+ ```bash
55
+ ZOS_CONNECT_URL=https://your-mainframe:9443/zosConnect
56
+ ZOS_CONNECT_USERNAME=your-username
57
+ ZOS_CONNECT_PASSWORD=your-password
58
+ ```
59
+
60
+ ### 3. Add to Claude Code
61
+
62
+ Add to `~/.claude.json`:
63
+
64
+ ```json
65
+ {
66
+ "mcpServers": {
67
+ "ibmz": {
68
+ "type": "stdio",
69
+ "command": "node",
70
+ "args": ["/Users/matthewkarsten/ibmz-mcp-server/index.js"],
71
+ "env": {
72
+ "IBM_CLOUD_API_KEY": "your-api-key",
73
+ "KEY_PROTECT_INSTANCE_ID": "your-instance-id"
74
+ }
75
+ }
76
+ }
77
+ }
78
+ ```
79
+
80
+ ## Architecture
81
+
82
+ ```
83
+ Claude Code (Opus 4.5)
84
+
85
+ └──▶ IBM Z MCP Server
86
+
87
+ ├──▶ Key Protect (HSM)
88
+ │ │
89
+ │ └── FIPS 140-2 Level 3 HSM
90
+
91
+ └──▶ z/OS Connect
92
+
93
+ ├── CICS Transactions
94
+ ├── IMS Programs
95
+ └── Batch Jobs
96
+ ```
97
+
98
+ ## Key Concepts
99
+
100
+ ### Envelope Encryption with Key Protect
101
+
102
+ Key Protect enables envelope encryption:
103
+
104
+ 1. **Root Keys (KEK)** - Stored in HSM, never leave the hardware
105
+ 2. **Data Encryption Keys (DEK)** - Wrapped by root keys
106
+ 3. **Wrap/Unwrap** - Operations to protect DEKs
107
+
108
+ ```
109
+ Data → Encrypt with DEK → Ciphertext
110
+ DEK → Wrap with KEK → Wrapped DEK (stored alongside ciphertext)
111
+ ```
112
+
113
+ ### z/OS Connect Integration
114
+
115
+ z/OS Connect provides REST APIs to mainframe programs:
116
+
117
+ - **CICS** - Online transaction processing
118
+ - **IMS** - Hierarchical database and transactions
119
+ - **Batch** - Scheduled batch processing
120
+ - **Db2** - Relational database access
121
+
122
+ JSON payloads are automatically mapped to COBOL copybooks.
123
+
124
+ ## Use Cases
125
+
126
+ ### Enterprise Key Management
127
+ - Manage encryption keys for cloud workloads
128
+ - Bring Your Own Key (BYOK) to IBM Cloud services
129
+ - Key rotation for compliance
130
+ - Envelope encryption for data at rest
131
+
132
+ ### Mainframe Modernization
133
+ - Expose COBOL programs as REST APIs
134
+ - Integrate mainframe data with cloud applications
135
+ - AI-powered mainframe operations via Claude
136
+ - Modernize without rewriting legacy code
137
+
138
+ ## IBM Cloud Resources
139
+
140
+ This MCP server can use:
141
+ - **Service**: Key Protect
142
+ - **Plan**: Tiered (first 20 keys free)
143
+ - **Region**: us-south
144
+
145
+ For z/OS Connect, you need:
146
+ - IBM mainframe with z/OS
147
+ - z/OS Connect EE installed
148
+ - Network access from your machine
149
+
150
+ ## Demo Scripts
151
+
152
+ Run these demos to test the integration:
153
+
154
+ ```bash
155
+ # Set environment
156
+ export IBM_CLOUD_API_KEY="your-key"
157
+ export KEY_PROTECT_INSTANCE_ID="your-instance-id"
158
+
159
+ # Full 5-service pipeline (NLU → watsonx → Key Protect → Cloudant → TTS)
160
+ node demo-full-stack.js
161
+
162
+ # End-to-end workflow (NLU → Key Protect → Cloudant)
163
+ node demo-e2e-workflow.js
164
+
165
+ # Test envelope encryption (HSM wrap/unwrap)
166
+ node test-envelope-encryption.js
167
+
168
+ # Watson services suite test
169
+ node demo-watson-suite.js
170
+ ```
171
+
172
+ ### Integration Status (Verified Dec 15, 2025)
173
+
174
+ | Service | Feature | Status |
175
+ |---------|---------|--------|
176
+ | Key Protect | List Keys | ✅ Working |
177
+ | Key Protect | Create Key | ✅ Working |
178
+ | Key Protect | Wrap DEK | ✅ Working |
179
+ | Key Protect | Unwrap DEK | ✅ Working |
180
+ | Key Protect | Rotate Key | ✅ Working |
181
+ | watsonx.ai | List Models | ✅ Working |
182
+ | Watson NLU | Sentiment/Entities | ✅ Working |
183
+ | Watson TTS | Voice Synthesis | ✅ Working |
184
+ | Cloudant | Document Storage | ✅ Working |
185
+
186
+ ## Files
187
+
188
+ ```
189
+ ibmz-mcp-server/
190
+ ├── index.js # MCP server implementation
191
+ ├── package.json # Dependencies
192
+ ├── docs/ # GitHub Pages documentation
193
+ │ ├── index.html # Main documentation
194
+ │ └── specs.html # Technical specifications
195
+ ├── demo-full-stack.js # Full 5-service pipeline
196
+ ├── demo-e2e-workflow.js # NLU → Key Protect → Cloudant
197
+ ├── demo-watson-suite.js # All Watson services test
198
+ ├── test-envelope-encryption.js # HSM wrap/unwrap test
199
+ └── README.md # This file
200
+ ```
201
+
202
+ ## Related MCP Servers
203
+
204
+ - [watsonx-mcp-server](https://github.com/PurpleSquirrelMedia/watsonx-mcp-server) - Foundation models (Granite, Llama, Mistral)
205
+
206
+ ## Author
207
+
208
+ Matthew Karsten
209
+
210
+ ## License
211
+
212
+ MIT
@@ -0,0 +1,241 @@
1
+ # Troubleshooting Guide
2
+
3
+ Common issues and solutions for the IBM Z MCP Server.
4
+
5
+ ## Key Protect Issues
6
+
7
+ ### `401 Unauthorized`
8
+
9
+ **Cause**: Invalid or expired IBM Cloud API key.
10
+
11
+ **Solutions**:
12
+ 1. Generate a new API key in IBM Cloud console
13
+ 2. Verify key has Key Protect service access
14
+ 3. Check IAM permissions include "Key Protect Reader" or higher
15
+
16
+ ### `403 Forbidden - Insufficient permissions`
17
+
18
+ **Cause**: API key lacks required Key Protect permissions.
19
+
20
+ **Solutions**:
21
+ 1. In IBM Cloud IAM, assign one of these roles:
22
+ - **Reader**: List and view keys
23
+ - **Writer**: Create, wrap, unwrap keys
24
+ - **Manager**: Full access including delete and rotate
25
+ 2. Wait 5 minutes for IAM changes to propagate
26
+
27
+ ### `Key not found`
28
+
29
+ **Cause**: Key ID doesn't exist or wrong instance.
30
+
31
+ **Solutions**:
32
+ 1. Verify `KEY_PROTECT_INSTANCE_ID` is correct
33
+ 2. Use `key_protect_list_keys` to see available keys
34
+ 3. Check you're using the key ID, not the key name
35
+
36
+ ### `Instance not found`
37
+
38
+ **Cause**: Invalid Key Protect instance ID.
39
+
40
+ **Solution**:
41
+ 1. Go to IBM Cloud > Resource List > Key Protect
42
+ 2. Click your instance
43
+ 3. Copy the GUID from the URL: `https://cloud.ibm.com/services/kms/KEY_PROTECT_INSTANCE_ID`
44
+
45
+ ### `Wrap/Unwrap failed`
46
+
47
+ **Cause**: Using wrong key type or invalid ciphertext.
48
+
49
+ **Solutions**:
50
+ 1. Only **root keys** can wrap/unwrap (not standard keys)
51
+ 2. For unwrap, use the exact ciphertext returned by wrap
52
+ 3. Check key hasn't been rotated (re-wrap with new version)
53
+
54
+ ### `Key rotation failed`
55
+
56
+ **Cause**: Can't rotate standard keys or key is disabled.
57
+
58
+ **Solutions**:
59
+ 1. Only root keys support rotation
60
+ 2. Check key state is "Active"
61
+ 3. Verify Manager role permissions
62
+
63
+ ## z/OS Connect Issues
64
+
65
+ ### `Connection refused`
66
+
67
+ **Cause**: z/OS Connect server not reachable.
68
+
69
+ **Solutions**:
70
+ 1. Verify `ZOS_CONNECT_URL` format: `https://host:port/zosConnect`
71
+ 2. Check firewall allows connection to mainframe
72
+ 3. Confirm z/OS Connect EE is running:
73
+ ```bash
74
+ # On z/OS
75
+ /D A,ZCON*
76
+ ```
77
+ 4. Test with curl:
78
+ ```bash
79
+ curl -k -u user:pass https://your-mainframe:9443/zosConnect/services
80
+ ```
81
+
82
+ ### `401 Unauthorized` (z/OS)
83
+
84
+ **Cause**: Invalid mainframe credentials.
85
+
86
+ **Solutions**:
87
+ 1. Verify `ZOS_CONNECT_USERNAME` and `ZOS_CONNECT_PASSWORD`
88
+ 2. Check RACF/ACF2/TSS password hasn't expired
89
+ 3. Ensure user ID has access to z/OS Connect resources
90
+
91
+ ### `Service not found`
92
+
93
+ **Cause**: Service not deployed or wrong name.
94
+
95
+ **Solutions**:
96
+ 1. Use `zos_connect_list_services` to see available services
97
+ 2. Check service is deployed in z/OS Connect
98
+ 3. Service names are case-sensitive
99
+
100
+ ### `500 Internal Server Error`
101
+
102
+ **Cause**: Mainframe program failed.
103
+
104
+ **Solutions**:
105
+ 1. Check z/OS Connect server logs
106
+ 2. Verify CICS region/IMS system is active
107
+ 3. Review COBOL program for ABEND codes
108
+ 4. Check input data matches copybook format
109
+
110
+ ### `CICS transaction failed`
111
+
112
+ **Cause**: Transaction abend or timeout.
113
+
114
+ **Solutions**:
115
+ 1. Check CICS logs for abend code (e.g., ASRA, AICA)
116
+ 2. Increase transaction timeout if needed
117
+ 3. Verify CICS region resources (files, queues)
118
+ 4. Check transaction is installed and enabled
119
+
120
+ ### `JSON mapping error`
121
+
122
+ **Cause**: JSON doesn't match COBOL copybook.
123
+
124
+ **Solutions**:
125
+ 1. Review the service's OpenAPI specification
126
+ 2. Match field names exactly (case-sensitive)
127
+ 3. Use correct data types (string for PIC X, number for PIC 9)
128
+ 4. Check field lengths don't exceed copybook definitions
129
+
130
+ ## Configuration Issues
131
+
132
+ ### `Missing environment variable`
133
+
134
+ **Cause**: Required env var not set.
135
+
136
+ **Required for Key Protect**:
137
+ ```bash
138
+ export IBM_CLOUD_API_KEY="your-key"
139
+ export KEY_PROTECT_INSTANCE_ID="your-instance-id"
140
+ export KEY_PROTECT_URL="https://us-south.kms.cloud.ibm.com"
141
+ ```
142
+
143
+ **Required for z/OS Connect**:
144
+ ```bash
145
+ export ZOS_CONNECT_URL="https://host:port/zosConnect"
146
+ export ZOS_CONNECT_USERNAME="user"
147
+ export ZOS_CONNECT_PASSWORD="password"
148
+ ```
149
+
150
+ ### `Invalid region URL`
151
+
152
+ **Key Protect regions**:
153
+ ```bash
154
+ # US South (Dallas)
155
+ KEY_PROTECT_URL=https://us-south.kms.cloud.ibm.com
156
+
157
+ # US East (Washington DC)
158
+ KEY_PROTECT_URL=https://us-east.kms.cloud.ibm.com
159
+
160
+ # EU Germany (Frankfurt)
161
+ KEY_PROTECT_URL=https://eu-de.kms.cloud.ibm.com
162
+
163
+ # EU Great Britain (London)
164
+ KEY_PROTECT_URL=https://eu-gb.kms.cloud.ibm.com
165
+
166
+ # Asia Pacific (Tokyo)
167
+ KEY_PROTECT_URL=https://jp-tok.kms.cloud.ibm.com
168
+
169
+ # Asia Pacific (Sydney)
170
+ KEY_PROTECT_URL=https://au-syd.kms.cloud.ibm.com
171
+ ```
172
+
173
+ ## MCP Server Issues
174
+
175
+ ### Server not appearing in Claude Code
176
+
177
+ **Solutions**:
178
+ 1. Verify `~/.claude.json` syntax is valid JSON
179
+ 2. Check path to `index.js` is correct
180
+ 3. Restart Claude Code after config changes
181
+ 4. Test server directly: `node /path/to/index.js`
182
+
183
+ ### `Cannot find module` errors
184
+
185
+ **Solution**:
186
+ ```bash
187
+ cd ~/ibmz-mcp-server
188
+ npm install
189
+ ```
190
+
191
+ ### SSL certificate errors
192
+
193
+ **Cause**: Self-signed cert on z/OS Connect.
194
+
195
+ **Solutions**:
196
+ 1. Add CA certificate to Node.js:
197
+ ```bash
198
+ export NODE_EXTRA_CA_CERTS=/path/to/cert.pem
199
+ ```
200
+ 2. Or disable verification (development only):
201
+ ```bash
202
+ export NODE_TLS_REJECT_UNAUTHORIZED=0
203
+ ```
204
+
205
+ ## Debugging
206
+
207
+ ### Enable verbose logging
208
+
209
+ ```bash
210
+ # Run server directly to see errors
211
+ DEBUG=* node /path/to/ibmz-mcp-server/index.js
212
+ ```
213
+
214
+ ### Test Key Protect connection
215
+
216
+ ```bash
217
+ # Get IAM token
218
+ TOKEN=$(curl -s -X POST "https://iam.cloud.ibm.com/identity/token" \
219
+ -H "Content-Type: application/x-www-form-urlencoded" \
220
+ -d "grant_type=urn:ibm:params:oauth:grant-type:apikey&apikey=$IBM_CLOUD_API_KEY" \
221
+ | jq -r '.access_token')
222
+
223
+ # List keys
224
+ curl -s "https://us-south.kms.cloud.ibm.com/api/v2/keys" \
225
+ -H "Authorization: Bearer $TOKEN" \
226
+ -H "Bluemix-Instance: $KEY_PROTECT_INSTANCE_ID"
227
+ ```
228
+
229
+ ### Test z/OS Connect
230
+
231
+ ```bash
232
+ curl -k -u $ZOS_CONNECT_USERNAME:$ZOS_CONNECT_PASSWORD \
233
+ "$ZOS_CONNECT_URL/services"
234
+ ```
235
+
236
+ ## Getting Help
237
+
238
+ - [Key Protect Documentation](https://cloud.ibm.com/docs/key-protect)
239
+ - [z/OS Connect Documentation](https://www.ibm.com/docs/en/zosconnect)
240
+ - [IBM Cloud Status](https://cloud.ibm.com/status)
241
+ - [GitHub Issues](https://github.com/PurpleSquirrelMedia/ibmz-mcp-server/issues)