@stackkedjohn/mcp-factory-cli 0.1.1 → 0.2.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 CHANGED
@@ -1,6 +1,19 @@
1
1
  # MCP Factory
2
2
 
3
- Generate production-ready MCP servers from API documentation in one command.
3
+ **Transform any API documentation into a production-ready MCP server in seconds.**
4
+
5
+ MCP Factory is a CLI tool that generates complete, type-safe Model Context Protocol (MCP) servers from API documentation. Give it an OpenAPI spec, Swagger doc, or YAML file, and get a working MCP server with hundreds of tools ready for Claude Desktop and Claude Code.
6
+
7
+ [![npm version](https://badge.fury.io/js/@stackkedjohn%2Fmcp-factory-cli.svg)](https://www.npmjs.com/package/@stackkedjohn/mcp-factory-cli)
8
+ [![GitHub](https://img.shields.io/github/license/StackkedJohn/mcp-factory)](https://github.com/StackkedJohn/mcp-factory)
9
+
10
+ ## Why MCP Factory?
11
+
12
+ - **Zero manual coding** - Generates complete TypeScript MCP servers automatically
13
+ - **Production-ready output** - Type-safe code with validation, error handling, and auth
14
+ - **Complete API coverage** - Every endpoint becomes an MCP tool
15
+ - **Works anywhere** - Run from any directory, point to any API docs
16
+ - **One-command install** - Automatically configures Claude Desktop/Code
4
17
 
5
18
  ## Installation
6
19
 
@@ -11,90 +24,317 @@ npm install -g @stackkedjohn/mcp-factory-cli
11
24
  ## Quick Start
12
25
 
13
26
  ```bash
14
- # Generate MCP server from OpenAPI spec
15
- mcp-factory create openapi.json
27
+ # Generate MCP server from API documentation
28
+ # Supports: OpenAPI, Swagger, API Blueprint (.apib)
29
+ mcp-factory create ./api-docs.yaml
16
30
 
17
- # Install to Claude Desktop/Code
18
- cd my-api-mcp
31
+ # Build the generated server
32
+ cd "My API-mcp"
19
33
  npm install && npm run build
20
- mcp-factory install my-api
21
34
 
22
- # List generated servers
23
- mcp-factory list
35
+ # Install to Claude Desktop
36
+ mcp-factory install "My API"
37
+
38
+ # Done! Restart Claude and start using it
39
+ ```
40
+
41
+ ## Real Example: Neon CRM API
42
+
43
+ ```bash
44
+ # Generate from 466KB OpenAPI spec
45
+ mcp-factory create ./neon-crm-v2.11.yaml
46
+
47
+ # Output:
48
+ # ✓ Parsed API: Neon CRM API Reference
49
+ # ✓ Generated 308 tools (5,772 lines of code)
50
+ # ✓ Build time: <3 seconds
51
+
52
+ cd "Neon CRM API Reference-mcp"
53
+ npm install && npm run build
54
+ mcp-factory install "Neon CRM API Reference"
55
+
56
+ # Now in Claude:
57
+ # "Get customer 12345 from Neon CRM"
58
+ # "Create a new donation for $100"
59
+ # "List all upcoming events"
60
+ ```
61
+
62
+ ## What Gets Generated
63
+
64
+ ```
65
+ My API-mcp/
66
+ ├── src/
67
+ │ ├── index.ts # MCP server implementation
68
+ │ ├── client.ts # HTTP client with auth & retry logic
69
+ │ ├── tools.ts # Tool handlers for each endpoint
70
+ │ ├── types.ts # TypeScript type definitions
71
+ │ └── validation.ts # Zod schemas for input validation
72
+ ├── build/ # Compiled JavaScript
73
+ ├── package.json # Dependencies & scripts
74
+ ├── tsconfig.json # TypeScript configuration
75
+ └── README.md # Usage instructions & Claude config
24
76
  ```
25
77
 
78
+ ### Generated Code Features
79
+
80
+ - ✅ **Type Safety** - Full TypeScript types and Zod validation
81
+ - ✅ **Authentication** - Handles OAuth, API keys, Bearer tokens
82
+ - ✅ **Error Handling** - Detailed error messages and retry logic
83
+ - ✅ **Rate Limiting** - Automatic retry with exponential backoff
84
+ - ✅ **Documentation** - Complete README with configuration examples
85
+ - ✅ **Tests** - Basic smoke tests included
86
+
26
87
  ## Commands
27
88
 
28
- ### create
89
+ ### `create`
29
90
 
30
- Generate an MCP server from API documentation:
91
+ Generate an MCP server from API documentation.
31
92
 
32
93
  ```bash
33
94
  mcp-factory create <input> [options]
34
95
 
96
+ Arguments:
97
+ input Path to API documentation file or URL
98
+
35
99
  Options:
36
- --ai-parse Use AI to parse unstructured documentation
37
- -o, --output <dir> Output directory for generated server
100
+ --ai-parse Use AI to parse unstructured documentation (coming soon)
101
+ -o, --output <dir> Custom output directory (default: ./<API Name>-mcp)
38
102
  ```
39
103
 
40
- **Supported input formats:**
104
+ **Supported Formats:**
41
105
  - OpenAPI 3.x (JSON/YAML)
42
106
  - Swagger 2.0 (JSON/YAML)
43
- - Postman collections (coming soon)
107
+ - API Blueprint (.apib)
108
+ - Postman Collections (coming soon)
44
109
  - Unstructured docs with `--ai-parse` (coming soon)
45
110
 
46
- ### validate
111
+ **Examples:**
112
+ ```bash
113
+ # Local file
114
+ mcp-factory create ./openapi.yaml
115
+
116
+ # API Blueprint file
117
+ mcp-factory create ./api-documentation.apib
47
118
 
48
- Validate API specification without generating code:
119
+ # URL (coming soon)
120
+ mcp-factory create https://api.example.com/openapi.json
121
+
122
+ # Custom output directory
123
+ mcp-factory create ./swagger.json -o ./custom-mcp
124
+ ```
125
+
126
+ ### `validate`
127
+
128
+ Validate API specification without generating code.
49
129
 
50
130
  ```bash
51
131
  mcp-factory validate <input>
52
132
  ```
53
133
 
54
- ### list
134
+ Checks if the API documentation is valid and can be processed.
135
+
136
+ ### `list`
55
137
 
56
- List all generated MCP servers:
138
+ List all generated MCP servers tracked by the registry.
57
139
 
58
140
  ```bash
59
141
  mcp-factory list
60
142
  ```
61
143
 
62
- ### install
144
+ Shows all servers you've generated with their paths and creation dates.
145
+
146
+ ### `install`
63
147
 
64
- Install generated server to Claude Desktop/Code configuration:
148
+ Automatically configure a generated server in Claude Desktop or Claude Code.
65
149
 
66
150
  ```bash
67
151
  mcp-factory install <server-name>
68
152
  ```
69
153
 
70
- ## Generated Server Structure
154
+ **What it does:**
155
+ - Locates server in registry
156
+ - Detects Claude Desktop and/or Claude Code
157
+ - Updates configuration with correct paths
158
+ - Provides next steps for adding API credentials
71
159
 
160
+ **Configuration files:**
161
+ - **Claude Desktop (macOS):** `~/Library/Application Support/Claude/claude_desktop_config.json`
162
+ - **Claude Desktop (Windows):** `%APPDATA%\Claude\claude_desktop_config.json`
163
+ - **Claude Code:** `~/.claude/config.json`
164
+
165
+ ## Complete Workflow
166
+
167
+ ### 1. Generate Server
168
+
169
+ ```bash
170
+ cd ~/my-projects
171
+ mcp-factory create ./stripe-openapi.yaml
72
172
  ```
73
- my-api-mcp/
74
- ├── src/
75
- │ ├── index.ts # MCP server entry point
76
- │ ├── client.ts # HTTP client with auth
77
- │ └── tools.ts # Tool implementations
78
- ├── package.json
79
- ├── tsconfig.json
80
- └── README.md
173
+
174
+ **Output:**
81
175
  ```
176
+ ℹ Detecting format: OpenAPI 3.0
177
+ ✓ Parsed API: Stripe API
178
+ ℹ Detected patterns: auth=bearer, pagination=cursor
179
+ ✓ Generated MCP server with 247 tools
180
+ ```
181
+
182
+ ### 2. Build & Test
183
+
184
+ ```bash
185
+ cd "Stripe API-mcp"
186
+ npm install
187
+ npm run build
188
+ npm test
189
+ ```
190
+
191
+ **Generated files:**
192
+ - `build/index.js` - Compiled MCP server
193
+ - `src/*.ts` - TypeScript source code
194
+ - Tests pass ✓
195
+
196
+ ### 3. Install to Claude
197
+
198
+ ```bash
199
+ mcp-factory install "Stripe API"
200
+ ```
201
+
202
+ **Output:**
203
+ ```
204
+ ✓ Installed Stripe API to Claude Desktop
205
+
206
+ Next steps:
207
+ 1. Edit config and add API credentials
208
+ 2. Restart Claude Desktop to load server
209
+ ```
210
+
211
+ ### 4. Add Credentials
212
+
213
+ Edit Claude Desktop config:
214
+
215
+ ```json
216
+ {
217
+ "mcpServers": {
218
+ "Stripe API": {
219
+ "command": "node",
220
+ "args": ["/path/to/Stripe API-mcp/build/index.js"],
221
+ "env": {
222
+ "STRIPE_API_KEY": "sk_live_..."
223
+ }
224
+ }
225
+ }
226
+ }
227
+ ```
228
+
229
+ ### 5. Use in Claude
230
+
231
+ Restart Claude Desktop, then:
232
+
233
+ ```
234
+ "List my Stripe customers"
235
+ "Create a new payment intent for $50"
236
+ "Get details for charge ch_abc123"
237
+ ```
238
+
239
+ Claude automatically uses the MCP server tools to make API calls.
240
+
241
+ ## How It Works
242
+
243
+ 1. **Format Detection** - Analyzes your documentation and identifies the format
244
+ 2. **API Parsing** - Extracts endpoints, parameters, auth patterns, and schemas
245
+ 3. **Pattern Analysis** - Detects pagination, rate limiting, and error formats
246
+ 4. **Code Generation** - Creates TypeScript MCP server with Handlebars templates
247
+ 5. **Optimization** - Only generates code for patterns your API actually uses
248
+
249
+ **Key Design Decisions:**
250
+ - Generate code, don't use runtime abstraction (transparent, no black box)
251
+ - TypeScript for type safety and IDE support
252
+ - Minimal dependencies (MCP SDK, Zod, Handlebars)
253
+ - Pattern-aware generation (lean output, no unused code)
82
254
 
83
255
  ## Development
84
256
 
257
+ ### Setup
258
+
85
259
  ```bash
86
- # Clone and setup
87
- git clone <repo>
260
+ git clone https://github.com/StackkedJohn/mcp-factory.git
88
261
  cd mcp-factory
89
262
  npm install
90
-
91
- # Build
92
263
  npm run build
264
+ ```
93
265
 
94
- # Test with sample
266
+ ### Local Testing
267
+
268
+ ```bash
269
+ # Test with sample OpenAPI spec
95
270
  node dist/cli.js create test-fixtures/weather-api.json
271
+
272
+ # Test generated server
273
+ cd "Weather API-mcp"
274
+ npm install && npm run build && npm test
275
+ ```
276
+
277
+ ### Project Structure
278
+
279
+ ```
280
+ mcp-factory/
281
+ ├── src/
282
+ │ ├── cli.ts # CLI entry point
283
+ │ ├── commands/ # Command implementations
284
+ │ ├── parsers/ # Format parsers (OpenAPI, Postman)
285
+ │ ├── generator/ # Code generation engine
286
+ │ ├── schema/ # Internal API schema types
287
+ │ ├── registry/ # Server registry management
288
+ │ └── utils/ # Logging, errors
289
+ ├── templates/ # Handlebars templates
290
+ │ ├── index.ts.hbs # MCP server template
291
+ │ ├── client.ts.hbs # HTTP client template
292
+ │ ├── tools.ts.hbs # Tool handlers template
293
+ │ └── ...
294
+ ├── test-fixtures/ # Sample API specs
295
+ └── docs/ # Design docs
96
296
  ```
97
297
 
298
+ ## Troubleshooting
299
+
300
+ ### Generated server won't start
301
+
302
+ ```bash
303
+ # Check build succeeded
304
+ npm run build
305
+
306
+ # Check for TypeScript errors
307
+ npm run build -- --noEmit
308
+ ```
309
+
310
+ ### Tools not appearing in Claude
311
+
312
+ 1. Verify server is in Claude config
313
+ 2. Check server path is absolute, not relative
314
+ 3. Restart Claude Desktop/Code
315
+ 4. Check Claude logs for errors
316
+
317
+ ### Authentication failures
318
+
319
+ 1. Verify API credentials in config `env` section
320
+ 2. Check API key format matches your API's requirements
321
+ 3. Test credentials with curl first
322
+
323
+ ## Links
324
+
325
+ - **npm Package:** https://www.npmjs.com/package/@stackkedjohn/mcp-factory-cli
326
+ - **GitHub Repository:** https://github.com/StackkedJohn/mcp-factory
327
+ - **Issues & Support:** https://github.com/StackkedJohn/mcp-factory/issues
328
+ - **MCP Documentation:** https://modelcontextprotocol.io
329
+
98
330
  ## License
99
331
 
100
- MIT
332
+ MIT License - see [LICENSE](LICENSE) file for details.
333
+
334
+ ## Contributing
335
+
336
+ Contributions welcome! Please open an issue first to discuss proposed changes.
337
+
338
+ ---
339
+
340
+ **Built with ❤️ for the Claude MCP ecosystem**
@@ -2,6 +2,7 @@ import * as path from 'path';
2
2
  import { detectFormat } from '../parsers/detector.js';
3
3
  import { parseOpenAPI } from '../parsers/openapi.js';
4
4
  import { parsePostman } from '../parsers/postman.js';
5
+ import { parseAPIBlueprint } from '../parsers/apib-parser.js';
5
6
  import { parseWithAI } from '../parsers/ai-parser.js';
6
7
  import { analyzePatterns } from '../generator/analyzer.js';
7
8
  import { generateServer } from '../generator/engine.js';
@@ -22,6 +23,9 @@ export async function createCommand(input, options) {
22
23
  else if (detection.format === 'postman') {
23
24
  schema = parsePostman(detection.content);
24
25
  }
26
+ else if (detection.format === 'apib') {
27
+ schema = await parseAPIBlueprint(detection.content);
28
+ }
25
29
  else if (options.aiParse) {
26
30
  logger.info('Using AI parser for unstructured docs...');
27
31
  schema = await parseWithAI(JSON.stringify(detection.content));
@@ -0,0 +1,2 @@
1
+ import type { APISchema } from '../schema/api-schema.js';
2
+ export declare function parseAPIBlueprint(content: string): Promise<APISchema>;