maximo-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/.env.example ADDED
@@ -0,0 +1,14 @@
1
+ # Maximo MCP Server Environment Variables
2
+ # Copy this file to .env and fill in your values
3
+ # NEVER commit the .env file to version control!
4
+
5
+ # Maximo API Configuration
6
+ MAXIMO_URL=https://your-maximo-host.com/maximo/api
7
+ MAXIMO_HOST=https://your-maximo-host.com
8
+ MAXIMO_API_KEY=your-api-key-here
9
+
10
+ # Optional: Path to local OpenAPI schema
11
+ MAXIMO_OPENAPI_PATH=./maximo_openapi.json
12
+
13
+ # Server Configuration
14
+ PORT=3002
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative
95
+ Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Markus van Kempen
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,336 @@
1
+ <div align="center">
2
+
3
+ # 🏭 Maximo MCP Server
4
+
5
+ ### AI-Powered Development for IBM Maximo
6
+
7
+ [![Node.js](https://img.shields.io/badge/Node.js-18+-339933?style=for-the-badge&logo=node.js&logoColor=white)](https://nodejs.org/)
8
+ [![MCP](https://img.shields.io/badge/MCP-Protocol-5A29E4?style=for-the-badge)](https://modelcontextprotocol.io/)
9
+ [![Maximo](https://img.shields.io/badge/IBM-Maximo-052FAD?style=for-the-badge&logo=ibm&logoColor=white)](https://www.ibm.com/products/maximo)
10
+ [![License](https://img.shields.io/badge/License-MIT-green?style=for-the-badge)](LICENSE)
11
+ [![Version](https://img.shields.io/badge/Version-v1.0.0-blue?style=for-the-badge)](package.json)
12
+
13
+ *Transform your Maximo development workflow with AI-driven schema discovery, live data querying, and intelligent code generation.*
14
+
15
+ **Author:** Markus van Kempen
16
+ **Email:** mvankempen@ca.ibm.com | markus.van.kempen@gmail.com
17
+ **Date:** 3 February 2026
18
+
19
+ [Getting Started](#-quick-start) • [Documentation](#-documentation) • [Live Demo](#-live-demo) • [Use Cases](#-use-cases)
20
+
21
+ </div>
22
+
23
+ ---
24
+
25
+ ## 🎯 What is This?
26
+
27
+ The **Maximo MCP Server** is a [Model Context Protocol](https://modelcontextprotocol.io/) server that connects AI assistants (like Antigravity, Cursor, or VS Code Copilot) directly to your IBM Maximo environment. Instead of manually copying API documentation, the AI can:
28
+
29
+ | Capability | Description |
30
+ |------------|-------------|
31
+ | 🔍 **Discover APIs** | Find available Object Structures (MXWO, MXASSET, etc.) |
32
+ | 📋 **Inspect Schemas** | Get exact field names, types, and descriptions |
33
+ | 📊 **Query Live Data** | Execute OSLC REST queries and see real results |
34
+ | 🎨 **Generate UI** | Create Carbon Design System tables and dashboards |
35
+ | ✅ **Validate Instantly** | Test queries before generating final code |
36
+
37
+ ---
38
+
39
+ ## 📚 Documentation
40
+
41
+ ### Core Guides
42
+
43
+ | Document | Description |
44
+ |----------|-------------|
45
+ | 📖 [**Maximo MCP Server Guide**](docs/Maximo_MCP_Server_Guide.md) | Complete setup, configuration, and tool reference |
46
+ | 🔌 [**Maximo API Interaction Guide**](docs/Maximo_API_Interaction_Guide.md) | OSLC query syntax, code generation patterns, troubleshooting |
47
+ | 🎬 [**Asset Manager Case Study**](docs/Asset_Manager_App_Case_Study.md) | Step-by-step walkthrough of building a complete app |
48
+
49
+ ### French Translations
50
+
51
+ | Document | Description |
52
+ |----------|-------------|
53
+ | 📖 [Guide du Serveur MCP Maximo](docs/Maximo_MCP_Server_Guide_FR.md) | Version française du guide complet |
54
+ | 🔌 [Guide d'Interaction API Maximo](docs/Maximo_API_Interaction_Guide_FR.md) | Version française du guide API |
55
+
56
+ ### Word Documents
57
+
58
+ All guides are also available in `.docx` format in the `docs/` folder for offline reading and sharing.
59
+
60
+ ---
61
+
62
+ ## ⚡ Quick Start
63
+
64
+ ### Prerequisites
65
+
66
+ - **Node.js** v18 or higher
67
+ - **Maximo API Key** with read access
68
+ - AI IDE with MCP support (Antigravity, Cursor, VS Code + Continue)
69
+
70
+ ### Installation
71
+
72
+ ```bash
73
+ # Clone the repository
74
+ git clone https://github.com/your-org/Maximo-MCP-EDF.git
75
+ cd Maximo-MCP-EDF
76
+
77
+ # Install dependencies
78
+ npm install
79
+
80
+ # Set up environment variables
81
+ cp .env.example .env
82
+ # Edit .env with your Maximo credentials
83
+ ```
84
+
85
+ ### Environment Configuration
86
+
87
+ Edit the `.env` file with your Maximo credentials:
88
+
89
+ ```bash
90
+ # .env (never commit this file!)
91
+ MAXIMO_URL=https://your-maximo-host.com/maximo/api
92
+ MAXIMO_HOST=https://your-maximo-host.com
93
+ MAXIMO_API_KEY=your-api-key-here
94
+ MAXIMO_OPENAPI_PATH=./maximo_openapi.json
95
+ PORT=3002
96
+ ```
97
+
98
+ ### Download the OpenAPI Schema (Recommended)
99
+
100
+ The OpenAPI schema file enables offline schema lookups for faster AI responses:
101
+
102
+ ```bash
103
+ # Download from your Maximo instance
104
+ curl -X GET "https://your-maximo-host.com/maximo/oslc/oas/api" \
105
+ -H "apikey:your-api-key-here" \
106
+ -o maximo_openapi.json
107
+ ```
108
+
109
+ Alternatively, download via Swagger UI at: `https://your-host/maximo/oslc/oas/api.html`
110
+
111
+ > **Note**: This file is ~12MB and contains all Object Structure definitions for your Maximo instance.
112
+
113
+ ### IDE Configuration
114
+
115
+ Copy and configure the MCP settings for your IDE:
116
+
117
+ **For Cursor:**
118
+ ```bash
119
+ cp config/mcp_config.json.example ~/.cursor/mcp.json
120
+ ```
121
+
122
+ **For Antigravity:**
123
+ ```bash
124
+ mkdir -p .gemini && cp config/mcp_config.json.example .gemini/settings.json
125
+ ```
126
+
127
+ Edit the config file and update the path to `maximo-mcp-server.js`:
128
+
129
+ ```json
130
+ {
131
+ "mcpServers": {
132
+ "maximo": {
133
+ "command": "node",
134
+ "args": ["/absolute/path/to/maximo-mcp-server.js"],
135
+ "env": {
136
+ "MAXIMO_URL": "https://your-maximo-host/maximo/api",
137
+ "MAXIMO_API_KEY": "your-api-key-here"
138
+ }
139
+ }
140
+ }
141
+ }
142
+ ```
143
+
144
+ ### Verify Connection
145
+
146
+ In your AI IDE, ask:
147
+ > "Is the Maximo MCP server connected?"
148
+
149
+ The AI will call `get_instance_details` and confirm connectivity.
150
+
151
+ ---
152
+
153
+ ## 🎬 Live Demo
154
+
155
+ ### Asset Manager Application
156
+
157
+ We built a complete **Maximo Asset Manager** web application using only natural language prompts and the MCP server.
158
+
159
+ <div align="center">
160
+
161
+ ![Asset Manager Dashboard](images/assets_loaded.png)
162
+
163
+ *50 assets loaded with real-time filtering and search*
164
+
165
+ </div>
166
+
167
+ #### Demo Features
168
+
169
+ | Feature | Screenshot |
170
+ |---------|------------|
171
+ | **Full Dashboard** | 50 assets, 4 stat cards, 3 sites |
172
+ | **Search Filter** | ![Pump Search](images/pump_search_results.png) |
173
+ | **Site Filter** | ![LAREDO Filter](images/laredo_filtered.png) |
174
+
175
+ #### 🎥 Screen Recording
176
+
177
+ A complete video demonstration is available: [`assets_demo_recording.webp`](images/assets_demo_recording.webp)
178
+
179
+ #### Try It Yourself
180
+
181
+ ```bash
182
+ # Start the local proxy server
183
+ node server.js
184
+
185
+ # Open in browser
186
+ open http://localhost:3002/demos/assets.html
187
+ ```
188
+
189
+ ---
190
+
191
+ ## 🛠 Available MCP Tools
192
+
193
+ The server exposes 6 tools to the AI:
194
+
195
+ ![MCP Tools UI](images/mcp_tools_ui.png)
196
+
197
+ | Tool Name | Description |
198
+ | :--- | :--- |
199
+ | `list_object_structures` | List available Maximo Object Structures (APIs) |
200
+ | `get_schema_details` | Get field definitions for an Object Structure |
201
+ | `query_maximo` | Execute OSLC REST queries |
202
+ | `render_carbon_table` | Generate Carbon Design HTML tables |
203
+ | `render_carbon_details` | Generate detail view for a record |
204
+ | `get_instance_details` | Check server connectivity |
205
+
206
+ ---
207
+
208
+ ## 💡 Use Cases
209
+
210
+ ### 1. Generate API Calls
211
+ > "Get me the last 10 approved work orders from BEDFORD site"
212
+
213
+ The AI calls `get_schema_details(MXWO)`, understands the fields, and generates:
214
+
215
+ ```http
216
+ GET /maximo/api/os/mxwo
217
+ ?oslc.where=status="APPR" and siteid="BEDFORD"
218
+ &oslc.select=wonum,description,status,reportdate
219
+ &oslc.orderBy=-reportdate
220
+ &oslc.pageSize=10
221
+ &lean=1
222
+ ```
223
+
224
+ ### 2. Generate Python Scripts
225
+ > "Write a Python script to export all Priority 1 work orders to CSV"
226
+
227
+ ```python
228
+ import requests
229
+ import csv
230
+
231
+ response = requests.get(
232
+ "https://your-host/maximo/api/os/mxwo",
233
+ params={"oslc.where": "wopriority=1", "lean": 1},
234
+ headers={"apikey": "YOUR_KEY"}
235
+ )
236
+
237
+ with open("priority1_workorders.csv", "w") as f:
238
+ writer = csv.DictWriter(f, fieldnames=["wonum", "description"])
239
+ writer.writeheader()
240
+ writer.writerows(response.json()["member"])
241
+ ```
242
+
243
+ ### 3. Generate SQL Queries
244
+ > "Write SQL to find overdue work orders"
245
+
246
+ ```sql
247
+ SELECT wonum, description, status, targcompdate
248
+ FROM workorder
249
+ WHERE status NOT IN ('COMP', 'CLOSE', 'CAN')
250
+ AND targcompdate < CURRENT_DATE;
251
+ ```
252
+
253
+ ### 4. Build Complete Applications
254
+ > "Create an HTML dashboard to display assets"
255
+
256
+ **Result:** A complete web application with:
257
+ - Dark theme with glassmorphism
258
+ - Search and filter functionality
259
+ - Interactive detail panels
260
+ - Pre-loaded data from Maximo
261
+
262
+ See the [Asset Manager Case Study](docs/Asset_Manager_App_Case_Study.md) for the full walkthrough.
263
+
264
+ ---
265
+
266
+ ## 📁 Project Structure
267
+
268
+ ```
269
+ Maximo-MCP-EDF/
270
+ ├── maximo-mcp-server.js # 🔌 MCP Server implementation
271
+ ├── server.js # 🌐 Local proxy server for CORS
272
+ ├── package.json # 📦 Dependencies
273
+ ├── README.md # This file
274
+ ├── .env.example # Environment template
275
+ ├── .gitignore # Git ignore rules
276
+
277
+ ├── docs/ # 📚 Documentation
278
+ │ ├── Maximo_MCP_Server_Guide.md # Complete MCP guide
279
+ │ ├── Maximo_API_Interaction_Guide.md # API interaction patterns
280
+ │ ├── Asset_Manager_App_Case_Study.md # Build walkthrough
281
+ │ ├── Maximo_MCP_Server_Guide_FR.md # French translation
282
+ │ └── Maximo_API_Interaction_Guide_FR.md # French translation
283
+
284
+ ├── demos/ # 🎨 Demo Applications
285
+ │ ├── assets.html # Asset Manager app
286
+ │ ├── carbon_workorders.html # Carbon table demo
287
+ │ └── index.html # API visualization demo
288
+
289
+ ├── images/ # 📸 Screenshots & Recordings
290
+ │ ├── assets_demo_recording.webp # Full demo recording
291
+ │ ├── assets_loaded.png # Dashboard screenshot
292
+ │ ├── pump_search_results.png # Search demo
293
+ │ └── laredo_filtered.png # Filter demo
294
+
295
+ └── config/ # ⚙️ Configuration Templates
296
+ └── mcp_config.json.example # MCP config template
297
+ ```
298
+
299
+ ---
300
+
301
+ ## 🔒 Security Best Practices
302
+
303
+ | Practice | Description |
304
+ |----------|-------------|
305
+ | 🔐 **Local Execution** | MCP server runs on your machine; API keys never leave your environment |
306
+ | 📖 **Read-Only Keys** | Use limited-permission API keys for development |
307
+ | 🔒 **Environment Variables** | Never hardcode credentials in config files |
308
+ | 🌐 **HTTPS Only** | Always use encrypted connections to Maximo |
309
+
310
+ ---
311
+
312
+ ## 🤝 Contributing
313
+
314
+ Contributions are welcome! Please read our contributing guidelines before submitting PRs.
315
+
316
+ 1. Fork the repository
317
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
318
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
319
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
320
+ 5. Open a Pull Request
321
+
322
+ ---
323
+
324
+ ## 📄 License
325
+
326
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
327
+
328
+ ---
329
+
330
+ ## 🙏 Acknowledgments
331
+
332
+ - [Model Context Protocol](https://modelcontextprotocol.io/) for the MCP specification
333
+ - [IBM Maximo](https://www.ibm.com/products/maximo) for the enterprise asset management platform
334
+ - [Carbon Design System](https://carbondesignsystem.com/) for the UI components
335
+
336
+
@@ -0,0 +1,591 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Maximo MCP Server
5
+ *
6
+ * Author: Markus van Kempen
7
+ * Date: 3 Feb 2026
8
+ *
9
+ * This server exposes tools to interact with an IBM Maximo instance via the Model Context Protocol.
10
+ * Capabilities:
11
+ * 1. Introspect Schema: Read the local OpenApi definition to understand available Object Structures.
12
+ * 2. Query Data: Fetch data from Maximo using OSLC/REST APIs.
13
+ */
14
+
15
+ // Load environment variables from .env file
16
+ require('dotenv').config();
17
+
18
+ const { Server } = require("@modelcontextprotocol/sdk/server/index.js");
19
+ const { StdioServerTransport } = require("@modelcontextprotocol/sdk/server/stdio.js");
20
+ const {
21
+ CallToolRequestSchema,
22
+ ListToolsRequestSchema,
23
+ } = require("@modelcontextprotocol/sdk/types.js");
24
+ const { z } = require("zod");
25
+ const fs = require('fs');
26
+ const path = require('path');
27
+
28
+ // --- Configuration (loaded from environment variables) ---
29
+ const MAXIMO_URL = process.env.MAXIMO_URL;
30
+ const API_KEY = process.env.MAXIMO_API_KEY;
31
+ const OPENAPI_FILE = process.env.MAXIMO_OPENAPI_PATH || path.join(__dirname, 'maximo_openapi.json');
32
+
33
+ // Validate required environment variables
34
+ if (!MAXIMO_URL || !API_KEY) {
35
+ console.error("ERROR: Missing required environment variables.");
36
+ console.error("Please set MAXIMO_URL and MAXIMO_API_KEY in your .env file or MCP config.");
37
+ console.error("See .env.example for reference.");
38
+ }
39
+
40
+
41
+ // --- State ---
42
+ let openApiSpec = null;
43
+
44
+ // --- Load Schema ---
45
+ try {
46
+ if (fs.existsSync(OPENAPI_FILE)) {
47
+ console.error(`Loading OpenAPI spec from ${OPENAPI_FILE}...`);
48
+ const raw = fs.readFileSync(OPENAPI_FILE, 'utf-8');
49
+ openApiSpec = JSON.parse(raw);
50
+ console.error(`Loaded OpenAPI spec. Components: ${Object.keys(openApiSpec.components?.schemas || {}).length}`);
51
+ } else {
52
+ console.error("Warning: maximo_openapi.json not found. Schema introspection will be limited.");
53
+ }
54
+ } catch (e) {
55
+ console.error("Error loading OpenAPI spec:", e);
56
+ }
57
+
58
+ // --- Server Setup ---
59
+ const server = new Server(
60
+ {
61
+ name: "maximo-mcp-server",
62
+ version: "1.0.0",
63
+ },
64
+ {
65
+ capabilities: {
66
+ tools: {},
67
+ },
68
+ }
69
+ );
70
+
71
+ // --- Tools Implementation ---
72
+
73
+ /**
74
+ * Tool: list_object_structures
75
+ * Lists available object structures from the loaded OpenAPI spec.
76
+ */
77
+ async function listObjectStructures({ filter }) {
78
+ if (!openApiSpec || !openApiSpec.components || !openApiSpec.components.schemas) {
79
+ return { content: [{ type: "text", text: "OpenAPI spec not loaded or invalid." }] };
80
+ }
81
+
82
+ const schemas = openApiSpec.components.schemas;
83
+ const results = Object.keys(schemas)
84
+ .filter(key => key.startsWith('RESOURCE_')) // Filter for Resources usually maps to OS
85
+ .map(key => {
86
+ const def = schemas[key];
87
+ return {
88
+ name: key.replace('RESOURCE_', ''),
89
+ title: def.title || key,
90
+ description: def.description || ''
91
+ };
92
+ })
93
+ .filter(item => !filter || item.name.toLowerCase().includes(filter.toLowerCase()) || item.description.toLowerCase().includes(filter.toLowerCase()))
94
+ .slice(0, 50); // Limit results
95
+
96
+ return {
97
+ content: [{ type: "text", text: JSON.stringify(results, null, 2) }]
98
+ };
99
+ }
100
+
101
+ /**
102
+ * Tool: get_schema_details
103
+ * Gets the property definition for a specific Object Structure
104
+ */
105
+ async function getSchemaDetails({ objectStructure }) {
106
+ if (!openApiSpec) {
107
+ return { content: [{ type: "text", text: "OpenAPI spec not loaded." }] };
108
+ }
109
+
110
+ // Maximo OpenAPI often names resource schemas as RESOURCE_{NAME}
111
+ const schemaName = `RESOURCE_${objectStructure.toUpperCase()}`;
112
+ const schema = openApiSpec.components?.schemas?.[schemaName];
113
+
114
+ if (!schema) {
115
+ return { content: [{ type: "text", text: `Schema for ${objectStructure} not found.` }] };
116
+ }
117
+
118
+ // Simplify the schema for LLM consumption
119
+ const simpleSchema = {
120
+ name: objectStructure,
121
+ description: schema.description,
122
+ properties: Object.entries(schema.properties || {}).map(([propName, propDef]) => ({
123
+ name: propName,
124
+ type: propDef.type,
125
+ title: propDef.title,
126
+ description: propDef.description,
127
+ maxLength: propDef.maxLength
128
+ }))
129
+ };
130
+
131
+ return {
132
+ content: [{ type: "text", text: JSON.stringify(simpleSchema, null, 2) }]
133
+ };
134
+ }
135
+
136
+ /**
137
+ * Tool: query_maximo
138
+ * Executes a GET request to the Maximo OSLC API
139
+ */
140
+ async function queryMaximo({ objectStructure, where, select, orderBy, pageSize = 10, formatted = true }) {
141
+ const params = new URLSearchParams({
142
+ "lean": "1",
143
+ "oslc.pageSize": pageSize.toString()
144
+ });
145
+
146
+ if (where) params.append("oslc.where", where);
147
+ if (select) params.append("oslc.select", select);
148
+ if (orderBy) params.append("oslc.orderBy", orderBy);
149
+
150
+ const url = `${MAXIMO_URL}/os/${objectStructure}?${params.toString()}`;
151
+
152
+ console.error(`Fetching: ${url}`);
153
+
154
+ try {
155
+ const response = await fetch(url, {
156
+ headers: {
157
+ "apikey": API_KEY,
158
+ "Content-Type": "application/json"
159
+ }
160
+ });
161
+
162
+ if (!response.ok) {
163
+ return {
164
+ content: [{ type: "text", text: `Error ${response.status}: ${response.statusText}` }],
165
+ isError: true
166
+ };
167
+ }
168
+
169
+ const data = await response.json();
170
+
171
+ // Extract relevant member data
172
+ const members = data.member || [];
173
+ const result = {
174
+ totalCount: data.responseInfo?.totalCount,
175
+ nextPage: data.responseInfo?.nextPage?.href,
176
+ count: members.length,
177
+ records: members
178
+ };
179
+
180
+ if (formatted) {
181
+ return await renderCarbonTable({
182
+ objectStructure,
183
+ where,
184
+ select,
185
+ orderBy,
186
+ pageSize,
187
+ title: `${objectStructure} Query Results`
188
+ });
189
+ }
190
+
191
+ return {
192
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
193
+ };
194
+
195
+ } catch (error) {
196
+ return {
197
+ content: [{ type: "text", text: `Network Error: ${error.message}` }],
198
+ isError: true
199
+ };
200
+ }
201
+ }
202
+
203
+ /**
204
+ * Tool: get_instance_details
205
+ * Introspects the system to find key details
206
+ */
207
+ async function getInstanceDetails() {
208
+ // 1. Check for latest Work Order to determine "Current Data Date"
209
+ const latestWoResult = await queryMaximo({
210
+ objectStructure: "MXWO",
211
+ select: "reportdate,wonum",
212
+ orderBy: "-reportdate",
213
+ pageSize: 1
214
+ });
215
+
216
+ let latestDate = "Unknown";
217
+ try {
218
+ const resultJson = JSON.parse(latestWoResult.content[0].text);
219
+ if (resultJson.records && resultJson.records.length > 0) {
220
+ latestDate = resultJson.records[0].reportdate;
221
+ }
222
+ } catch (e) {
223
+ // Ignore parsing error
224
+ }
225
+
226
+ const details = {
227
+ latestWorkOrderDate: latestDate,
228
+ instanceUrl: MAXIMO_URL,
229
+ timestamp: new Date().toISOString()
230
+ };
231
+
232
+ return {
233
+ content: [{ type: "text", text: JSON.stringify(details, null, 2) }]
234
+ };
235
+ }
236
+
237
+ /**
238
+ * Tool: render_carbon_table
239
+ * Generates a Carbon-styled HTML table for Maximo data
240
+ */
241
+ async function renderCarbonTable({ objectStructure, where, select, orderBy, pageSize = 10, title = "Maximo Data" }) {
242
+ // Avoid recursion if called from queryMaximo
243
+ const queryResult = await (async () => {
244
+ const params = new URLSearchParams({
245
+ "lean": "1",
246
+ "oslc.pageSize": pageSize.toString()
247
+ });
248
+ if (where) params.append("oslc.where", where);
249
+ if (select) params.append("oslc.select", select);
250
+ if (orderBy) params.append("oslc.orderBy", orderBy);
251
+ const url = `${MAXIMO_URL}/os/${objectStructure}?${params.toString()}`;
252
+ try {
253
+ const res = await fetch(url, { headers: { "apikey": API_KEY, "Content-Type": "application/json" } });
254
+ if (!res.ok) return { isError: true, content: [{ type: "text", text: `Error ${res.status}` }] };
255
+ const data = await res.json();
256
+ return { content: [{ text: JSON.stringify({ records: data.member, totalCount: data.responseInfo?.totalCount }) }] };
257
+ } catch (e) { return { isError: true, content: [{ type: "text", text: e.message }] }; }
258
+ })();
259
+
260
+ if (queryResult.isError) return queryResult;
261
+
262
+ const data = JSON.parse(queryResult.content[0].text);
263
+ const records = data.records || [];
264
+
265
+ if (records.length === 0) {
266
+ return { content: [{ type: "text", text: `<div class="bx--inline-notification bx--inline-notification--info"><div class="bx--inline-notification__details">No records found for ${objectStructure}</div></div>` }] };
267
+ }
268
+
269
+ const columns = select ? select.split(',') : Object.keys(records[0]).filter(k => !k.startsWith('_') && k !== 'href');
270
+
271
+ let html = `
272
+ <!DOCTYPE html>
273
+ <html>
274
+ <head>
275
+ <link rel="stylesheet" href="https://unpkg.com/carbon-components/css/carbon-components.min.css">
276
+ <style>
277
+ body { padding: 1rem; background: #f4f4f4; }
278
+ .container { background: white; padding: 2rem; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
279
+ .bx--search { margin-bottom: 2rem; }
280
+ .bx--table-sort { cursor: pointer; }
281
+ </style>
282
+ </head>
283
+ <body class="bx--body">
284
+ <div class="container">
285
+ <div class="bx--data-table-container">
286
+ <div class="bx--data-table-header">
287
+ <h4 class="bx--data-table-header__title">${title}</h4>
288
+ <p class="bx--data-table-header__description">Object Structure: ${objectStructure} | Total: ${data.totalCount || records.length}</p>
289
+ </div>
290
+
291
+ <div class="bx--toolbar">
292
+ <div class="bx--toolbar-content">
293
+ <div class="bx--search bx--search--sm" role="search" data-search>
294
+ <label id="search-label-1" class="bx--label" for="search-input-1">Search</label>
295
+ <input class="bx--search-input" type="text" id="table-search" role="searchbox" placeholder="Filter records..." aria-labelledby="search-label-1">
296
+ <svg focusable="false" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="bx--search-magnifier" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"><path d="M15,14.3L10.7,10c1.9-2.3,1.7-5.8-0.5-7.9C9,1,7.4,0.5,5.8,0.5S2.7,1,1.5,2.1C-0.7,4.3-0.7,7.7,1.5,9.9 c1.1,1.1,2.6,1.6,4.2,1.6c1.2,0,2.5-0.4,3.5-1.1l4.3,4.3L15,14.3z M2,9.2C0.3,7.5,0.3,4.7,2.1,3C2.9,2.1,4.2,1.6,5.5,1.6 s2.5,0.5,3.4,1.4c1.7,1.7,1.7,4.5,0,6.2c-0.9,0.9-2.1,1.4-3.4,1.4S3,10.1,2,9.2z"></path></svg>
297
+ </div>
298
+ </div>
299
+ </div>
300
+
301
+ <table class="bx--data-table bx--data-table--zebra bx--data-table--compact" id="main-table">
302
+ <thead>
303
+ <tr>
304
+ ${columns.map((col, idx) => `
305
+ <th class="bx--table-sort" onclick="sortTable(${idx})">
306
+ <span class="bx--table-header-label">${col.trim().toUpperCase()}</span>
307
+ <svg focusable="false" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="bx--table-sort__icon" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"><path d="M12.3 9.3L8.5 13.1 8.5 1 7.5 1 7.5 13.1 3.7 9.3 3 10 8 15 13 10z"></path></svg>
308
+ </th>
309
+ `).join('')}
310
+ </tr>
311
+ </thead>
312
+ <tbody id="table-body">
313
+ ${records.map(rec => `
314
+ <tr>
315
+ ${columns.map(col => {
316
+ let val = rec[col.trim()] !== undefined ? rec[col.trim()] : '--';
317
+ if (val === null) val = '--';
318
+ if (typeof val === 'object') val = JSON.stringify(val);
319
+ return `<td>${val}</td>`;
320
+ }).join('')}
321
+ </tr>
322
+ `).join('')}
323
+ </tbody>
324
+ </table>
325
+ </div>
326
+ </div>
327
+
328
+ <script>
329
+ // Filter logic
330
+ document.getElementById('table-search').addEventListener('input', function(e) {
331
+ const term = e.target.value.toLowerCase();
332
+ const rows = document.querySelectorAll('#table-body tr');
333
+ rows.forEach(row => {
334
+ const text = row.textContent.toLowerCase();
335
+ row.style.display = text.includes(term) ? '' : 'none';
336
+ });
337
+ });
338
+
339
+ // Sorting logic
340
+ let sortDir = 1;
341
+ function sortTable(n) {
342
+ const table = document.getElementById("main-table");
343
+ const tbody = document.getElementById("table-body");
344
+ const rows = Array.from(tbody.querySelectorAll("tr"));
345
+
346
+ sortDir *= -1;
347
+
348
+ const sortedRows = rows.sort((a, b) => {
349
+ const x = a.getElementsByTagName("td")[n].textContent.toLowerCase();
350
+ const y = b.getElementsByTagName("td")[n].textContent.toLowerCase();
351
+ return x.localeCompare(y, undefined, {numeric: true}) * sortDir;
352
+ });
353
+
354
+ while (tbody.firstChild) tbody.removeChild(tbody.firstChild);
355
+ tbody.append(...sortedRows);
356
+ }
357
+ </script>
358
+ </body>
359
+ </html>`;
360
+
361
+ return {
362
+ content: [{ type: "text", text: html }]
363
+ };
364
+ }
365
+
366
+ /**
367
+ * Tool: render_carbon_details
368
+ * Generates a Carbon-styled Detail view for a single Maximo record
369
+ */
370
+ async function renderCarbonDetails({ objectStructure, where }) {
371
+ const params = new URLSearchParams({ "lean": "1", "oslc.pageSize": "1" });
372
+ if (where) params.append("oslc.where", where);
373
+ const url = `${MAXIMO_URL}/os/${objectStructure}?${params.toString()}`;
374
+
375
+ let rec;
376
+ try {
377
+ const res = await fetch(url, { headers: { "apikey": API_KEY, "Content-Type": "application/json" } });
378
+ if (!res.ok) return { isError: true, content: [{ type: "text", text: `Error ${res.status}` }] };
379
+ const data = await res.json();
380
+ if (!data.member || data.member.length === 0) return { content: [{ type: "text", text: "Record not found" }] };
381
+ rec = data.member[0];
382
+ } catch (e) { return { isError: true, content: [{ type: "text", text: e.message }] }; }
383
+
384
+ const fields = Object.entries(rec).filter(([k]) => !k.startsWith('_') && k !== 'href');
385
+
386
+ let html = `
387
+ <!DOCTYPE html>
388
+ <html>
389
+ <head>
390
+ <link rel="stylesheet" href="https://unpkg.com/carbon-components/css/carbon-components.min.css">
391
+ <style>
392
+ body { padding: 2rem; background: #f4f4f4; }
393
+ .bx--tile { background: white; max-width: 800px; margin: 0 auto; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
394
+ .field-row { display: flex; border-bottom: 1px solid #e0e0e0; padding: 0.75rem 1rem; }
395
+ .field-label { font-weight: bold; width: 250px; color: #525252; text-transform: uppercase; font-size: 0.75rem; }
396
+ .field-value { flex: 1; color: #161616; }
397
+ .header { background: #161616; color: white; padding: 1rem; margin: -1rem -1rem 1rem -1rem; }
398
+ </style>
399
+ </head>
400
+ <body class="bx--body">
401
+ <div class="bx--tile">
402
+ <div style="padding:1rem">
403
+ <h3 class="bx--type-productive-heading-03" style="margin-bottom: 1.5rem;">${objectStructure} Record Details</h3>
404
+ <div class="bx--grid bx--grid--no-gutter">
405
+ ${fields.map(([k, v]) => `
406
+ <div class="field-row">
407
+ <div class="field-label">${k}</div>
408
+ <div class="field-value">${typeof v === 'object' ? JSON.stringify(v) : (v !== null ? v : '--')}</div>
409
+ </div>
410
+ `).join('')}
411
+ </div>
412
+ </div>
413
+ </div>
414
+ </body>
415
+ </html>`;
416
+
417
+ return {
418
+ content: [{ type: "text", text: html }]
419
+ };
420
+ }
421
+
422
+ // --- Protocol Handling ---
423
+
424
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
425
+ return {
426
+ tools: [
427
+ {
428
+ name: "list_object_structures",
429
+ description: "List available Maximo Object Structures (APIs) from the schema, with optional filtering.",
430
+ inputSchema: {
431
+ type: "object",
432
+ properties: {
433
+ filter: {
434
+ type: "string",
435
+ description: "Search term to filter Object Structures by name or description"
436
+ }
437
+ }
438
+ }
439
+ },
440
+ {
441
+ name: "get_schema_details",
442
+ description: "Get the detailed field definitions (properties, types) for a specific Maximo Object Structure.",
443
+ inputSchema: {
444
+ type: "object",
445
+ properties: {
446
+ objectStructure: {
447
+ type: "string",
448
+ description: "The name of the Object Structure (e.g., MXWO, MXASSET)"
449
+ }
450
+ },
451
+ required: ["objectStructure"]
452
+ }
453
+ },
454
+ {
455
+ name: "query_maximo",
456
+ description: "Query data from Maximo using the OSLC REST API.",
457
+ inputSchema: {
458
+ type: "object",
459
+ properties: {
460
+ objectStructure: {
461
+ type: "string",
462
+ description: "The Object Structure to query (e.g., mxwo, mxasset)"
463
+ },
464
+ where: {
465
+ type: "string",
466
+ description: "OSLC where clause (e.g., status=\"APPR\" and siteid=\"BEDFORD\")"
467
+ },
468
+ select: {
469
+ type: "string",
470
+ description: "Comma-separated list of fields to select (e.g., wonum,description,status)"
471
+ },
472
+ pageSize: {
473
+ type: "number",
474
+ description: "Number of records to return (default 10)",
475
+ default: 10
476
+ },
477
+ orderBy: {
478
+ type: "string",
479
+ description: "OSLC orderBy clause (e.g., -reportdate)"
480
+ },
481
+ formatted: {
482
+ type: "boolean",
483
+ description: "If true, returns a Carbon-styled HTML table instead of JSON (default: true)"
484
+ }
485
+ },
486
+ required: ["objectStructure"]
487
+ }
488
+ },
489
+ {
490
+ name: "render_carbon_table",
491
+ description: "Generates a beautiful Carbon Design System HTML table from Maximo data.",
492
+ inputSchema: {
493
+ type: "object",
494
+ properties: {
495
+ objectStructure: {
496
+ type: "string",
497
+ description: "The Object Structure to query (e.g., mxwo, mxasset)"
498
+ },
499
+ where: {
500
+ type: "string",
501
+ description: "OSLC where clause"
502
+ },
503
+ select: {
504
+ type: "string",
505
+ description: "Comma-separated list of fields (e.g., wonum,description)"
506
+ },
507
+ orderBy: {
508
+ type: "string",
509
+ description: "Sorting criteria"
510
+ },
511
+ pageSize: {
512
+ type: "number",
513
+ description: "Number of records (default 10)"
514
+ },
515
+ title: {
516
+ type: "string",
517
+ description: "Title for the table"
518
+ }
519
+ },
520
+ required: ["objectStructure"]
521
+ }
522
+ },
523
+ {
524
+ name: "render_carbon_details",
525
+ description: "Generates a beautiful Carbon Design System detail view for a specific Maximo record.",
526
+ inputSchema: {
527
+ type: "object",
528
+ properties: {
529
+ objectStructure: {
530
+ type: "string",
531
+ description: "The Object Structure (e.g., mxwo)"
532
+ },
533
+ where: {
534
+ type: "string",
535
+ description: "OSLC where clause to find the unique record (e.g., wonum=\"1001\")"
536
+ }
537
+ },
538
+ required: ["objectStructure", "where"]
539
+ }
540
+ },
541
+ {
542
+ name: "get_instance_details",
543
+ description: "Introspect the Maximo instance to get context data (e.g., latest data dates, version).",
544
+ inputSchema: {
545
+ type: "object",
546
+ properties: {},
547
+ }
548
+ }
549
+ ]
550
+ };
551
+ });
552
+
553
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
554
+ try {
555
+ const { name, arguments: args } = request.params;
556
+
557
+ switch (name) {
558
+ case "list_object_structures":
559
+ return await listObjectStructures(args);
560
+ case "get_schema_details":
561
+ return await getSchemaDetails(args);
562
+ case "query_maximo":
563
+ return await queryMaximo(args);
564
+ case "render_carbon_table":
565
+ return await renderCarbonTable(args);
566
+ case "render_carbon_details":
567
+ return await renderCarbonDetails(args);
568
+ case "get_instance_details":
569
+ return await getInstanceDetails();
570
+ default:
571
+ throw new Error(`Unknown tool: ${name}`);
572
+ }
573
+ } catch (error) {
574
+ return {
575
+ content: [{ type: "text", text: `Error: ${error.message} ` }],
576
+ isError: true
577
+ };
578
+ }
579
+ });
580
+
581
+ // Start the server
582
+ async function run() {
583
+ const transport = new StdioServerTransport();
584
+ await server.connect(transport);
585
+ console.error("Maximo MCP Server running on stdio");
586
+ }
587
+
588
+ run().catch((error) => {
589
+ console.error("Fatal error running server:", error);
590
+ process.exit(1);
591
+ });
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "maximo-mcp-server",
3
+ "version": "1.0.0",
4
+ "description": "Model Context Protocol (MCP) server for IBM Maximo",
5
+ "main": "maximo-mcp-server.js",
6
+ "bin": {
7
+ "maximo-mcp-server": "./maximo-mcp-server.js"
8
+ },
9
+ "files": [
10
+ "maximo-mcp-server.js",
11
+ "server.js",
12
+ ".env.example",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
16
+ "scripts": {
17
+ "start": "node server.js",
18
+ "mcp": "node maximo-mcp-server.js",
19
+ "test": "jest",
20
+ "lint": "eslint .",
21
+ "format": "prettier --write ."
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/markusvankempen/maximo-mcp-ai-integration-options.git"
26
+ },
27
+ "keywords": [
28
+ "mcp",
29
+ "maximo",
30
+ "ibm",
31
+ "ai",
32
+ "agent",
33
+ "llm"
34
+ ],
35
+ "author": "Markus van Kempen",
36
+ "license": "Apache-2.0",
37
+ "bugs": {
38
+ "url": "https://github.com/markusvankempen/maximo-mcp-ai-integration-options/issues"
39
+ },
40
+ "homepage": "https://github.com/markusvankempen/maximo-mcp-ai-integration-options#readme",
41
+ "dependencies": {
42
+ "@modelcontextprotocol/sdk": "^1.25.3",
43
+ "dotenv": "^17.2.3",
44
+ "express": "^4.22.1",
45
+ "http-proxy-middleware": "^2.0.9",
46
+ "zod": "^4.3.6"
47
+ },
48
+ "devDependencies": {
49
+ "eslint": "^9.39.2",
50
+ "eslint-config-prettier": "^10.1.8",
51
+ "eslint-plugin-prettier": "^5.5.5",
52
+ "jest": "^30.2.0",
53
+ "prettier": "^3.8.1",
54
+ "supertest": "^7.2.2"
55
+ }
56
+ }
package/server.js ADDED
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Maximo Proxy Server
3
+ *
4
+ * Author: Markus van Kempen
5
+ * Date: 3 Feb 2026
6
+ *
7
+ * Description: An Express.js proxy server to bypass CORS and forward requests to the Maximo API.
8
+ * It also serves the static frontend files.
9
+ */
10
+ require('dotenv').config();
11
+
12
+ const express = require('express');
13
+ const { createProxyMiddleware } = require('http-proxy-middleware');
14
+ const path = require('path');
15
+
16
+ const app = express();
17
+ const PORT = process.env.PORT || 3002;
18
+
19
+ // Configuration from environment variables
20
+ const API_TARGET = process.env.MAXIMO_HOST || 'https://your-maximo-host.com';
21
+
22
+ // Middleware to log requests
23
+ app.use((req, res, next) => {
24
+ console.log(`[${new Date().toISOString()}] ${req.method} ${req.url}`);
25
+ next();
26
+ });
27
+
28
+ // 1. Proxy API Requests
29
+ // Forward all requests starting with /maximo to the external API
30
+ app.use('/maximo', createProxyMiddleware({
31
+ target: API_TARGET,
32
+ changeOrigin: true, // Necessary for the target server to believe the request is coming from itself
33
+ secure: false, // Disable SSL verification (like curl -k) to avoid self-signed cert errors
34
+ logLevel: 'debug', // Log proxy events
35
+ onProxyRes: function (proxyRes, req, res) {
36
+ // Add CORS headers to the response to allow browser access if strictly needed
37
+ // (Though serving static files from the same origin creates a same-origin context)
38
+ proxyRes.headers['Access-Control-Allow-Origin'] = '*';
39
+ }
40
+ }));
41
+
42
+ // 2. Serve Static Files
43
+ // Serve files from the project root and subdirectories
44
+ app.use(express.static(path.join(__dirname)));
45
+ app.use('/demos', express.static(path.join(__dirname, 'demos')));
46
+ app.use('/images', express.static(path.join(__dirname, 'images')));
47
+ app.use('/docs', express.static(path.join(__dirname, 'docs')));
48
+
49
+ // Start Server
50
+ app.listen(PORT, () => {
51
+ console.log(`\n==================================================`);
52
+ console.log(`🚀 Maximo App Proxy Server`);
53
+ console.log(`==================================================`);
54
+ console.log(`Server running at: http://localhost:${PORT}`);
55
+ console.log(`Proxying /maximo -> ${API_TARGET}/maximo`);
56
+ console.log(`\nDemo Apps:`);
57
+ console.log(` • Asset Manager: http://localhost:${PORT}/demos/assets.html`);
58
+ console.log(` • Work Orders: http://localhost:${PORT}/demos/index.html`);
59
+ console.log(` • Carbon Table: http://localhost:${PORT}/demos/carbon_workorders.html`);
60
+ console.log(`\nPress Ctrl+C to stop.`);
61
+ });