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