@dilina0914/openapi-mcp 6.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/README.md ADDED
@@ -0,0 +1,438 @@
1
+ # OpenAPI MCP Server
2
+
3
+ A Model Context Protocol (MCP) server for parsing OpenAPI specifications and extracting Cloud ERP service metadata. Load specs, explore endpoints, extract schemas, and search operations through MCP tools.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@dilina0914/openapi-mcp.svg)](https://www.npmjs.com/package/@dilina0914/openapi-mcp)
6
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D20.0.0-brightgreen.svg)](https://nodejs.org/)
7
+
8
+ ## Features
9
+
10
+ - **OpenAPI Parsing**: Load and parse OpenAPI 3.0 specifications from files or URLs
11
+ - **7 Powerful Tools**: Complete API discovery, schema extraction, and operation search
12
+ - **Endpoint Discovery**: List and filter API endpoints by tags, paths, or methods
13
+ - **Schema Extraction**: Extract entity schemas with data types, required fields, and examples
14
+ - **Operation Search**: Search operations by query, tag, or entity name
15
+ - **Multi-Spec Support**: Load and manage multiple specs simultaneously
16
+
17
+ ## Prerequisites
18
+
19
+ - Node.js v20.0.0 or higher
20
+ - npm or pnpm package manager
21
+ - OpenAPI 3.0 specification files (JSON or YAML)
22
+
23
+ ## Package Information
24
+
25
+ This package is **fully bundled** - all internal dependencies are included.
26
+
27
+ | Property | Value |
28
+ |----------|-------|
29
+ | **Bundle Size** | ~35 KB |
30
+ | **Node.js** | ≥20.0.0 |
31
+ | **Module Type** | ESM |
32
+ | **TypeScript** | Included |
33
+
34
+ ### Peer Dependencies
35
+
36
+ The following dependencies are required and must be installed separately (or will be auto-installed):
37
+
38
+ ```bash
39
+ # Auto-installed when using npx
40
+ @modelcontextprotocol/sdk ^1.0.0
41
+ ```
42
+
43
+ ## Integration Options
44
+
45
+ Choose the integration method that works best for your workflow:
46
+
47
+ ### Option 1: VS Code Integration
48
+
49
+ Integrate the MCP server into VS Code to use API discovery tools directly in your editor.
50
+
51
+ **Step 1: Create the MCP configuration folder**
52
+
53
+ In your project root directory, create a `.vscode` folder:
54
+
55
+ ```bash
56
+ mkdir .vscode
57
+ ```
58
+
59
+ **Step 2: Create the MCP configuration file**
60
+
61
+ Inside the `.vscode` folder, create a file named `mcp.json` with the following content:
62
+
63
+ ```json
64
+ {
65
+ "servers": {
66
+ "openapi": {
67
+ "command": "npx",
68
+ "args": [
69
+ "-y",
70
+ "@dilina0914/openapi-mcp@6.0.0"
71
+ ],
72
+ "env": {
73
+ "LOG_LEVEL": "info",
74
+ "AUDIT_LOG_ENABLED": "true"
75
+ }
76
+ }
77
+ }
78
+ }
79
+ ```
80
+
81
+ **Step 3: Configure environment variables**
82
+
83
+ | Variable | Description | Required | Default |
84
+ |----------|-------------|----------|---------|
85
+ | `LOG_LEVEL` | Logging level (debug, info, warn, error) | No | `info` |
86
+ | `AUDIT_LOG_ENABLED` | Enable audit logging | No | `true` |
87
+ | `AUDIT_LOG_DIR` | Directory for audit logs | No | `./logs/audit` |
88
+
89
+ **Step 4: Restart VS Code**
90
+
91
+ Close and reopen VS Code to load the MCP server configuration.
92
+
93
+ ### Option 2: Cursor IDE Integration
94
+
95
+ Cursor IDE has built-in support for MCP servers, making integration straightforward.
96
+
97
+ **Step 1: Open Cursor Settings**
98
+
99
+ 1. Open Cursor IDE
100
+ 2. Go to Settings (File > Preferences > Settings or Ctrl/Cmd + ,)
101
+ 3. Search for "MCP" or navigate to the MCP configuration section
102
+
103
+ **Step 2: Add MCP Server Configuration**
104
+
105
+ In the MCP settings, add a new server with the following configuration:
106
+
107
+ ```json
108
+ {
109
+ "mcpServers": {
110
+ "openapi": {
111
+ "command": "npx",
112
+ "args": [
113
+ "-y",
114
+ "@dilina0914/openapi-mcp@6.0.0"
115
+ ],
116
+ "env": {
117
+ "LOG_LEVEL": "info"
118
+ }
119
+ }
120
+ }
121
+ }
122
+ ```
123
+
124
+ **Step 3: Save and Restart**
125
+
126
+ Save the configuration and restart Cursor IDE to activate the MCP server.
127
+
128
+ ### Option 3: Claude Desktop Integration
129
+
130
+ Add to your Claude Desktop configuration file:
131
+
132
+ **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
133
+ **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
134
+
135
+ ```json
136
+ {
137
+ "mcpServers": {
138
+ "openapi": {
139
+ "command": "npx",
140
+ "args": ["-y", "@dilina0914/openapi-mcp@6.0.0"],
141
+ "env": {
142
+ "LOG_LEVEL": "info"
143
+ }
144
+ }
145
+ }
146
+ }
147
+ ```
148
+
149
+ ### Option 4: Local Development
150
+
151
+ Run the server directly for development or testing.
152
+
153
+ **Step 1: Install the package**
154
+
155
+ ```bash
156
+ npm install @dilina0914/openapi-mcp
157
+ ```
158
+
159
+ **Step 2: Configure environment variables**
160
+
161
+ Windows (PowerShell):
162
+ ```powershell
163
+ $env:LOG_LEVEL = "info"
164
+ $env:AUDIT_LOG_ENABLED = "true"
165
+ ```
166
+
167
+ Windows (Command Prompt):
168
+ ```cmd
169
+ set LOG_LEVEL=info
170
+ set AUDIT_LOG_ENABLED=true
171
+ ```
172
+
173
+ Linux/macOS:
174
+ ```bash
175
+ export LOG_LEVEL="info"
176
+ export AUDIT_LOG_ENABLED="true"
177
+ ```
178
+
179
+ **Step 3: Run the server**
180
+
181
+ ```bash
182
+ npx @dilina0914/openapi-mcp
183
+ ```
184
+
185
+ ## Quick Troubleshooting
186
+
187
+ ### Spec Not Found
188
+
189
+ **Error:** `Spec not found: <specId>. Use loadSpec first.`
190
+
191
+ **Solution:**
192
+ - Load the spec first using the `loadSpec` tool
193
+ - Verify the specId returned from `loadSpec`
194
+ - Specs are stored in memory and lost when server restarts
195
+
196
+ ### Invalid OpenAPI Spec
197
+
198
+ **Error:** `Failed to parse OpenAPI spec`
199
+
200
+ **Solution:**
201
+ - Verify the file is valid JSON or YAML
202
+ - Ensure it's a valid OpenAPI 3.0 specification
203
+ - Check file path or URL accessibility
204
+
205
+ ### Schema Not Found
206
+
207
+ **Error:** `Schema not found: <name>`
208
+
209
+ **Solution:**
210
+ - Use `listSchemas` to see available schemas
211
+ - Schema names are case-sensitive
212
+ - Verify the schema exists in the spec
213
+
214
+ ### File Access Errors
215
+
216
+ **Error:** `ENOENT: no such file or directory`
217
+
218
+ **Solution:**
219
+ - Use absolute paths for local files
220
+ - Verify file permissions
221
+ - For URLs, check network connectivity
222
+
223
+ ## What's Included
224
+
225
+ ### MCP Tools (7 total)
226
+
227
+ #### Spec Management
228
+
229
+ | Tool | Description |
230
+ |------|-------------|
231
+ | `loadSpec` | Load an OpenAPI spec from file path or URL |
232
+ | `unloadSpec` | Unload a previously loaded spec from memory |
233
+
234
+ #### Endpoint Discovery
235
+
236
+ | Tool | Description |
237
+ |------|-------------|
238
+ | `listEndpoints` | List all API endpoints with filtering options |
239
+ | `getOperationDetails` | Get full operation details by ID or path/method |
240
+ | `searchOperations` | Search operations by query, tag, or entity name |
241
+
242
+ #### Schema Extraction
243
+
244
+ | Tool | Description |
245
+ |------|-------------|
246
+ | `listSchemas` | List all schemas/entities defined in the spec |
247
+ | `getEntitySchema` | Extract detailed entity schema with data types |
248
+
249
+ ### Supported Features
250
+
251
+ | Feature | Description |
252
+ |---------|-------------|
253
+ | **OpenAPI 3.0** | Full support for OpenAPI 3.0 specifications |
254
+ | **JSON & YAML** | Parse both JSON and YAML spec formats |
255
+ | **File & URL** | Load specs from local files or remote URLs |
256
+ | **$ref Resolution** | Automatic resolution of schema references |
257
+ | **Multi-Spec** | Manage multiple specs simultaneously |
258
+
259
+ ### Output Information
260
+
261
+ The MCP extracts and provides:
262
+
263
+ - API title, version, and description
264
+ - Endpoints with method, path, summary, and tags
265
+ - Operation parameters (path, query, header, cookie)
266
+ - Request body schemas with content types
267
+ - Response schemas for all status codes
268
+ - Entity schemas with properties, types, and constraints
269
+ - Required fields and default values
270
+ - Example values when available
271
+
272
+ ## Tool Examples
273
+
274
+ ### Load a Spec
275
+
276
+ ```json
277
+ {
278
+ "tool": "loadSpec",
279
+ "arguments": {
280
+ "source": "C:\\specs\\my-api.yaml",
281
+ "specId": "my-api"
282
+ }
283
+ }
284
+ ```
285
+
286
+ **Response:**
287
+ ```json
288
+ {
289
+ "specId": "my-api",
290
+ "title": "Cloud ERP API",
291
+ "version": "1.0.0",
292
+ "endpointCount": 245,
293
+ "schemaCount": 89
294
+ }
295
+ ```
296
+
297
+ ### List Endpoints
298
+
299
+ ```json
300
+ {
301
+ "tool": "listEndpoints",
302
+ "arguments": {
303
+ "specId": "my-api",
304
+ "tag": "CustomerOrder",
305
+ "methods": ["GET", "POST"]
306
+ }
307
+ }
308
+ ```
309
+
310
+ **Response:**
311
+ ```json
312
+ {
313
+ "endpoints": [
314
+ {
315
+ "path": "/api/v1/customer-orders",
316
+ "method": "GET",
317
+ "summary": "List all customer orders",
318
+ "tags": ["CustomerOrder"]
319
+ },
320
+ {
321
+ "path": "/api/v1/customer-orders",
322
+ "method": "POST",
323
+ "summary": "Create a new customer order",
324
+ "tags": ["CustomerOrder"]
325
+ }
326
+ ],
327
+ "totalCount": 2
328
+ }
329
+ ```
330
+
331
+ ### Get Entity Schema
332
+
333
+ ```json
334
+ {
335
+ "tool": "getEntitySchema",
336
+ "arguments": {
337
+ "specId": "my-api",
338
+ "schemaName": "CustomerOrder",
339
+ "resolveRefs": true,
340
+ "includeExamples": true
341
+ }
342
+ }
343
+ ```
344
+
345
+ **Response:**
346
+ ```json
347
+ {
348
+ "schema": {
349
+ "name": "CustomerOrder",
350
+ "type": "object",
351
+ "properties": {
352
+ "orderId": {
353
+ "type": "string",
354
+ "description": "Unique order identifier"
355
+ },
356
+ "customerId": {
357
+ "type": "string",
358
+ "required": true
359
+ },
360
+ "orderDate": {
361
+ "type": "string",
362
+ "format": "date-time"
363
+ }
364
+ },
365
+ "required": ["customerId"]
366
+ }
367
+ }
368
+ ```
369
+
370
+ ### Search Operations
371
+
372
+ ```json
373
+ {
374
+ "tool": "searchOperations",
375
+ "arguments": {
376
+ "specId": "my-api",
377
+ "query": "create customer",
378
+ "limit": 5
379
+ }
380
+ }
381
+ ```
382
+
383
+ ### Get Operation Details
384
+
385
+ ```json
386
+ {
387
+ "tool": "getOperationDetails",
388
+ "arguments": {
389
+ "specId": "my-api",
390
+ "path": "/api/v1/customer-orders",
391
+ "method": "POST"
392
+ }
393
+ }
394
+ ```
395
+
396
+ ### List All Schemas
397
+
398
+ ```json
399
+ {
400
+ "tool": "listSchemas",
401
+ "arguments": {
402
+ "specId": "my-api"
403
+ }
404
+ }
405
+ ```
406
+
407
+ **Response:**
408
+ ```json
409
+ {
410
+ "schemas": [
411
+ { "name": "CustomerOrder", "type": "object", "description": "Customer order entity" },
412
+ { "name": "OrderLine", "type": "object", "description": "Order line item" },
413
+ { "name": "Customer", "type": "object", "description": "Customer entity" }
414
+ ],
415
+ "totalCount": 3
416
+ }
417
+ ```
418
+
419
+ ## Security Features
420
+
421
+ - **Audit Logging**: Complete audit trail of spec access
422
+ - **Input Validation**: File paths and parameters are validated
423
+ - **Memory Management**: Specs can be unloaded to free memory
424
+ - **No External Calls**: Specs are parsed locally (URLs are fetched once)
425
+
426
+ ## License
427
+
428
+ MIT
429
+
430
+ ## Links
431
+
432
+ - **GitHub Repository**: https://github.com/dilinaweerasinghe/integration-testing-mcp
433
+ - **npm Package**: https://www.npmjs.com/package/@dilina0914/openapi-mcp
434
+ - **Issues**: https://github.com/dilinaweerasinghe/integration-testing-mcp/issues
435
+
436
+ ## Support
437
+
438
+ Open an issue on the GitHub repository for support.