@ivotoby/openapi-mcp-server 1.12.5 → 1.14.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 +69 -21
- package/dist/bundle.js +184 -59
- package/dist/cli.js +183 -59
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,7 +36,6 @@ The server supports two transport methods:
|
|
|
36
36
|
No need to clone this repository. Simply configure Claude Desktop to use this MCP server:
|
|
37
37
|
|
|
38
38
|
1. Locate or create your Claude Desktop configuration file:
|
|
39
|
-
|
|
40
39
|
- On macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
41
40
|
|
|
42
41
|
2. Add the following configuration:
|
|
@@ -120,6 +119,11 @@ The server can be configured through environment variables or command line argum
|
|
|
120
119
|
- `OPENAPI_SPEC_FROM_STDIN` - Set to "true" to read OpenAPI spec from standard input
|
|
121
120
|
- `OPENAPI_SPEC_INLINE` - Provide OpenAPI spec content directly as a string
|
|
122
121
|
- `API_HEADERS` - Comma-separated key:value pairs for API headers
|
|
122
|
+
- `CLIENT_CERT_PATH` - Path to client certificate PEM file for mutual TLS
|
|
123
|
+
- `CLIENT_KEY_PATH` - Path to client private key PEM file for mutual TLS
|
|
124
|
+
- `CA_CERT_PATH` - Path to custom CA certificate PEM file for private/internal CAs
|
|
125
|
+
- `CLIENT_KEY_PASSPHRASE` - Passphrase for an encrypted client private key
|
|
126
|
+
- `REJECT_UNAUTHORIZED` - Whether to reject untrusted server certificates (default: `true`)
|
|
123
127
|
- `SERVER_NAME` - Name for the MCP server (default: "mcp-openapi-server")
|
|
124
128
|
- `SERVER_VERSION` - Version of the server (default: "1.0.0")
|
|
125
129
|
- `TRANSPORT_TYPE` - Transport type to use: "stdio" or "http" (default: "stdio")
|
|
@@ -128,6 +132,7 @@ The server can be configured through environment variables or command line argum
|
|
|
128
132
|
- `ENDPOINT_PATH` - Endpoint path for HTTP transport (default: "/mcp")
|
|
129
133
|
- `TOOLS_MODE` - Tools loading mode: "all" (load all endpoint-based tools), "dynamic" (load only meta-tools), or "explicit" (load only tools specified in includeTools) (default: "all")
|
|
130
134
|
- `DISABLE_ABBREVIATION` - Disable name optimization (this could throw errors when name is > 64 chars)
|
|
135
|
+
- `VERBOSE` - Enable operational logging (`true` by default; set to `false` to suppress non-essential logs)
|
|
131
136
|
- `PROMPTS_PATH` - Path or URL to prompts JSON/YAML file
|
|
132
137
|
- `PROMPTS_INLINE` - Provide prompts directly as JSON string
|
|
133
138
|
- `RESOURCES_PATH` - Path or URL to resources JSON/YAML file
|
|
@@ -140,15 +145,56 @@ npx @ivotoby/openapi-mcp-server \
|
|
|
140
145
|
--api-base-url https://api.example.com \
|
|
141
146
|
--openapi-spec https://api.example.com/openapi.json \
|
|
142
147
|
--headers "Authorization:Bearer token123,X-API-Key:your-api-key" \
|
|
148
|
+
--client-cert ./certs/client.pem \
|
|
149
|
+
--client-key ./certs/client-key.pem \
|
|
143
150
|
--name "my-mcp-server" \
|
|
144
151
|
--server-version "1.0.0" \
|
|
145
152
|
--transport http \
|
|
146
153
|
--port 3000 \
|
|
147
154
|
--host 127.0.0.1 \
|
|
148
155
|
--path /mcp \
|
|
149
|
-
--disable-abbreviation true
|
|
156
|
+
--disable-abbreviation true \
|
|
157
|
+
--verbose false
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Mutual TLS (mTLS)
|
|
161
|
+
|
|
162
|
+
If your upstream API requires client certificate authentication, you can attach TLS credentials directly to outbound requests.
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
npx @ivotoby/openapi-mcp-server \
|
|
166
|
+
--api-base-url https://secure-api.example.com \
|
|
167
|
+
--openapi-spec https://secure-api.example.com/openapi.json \
|
|
168
|
+
--client-cert ./certs/client.pem \
|
|
169
|
+
--client-key ./certs/client-key.pem \
|
|
170
|
+
--headers "Authorization:Bearer token123"
|
|
150
171
|
```
|
|
151
172
|
|
|
173
|
+
This is orthogonal to HTTP-level auth, so mTLS can be combined with static headers or an `AuthProvider`.
|
|
174
|
+
|
|
175
|
+
TLS-related options only apply when `--api-base-url` uses `https://`.
|
|
176
|
+
|
|
177
|
+
For private CAs or encrypted keys:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
npx @ivotoby/openapi-mcp-server \
|
|
181
|
+
--api-base-url https://internal-api.example.com \
|
|
182
|
+
--openapi-spec ./openapi.yaml \
|
|
183
|
+
--client-cert ./certs/client.pem \
|
|
184
|
+
--client-key ./certs/client-key.pem \
|
|
185
|
+
--client-key-passphrase "$CLIENT_KEY_PASSPHRASE" \
|
|
186
|
+
--ca-cert ./certs/internal-ca.pem \
|
|
187
|
+
--reject-unauthorized false
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
- `--client-cert` / `CLIENT_CERT_PATH`: client certificate PEM file
|
|
191
|
+
- `--client-key` / `CLIENT_KEY_PATH`: client private key PEM file
|
|
192
|
+
- `--client-key-passphrase` / `CLIENT_KEY_PASSPHRASE`: passphrase for encrypted private keys
|
|
193
|
+
- `--ca-cert` / `CA_CERT_PATH`: custom CA bundle for private/internal certificate authorities
|
|
194
|
+
- `--reject-unauthorized` / `REJECT_UNAUTHORIZED`: set to `false` only when you intentionally want to allow self-signed or otherwise untrusted server certificates
|
|
195
|
+
|
|
196
|
+
Set `--verbose false` or `VERBOSE=false` if you want the server to stay quiet in scripts or embedded environments.
|
|
197
|
+
|
|
152
198
|
## OpenAPI Specification Loading
|
|
153
199
|
|
|
154
200
|
The MCP server supports multiple methods for loading OpenAPI specifications, providing flexibility for different deployment scenarios:
|
|
@@ -286,11 +332,11 @@ In addition to exposing OpenAPI endpoints as **tools**, this server can expose *
|
|
|
286
332
|
|
|
287
333
|
### What Are Prompts and Resources?
|
|
288
334
|
|
|
289
|
-
| Feature
|
|
290
|
-
|
|
291
|
-
| **Tools**
|
|
292
|
-
| **Prompts**
|
|
293
|
-
| **Resources** | Read-only content for context
|
|
335
|
+
| Feature | Purpose | Use Case |
|
|
336
|
+
| ------------- | --------------------------------------------- | --------------------------- |
|
|
337
|
+
| **Tools** | API endpoints for the AI to execute | Making API calls |
|
|
338
|
+
| **Prompts** | Templated messages with argument substitution | Reusable workflow templates |
|
|
339
|
+
| **Resources** | Read-only content for context | API documentation, schemas |
|
|
294
340
|
|
|
295
341
|
### Loading Prompts
|
|
296
342
|
|
|
@@ -434,11 +480,13 @@ curl http://localhost:3000/health
|
|
|
434
480
|
```
|
|
435
481
|
|
|
436
482
|
**Health Response Fields:**
|
|
483
|
+
|
|
437
484
|
- `status`: Always returns "healthy" when server is running
|
|
438
485
|
- `activeSessions`: Number of active MCP sessions
|
|
439
486
|
- `uptime`: Server uptime in seconds
|
|
440
487
|
|
|
441
488
|
**Key Features:**
|
|
489
|
+
|
|
442
490
|
- No authentication required
|
|
443
491
|
- Works with any HTTP method (GET, POST, etc.)
|
|
444
492
|
- Ideal for load balancers, Kubernetes probes, and monitoring systems
|
|
@@ -470,7 +518,6 @@ HEALTHCHECK --interval=30s --timeout=3s \
|
|
|
470
518
|
To see debug logs:
|
|
471
519
|
|
|
472
520
|
1. When using stdio transport with Claude Desktop:
|
|
473
|
-
|
|
474
521
|
- Logs appear in the Claude Desktop logs
|
|
475
522
|
|
|
476
523
|
2. When using HTTP transport:
|
|
@@ -630,15 +677,16 @@ if (resourcesManager) {
|
|
|
630
677
|
|
|
631
678
|
```typescript
|
|
632
679
|
interface PromptDefinition {
|
|
633
|
-
name: string
|
|
634
|
-
title?: string
|
|
635
|
-
description?: string
|
|
636
|
-
arguments?: {
|
|
680
|
+
name: string // Unique identifier
|
|
681
|
+
title?: string // Human-readable display title
|
|
682
|
+
description?: string // Description of the prompt
|
|
683
|
+
arguments?: {
|
|
684
|
+
// Template arguments
|
|
637
685
|
name: string
|
|
638
686
|
description?: string
|
|
639
687
|
required?: boolean
|
|
640
688
|
}[]
|
|
641
|
-
template: string
|
|
689
|
+
template: string // Template with {{argName}} placeholders
|
|
642
690
|
}
|
|
643
691
|
```
|
|
644
692
|
|
|
@@ -646,14 +694,14 @@ interface PromptDefinition {
|
|
|
646
694
|
|
|
647
695
|
```typescript
|
|
648
696
|
interface ResourceDefinition {
|
|
649
|
-
uri: string
|
|
650
|
-
name: string
|
|
651
|
-
title?: string
|
|
652
|
-
description?: string
|
|
653
|
-
mimeType?: string
|
|
654
|
-
text?: string
|
|
655
|
-
blob?: string
|
|
656
|
-
contentProvider?: () => Promise<string | { blob: string }>
|
|
697
|
+
uri: string // Unique URI identifier
|
|
698
|
+
name: string // Resource name
|
|
699
|
+
title?: string // Human-readable display title
|
|
700
|
+
description?: string // Description of the resource
|
|
701
|
+
mimeType?: string // Content MIME type
|
|
702
|
+
text?: string // Static text content
|
|
703
|
+
blob?: string // Static binary content (base64)
|
|
704
|
+
contentProvider?: () => Promise<string | { blob: string }> // Dynamic content
|
|
657
705
|
}
|
|
658
706
|
```
|
|
659
707
|
|