mcp-new 1.1.0 → 1.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 +191 -121
- package/dist/{chunk-K3TOM22I.js → chunk-BHGUGEHE.js} +498 -9
- package/dist/cli.js +66 -6
- package/dist/index.d.ts +26 -1
- package/dist/index.js +13 -1
- package/package.json +2 -2
- package/templates/go/README.md.ejs +67 -4
- package/templates/python/README.md.ejs +58 -15
- package/templates/rust/README.md.ejs +67 -4
- package/templates/typescript/README.md.ejs +56 -15
- /package/bin/{mcp-generator.js → mcp-new.js} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -194,6 +194,8 @@ interface GeneratorContext {
|
|
|
194
194
|
outputDir: string;
|
|
195
195
|
templateDir: string;
|
|
196
196
|
}
|
|
197
|
+
declare const PresetIdSchema: z.ZodEnum<["database", "rest-api", "filesystem"]>;
|
|
198
|
+
type PresetId$1 = z.infer<typeof PresetIdSchema>;
|
|
197
199
|
interface CLIOptions {
|
|
198
200
|
typescript?: boolean;
|
|
199
201
|
python?: boolean;
|
|
@@ -202,6 +204,7 @@ interface CLIOptions {
|
|
|
202
204
|
skipInstall?: boolean;
|
|
203
205
|
fromOpenapi?: string;
|
|
204
206
|
fromPrompt?: boolean;
|
|
207
|
+
preset?: string;
|
|
205
208
|
yes?: boolean;
|
|
206
209
|
}
|
|
207
210
|
|
|
@@ -385,6 +388,23 @@ declare class PromptGenerator extends BaseGenerator {
|
|
|
385
388
|
}
|
|
386
389
|
declare function generateFromPrompt(baseConfig: Partial<ProjectConfig>): Promise<void>;
|
|
387
390
|
|
|
391
|
+
type PresetId = 'database' | 'rest-api' | 'filesystem';
|
|
392
|
+
|
|
393
|
+
declare class PresetGenerator extends BaseGenerator {
|
|
394
|
+
private presetName;
|
|
395
|
+
constructor(context: GeneratorContext, presetName: string);
|
|
396
|
+
generate(): Promise<void>;
|
|
397
|
+
}
|
|
398
|
+
interface PresetGeneratorOptions {
|
|
399
|
+
projectName?: string;
|
|
400
|
+
presetId: PresetId;
|
|
401
|
+
language?: Language;
|
|
402
|
+
skipInstall?: boolean;
|
|
403
|
+
useDefaults?: boolean;
|
|
404
|
+
}
|
|
405
|
+
declare function generateFromPreset(options: PresetGeneratorOptions): Promise<void>;
|
|
406
|
+
declare function validatePresetId(presetId: string): presetId is PresetId;
|
|
407
|
+
|
|
388
408
|
declare function parseOpenAPISpec(content: string): Promise<ParsedEndpoint[]>;
|
|
389
409
|
declare function selectEndpoints(endpoints: ParsedEndpoint[]): Promise<ParsedEndpoint[]>;
|
|
390
410
|
declare function endpointToMCPTool(endpoint: ParsedEndpoint): {
|
|
@@ -493,6 +513,11 @@ declare function promptAddResources(): Promise<boolean>;
|
|
|
493
513
|
declare function promptResourceConfig(): Promise<ResourceConfig>;
|
|
494
514
|
declare function promptMultipleResources(): Promise<ResourceConfig[]>;
|
|
495
515
|
|
|
516
|
+
type GenerationMethod = 'wizard' | 'preset' | 'openapi' | 'prompt';
|
|
517
|
+
declare function promptGenerationMethod(): Promise<GenerationMethod>;
|
|
518
|
+
|
|
519
|
+
declare function promptPreset(): Promise<PresetId>;
|
|
520
|
+
|
|
496
521
|
interface WizardOptions {
|
|
497
522
|
defaultName?: string;
|
|
498
523
|
skipDescription?: boolean;
|
|
@@ -519,4 +544,4 @@ interface AddToolOptions {
|
|
|
519
544
|
}
|
|
520
545
|
declare function addToolCommand(options: AddToolOptions): Promise<void>;
|
|
521
546
|
|
|
522
|
-
export { BaseGenerator, type CLIOptions, type GeneratorContext, type Language, LanguageSchema, type MCPPrompt, type MCPPromptArgument, type MCPPropertySchema, type MCPResource, type MCPServerCapabilities, type MCPServerInfo, type MCPTool, type MCPToolInputSchema, type OpenAPIComponents, OpenAPIGenerator, type OpenAPIInfo, type OpenAPIMediaType, type OpenAPIOperation, type OpenAPIParameter, type OpenAPIPathItem, type OpenAPIRequestBody, type OpenAPIResponse, type OpenAPISchema, type OpenAPIServer, type OpenAPISpec, type ParsedEndpoint, type ParsedParameter, type ParsedRequestBody, type ProjectConfig, ProjectConfigSchema, PromptGenerator, type ResourceConfig, ResourceConfigSchema, type SpinnerInstance, type ToolConfig, ToolConfigSchema, type ToolParameter, ToolParameterSchema, type Transport, TransportSchema, WizardGenerator, type WizardOptions, addToolCommand, copyDir, copyFile, createCommand, createGeneratorContext, createInitialCommit, createSpinner, endpointToMCPTool, ensureDir, exists, generateFromOpenAPI, generateFromPrompt, generateFromWizard, getGitUser, getTemplateDir, initCommand, initGitRepository, isDirectory, isGitInstalled, isInsideGitRepository, logger, parseAndValidate, parseOpenAPISpec, parsePostmanCollection, parseSwaggerSpec, projectNameRegex, promptAddResources, promptAddTools, promptIncludeExampleTool, promptLanguage, promptMultipleResources, promptMultipleTools, promptProjectDescription, promptProjectName, promptResourceConfig, promptToolConfig, promptTransport, readDir, readFile, remove, renderTemplate, renderTemplateToFile, resolveOutputPath, runQuickWizard, runWizard, safeParseAndValidate, selectEndpoints, validateFilePath, validateProjectName, validateToolName, validateUrl, walkDir, withSpinner, writeFile };
|
|
547
|
+
export { BaseGenerator, type CLIOptions, type GenerationMethod, type GeneratorContext, type Language, LanguageSchema, type MCPPrompt, type MCPPromptArgument, type MCPPropertySchema, type MCPResource, type MCPServerCapabilities, type MCPServerInfo, type MCPTool, type MCPToolInputSchema, type OpenAPIComponents, OpenAPIGenerator, type OpenAPIInfo, type OpenAPIMediaType, type OpenAPIOperation, type OpenAPIParameter, type OpenAPIPathItem, type OpenAPIRequestBody, type OpenAPIResponse, type OpenAPISchema, type OpenAPIServer, type OpenAPISpec, type ParsedEndpoint, type ParsedParameter, type ParsedRequestBody, PresetGenerator, type PresetGeneratorOptions, type PresetId$1 as PresetId, PresetIdSchema, type ProjectConfig, ProjectConfigSchema, PromptGenerator, type ResourceConfig, ResourceConfigSchema, type SpinnerInstance, type ToolConfig, ToolConfigSchema, type ToolParameter, ToolParameterSchema, type Transport, TransportSchema, WizardGenerator, type WizardOptions, addToolCommand, copyDir, copyFile, createCommand, createGeneratorContext, createInitialCommit, createSpinner, endpointToMCPTool, ensureDir, exists, generateFromOpenAPI, generateFromPreset, generateFromPrompt, generateFromWizard, getGitUser, getTemplateDir, initCommand, initGitRepository, isDirectory, isGitInstalled, isInsideGitRepository, logger, parseAndValidate, parseOpenAPISpec, parsePostmanCollection, parseSwaggerSpec, projectNameRegex, promptAddResources, promptAddTools, promptGenerationMethod, promptIncludeExampleTool, promptLanguage, promptMultipleResources, promptMultipleTools, promptPreset, promptProjectDescription, promptProjectName, promptResourceConfig, promptToolConfig, promptTransport, readDir, readFile, remove, renderTemplate, renderTemplateToFile, resolveOutputPath, runQuickWizard, runWizard, safeParseAndValidate, selectEndpoints, validateFilePath, validatePresetId, validateProjectName, validateToolName, validateUrl, walkDir, withSpinner, writeFile };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseGenerator,
|
|
3
3
|
OpenAPIGenerator,
|
|
4
|
+
PresetGenerator,
|
|
4
5
|
PromptGenerator,
|
|
5
6
|
WizardGenerator,
|
|
6
7
|
addToolCommand,
|
|
@@ -14,6 +15,7 @@ import {
|
|
|
14
15
|
ensureDir,
|
|
15
16
|
exists,
|
|
16
17
|
generateFromOpenAPI,
|
|
18
|
+
generateFromPreset,
|
|
17
19
|
generateFromPrompt,
|
|
18
20
|
generateFromWizard,
|
|
19
21
|
getGitUser,
|
|
@@ -29,10 +31,12 @@ import {
|
|
|
29
31
|
projectNameRegex,
|
|
30
32
|
promptAddResources,
|
|
31
33
|
promptAddTools,
|
|
34
|
+
promptGenerationMethod,
|
|
32
35
|
promptIncludeExampleTool,
|
|
33
36
|
promptLanguage,
|
|
34
37
|
promptMultipleResources,
|
|
35
38
|
promptMultipleTools,
|
|
39
|
+
promptPreset,
|
|
36
40
|
promptProjectDescription,
|
|
37
41
|
promptProjectName,
|
|
38
42
|
promptResourceConfig,
|
|
@@ -49,13 +53,14 @@ import {
|
|
|
49
53
|
safeParseAndValidate,
|
|
50
54
|
selectEndpoints,
|
|
51
55
|
validateFilePath,
|
|
56
|
+
validatePresetId,
|
|
52
57
|
validateProjectName,
|
|
53
58
|
validateToolName,
|
|
54
59
|
validateUrl,
|
|
55
60
|
walkDir,
|
|
56
61
|
withSpinner,
|
|
57
62
|
writeFile
|
|
58
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-BHGUGEHE.js";
|
|
59
64
|
|
|
60
65
|
// src/types/config.ts
|
|
61
66
|
import { z } from "zod";
|
|
@@ -89,6 +94,7 @@ var ProjectConfigSchema = z.object({
|
|
|
89
94
|
skipInstall: z.boolean().default(false),
|
|
90
95
|
initGit: z.boolean().default(true)
|
|
91
96
|
});
|
|
97
|
+
var PresetIdSchema = z.enum(["database", "rest-api", "filesystem"]);
|
|
92
98
|
|
|
93
99
|
// src/parsers/swagger.ts
|
|
94
100
|
import YAML from "yaml";
|
|
@@ -287,6 +293,8 @@ export {
|
|
|
287
293
|
BaseGenerator,
|
|
288
294
|
LanguageSchema,
|
|
289
295
|
OpenAPIGenerator,
|
|
296
|
+
PresetGenerator,
|
|
297
|
+
PresetIdSchema,
|
|
290
298
|
ProjectConfigSchema,
|
|
291
299
|
PromptGenerator,
|
|
292
300
|
ResourceConfigSchema,
|
|
@@ -305,6 +313,7 @@ export {
|
|
|
305
313
|
ensureDir,
|
|
306
314
|
exists,
|
|
307
315
|
generateFromOpenAPI,
|
|
316
|
+
generateFromPreset,
|
|
308
317
|
generateFromPrompt,
|
|
309
318
|
generateFromWizard,
|
|
310
319
|
getGitUser,
|
|
@@ -322,10 +331,12 @@ export {
|
|
|
322
331
|
projectNameRegex,
|
|
323
332
|
promptAddResources,
|
|
324
333
|
promptAddTools,
|
|
334
|
+
promptGenerationMethod,
|
|
325
335
|
promptIncludeExampleTool,
|
|
326
336
|
promptLanguage,
|
|
327
337
|
promptMultipleResources,
|
|
328
338
|
promptMultipleTools,
|
|
339
|
+
promptPreset,
|
|
329
340
|
promptProjectDescription,
|
|
330
341
|
promptProjectName,
|
|
331
342
|
promptResourceConfig,
|
|
@@ -342,6 +353,7 @@ export {
|
|
|
342
353
|
safeParseAndValidate,
|
|
343
354
|
selectEndpoints,
|
|
344
355
|
validateFilePath,
|
|
356
|
+
validatePresetId,
|
|
345
357
|
validateProjectName,
|
|
346
358
|
validateToolName,
|
|
347
359
|
validateUrl,
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-new",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "CLI generator for MCP servers. Like create-react-app, but for MCP.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"bin": {
|
|
9
|
-
"mcp-
|
|
9
|
+
"mcp-new": "./bin/mcp-new.js"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"dist",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# <%= name %>
|
|
2
2
|
|
|
3
|
-
<%= description || 'MCP Server generated
|
|
3
|
+
<%= description || 'MCP Server generated with mcp-generator' %>
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
@@ -41,15 +41,78 @@ The server communicates via standard input/output.
|
|
|
41
41
|
The server will start an HTTP server with SSE endpoint.
|
|
42
42
|
<% } %>
|
|
43
43
|
|
|
44
|
+
## Claude Desktop Configuration
|
|
45
|
+
|
|
46
|
+
Add the following to your Claude Desktop config file:
|
|
47
|
+
|
|
48
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
49
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"mcpServers": {
|
|
54
|
+
"<%- name %>": {
|
|
55
|
+
"command": "<%- process.cwd().replace(/\\/g, '/') %>/<%- name %>/<%- name %>"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
44
61
|
## Available Tools
|
|
45
62
|
|
|
46
63
|
<% if (includeExampleTool) { %>
|
|
47
|
-
|
|
64
|
+
### `example_tool`
|
|
65
|
+
|
|
66
|
+
An example tool that echoes the input.
|
|
67
|
+
|
|
68
|
+
| Parameter | Type | Required | Description |
|
|
69
|
+
|-----------|------|----------|-------------|
|
|
70
|
+
| `input` | string | Yes | Input to echo |
|
|
71
|
+
|
|
72
|
+
**Example:**
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"name": "example_tool",
|
|
76
|
+
"arguments": {
|
|
77
|
+
"input": "hello"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
48
82
|
<% } %>
|
|
49
83
|
<% tools.forEach(function(tool) { %>
|
|
50
|
-
|
|
84
|
+
### `<%- tool.name %>`
|
|
85
|
+
|
|
86
|
+
<%= tool.description %>
|
|
87
|
+
|
|
88
|
+
<% if (tool.parameters && tool.parameters.length > 0) { %>
|
|
89
|
+
| Parameter | Type | Required | Description |
|
|
90
|
+
|-----------|------|----------|-------------|
|
|
91
|
+
<% tool.parameters.forEach(function(param) { %>| `<%= param.name %>` | <%= param.type %> | <%= param.required ? 'Yes' : 'No' %> | <%= param.description %> |
|
|
51
92
|
<% }); %>
|
|
52
93
|
|
|
94
|
+
**Example:**
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"name": "<%- tool.name %>",
|
|
98
|
+
"arguments": {
|
|
99
|
+
<% var reqParams = tool.parameters.filter(p => p.required); reqParams.forEach(function(param, index) { var val = param.type === 'string' ? '"value"' : param.type === 'number' ? '0' : param.type === 'boolean' ? 'true' : param.type === 'array' ? '[]' : '{}'; %> "<%- param.name %>": <%- val %><% if (index < reqParams.length - 1) { %>,<% } %>
|
|
100
|
+
<% }); %> }
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
<% } else { %>
|
|
104
|
+
*This tool has no parameters.*
|
|
105
|
+
|
|
106
|
+
**Example:**
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"name": "<%- tool.name %>",
|
|
110
|
+
"arguments": {}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
<% } %>
|
|
114
|
+
|
|
115
|
+
<% }); %>
|
|
53
116
|
## Development
|
|
54
117
|
|
|
55
118
|
```bash
|
|
@@ -72,7 +135,7 @@ npx @modelcontextprotocol/inspector ./<%= name %>
|
|
|
72
135
|
## Project Structure
|
|
73
136
|
|
|
74
137
|
```
|
|
75
|
-
|
|
138
|
+
<%= name %>/
|
|
76
139
|
├── cmd/
|
|
77
140
|
│ └── server/
|
|
78
141
|
│ └── main.go # Server entry point
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# <%= name %>
|
|
2
2
|
|
|
3
|
-
<%= description || 'MCP Server generated
|
|
3
|
+
<%= description || 'MCP Server generated with mcp-generator' %>
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -28,14 +28,12 @@ Or if installed:
|
|
|
28
28
|
<%= name %>
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
## Configuration
|
|
31
|
+
## Claude Desktop Configuration
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Add the following to your Claude Desktop config file:
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
38
|
-
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
35
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
36
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
39
37
|
|
|
40
38
|
```json
|
|
41
39
|
{
|
|
@@ -43,7 +41,7 @@ Add this to your Claude Desktop config file:
|
|
|
43
41
|
"<%= name %>": {
|
|
44
42
|
"command": "python",
|
|
45
43
|
"args": ["-m", "src.server"],
|
|
46
|
-
"cwd": "
|
|
44
|
+
"cwd": "<%= process.cwd().replace(/\\/g, '/') %>/<%= name %>"
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
47
|
}
|
|
@@ -52,26 +50,71 @@ Add this to your Claude Desktop config file:
|
|
|
52
50
|
## Available Tools
|
|
53
51
|
|
|
54
52
|
<% if (includeExampleTool) { %>
|
|
55
|
-
### example_tool
|
|
53
|
+
### `example_tool`
|
|
56
54
|
|
|
57
55
|
A sample tool that demonstrates basic MCP tool functionality.
|
|
58
56
|
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
| Parameter | Type | Required | Description |
|
|
58
|
+
|-----------|------|----------|-------------|
|
|
59
|
+
| `query` | string | Yes | The query parameter |
|
|
60
|
+
|
|
61
|
+
**Example:**
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"name": "example_tool",
|
|
65
|
+
"arguments": {
|
|
66
|
+
"query": "hello world"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
61
70
|
|
|
62
71
|
<% } %>
|
|
63
72
|
<% tools.forEach(function(tool) { %>
|
|
64
|
-
###
|
|
73
|
+
### `<%= tool.name %>`
|
|
65
74
|
|
|
66
75
|
<%= tool.description %>
|
|
67
76
|
|
|
68
77
|
<% if (tool.parameters && tool.parameters.length > 0) { %>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
78
|
+
| Parameter | Type | Required | Description |
|
|
79
|
+
|-----------|------|----------|-------------|
|
|
80
|
+
<% tool.parameters.forEach(function(param) { %>| `<%= param.name %>` | <%= param.type %> | <%= param.required ? 'Yes' : 'No' %> | <%= param.description %> |
|
|
72
81
|
<% }); %>
|
|
82
|
+
|
|
83
|
+
**Example:**
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"name": "<%- tool.name %>",
|
|
87
|
+
"arguments": {
|
|
88
|
+
<% var reqParams = tool.parameters.filter(p => p.required); reqParams.forEach(function(param, index) { var val = param.type === 'string' ? '"value"' : param.type === 'number' ? '0' : param.type === 'boolean' ? 'true' : param.type === 'array' ? '[]' : '{}'; %> "<%- param.name %>": <%- val %><% if (index < reqParams.length - 1) { %>,<% } %>
|
|
89
|
+
<% }); %> }
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
<% } else { %>
|
|
93
|
+
*This tool has no parameters.*
|
|
94
|
+
|
|
95
|
+
**Example:**
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"name": "<%= tool.name %>",
|
|
99
|
+
"arguments": {}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
73
102
|
<% } %>
|
|
103
|
+
|
|
74
104
|
<% }); %>
|
|
105
|
+
## Project Structure
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
<%= name %>/
|
|
109
|
+
├── src/
|
|
110
|
+
│ ├── __init__.py
|
|
111
|
+
│ ├── server.py # Main server file
|
|
112
|
+
│ └── tools/
|
|
113
|
+
│ └── __init__.py
|
|
114
|
+
├── pyproject.toml
|
|
115
|
+
├── requirements.txt
|
|
116
|
+
└── README.md
|
|
117
|
+
```
|
|
75
118
|
|
|
76
119
|
## License
|
|
77
120
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# <%= name %>
|
|
2
2
|
|
|
3
|
-
<%= description || 'MCP Server generated
|
|
3
|
+
<%= description || 'MCP Server generated with mcp-generator' %>
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
@@ -42,15 +42,78 @@ cargo run --release
|
|
|
42
42
|
The server will start an HTTP server with SSE endpoint on port 8080.
|
|
43
43
|
<% } %>
|
|
44
44
|
|
|
45
|
+
## Claude Desktop Configuration
|
|
46
|
+
|
|
47
|
+
Add the following to your Claude Desktop config file:
|
|
48
|
+
|
|
49
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
50
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"mcpServers": {
|
|
55
|
+
"<%- name %>": {
|
|
56
|
+
"command": "<%- process.cwd().replace(/\\/g, '/') %>/<%- name %>/target/release/<%- name %>"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
45
62
|
## Available Tools
|
|
46
63
|
|
|
47
64
|
<% if (includeExampleTool) { %>
|
|
48
|
-
|
|
65
|
+
### `example_tool`
|
|
66
|
+
|
|
67
|
+
An example tool that echoes the input.
|
|
68
|
+
|
|
69
|
+
| Parameter | Type | Required | Description |
|
|
70
|
+
|-----------|------|----------|-------------|
|
|
71
|
+
| `input` | string | Yes | Input to echo |
|
|
72
|
+
|
|
73
|
+
**Example:**
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"name": "example_tool",
|
|
77
|
+
"arguments": {
|
|
78
|
+
"input": "hello"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
49
83
|
<% } %>
|
|
50
84
|
<% tools.forEach(function(tool) { %>
|
|
51
|
-
|
|
85
|
+
### `<%- tool.name %>`
|
|
86
|
+
|
|
87
|
+
<%= tool.description %>
|
|
88
|
+
|
|
89
|
+
<% if (tool.parameters && tool.parameters.length > 0) { %>
|
|
90
|
+
| Parameter | Type | Required | Description |
|
|
91
|
+
|-----------|------|----------|-------------|
|
|
92
|
+
<% tool.parameters.forEach(function(param) { %>| `<%= param.name %>` | <%= param.type %> | <%= param.required ? 'Yes' : 'No' %> | <%= param.description %> |
|
|
52
93
|
<% }); %>
|
|
53
94
|
|
|
95
|
+
**Example:**
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"name": "<%- tool.name %>",
|
|
99
|
+
"arguments": {
|
|
100
|
+
<% var reqParams = tool.parameters.filter(p => p.required); reqParams.forEach(function(param, index) { var val = param.type === 'string' ? '"value"' : param.type === 'number' ? '0' : param.type === 'boolean' ? 'true' : param.type === 'array' ? '[]' : '{}'; %> "<%- param.name %>": <%- val %><% if (index < reqParams.length - 1) { %>,<% } %>
|
|
101
|
+
<% }); %> }
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
<% } else { %>
|
|
105
|
+
*This tool has no parameters.*
|
|
106
|
+
|
|
107
|
+
**Example:**
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"name": "<%- tool.name %>",
|
|
111
|
+
"arguments": {}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
<% } %>
|
|
115
|
+
|
|
116
|
+
<% }); %>
|
|
54
117
|
## Development
|
|
55
118
|
|
|
56
119
|
```bash
|
|
@@ -79,7 +142,7 @@ npx @modelcontextprotocol/inspector ./target/release/<%= name %>
|
|
|
79
142
|
## Project Structure
|
|
80
143
|
|
|
81
144
|
```
|
|
82
|
-
|
|
145
|
+
<%= name %>/
|
|
83
146
|
├── src/
|
|
84
147
|
│ ├── main.rs # Server entry point
|
|
85
148
|
│ └── tools.rs # Tool implementations
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# <%= name %>
|
|
2
2
|
|
|
3
|
-
<%= description || 'MCP Server generated
|
|
3
|
+
<%= description || 'MCP Server generated with mcp-generator' %>
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -29,21 +29,19 @@ npm run dev
|
|
|
29
29
|
npm run inspector
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
## Configuration
|
|
32
|
+
## Claude Desktop Configuration
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
Add the following to your Claude Desktop config file:
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
39
|
-
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
36
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
37
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
40
38
|
|
|
41
39
|
```json
|
|
42
40
|
{
|
|
43
41
|
"mcpServers": {
|
|
44
42
|
"<%= name %>": {
|
|
45
43
|
"command": "node",
|
|
46
|
-
"args": ["
|
|
44
|
+
"args": ["<%= process.cwd().replace(/\\/g, '/') %>/<%= name %>/dist/index.js"]
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
47
|
}
|
|
@@ -52,26 +50,69 @@ Add this to your Claude Desktop config file:
|
|
|
52
50
|
## Available Tools
|
|
53
51
|
|
|
54
52
|
<% if (includeExampleTool) { %>
|
|
55
|
-
### example_tool
|
|
53
|
+
### `example_tool`
|
|
56
54
|
|
|
57
55
|
A sample tool that demonstrates basic MCP tool functionality.
|
|
58
56
|
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
| Parameter | Type | Required | Description |
|
|
58
|
+
|-----------|------|----------|-------------|
|
|
59
|
+
| `query` | string | Yes | The query parameter |
|
|
60
|
+
|
|
61
|
+
**Example:**
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"name": "example_tool",
|
|
65
|
+
"arguments": {
|
|
66
|
+
"query": "hello world"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
61
70
|
|
|
62
71
|
<% } %>
|
|
63
72
|
<% tools.forEach(function(tool) { %>
|
|
64
|
-
###
|
|
73
|
+
### `<%= tool.name %>`
|
|
65
74
|
|
|
66
75
|
<%= tool.description %>
|
|
67
76
|
|
|
68
77
|
<% if (tool.parameters && tool.parameters.length > 0) { %>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
78
|
+
| Parameter | Type | Required | Description |
|
|
79
|
+
|-----------|------|----------|-------------|
|
|
80
|
+
<% tool.parameters.forEach(function(param) { %>| `<%= param.name %>` | <%= param.type %> | <%= param.required ? 'Yes' : 'No' %> | <%= param.description %> |
|
|
72
81
|
<% }); %>
|
|
82
|
+
|
|
83
|
+
**Example:**
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"name": "<%- tool.name %>",
|
|
87
|
+
"arguments": {
|
|
88
|
+
<% var reqParams = tool.parameters.filter(p => p.required); reqParams.forEach(function(param, index) { var val = param.type === 'string' ? '"value"' : param.type === 'number' ? '0' : param.type === 'boolean' ? 'true' : param.type === 'array' ? '[]' : '{}'; %> "<%- param.name %>": <%- val %><% if (index < reqParams.length - 1) { %>,<% } %>
|
|
89
|
+
<% }); %> }
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
<% } else { %>
|
|
93
|
+
*This tool has no parameters.*
|
|
94
|
+
|
|
95
|
+
**Example:**
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"name": "<%= tool.name %>",
|
|
99
|
+
"arguments": {}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
73
102
|
<% } %>
|
|
103
|
+
|
|
74
104
|
<% }); %>
|
|
105
|
+
## Project Structure
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
<%= name %>/
|
|
109
|
+
├── src/
|
|
110
|
+
│ └── index.ts # Main server file
|
|
111
|
+
├── dist/ # Compiled output
|
|
112
|
+
├── package.json
|
|
113
|
+
├── tsconfig.json
|
|
114
|
+
└── README.md
|
|
115
|
+
```
|
|
75
116
|
|
|
76
117
|
## License
|
|
77
118
|
|
|
File without changes
|