api2ai 1.0.3 → 1.0.6

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.
@@ -0,0 +1,7 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(node generate-mcp-use-server.js:*)"
5
+ ]
6
+ }
7
+ }
package/README.md CHANGED
@@ -101,9 +101,39 @@ my-mcp-server/
101
101
  ├── package.json
102
102
  ├── README.md # Generated documentation
103
103
  └── src/
104
- ├── index.js # Main server with tool registrations
105
- ├── http-client.js # HTTP utilities
106
- └── tools-config.js # Tool configurations
104
+ ├── index.js # Main server with MCP tool registrations
105
+ ├── http-client.js # HTTP utilities for API calls
106
+ └── tools-config.js # Tool configurations from OpenAPI spec
107
+ ```
108
+
109
+ ### Tool Registration Format
110
+
111
+ Each API endpoint is converted into a proper MCP tool:
112
+
113
+ ```javascript
114
+ // Example generated tool
115
+ server.tool(
116
+ {
117
+ name: 'getPetById',
118
+ description: 'Find pet by ID',
119
+ schema: z.object({
120
+ petId: z.number().int().describe('ID of pet to return'),
121
+ }),
122
+ },
123
+ async (params) => {
124
+ const toolConfig = toolConfigMap.get('getPetById');
125
+ const result = await executeRequest(toolConfig, params, apiConfig);
126
+
127
+ if (!result.ok) {
128
+ return text(\`Error: \${result.status} \${result.statusText}\`);
129
+ }
130
+
131
+ // Returns MCP content types (text or object)
132
+ return typeof result.data === 'object'
133
+ ? object(result.data)
134
+ : text(result.data);
135
+ }
136
+ );
107
137
  ```
108
138
 
109
139
  ## Generated Server Features
@@ -108,9 +108,32 @@ petstore-api/
108
108
  ├── package.json # Dependencies
109
109
  ├── README.md # This file
110
110
  └── src/
111
- ├── index.js # Main server with tool registrations
112
- ├── http-client.js # HTTP utilities for API calls
113
- └── tools-config.js # Tool configurations from OpenAPI
111
+ ├── index.js # Main server with MCP tool registrations
112
+ ├── http-client.js # HTTP utilities for API calls
113
+ └── tools-config.js # Tool configurations from OpenAPI spec
114
+ ```
115
+
116
+ ## How It Works
117
+
118
+ Each tool is registered using the proper MCP format:
119
+
120
+ ```javascript
121
+ server.tool(
122
+ {
123
+ name: 'getPetById',
124
+ description: 'Find pet by ID',
125
+ schema: z.object({
126
+ petId: z.number().int().describe('ID of pet to return'),
127
+ }),
128
+ },
129
+ async (params) => {
130
+ // Fetch data from the API
131
+ const result = await executeRequest(toolConfig, params, apiConfig);
132
+
133
+ // Return MCP content (text or object)
134
+ return result.ok ? object(result.data) : text(`Error: ${result.status}`);
135
+ }
136
+ );
114
137
  ```
115
138
 
116
139
  ## Production Deployment
@@ -137,7 +160,7 @@ pm2 start src/index.js --name petstore-api
137
160
  ## Source
138
161
 
139
162
  - **OpenAPI Spec**: `https://petstore3.swagger.io/api/v3/openapi.json`
140
- - **Generated**: 2025-12-30T23:36:57.107Z
163
+ - **Generated**: 2025-12-31T01:39:23.989Z
141
164
  - **Framework**: [mcp-use](https://mcp-use.com)
142
165
 
143
166
  ## License