Skip to content

Commit 34a1f6d

Browse files
committed
perf: keep code with the same style and format command
1 parent e17ab1a commit 34a1f6d

2 files changed

Lines changed: 36 additions & 32 deletions

File tree

README.md

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ openapi-mcp-generator --input path/to/openapi.json --output path/to/output/dir -
4848

4949
### CLI Options
5050

51-
| Option | Alias | Description | Default |
52-
|--------------------|-------|-----------------------------------------------------------------------------------------------------|---------------------------------|
53-
| `--input` | `-i` | Path or URL to OpenAPI specification (YAML or JSON) | **Required** |
54-
| `--output` | `-o` | Directory to output the generated MCP project | **Required** |
55-
| `--server-name` | `-n` | Name of the MCP server (`package.json:name`) | OpenAPI title or `mcp-api-server` |
56-
| `--server-version` | `-v` | Version of the MCP server (`package.json:version`) | OpenAPI version or `1.0.0` |
57-
| `--base-url` | `-b` | Base URL for API requests. Required if OpenAPI `servers` missing or ambiguous. | Auto-detected if possible |
58-
| `--transport` | `-t` | Transport mode: `"stdio"` (default), `"web"`, or `"streamable-http"` | `"stdio"` |
59-
| `--port` | `-p` | Port for web-based transports | `3000` |
60-
| `--force` | | Overwrite existing files in the output directory without confirmation | `false` |
51+
| Option | Alias | Description | Default |
52+
| ------------------ | ----- | ------------------------------------------------------------------------------ | --------------------------------- |
53+
| `--input` | `-i` | Path or URL to OpenAPI specification (YAML or JSON) | **Required** |
54+
| `--output` | `-o` | Directory to output the generated MCP project | **Required** |
55+
| `--server-name` | `-n` | Name of the MCP server (`package.json:name`) | OpenAPI title or `mcp-api-server` |
56+
| `--server-version` | `-v` | Version of the MCP server (`package.json:version`) | OpenAPI version or `1.0.0` |
57+
| `--base-url` | `-b` | Base URL for API requests. Required if OpenAPI `servers` missing or ambiguous. | Auto-detected if possible |
58+
| `--transport` | `-t` | Transport mode: `"stdio"` (default), `"web"`, or `"streamable-http"` | `"stdio"` |
59+
| `--port` | `-p` | Port for web-based transports | `3000` |
60+
| `--force` | | Overwrite existing files in the output directory without confirmation | `false` |
6161

6262
## 📦 Programmatic API
6363

@@ -74,7 +74,7 @@ const filteredTools = await getToolsFromOpenApi('https://example.com/api-spec.js
7474
baseUrl: 'https://api.example.com',
7575
dereference: true,
7676
excludeOperationIds: ['deletePet'],
77-
filterFn: (tool) => tool.method.toLowerCase() === 'get'
77+
filterFn: (tool) => tool.method.toLowerCase() === 'get',
7878
});
7979
```
8080

@@ -100,6 +100,7 @@ The generated project includes:
100100
```
101101

102102
Core dependencies:
103+
103104
- `@modelcontextprotocol/sdk` - MCP protocol implementation
104105
- `axios` - HTTP client for API requests
105106
- `zod` - Runtime validation
@@ -138,31 +139,31 @@ Implements the MCP StreamableHTTP transport which offers:
138139

139140
### Transport Comparison
140141

141-
| Feature | stdio | web (SSE) | streamable-http |
142-
|---------|-------|-----------|----------------|
143-
| Protocol | JSON-RPC over stdio | JSON-RPC over SSE | JSON-RPC over HTTP |
144-
| Connection | Persistent | Persistent | Request/response |
145-
| Bidirectional | Yes | Yes | Yes (stateful) |
146-
| Multiple clients | No | Yes | Yes |
147-
| Browser compatible | No | Yes | Yes |
148-
| Firewall friendly | No | Yes | Yes |
149-
| Load balancing | No | Limited | Yes |
150-
| Status codes | No | Limited | Full HTTP codes |
151-
| Headers | No | Limited | Full HTTP headers |
152-
| Test client | No | Yes | Yes |
142+
| Feature | stdio | web (SSE) | streamable-http |
143+
| ------------------ | ------------------- | ----------------- | ------------------ |
144+
| Protocol | JSON-RPC over stdio | JSON-RPC over SSE | JSON-RPC over HTTP |
145+
| Connection | Persistent | Persistent | Request/response |
146+
| Bidirectional | Yes | Yes | Yes (stateful) |
147+
| Multiple clients | No | Yes | Yes |
148+
| Browser compatible | No | Yes | Yes |
149+
| Firewall friendly | No | Yes | Yes |
150+
| Load balancing | No | Limited | Yes |
151+
| Status codes | No | Limited | Full HTTP codes |
152+
| Headers | No | Limited | Full HTTP headers |
153+
| Test client | No | Yes | Yes |
153154

154155
---
155156

156157
## 🔐 Environment Variables for Authentication
157158

158159
Configure auth credentials in your environment:
159160

160-
| Auth Type | Variable Format |
161-
|-------------|----------------------------------------------------------|
162-
| API Key | `API_KEY_<SCHEME_NAME>` |
163-
| Bearer | `BEARER_TOKEN_<SCHEME_NAME>` |
164-
| Basic Auth | `BASIC_USERNAME_<SCHEME_NAME>`, `BASIC_PASSWORD_<SCHEME_NAME>` |
165-
| OAuth2 | `OAUTH_CLIENT_ID_<SCHEME_NAME>`, `OAUTH_CLIENT_SECRET_<SCHEME_NAME>`, `OAUTH_SCOPES_<SCHEME_NAME>` |
161+
| Auth Type | Variable Format |
162+
| ---------- | -------------------------------------------------------------------------------------------------- |
163+
| API Key | `API_KEY_<SCHEME_NAME>` |
164+
| Bearer | `BEARER_TOKEN_<SCHEME_NAME>` |
165+
| Basic Auth | `BASIC_USERNAME_<SCHEME_NAME>`, `BASIC_PASSWORD_<SCHEME_NAME>` |
166+
| OAuth2 | `OAUTH_CLIENT_ID_<SCHEME_NAME>`, `OAUTH_CLIENT_SECRET_<SCHEME_NAME>`, `OAUTH_SCOPES_<SCHEME_NAME>` |
166167

167168
---
168169

@@ -214,8 +215,9 @@ Contributions are welcome!
214215

215216
1. Fork the repo
216217
2. Create a feature branch: `git checkout -b feature/amazing-feature`
217-
3. Commit your changes: `git commit -m "Add amazing feature"`
218-
4. Push and open a PR
218+
3. Run `npm run format.write` to format your code
219+
4. Commit your changes: `git commit -m "Add amazing feature"`
220+
5. Push and open a PR
219221

220222
📌 Repository: [github.com/harsha-iiiv/openapi-mcp-generator](https://github.com/harsha-iiiv/openapi-mcp-generator)
221223

examples/pet-store-streamable-http/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
"scripts": {
1313
"start": "node build/index.js",
1414
"build": "tsc && chmod 755 build/index.js",
15+
"format.check": "prettier --check .",
16+
"format.write": "prettier --write .",
1517
"typecheck": "tsc --noEmit",
1618
"prestart": "npm run build",
1719
"start:http": "node build/index.js --transport=streamable-http"
@@ -35,4 +37,4 @@
3537
"typescript": "^5.8.3",
3638
"@types/uuid": "^10.0.0"
3739
}
38-
}
40+
}

0 commit comments

Comments
 (0)