@stackguide/mcp-server 3.2.0 → 3.8.1
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 +315 -9
- package/dist/config/persistence.d.ts +16 -0
- package/dist/config/persistence.d.ts.map +1 -1
- package/dist/config/persistence.js +53 -0
- package/dist/config/persistence.js.map +1 -1
- package/dist/handlers/analyze.d.ts +11 -0
- package/dist/handlers/analyze.d.ts.map +1 -0
- package/dist/handlers/analyze.js +274 -0
- package/dist/handlers/analyze.js.map +1 -0
- package/dist/handlers/config.d.ts +1 -8
- package/dist/handlers/config.d.ts.map +1 -1
- package/dist/handlers/config.js +7 -1
- package/dist/handlers/config.js.map +1 -1
- package/dist/handlers/context.d.ts +1 -5
- package/dist/handlers/context.d.ts.map +1 -1
- package/dist/handlers/context.js +7 -1
- package/dist/handlers/context.js.map +1 -1
- package/dist/handlers/cursor.d.ts +1 -7
- package/dist/handlers/cursor.d.ts.map +1 -1
- package/dist/handlers/cursor.js +7 -1
- package/dist/handlers/cursor.js.map +1 -1
- package/dist/handlers/custom-rule.d.ts +1 -11
- package/dist/handlers/custom-rule.d.ts.map +1 -1
- package/dist/handlers/custom-rule.js +7 -1
- package/dist/handlers/custom-rule.js.map +1 -1
- package/dist/handlers/docs.d.ts +1 -8
- package/dist/handlers/docs.d.ts.map +1 -1
- package/dist/handlers/docs.js +7 -1
- package/dist/handlers/docs.js.map +1 -1
- package/dist/handlers/generate.d.ts +1 -13
- package/dist/handlers/generate.d.ts.map +1 -1
- package/dist/handlers/generate.js +6 -3
- package/dist/handlers/generate.js.map +1 -1
- package/dist/handlers/health.d.ts +1 -8
- package/dist/handlers/health.d.ts.map +1 -1
- package/dist/handlers/health.js +11 -3
- package/dist/handlers/health.js.map +1 -1
- package/dist/handlers/help.d.ts +1 -5
- package/dist/handlers/help.d.ts.map +1 -1
- package/dist/handlers/help.js +7 -1
- package/dist/handlers/help.js.map +1 -1
- package/dist/handlers/index.d.ts +1 -0
- package/dist/handlers/index.d.ts.map +1 -1
- package/dist/handlers/index.js +1 -0
- package/dist/handlers/index.js.map +1 -1
- package/dist/handlers/knowledge.d.ts +1 -8
- package/dist/handlers/knowledge.d.ts.map +1 -1
- package/dist/handlers/knowledge.js +7 -1
- package/dist/handlers/knowledge.js.map +1 -1
- package/dist/handlers/prompts.d.ts +31 -0
- package/dist/handlers/prompts.d.ts.map +1 -0
- package/dist/handlers/prompts.js +225 -0
- package/dist/handlers/prompts.js.map +1 -0
- package/dist/handlers/resources.d.ts +27 -0
- package/dist/handlers/resources.d.ts.map +1 -0
- package/dist/handlers/resources.js +210 -0
- package/dist/handlers/resources.js.map +1 -0
- package/dist/handlers/review.d.ts.map +1 -1
- package/dist/handlers/review.js +18 -1
- package/dist/handlers/review.js.map +1 -1
- package/dist/handlers/rules.d.ts +1 -9
- package/dist/handlers/rules.d.ts.map +1 -1
- package/dist/handlers/rules.js +7 -1
- package/dist/handlers/rules.js.map +1 -1
- package/dist/handlers/setup.d.ts +1 -0
- package/dist/handlers/setup.d.ts.map +1 -1
- package/dist/handlers/setup.js +42 -0
- package/dist/handlers/setup.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -417
- package/dist/index.js.map +1 -1
- package/dist/router/index.d.ts +69 -0
- package/dist/router/index.d.ts.map +1 -0
- package/dist/router/index.js +151 -0
- package/dist/router/index.js.map +1 -0
- package/dist/services/ast/analyzer.d.ts +55 -0
- package/dist/services/ast/analyzer.d.ts.map +1 -0
- package/dist/services/ast/analyzer.js +268 -0
- package/dist/services/ast/analyzer.js.map +1 -0
- package/dist/services/ast/index.d.ts +10 -0
- package/dist/services/ast/index.d.ts.map +1 -0
- package/dist/services/ast/index.js +12 -0
- package/dist/services/ast/index.js.map +1 -0
- package/dist/services/ast/rules.d.ts +13 -0
- package/dist/services/ast/rules.d.ts.map +1 -0
- package/dist/services/ast/rules.js +358 -0
- package/dist/services/ast/rules.js.map +1 -0
- package/dist/services/ast/treeSitterParser.d.ts +54 -0
- package/dist/services/ast/treeSitterParser.d.ts.map +1 -0
- package/dist/services/ast/treeSitterParser.js +394 -0
- package/dist/services/ast/treeSitterParser.js.map +1 -0
- package/dist/services/ast/types.d.ts +167 -0
- package/dist/services/ast/types.d.ts.map +1 -0
- package/dist/services/ast/types.js +35 -0
- package/dist/services/ast/types.js.map +1 -0
- package/dist/services/codeAnalyzer.d.ts.map +1 -1
- package/dist/services/codeAnalyzer.js +43 -3
- package/dist/services/codeAnalyzer.js.map +1 -1
- package/dist/services/httpClient.d.ts +45 -0
- package/dist/services/httpClient.d.ts.map +1 -0
- package/dist/services/httpClient.js +309 -0
- package/dist/services/httpClient.js.map +1 -0
- package/dist/services/intelligence/configGenerator.d.ts +28 -0
- package/dist/services/intelligence/configGenerator.d.ts.map +1 -0
- package/dist/services/intelligence/configGenerator.js +404 -0
- package/dist/services/intelligence/configGenerator.js.map +1 -0
- package/dist/services/intelligence/dependencyAdvisor.d.ts +24 -0
- package/dist/services/intelligence/dependencyAdvisor.d.ts.map +1 -0
- package/dist/services/intelligence/dependencyAdvisor.js +404 -0
- package/dist/services/intelligence/dependencyAdvisor.js.map +1 -0
- package/dist/services/intelligence/index.d.ts +12 -0
- package/dist/services/intelligence/index.d.ts.map +1 -0
- package/dist/services/intelligence/index.js +16 -0
- package/dist/services/intelligence/index.js.map +1 -0
- package/dist/services/intelligence/projectFs.d.ts +11 -0
- package/dist/services/intelligence/projectFs.d.ts.map +1 -0
- package/dist/services/intelligence/projectFs.js +30 -0
- package/dist/services/intelligence/projectFs.js.map +1 -0
- package/dist/services/intelligence/projectIntelligence.d.ts +26 -0
- package/dist/services/intelligence/projectIntelligence.d.ts.map +1 -0
- package/dist/services/intelligence/projectIntelligence.js +344 -0
- package/dist/services/intelligence/projectIntelligence.js.map +1 -0
- package/dist/services/intelligence/structureAnalyzer.d.ts +27 -0
- package/dist/services/intelligence/structureAnalyzer.d.ts.map +1 -0
- package/dist/services/intelligence/structureAnalyzer.js +286 -0
- package/dist/services/intelligence/structureAnalyzer.js.map +1 -0
- package/dist/services/intelligence/templates.d.ts +22 -0
- package/dist/services/intelligence/templates.d.ts.map +1 -0
- package/dist/services/intelligence/templates.js +521 -0
- package/dist/services/intelligence/templates.js.map +1 -0
- package/dist/services/intelligence/types.d.ts +222 -0
- package/dist/services/intelligence/types.d.ts.map +1 -0
- package/dist/services/intelligence/types.js +7 -0
- package/dist/services/intelligence/types.js.map +1 -0
- package/dist/services/projectFs.d.ts +85 -0
- package/dist/services/projectFs.d.ts.map +1 -0
- package/dist/services/projectFs.js +287 -0
- package/dist/services/projectFs.js.map +1 -0
- package/dist/services/rulesEngine.d.ts +255 -0
- package/dist/services/rulesEngine.d.ts.map +1 -0
- package/dist/services/rulesEngine.js +483 -0
- package/dist/services/rulesEngine.js.map +1 -0
- package/dist/services/webDocumentation.d.ts +9 -0
- package/dist/services/webDocumentation.d.ts.map +1 -1
- package/dist/services/webDocumentation.js +144 -1
- package/dist/services/webDocumentation.js.map +1 -1
- package/dist/storage/index.d.ts +7 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +7 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/sqlite.d.ts +92 -0
- package/dist/storage/sqlite.d.ts.map +1 -0
- package/dist/storage/sqlite.js +471 -0
- package/dist/storage/sqlite.js.map +1 -0
- package/dist/storage/types.d.ts +147 -0
- package/dist/storage/types.d.ts.map +1 -0
- package/dist/storage/types.js +13 -0
- package/dist/storage/types.js.map +1 -0
- package/dist/tools/definitions.d.ts +87 -0
- package/dist/tools/definitions.d.ts.map +1 -1
- package/dist/tools/definitions.js +34 -0
- package/dist/tools/definitions.js.map +1 -1
- package/dist/utils/logger.d.ts +11 -2
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +30 -2
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/validation.d.ts +3 -3
- package/dist/validation/index.d.ts +8 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +19 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/schemas.d.ts +341 -0
- package/dist/validation/schemas.d.ts.map +1 -0
- package/dist/validation/schemas.js +244 -0
- package/dist/validation/schemas.js.map +1 -0
- package/package.json +9 -2
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod Validation Schemas
|
|
3
|
+
* Centralized input validation for all MCP handlers
|
|
4
|
+
* @version 3.6.0
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
/** Project type enum */
|
|
8
|
+
export declare const ProjectTypeSchema: z.ZodEnum<["react-typescript", "react-node", "vue-node", "nextjs", "nestjs", "express", "rails", "laravel", "golang", "rust", "python-fastapi", "python-django", "python-flask", "custom"]>;
|
|
9
|
+
export type ProjectType = z.infer<typeof ProjectTypeSchema>;
|
|
10
|
+
/** Severity level enum */
|
|
11
|
+
export declare const SeveritySchema: z.ZodEnum<["error", "warning", "info", "suggestion"]>;
|
|
12
|
+
export type Severity = z.infer<typeof SeveritySchema>;
|
|
13
|
+
/** File path validation */
|
|
14
|
+
export declare const FilePathSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
15
|
+
/** URL validation */
|
|
16
|
+
export declare const UrlSchema: z.ZodString;
|
|
17
|
+
/** Safe string (no special chars that could cause issues) */
|
|
18
|
+
export declare const SafeStringSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
19
|
+
/** Identifier (alphanumeric + dash/underscore) */
|
|
20
|
+
export declare const IdentifierSchema: z.ZodString;
|
|
21
|
+
/** setup handler input */
|
|
22
|
+
export declare const SetupInputSchema: z.ZodObject<{
|
|
23
|
+
type: z.ZodOptional<z.ZodEnum<["react-typescript", "react-node", "vue-node", "nextjs", "nestjs", "express", "rails", "laravel", "golang", "rust", "python-fastapi", "python-django", "python-flask", "custom"]>>;
|
|
24
|
+
path: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
25
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
26
|
+
type: z.ZodOptional<z.ZodEnum<["react-typescript", "react-node", "vue-node", "nextjs", "nestjs", "express", "rails", "laravel", "golang", "rust", "python-fastapi", "python-django", "python-flask", "custom"]>>;
|
|
27
|
+
path: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
28
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
29
|
+
type: z.ZodOptional<z.ZodEnum<["react-typescript", "react-node", "vue-node", "nextjs", "nestjs", "express", "rails", "laravel", "golang", "rust", "python-fastapi", "python-django", "python-flask", "custom"]>>;
|
|
30
|
+
path: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
31
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
32
|
+
export type SetupInput = z.infer<typeof SetupInputSchema>;
|
|
33
|
+
/** rules handler input */
|
|
34
|
+
export declare const RulesInputSchema: z.ZodObject<{
|
|
35
|
+
action: z.ZodDefault<z.ZodOptional<z.ZodEnum<["list", "search", "get", "select"]>>>;
|
|
36
|
+
query: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
37
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
38
|
+
category: z.ZodOptional<z.ZodEnum<["security", "performance", "best-practices", "coding-standards", "architecture", "testing"]>>;
|
|
39
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
40
|
+
action: z.ZodDefault<z.ZodOptional<z.ZodEnum<["list", "search", "get", "select"]>>>;
|
|
41
|
+
query: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
42
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
43
|
+
category: z.ZodOptional<z.ZodEnum<["security", "performance", "best-practices", "coding-standards", "architecture", "testing"]>>;
|
|
44
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
45
|
+
action: z.ZodDefault<z.ZodOptional<z.ZodEnum<["list", "search", "get", "select"]>>>;
|
|
46
|
+
query: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
47
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
48
|
+
category: z.ZodOptional<z.ZodEnum<["security", "performance", "best-practices", "coding-standards", "architecture", "testing"]>>;
|
|
49
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
50
|
+
export type RulesInput = z.infer<typeof RulesInputSchema>;
|
|
51
|
+
/** knowledge handler input */
|
|
52
|
+
export declare const KnowledgeInputSchema: z.ZodObject<{
|
|
53
|
+
action: z.ZodDefault<z.ZodOptional<z.ZodEnum<["list", "search", "get"]>>>;
|
|
54
|
+
query: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
55
|
+
category: z.ZodOptional<z.ZodEnum<["patterns", "common-issues", "architecture", "workflows"]>>;
|
|
56
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
57
|
+
action: z.ZodDefault<z.ZodOptional<z.ZodEnum<["list", "search", "get"]>>>;
|
|
58
|
+
query: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
59
|
+
category: z.ZodOptional<z.ZodEnum<["patterns", "common-issues", "architecture", "workflows"]>>;
|
|
60
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
61
|
+
action: z.ZodDefault<z.ZodOptional<z.ZodEnum<["list", "search", "get"]>>>;
|
|
62
|
+
query: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
63
|
+
category: z.ZodOptional<z.ZodEnum<["patterns", "common-issues", "architecture", "workflows"]>>;
|
|
64
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
65
|
+
export type KnowledgeInput = z.infer<typeof KnowledgeInputSchema>;
|
|
66
|
+
/** review handler input */
|
|
67
|
+
export declare const ReviewInputSchema: z.ZodObject<{
|
|
68
|
+
file: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
69
|
+
url: z.ZodOptional<z.ZodString>;
|
|
70
|
+
project: z.ZodOptional<z.ZodBoolean>;
|
|
71
|
+
focus: z.ZodDefault<z.ZodOptional<z.ZodEnum<["all", "security", "performance", "architecture", "coding-standards"]>>>;
|
|
72
|
+
incremental: z.ZodOptional<z.ZodBoolean>;
|
|
73
|
+
maxDepth: z.ZodOptional<z.ZodNumber>;
|
|
74
|
+
maxFiles: z.ZodOptional<z.ZodNumber>;
|
|
75
|
+
useCache: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
77
|
+
file: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
78
|
+
url: z.ZodOptional<z.ZodString>;
|
|
79
|
+
project: z.ZodOptional<z.ZodBoolean>;
|
|
80
|
+
focus: z.ZodDefault<z.ZodOptional<z.ZodEnum<["all", "security", "performance", "architecture", "coding-standards"]>>>;
|
|
81
|
+
incremental: z.ZodOptional<z.ZodBoolean>;
|
|
82
|
+
maxDepth: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
maxFiles: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
useCache: z.ZodOptional<z.ZodBoolean>;
|
|
85
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
86
|
+
file: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
87
|
+
url: z.ZodOptional<z.ZodString>;
|
|
88
|
+
project: z.ZodOptional<z.ZodBoolean>;
|
|
89
|
+
focus: z.ZodDefault<z.ZodOptional<z.ZodEnum<["all", "security", "performance", "architecture", "coding-standards"]>>>;
|
|
90
|
+
incremental: z.ZodOptional<z.ZodBoolean>;
|
|
91
|
+
maxDepth: z.ZodOptional<z.ZodNumber>;
|
|
92
|
+
maxFiles: z.ZodOptional<z.ZodNumber>;
|
|
93
|
+
useCache: z.ZodOptional<z.ZodBoolean>;
|
|
94
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
95
|
+
export type ReviewInput = z.infer<typeof ReviewInputSchema>;
|
|
96
|
+
/** context handler input */
|
|
97
|
+
export declare const ContextInputSchema: z.ZodObject<{
|
|
98
|
+
full: z.ZodOptional<z.ZodBoolean>;
|
|
99
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
100
|
+
full: z.ZodOptional<z.ZodBoolean>;
|
|
101
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
102
|
+
full: z.ZodOptional<z.ZodBoolean>;
|
|
103
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
104
|
+
export type ContextInput = z.infer<typeof ContextInputSchema>;
|
|
105
|
+
/** docs handler input */
|
|
106
|
+
export declare const DocsInputSchema: z.ZodObject<{
|
|
107
|
+
action: z.ZodDefault<z.ZodOptional<z.ZodEnum<["fetch", "search", "list", "get", "remove", "suggest"]>>>;
|
|
108
|
+
url: z.ZodOptional<z.ZodString>;
|
|
109
|
+
urls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
110
|
+
query: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
111
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
112
|
+
action: z.ZodDefault<z.ZodOptional<z.ZodEnum<["fetch", "search", "list", "get", "remove", "suggest"]>>>;
|
|
113
|
+
url: z.ZodOptional<z.ZodString>;
|
|
114
|
+
urls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
115
|
+
query: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
116
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
117
|
+
action: z.ZodDefault<z.ZodOptional<z.ZodEnum<["fetch", "search", "list", "get", "remove", "suggest"]>>>;
|
|
118
|
+
url: z.ZodOptional<z.ZodString>;
|
|
119
|
+
urls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
120
|
+
query: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
121
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
122
|
+
export type DocsInput = z.infer<typeof DocsInputSchema>;
|
|
123
|
+
/** cursor handler input */
|
|
124
|
+
export declare const CursorInputSchema: z.ZodObject<{
|
|
125
|
+
action: z.ZodDefault<z.ZodOptional<z.ZodEnum<["browse", "search", "popular", "import", "categories"]>>>;
|
|
126
|
+
query: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
127
|
+
slug: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
128
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
129
|
+
action: z.ZodDefault<z.ZodOptional<z.ZodEnum<["browse", "search", "popular", "import", "categories"]>>>;
|
|
130
|
+
query: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
131
|
+
slug: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
132
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
133
|
+
action: z.ZodDefault<z.ZodOptional<z.ZodEnum<["browse", "search", "popular", "import", "categories"]>>>;
|
|
134
|
+
query: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
135
|
+
slug: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
136
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
137
|
+
export type CursorInput = z.infer<typeof CursorInputSchema>;
|
|
138
|
+
/** config handler input */
|
|
139
|
+
export declare const ConfigInputSchema: z.ZodObject<{
|
|
140
|
+
action: z.ZodDefault<z.ZodOptional<z.ZodEnum<["save", "load", "list", "delete", "export", "import"]>>>;
|
|
141
|
+
name: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
142
|
+
id: z.ZodOptional<z.ZodString>;
|
|
143
|
+
json: z.ZodOptional<z.ZodString>;
|
|
144
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
145
|
+
action: z.ZodDefault<z.ZodOptional<z.ZodEnum<["save", "load", "list", "delete", "export", "import"]>>>;
|
|
146
|
+
name: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
147
|
+
id: z.ZodOptional<z.ZodString>;
|
|
148
|
+
json: z.ZodOptional<z.ZodString>;
|
|
149
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
150
|
+
action: z.ZodDefault<z.ZodOptional<z.ZodEnum<["save", "load", "list", "delete", "export", "import"]>>>;
|
|
151
|
+
name: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
152
|
+
id: z.ZodOptional<z.ZodString>;
|
|
153
|
+
json: z.ZodOptional<z.ZodString>;
|
|
154
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
155
|
+
export type ConfigInput = z.infer<typeof ConfigInputSchema>;
|
|
156
|
+
/** custom-rule handler input */
|
|
157
|
+
export declare const CustomRuleInputSchema: z.ZodObject<{
|
|
158
|
+
action: z.ZodDefault<z.ZodOptional<z.ZodEnum<["create", "update", "delete", "list", "export", "import"]>>>;
|
|
159
|
+
name: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
160
|
+
content: z.ZodOptional<z.ZodString>;
|
|
161
|
+
category: z.ZodOptional<z.ZodEnum<["security", "performance", "best-practices", "coding-standards", "architecture"]>>;
|
|
162
|
+
id: z.ZodOptional<z.ZodString>;
|
|
163
|
+
json: z.ZodOptional<z.ZodString>;
|
|
164
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
165
|
+
action: z.ZodDefault<z.ZodOptional<z.ZodEnum<["create", "update", "delete", "list", "export", "import"]>>>;
|
|
166
|
+
name: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
167
|
+
content: z.ZodOptional<z.ZodString>;
|
|
168
|
+
category: z.ZodOptional<z.ZodEnum<["security", "performance", "best-practices", "coding-standards", "architecture"]>>;
|
|
169
|
+
id: z.ZodOptional<z.ZodString>;
|
|
170
|
+
json: z.ZodOptional<z.ZodString>;
|
|
171
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
172
|
+
action: z.ZodDefault<z.ZodOptional<z.ZodEnum<["create", "update", "delete", "list", "export", "import"]>>>;
|
|
173
|
+
name: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
174
|
+
content: z.ZodOptional<z.ZodString>;
|
|
175
|
+
category: z.ZodOptional<z.ZodEnum<["security", "performance", "best-practices", "coding-standards", "architecture"]>>;
|
|
176
|
+
id: z.ZodOptional<z.ZodString>;
|
|
177
|
+
json: z.ZodOptional<z.ZodString>;
|
|
178
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
179
|
+
export type CustomRuleInput = z.infer<typeof CustomRuleInputSchema>;
|
|
180
|
+
/** generate handler input */
|
|
181
|
+
export declare const GenerateInputSchema: z.ZodObject<{
|
|
182
|
+
type: z.ZodEnum<["component", "hook", "service", "test", "api", "model", "util"]>;
|
|
183
|
+
name: z.ZodString;
|
|
184
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
185
|
+
typescript: z.ZodOptional<z.ZodBoolean>;
|
|
186
|
+
withTests: z.ZodOptional<z.ZodBoolean>;
|
|
187
|
+
withStyles: z.ZodOptional<z.ZodBoolean>;
|
|
188
|
+
framework: z.ZodOptional<z.ZodString>;
|
|
189
|
+
scanProject: z.ZodOptional<z.ZodBoolean>;
|
|
190
|
+
}, "strip", z.ZodTypeAny, {
|
|
191
|
+
typescript?: boolean | undefined;
|
|
192
|
+
withTests?: boolean | undefined;
|
|
193
|
+
withStyles?: boolean | undefined;
|
|
194
|
+
framework?: string | undefined;
|
|
195
|
+
scanProject?: boolean | undefined;
|
|
196
|
+
}, {
|
|
197
|
+
typescript?: boolean | undefined;
|
|
198
|
+
withTests?: boolean | undefined;
|
|
199
|
+
withStyles?: boolean | undefined;
|
|
200
|
+
framework?: string | undefined;
|
|
201
|
+
scanProject?: boolean | undefined;
|
|
202
|
+
}>>;
|
|
203
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
204
|
+
type: z.ZodEnum<["component", "hook", "service", "test", "api", "model", "util"]>;
|
|
205
|
+
name: z.ZodString;
|
|
206
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
207
|
+
typescript: z.ZodOptional<z.ZodBoolean>;
|
|
208
|
+
withTests: z.ZodOptional<z.ZodBoolean>;
|
|
209
|
+
withStyles: z.ZodOptional<z.ZodBoolean>;
|
|
210
|
+
framework: z.ZodOptional<z.ZodString>;
|
|
211
|
+
scanProject: z.ZodOptional<z.ZodBoolean>;
|
|
212
|
+
}, "strip", z.ZodTypeAny, {
|
|
213
|
+
typescript?: boolean | undefined;
|
|
214
|
+
withTests?: boolean | undefined;
|
|
215
|
+
withStyles?: boolean | undefined;
|
|
216
|
+
framework?: string | undefined;
|
|
217
|
+
scanProject?: boolean | undefined;
|
|
218
|
+
}, {
|
|
219
|
+
typescript?: boolean | undefined;
|
|
220
|
+
withTests?: boolean | undefined;
|
|
221
|
+
withStyles?: boolean | undefined;
|
|
222
|
+
framework?: string | undefined;
|
|
223
|
+
scanProject?: boolean | undefined;
|
|
224
|
+
}>>;
|
|
225
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
226
|
+
type: z.ZodEnum<["component", "hook", "service", "test", "api", "model", "util"]>;
|
|
227
|
+
name: z.ZodString;
|
|
228
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
229
|
+
typescript: z.ZodOptional<z.ZodBoolean>;
|
|
230
|
+
withTests: z.ZodOptional<z.ZodBoolean>;
|
|
231
|
+
withStyles: z.ZodOptional<z.ZodBoolean>;
|
|
232
|
+
framework: z.ZodOptional<z.ZodString>;
|
|
233
|
+
scanProject: z.ZodOptional<z.ZodBoolean>;
|
|
234
|
+
}, "strip", z.ZodTypeAny, {
|
|
235
|
+
typescript?: boolean | undefined;
|
|
236
|
+
withTests?: boolean | undefined;
|
|
237
|
+
withStyles?: boolean | undefined;
|
|
238
|
+
framework?: string | undefined;
|
|
239
|
+
scanProject?: boolean | undefined;
|
|
240
|
+
}, {
|
|
241
|
+
typescript?: boolean | undefined;
|
|
242
|
+
withTests?: boolean | undefined;
|
|
243
|
+
withStyles?: boolean | undefined;
|
|
244
|
+
framework?: string | undefined;
|
|
245
|
+
scanProject?: boolean | undefined;
|
|
246
|
+
}>>;
|
|
247
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
248
|
+
export type GenerateInput = z.infer<typeof GenerateInputSchema>;
|
|
249
|
+
/** health handler input */
|
|
250
|
+
export declare const HealthInputSchema: z.ZodObject<{
|
|
251
|
+
detailed: z.ZodOptional<z.ZodBoolean>;
|
|
252
|
+
path: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
253
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
254
|
+
detailed: z.ZodOptional<z.ZodBoolean>;
|
|
255
|
+
path: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
256
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
257
|
+
detailed: z.ZodOptional<z.ZodBoolean>;
|
|
258
|
+
path: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
259
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
260
|
+
export type HealthInput = z.infer<typeof HealthInputSchema>;
|
|
261
|
+
/** help handler input */
|
|
262
|
+
export declare const HelpInputSchema: z.ZodObject<{
|
|
263
|
+
topic: z.ZodDefault<z.ZodOptional<z.ZodEnum<["setup", "rules", "review", "cursor", "docs", "config", "generate", "health", "all"]>>>;
|
|
264
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
265
|
+
topic: z.ZodDefault<z.ZodOptional<z.ZodEnum<["setup", "rules", "review", "cursor", "docs", "config", "generate", "health", "all"]>>>;
|
|
266
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
267
|
+
topic: z.ZodDefault<z.ZodOptional<z.ZodEnum<["setup", "rules", "review", "cursor", "docs", "config", "generate", "health", "all"]>>>;
|
|
268
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
269
|
+
export type HelpInput = z.infer<typeof HelpInputSchema>;
|
|
270
|
+
/** analyze_code tool input */
|
|
271
|
+
export declare const AnalyzeCodeInputSchema: z.ZodObject<{
|
|
272
|
+
code: z.ZodString;
|
|
273
|
+
language: z.ZodOptional<z.ZodString>;
|
|
274
|
+
filePath: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
275
|
+
categories: z.ZodOptional<z.ZodArray<z.ZodEnum<["security", "performance", "best-practices", "maintainability", "architecture"]>, "many">>;
|
|
276
|
+
}, "strict", z.ZodTypeAny, {
|
|
277
|
+
code: string;
|
|
278
|
+
categories?: ("best-practices" | "security" | "performance" | "architecture" | "maintainability")[] | undefined;
|
|
279
|
+
language?: string | undefined;
|
|
280
|
+
filePath?: string | undefined;
|
|
281
|
+
}, {
|
|
282
|
+
code: string;
|
|
283
|
+
categories?: ("best-practices" | "security" | "performance" | "architecture" | "maintainability")[] | undefined;
|
|
284
|
+
language?: string | undefined;
|
|
285
|
+
filePath?: string | undefined;
|
|
286
|
+
}>;
|
|
287
|
+
export type AnalyzeCodeInput = z.infer<typeof AnalyzeCodeInputSchema>;
|
|
288
|
+
/** get_rules tool input */
|
|
289
|
+
export declare const GetRulesInputSchema: z.ZodObject<{
|
|
290
|
+
language: z.ZodOptional<z.ZodString>;
|
|
291
|
+
category: z.ZodOptional<z.ZodEnum<["security", "performance", "best-practices", "maintainability", "architecture"]>>;
|
|
292
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
293
|
+
}, "strict", z.ZodTypeAny, {
|
|
294
|
+
category?: "best-practices" | "security" | "performance" | "architecture" | "maintainability" | undefined;
|
|
295
|
+
enabled?: boolean | undefined;
|
|
296
|
+
language?: string | undefined;
|
|
297
|
+
}, {
|
|
298
|
+
category?: "best-practices" | "security" | "performance" | "architecture" | "maintainability" | undefined;
|
|
299
|
+
enabled?: boolean | undefined;
|
|
300
|
+
language?: string | undefined;
|
|
301
|
+
}>;
|
|
302
|
+
export type GetRulesInput = z.infer<typeof GetRulesInputSchema>;
|
|
303
|
+
/** Result type for validation */
|
|
304
|
+
export type ValidationResult<T> = {
|
|
305
|
+
success: true;
|
|
306
|
+
data: T;
|
|
307
|
+
} | {
|
|
308
|
+
success: false;
|
|
309
|
+
error: string;
|
|
310
|
+
details?: z.ZodIssue[];
|
|
311
|
+
};
|
|
312
|
+
/**
|
|
313
|
+
* Validate input against a schema
|
|
314
|
+
*/
|
|
315
|
+
export declare function validate<T>(schema: z.ZodSchema<T>, input: unknown): ValidationResult<T>;
|
|
316
|
+
/**
|
|
317
|
+
* Validate and throw on failure
|
|
318
|
+
*/
|
|
319
|
+
export declare function validateOrThrow<T>(schema: z.ZodSchema<T>, input: unknown, context?: string): T;
|
|
320
|
+
/**
|
|
321
|
+
* Create a validated handler wrapper
|
|
322
|
+
*/
|
|
323
|
+
export declare function withValidation<TInput, TOutput>(schema: z.ZodSchema<TInput>, handler: (input: TInput) => Promise<TOutput>): (input: unknown) => Promise<TOutput>;
|
|
324
|
+
/**
|
|
325
|
+
* Sanitize string for safe display
|
|
326
|
+
*/
|
|
327
|
+
export declare function sanitizeForDisplay(input: string, maxLength?: number): string;
|
|
328
|
+
/**
|
|
329
|
+
* Sanitize file path
|
|
330
|
+
*/
|
|
331
|
+
export declare function sanitizePath(input: string): string;
|
|
332
|
+
/**
|
|
333
|
+
* Sanitize identifier
|
|
334
|
+
*/
|
|
335
|
+
export declare function sanitizeIdentifier(input: string): string;
|
|
336
|
+
export declare const HANDLER_SCHEMAS: Record<string, z.ZodSchema>;
|
|
337
|
+
/**
|
|
338
|
+
* Validate handler input by handler name
|
|
339
|
+
*/
|
|
340
|
+
export declare function validateHandlerInput(handlerName: string, input: unknown): ValidationResult<unknown>;
|
|
341
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/valid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S,SAAO,GAAG,MAAM,CAK1E;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKlD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKxD;AAMD,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,SAAS,CAavD,CAAC;AAEF;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,OAAO,GACb,gBAAgB,CAAC,OAAO,CAAC,CAQ3B"}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod Validation Schemas
|
|
3
|
+
* Centralized input validation for all MCP handlers
|
|
4
|
+
* @version 3.6.0
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// Common Schemas
|
|
9
|
+
// ============================================================================
|
|
10
|
+
/** Project type enum */
|
|
11
|
+
export const ProjectTypeSchema = z.enum([
|
|
12
|
+
'react-typescript',
|
|
13
|
+
'react-node',
|
|
14
|
+
'vue-node',
|
|
15
|
+
'nextjs',
|
|
16
|
+
'nestjs',
|
|
17
|
+
'express',
|
|
18
|
+
'rails',
|
|
19
|
+
'laravel',
|
|
20
|
+
'golang',
|
|
21
|
+
'rust',
|
|
22
|
+
'python-fastapi',
|
|
23
|
+
'python-django',
|
|
24
|
+
'python-flask',
|
|
25
|
+
'custom'
|
|
26
|
+
]);
|
|
27
|
+
/** Severity level enum */
|
|
28
|
+
export const SeveritySchema = z.enum(['error', 'warning', 'info', 'suggestion']);
|
|
29
|
+
/** File path validation */
|
|
30
|
+
export const FilePathSchema = z.string()
|
|
31
|
+
.min(1, 'File path cannot be empty')
|
|
32
|
+
.max(1024, 'File path too long')
|
|
33
|
+
.refine((path) => !path.includes('\0'), 'File path contains invalid characters');
|
|
34
|
+
/** URL validation */
|
|
35
|
+
export const UrlSchema = z.string()
|
|
36
|
+
.url('Invalid URL format')
|
|
37
|
+
.max(2048, 'URL too long');
|
|
38
|
+
/** Safe string (no special chars that could cause issues) */
|
|
39
|
+
export const SafeStringSchema = z.string()
|
|
40
|
+
.max(1000, 'String too long')
|
|
41
|
+
.transform(s => s.trim());
|
|
42
|
+
/** Identifier (alphanumeric + dash/underscore) */
|
|
43
|
+
export const IdentifierSchema = z.string()
|
|
44
|
+
.min(1, 'Identifier cannot be empty')
|
|
45
|
+
.max(100, 'Identifier too long')
|
|
46
|
+
.regex(/^[a-zA-Z][a-zA-Z0-9_-]*$/, 'Invalid identifier format');
|
|
47
|
+
// ============================================================================
|
|
48
|
+
// Handler Input Schemas
|
|
49
|
+
// ============================================================================
|
|
50
|
+
/** setup handler input */
|
|
51
|
+
export const SetupInputSchema = z.object({
|
|
52
|
+
type: ProjectTypeSchema.optional(),
|
|
53
|
+
path: FilePathSchema.optional()
|
|
54
|
+
}).passthrough();
|
|
55
|
+
/** rules handler input */
|
|
56
|
+
export const RulesInputSchema = z.object({
|
|
57
|
+
action: z.enum(['list', 'search', 'get', 'select']).optional().default('list'),
|
|
58
|
+
query: SafeStringSchema.optional(),
|
|
59
|
+
ids: z.array(z.string().max(200)).optional(),
|
|
60
|
+
category: z.enum(['security', 'performance', 'best-practices', 'coding-standards', 'architecture', 'testing']).optional()
|
|
61
|
+
}).passthrough();
|
|
62
|
+
/** knowledge handler input */
|
|
63
|
+
export const KnowledgeInputSchema = z.object({
|
|
64
|
+
action: z.enum(['list', 'search', 'get']).optional().default('list'),
|
|
65
|
+
query: SafeStringSchema.optional(),
|
|
66
|
+
category: z.enum(['patterns', 'common-issues', 'architecture', 'workflows']).optional()
|
|
67
|
+
}).passthrough();
|
|
68
|
+
/** review handler input */
|
|
69
|
+
export const ReviewInputSchema = z.object({
|
|
70
|
+
file: FilePathSchema.optional(),
|
|
71
|
+
url: UrlSchema.optional(),
|
|
72
|
+
project: z.boolean().optional(),
|
|
73
|
+
focus: z.enum(['all', 'security', 'performance', 'architecture', 'coding-standards']).optional().default('all'),
|
|
74
|
+
incremental: z.boolean().optional(),
|
|
75
|
+
maxDepth: z.number().int().min(1).max(20).optional(),
|
|
76
|
+
maxFiles: z.number().int().min(1).optional(),
|
|
77
|
+
useCache: z.boolean().optional()
|
|
78
|
+
}).passthrough();
|
|
79
|
+
/** context handler input */
|
|
80
|
+
export const ContextInputSchema = z.object({
|
|
81
|
+
full: z.boolean().optional()
|
|
82
|
+
}).passthrough();
|
|
83
|
+
/** docs handler input */
|
|
84
|
+
export const DocsInputSchema = z.object({
|
|
85
|
+
action: z.enum(['fetch', 'search', 'list', 'get', 'remove', 'suggest']).optional().default('list'),
|
|
86
|
+
url: z.string().max(2048).optional(), // Can be URL or ID for get/remove
|
|
87
|
+
urls: z.array(UrlSchema).optional(),
|
|
88
|
+
query: SafeStringSchema.optional()
|
|
89
|
+
}).passthrough();
|
|
90
|
+
/** cursor handler input */
|
|
91
|
+
export const CursorInputSchema = z.object({
|
|
92
|
+
action: z.enum(['browse', 'search', 'popular', 'import', 'categories']).optional().default('categories'),
|
|
93
|
+
query: SafeStringSchema.optional(),
|
|
94
|
+
slug: SafeStringSchema.optional()
|
|
95
|
+
}).passthrough();
|
|
96
|
+
/** config handler input */
|
|
97
|
+
export const ConfigInputSchema = z.object({
|
|
98
|
+
action: z.enum(['save', 'load', 'list', 'delete', 'export', 'import']).optional().default('list'),
|
|
99
|
+
name: SafeStringSchema.optional(),
|
|
100
|
+
id: z.string().max(200).optional(),
|
|
101
|
+
json: z.string().max(100000).optional()
|
|
102
|
+
}).passthrough();
|
|
103
|
+
/** custom-rule handler input */
|
|
104
|
+
export const CustomRuleInputSchema = z.object({
|
|
105
|
+
action: z.enum(['create', 'update', 'delete', 'list', 'export', 'import']).optional().default('list'),
|
|
106
|
+
name: SafeStringSchema.optional(),
|
|
107
|
+
content: z.string().max(50000).optional(),
|
|
108
|
+
category: z.enum(['security', 'performance', 'best-practices', 'coding-standards', 'architecture']).optional(),
|
|
109
|
+
id: z.string().max(200).optional(),
|
|
110
|
+
json: z.string().max(100000).optional()
|
|
111
|
+
}).passthrough();
|
|
112
|
+
/** generate handler input */
|
|
113
|
+
export const GenerateInputSchema = z.object({
|
|
114
|
+
type: z.enum(['component', 'hook', 'service', 'test', 'api', 'model', 'util']),
|
|
115
|
+
name: z.string().min(1).max(100),
|
|
116
|
+
options: z.object({
|
|
117
|
+
typescript: z.boolean().optional(),
|
|
118
|
+
withTests: z.boolean().optional(),
|
|
119
|
+
withStyles: z.boolean().optional(),
|
|
120
|
+
framework: z.string().max(50).optional(),
|
|
121
|
+
scanProject: z.boolean().optional()
|
|
122
|
+
}).optional()
|
|
123
|
+
}).passthrough();
|
|
124
|
+
/** health handler input */
|
|
125
|
+
export const HealthInputSchema = z.object({
|
|
126
|
+
detailed: z.boolean().optional(),
|
|
127
|
+
path: FilePathSchema.optional()
|
|
128
|
+
}).passthrough();
|
|
129
|
+
/** help handler input */
|
|
130
|
+
export const HelpInputSchema = z.object({
|
|
131
|
+
topic: z.enum(['setup', 'rules', 'review', 'cursor', 'docs', 'config', 'generate', 'health', 'all']).optional().default('all')
|
|
132
|
+
}).passthrough();
|
|
133
|
+
// ============================================================================
|
|
134
|
+
// Tool Argument Schemas
|
|
135
|
+
// ============================================================================
|
|
136
|
+
/** analyze_code tool input */
|
|
137
|
+
export const AnalyzeCodeInputSchema = z.object({
|
|
138
|
+
code: z.string().min(1, 'Code cannot be empty').max(100000, 'Code too large'),
|
|
139
|
+
language: z.string().max(50).optional(),
|
|
140
|
+
filePath: FilePathSchema.optional(),
|
|
141
|
+
categories: z.array(z.enum(['security', 'performance', 'best-practices', 'maintainability', 'architecture'])).optional()
|
|
142
|
+
}).strict();
|
|
143
|
+
/** get_rules tool input */
|
|
144
|
+
export const GetRulesInputSchema = z.object({
|
|
145
|
+
language: z.string().max(50).optional(),
|
|
146
|
+
category: z.enum(['security', 'performance', 'best-practices', 'maintainability', 'architecture']).optional(),
|
|
147
|
+
enabled: z.boolean().optional()
|
|
148
|
+
}).strict();
|
|
149
|
+
/**
|
|
150
|
+
* Validate input against a schema
|
|
151
|
+
*/
|
|
152
|
+
export function validate(schema, input) {
|
|
153
|
+
const result = schema.safeParse(input);
|
|
154
|
+
if (result.success) {
|
|
155
|
+
return { success: true, data: result.data };
|
|
156
|
+
}
|
|
157
|
+
const errorMessages = result.error.issues.map(issue => {
|
|
158
|
+
const path = issue.path.join('.');
|
|
159
|
+
return path ? `${path}: ${issue.message}` : issue.message;
|
|
160
|
+
});
|
|
161
|
+
return {
|
|
162
|
+
success: false,
|
|
163
|
+
error: errorMessages.join('; '),
|
|
164
|
+
details: result.error.issues
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Validate and throw on failure
|
|
169
|
+
*/
|
|
170
|
+
export function validateOrThrow(schema, input, context) {
|
|
171
|
+
const result = validate(schema, input);
|
|
172
|
+
if (!result.success) {
|
|
173
|
+
const prefix = context ? `${context}: ` : '';
|
|
174
|
+
throw new Error(`${prefix}${result.error}`);
|
|
175
|
+
}
|
|
176
|
+
return result.data;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Create a validated handler wrapper
|
|
180
|
+
*/
|
|
181
|
+
export function withValidation(schema, handler) {
|
|
182
|
+
return async (input) => {
|
|
183
|
+
const validated = validateOrThrow(schema, input);
|
|
184
|
+
return handler(validated);
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
// ============================================================================
|
|
188
|
+
// Sanitization Utilities
|
|
189
|
+
// ============================================================================
|
|
190
|
+
/**
|
|
191
|
+
* Sanitize string for safe display
|
|
192
|
+
*/
|
|
193
|
+
export function sanitizeForDisplay(input, maxLength = 1000) {
|
|
194
|
+
return input
|
|
195
|
+
.slice(0, maxLength)
|
|
196
|
+
.replace(/[\x00-\x1F\x7F]/g, '') // Remove control characters
|
|
197
|
+
.trim();
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Sanitize file path
|
|
201
|
+
*/
|
|
202
|
+
export function sanitizePath(input) {
|
|
203
|
+
return input
|
|
204
|
+
.replace(/\.\./g, '') // Remove directory traversal
|
|
205
|
+
.replace(/^\/+/, '/') // Normalize leading slashes
|
|
206
|
+
.replace(/\\/g, '/'); // Normalize backslashes
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Sanitize identifier
|
|
210
|
+
*/
|
|
211
|
+
export function sanitizeIdentifier(input) {
|
|
212
|
+
return input
|
|
213
|
+
.replace(/[^a-zA-Z0-9_-]/g, '-')
|
|
214
|
+
.replace(/^-+|-+$/g, '')
|
|
215
|
+
.slice(0, 100);
|
|
216
|
+
}
|
|
217
|
+
// ============================================================================
|
|
218
|
+
// Schema Registry (for dynamic validation)
|
|
219
|
+
// ============================================================================
|
|
220
|
+
export const HANDLER_SCHEMAS = {
|
|
221
|
+
'setup': SetupInputSchema,
|
|
222
|
+
'rules': RulesInputSchema,
|
|
223
|
+
'knowledge': KnowledgeInputSchema,
|
|
224
|
+
'review': ReviewInputSchema,
|
|
225
|
+
'context': ContextInputSchema,
|
|
226
|
+
'docs': DocsInputSchema,
|
|
227
|
+
'cursor': CursorInputSchema,
|
|
228
|
+
'config': ConfigInputSchema,
|
|
229
|
+
'custom-rule': CustomRuleInputSchema,
|
|
230
|
+
'generate': GenerateInputSchema,
|
|
231
|
+
'health': HealthInputSchema,
|
|
232
|
+
'help': HelpInputSchema
|
|
233
|
+
};
|
|
234
|
+
/**
|
|
235
|
+
* Validate handler input by handler name
|
|
236
|
+
*/
|
|
237
|
+
export function validateHandlerInput(handlerName, input) {
|
|
238
|
+
const schema = HANDLER_SCHEMAS[handlerName];
|
|
239
|
+
if (!schema) {
|
|
240
|
+
return { success: true, data: input }; // No schema, pass through
|
|
241
|
+
}
|
|
242
|
+
return validate(schema, input);
|
|
243
|
+
}
|
|
244
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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C,CAAC;AACjC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackguide/mcp-server",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.1",
|
|
4
4
|
"description": "MCP Server for dynamic language and framework context loading - Compatible with Cursor and GitHub Copilot",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -34,10 +34,17 @@
|
|
|
34
34
|
"license": "GPL-3.0",
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
37
|
+
"better-sqlite3": "^12.5.0",
|
|
38
|
+
"tree-sitter": "^0.25.0",
|
|
39
|
+
"tree-sitter-go": "^0.25.0",
|
|
40
|
+
"tree-sitter-python": "^0.25.0",
|
|
41
|
+
"tree-sitter-rust": "^0.24.0",
|
|
42
|
+
"tree-sitter-typescript": "^0.23.2",
|
|
37
43
|
"ts-morph": "^27.0.2",
|
|
38
|
-
"zod": "^3.
|
|
44
|
+
"zod": "^3.25.76"
|
|
39
45
|
},
|
|
40
46
|
"devDependencies": {
|
|
47
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
41
48
|
"@types/node": "^20.10.0",
|
|
42
49
|
"@vitest/coverage-v8": "^4.0.16",
|
|
43
50
|
"tsx": "^4.7.0",
|