api2ai 1.0.1 → 1.0.3
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 +0 -0
- package/bun.lock +0 -0
- package/example-petstore/.env.example +0 -0
- package/example-petstore/README.md +0 -0
- package/example-petstore/bun.lock +0 -0
- package/example-petstore/package.json +0 -0
- package/example-petstore/src/http-client.js +0 -0
- package/example-petstore/src/index.js +0 -0
- package/example-petstore/src/tools-config.js +0 -0
- package/example.js +0 -0
- package/generate-mcp-use-server.js +7 -6
- package/package.json +4 -2
package/README.md
CHANGED
|
File without changes
|
package/bun.lock
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/example.js
CHANGED
|
File without changes
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
import fs from 'fs/promises';
|
|
17
17
|
import path from 'path';
|
|
18
|
+
import { fileURLToPath } from 'url';
|
|
18
19
|
|
|
19
20
|
// ============================================================================
|
|
20
21
|
// OpenAPI Spec Loading & Parsing
|
|
@@ -246,9 +247,9 @@ function generatePackageJson(serverName, tools, port) {
|
|
|
246
247
|
dev: 'node --watch src/index.js',
|
|
247
248
|
},
|
|
248
249
|
dependencies: {
|
|
249
|
-
'mcp-use': '
|
|
250
|
+
'mcp-use': '1.11.2',
|
|
250
251
|
'zod': '^3.23.0',
|
|
251
|
-
'dotenv': '^
|
|
252
|
+
'dotenv': '^17.2.3',
|
|
252
253
|
},
|
|
253
254
|
engines: { node: '>=18.0.0' },
|
|
254
255
|
}, null, 2);
|
|
@@ -775,7 +776,7 @@ Then open http://localhost:${port}/inspector to test your tools!
|
|
|
775
776
|
export { generateMcpServer, extractTools, loadOpenApiSpec };
|
|
776
777
|
|
|
777
778
|
// CLI entry point
|
|
778
|
-
const isMainModule = process.argv[1]
|
|
779
|
+
const isMainModule = process.argv[1] === fileURLToPath(import.meta.url);
|
|
779
780
|
|
|
780
781
|
if (isMainModule) {
|
|
781
782
|
const args = process.argv.slice(2);
|
|
@@ -785,7 +786,7 @@ if (isMainModule) {
|
|
|
785
786
|
OpenAPI to MCP Server Generator (mcp-use framework)
|
|
786
787
|
|
|
787
788
|
Usage:
|
|
788
|
-
|
|
789
|
+
npx api2ai <openapi-spec> [output-folder] [options]
|
|
789
790
|
|
|
790
791
|
Arguments:
|
|
791
792
|
openapi-spec Path to local file or URL to remote OpenAPI spec
|
|
@@ -798,8 +799,8 @@ Options:
|
|
|
798
799
|
--help, -h Show this help message
|
|
799
800
|
|
|
800
801
|
Examples:
|
|
801
|
-
|
|
802
|
-
|
|
802
|
+
npx api2ai ./petstore.json ./my-server
|
|
803
|
+
npx api2ai https://petstore3.swagger.io/api/v3/openapi.json ./petstore-mcp \\
|
|
803
804
|
--name petstore-api --port 8080
|
|
804
805
|
`);
|
|
805
806
|
process.exit(0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "api2ai",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Generate MCP servers from OpenAPI specs using the mcp-use framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "generate-mcp-use-server.js",
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
"generate": "node generate-mcp-use-server.js",
|
|
13
13
|
"example:petstore": "node generate-mcp-use-server.js https://petstore3.swagger.io/api/v3/openapi.json ./example-petstore --name petstore-api --port 3000"
|
|
14
14
|
},
|
|
15
|
-
"dependencies": {
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"js-yaml": "^4.1.0"
|
|
17
|
+
},
|
|
16
18
|
"devDependencies": {
|
|
17
19
|
"js-yaml": "^4.1.0"
|
|
18
20
|
},
|