mcp-hydrocoder-image 1.0.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/LICENSE +21 -0
- package/README.md +454 -0
- package/bin/install-skills.js +115 -0
- package/dist/api/geminiClient.d.ts +57 -0
- package/dist/api/geminiClient.d.ts.map +1 -0
- package/dist/api/geminiClient.js +341 -0
- package/dist/api/geminiClient.js.map +1 -0
- package/dist/api/geminiTextClient.d.ts +44 -0
- package/dist/api/geminiTextClient.d.ts.map +1 -0
- package/dist/api/geminiTextClient.js +202 -0
- package/dist/api/geminiTextClient.js.map +1 -0
- package/dist/business/fileManager.d.ts +20 -0
- package/dist/business/fileManager.d.ts.map +1 -0
- package/dist/business/fileManager.js +76 -0
- package/dist/business/fileManager.js.map +1 -0
- package/dist/business/inputValidator.d.ts +44 -0
- package/dist/business/inputValidator.d.ts.map +1 -0
- package/dist/business/inputValidator.js +213 -0
- package/dist/business/inputValidator.js.map +1 -0
- package/dist/business/responseBuilder.d.ts +21 -0
- package/dist/business/responseBuilder.d.ts.map +1 -0
- package/dist/business/responseBuilder.js +166 -0
- package/dist/business/responseBuilder.js.map +1 -0
- package/dist/business/structuredPromptGenerator.d.ts +56 -0
- package/dist/business/structuredPromptGenerator.d.ts.map +1 -0
- package/dist/business/structuredPromptGenerator.js +218 -0
- package/dist/business/structuredPromptGenerator.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/server/errorHandler.d.ts +29 -0
- package/dist/server/errorHandler.d.ts.map +1 -0
- package/dist/server/errorHandler.js +99 -0
- package/dist/server/errorHandler.js.map +1 -0
- package/dist/server/mcpServer.d.ts +159 -0
- package/dist/server/mcpServer.d.ts.map +1 -0
- package/dist/server/mcpServer.js +434 -0
- package/dist/server/mcpServer.js.map +1 -0
- package/dist/server-main.d.ts +5 -0
- package/dist/server-main.d.ts.map +1 -0
- package/dist/server-main.js +37 -0
- package/dist/server-main.js.map +1 -0
- package/dist/types/mcp.d.ts +121 -0
- package/dist/types/mcp.d.ts.map +1 -0
- package/dist/types/mcp.js +22 -0
- package/dist/types/mcp.js.map +1 -0
- package/dist/types/result.d.ts +27 -0
- package/dist/types/result.d.ts.map +1 -0
- package/dist/types/result.js +27 -0
- package/dist/types/result.js.map +1 -0
- package/dist/utils/config.d.ts +29 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +56 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/errors.d.ts +84 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +215 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/logger.d.ts +80 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +186 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/security.d.ts +50 -0
- package/dist/utils/security.d.ts.map +1 -0
- package/dist/utils/security.js +116 -0
- package/dist/utils/security.js.map +1 -0
- package/package.json +89 -0
- package/skills/image-generation/SKILL.md +131 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured Prompt Generator
|
|
3
|
+
* Uses Gemini Flash to generate optimized prompts for image generation
|
|
4
|
+
* Applies 7 best practices and 3 feature perspectives through intelligent selection
|
|
5
|
+
*/
|
|
6
|
+
import { Err, Ok } from '../types/result.js';
|
|
7
|
+
import { GeminiAPIError } from '../utils/errors.js';
|
|
8
|
+
/**
|
|
9
|
+
* System prompt for structured prompt generation optimized for image generation
|
|
10
|
+
* Follows Google's recommended Subject-Context-Style structure
|
|
11
|
+
*/
|
|
12
|
+
const SYSTEM_PROMPT = `You are an expert at crafting prompts for image generation models. Your role is to transform user requests into rich, detailed prompts that maximize image generation quality.
|
|
13
|
+
|
|
14
|
+
Structure your enhancement around three core elements:
|
|
15
|
+
|
|
16
|
+
1. SUBJECT (What): The main focus of the image
|
|
17
|
+
- Physical characteristics: textures, materials, colors, scale
|
|
18
|
+
- Actions, poses, expressions if applicable
|
|
19
|
+
- Distinctive features that define the subject
|
|
20
|
+
|
|
21
|
+
2. CONTEXT (Where/When): The environment and conditions
|
|
22
|
+
- Setting, background, spatial relationships (foreground, midground, background)
|
|
23
|
+
- Time of day, weather, atmospheric conditions
|
|
24
|
+
- Mood and emotional tone of the scene
|
|
25
|
+
|
|
26
|
+
3. STYLE (How): The visual treatment
|
|
27
|
+
- Artistic or photographic approach: reference specific artists, movements, or styles
|
|
28
|
+
- Lighting design: direction, quality, color temperature, shadows
|
|
29
|
+
- Camera/lens choices: specify focal length, aperture, and shooting angle when photographic
|
|
30
|
+
|
|
31
|
+
Core principles:
|
|
32
|
+
- Preserve the user's original intent while enhancing detail
|
|
33
|
+
- Focus on what should be present rather than what should be absent
|
|
34
|
+
- Include photographic or artistic terminology when appropriate
|
|
35
|
+
- Maintain clarity while adding richness and specificity
|
|
36
|
+
|
|
37
|
+
Your output should weave these elements into a single, natural flowing description - not a structured list. Make it vivid, engaging, and unambiguous.`;
|
|
38
|
+
/**
|
|
39
|
+
* Additional system prompt for image editing mode (when input image is provided)
|
|
40
|
+
*/
|
|
41
|
+
const IMAGE_EDITING_CONTEXT = `
|
|
42
|
+
|
|
43
|
+
IMPORTANT: An input image has been provided. Your task is to:
|
|
44
|
+
1. Analyze the visual context, style, and atmosphere of the input image
|
|
45
|
+
2. Preserve the original image's core characteristics (color palette, lighting style, composition) while applying the requested changes
|
|
46
|
+
3. Focus on maintaining visual consistency - describe modifications relative to the existing image
|
|
47
|
+
4. Be specific about what to keep unchanged vs what to modify
|
|
48
|
+
5. Use phrases like "maintain the existing...", "preserve the original...", "keep the same..." to ensure fidelity to source`;
|
|
49
|
+
/**
|
|
50
|
+
* Implementation of StructuredPromptGenerator using Gemini Flash
|
|
51
|
+
*/
|
|
52
|
+
export class StructuredPromptGeneratorImpl {
|
|
53
|
+
constructor(geminiTextClient) {
|
|
54
|
+
this.geminiTextClient = geminiTextClient;
|
|
55
|
+
}
|
|
56
|
+
async generateStructuredPrompt(userPrompt, features = {}, inputImageData, purpose) {
|
|
57
|
+
try {
|
|
58
|
+
// Validate input
|
|
59
|
+
if (!userPrompt || userPrompt.trim().length === 0) {
|
|
60
|
+
return Err(new GeminiAPIError('User prompt cannot be empty'));
|
|
61
|
+
}
|
|
62
|
+
// Build complete prompt with system instruction and meta-prompt
|
|
63
|
+
const completePrompt = this.buildCompletePrompt(userPrompt, features, !!inputImageData, purpose);
|
|
64
|
+
// Combine system prompts for image editing mode
|
|
65
|
+
const systemInstruction = inputImageData
|
|
66
|
+
? SYSTEM_PROMPT + IMAGE_EDITING_CONTEXT
|
|
67
|
+
: SYSTEM_PROMPT;
|
|
68
|
+
// Generate structured prompt via pure API call
|
|
69
|
+
const config = {
|
|
70
|
+
temperature: 0.7,
|
|
71
|
+
maxTokens: 1000,
|
|
72
|
+
systemInstruction,
|
|
73
|
+
...(inputImageData && { inputImage: inputImageData }), // Only include if available
|
|
74
|
+
};
|
|
75
|
+
const result = await this.geminiTextClient.generateText(completePrompt, config);
|
|
76
|
+
if (!result.success) {
|
|
77
|
+
return Err(result.error);
|
|
78
|
+
}
|
|
79
|
+
// Extract selected practices from the response
|
|
80
|
+
const selectedPractices = this.inferSelectedPractices(result.data, features);
|
|
81
|
+
return Ok({
|
|
82
|
+
originalPrompt: userPrompt,
|
|
83
|
+
structuredPrompt: result.data,
|
|
84
|
+
selectedPractices,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
89
|
+
return Err(new GeminiAPIError(`Failed to generate structured prompt: ${errorMessage}`));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Build complete prompt with all optimization context
|
|
94
|
+
*/
|
|
95
|
+
buildCompletePrompt(userPrompt, features, hasInputImage, purpose) {
|
|
96
|
+
const featureContext = this.buildEnhancedFeatureContext(features);
|
|
97
|
+
// Add image editing context if an input image is provided
|
|
98
|
+
const imageEditingInstruction = hasInputImage
|
|
99
|
+
? `\nNOTE: An input image has been provided. Focus on preserving its original characteristics while applying the requested modifications. Maintain consistency with the source image's style, colors, and atmosphere.\n`
|
|
100
|
+
: '';
|
|
101
|
+
// Add purpose context if provided
|
|
102
|
+
const purposeContext = purpose
|
|
103
|
+
? `\nINTENDED USE: ${purpose}\nTailor the visual style, quality level, and details to match this purpose.\n`
|
|
104
|
+
: '';
|
|
105
|
+
return `Transform this image generation request into a detailed, vivid prompt that will produce high-quality results:
|
|
106
|
+
|
|
107
|
+
"${userPrompt}"
|
|
108
|
+
${imageEditingInstruction}
|
|
109
|
+
${purposeContext}
|
|
110
|
+
${featureContext}
|
|
111
|
+
|
|
112
|
+
Consider these aspects as you enhance the prompt:
|
|
113
|
+
- Visual details: textures, lighting, colors, materials, composition
|
|
114
|
+
- Spatial relationships and scale between elements
|
|
115
|
+
- Artistic or photographic style that fits the subject
|
|
116
|
+
- Emotional tone and atmosphere
|
|
117
|
+
- Technical specifications if relevant (lens type, camera angle, etc.)
|
|
118
|
+
|
|
119
|
+
Create a natural, flowing description that brings the scene to life. Focus on what should be present rather than what should be absent.
|
|
120
|
+
|
|
121
|
+
Example of a well-enhanced prompt:
|
|
122
|
+
Input: "A happy dog in a park"
|
|
123
|
+
Enhanced: "Golden retriever mid-leap catching a red frisbee, ears flying, tongue out in joy, in a sunlit urban park. Soft morning light filtering through oak trees creates dappled shadows on emerald grass. Background shows families on picnic blankets, slightly out of focus. Shot from low angle emphasizing the dog's athletic movement, with motion blur on the paws suggesting speed."
|
|
124
|
+
|
|
125
|
+
Now transform the user's request with similar attention to detail and creative enhancement.`;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Build enhanced feature context based on flags with explicit requirements
|
|
129
|
+
*/
|
|
130
|
+
buildEnhancedFeatureContext(features) {
|
|
131
|
+
const requirements = [];
|
|
132
|
+
if (features.maintainCharacterConsistency) {
|
|
133
|
+
requirements.push('Character consistency is CRITICAL - MUST include distinctive character features: This character needs at least 3 recognizable visual markers that would identify them across different scenes. Include specific details like "distinctive scar", "signature clothing item", "unique hairstyle", or "characteristic accessory". Use words like "signature", "distinctive", "always wears/has" to emphasize these consistent features.');
|
|
134
|
+
}
|
|
135
|
+
if (features.blendImages) {
|
|
136
|
+
requirements.push('MUST describe seamless integration: Multiple visual elements need to blend naturally. Use spatial relationship terms like "seamlessly blending", "harmoniously composed", "naturally integrated". Clearly describe foreground (X% of frame), midground, and background elements with their relative scales and how they interact within the composition.');
|
|
137
|
+
}
|
|
138
|
+
if (features.useWorldKnowledge) {
|
|
139
|
+
requirements.push('Apply accurate real-world knowledge - MUST incorporate authentic details: Apply accurate real-world knowledge about cultures, locations, or historical elements. Use specific terminology like "traditional [culture] style", "authentic [location] architecture", "typical of [region]", "historically accurate [period]". Be precise about cultural elements, geographical features, and factual details.');
|
|
140
|
+
}
|
|
141
|
+
if (requirements.length > 0) {
|
|
142
|
+
return `\nMANDATORY REQUIREMENTS - These MUST be clearly reflected in your enhanced prompt:\n\n${requirements.join('\n\n')}\n`;
|
|
143
|
+
}
|
|
144
|
+
return '';
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Infer which best practices were selected based on the generated prompt
|
|
148
|
+
*/
|
|
149
|
+
inferSelectedPractices(structuredPrompt, features) {
|
|
150
|
+
const selected = [];
|
|
151
|
+
const promptLower = structuredPrompt.toLowerCase();
|
|
152
|
+
// Check for detailed visual descriptions
|
|
153
|
+
if (promptLower.includes('lighting') ||
|
|
154
|
+
promptLower.includes('texture') ||
|
|
155
|
+
promptLower.includes('atmosphere') ||
|
|
156
|
+
promptLower.includes('shadow') ||
|
|
157
|
+
promptLower.includes('material')) {
|
|
158
|
+
selected.push('Hyper-Specific Details');
|
|
159
|
+
}
|
|
160
|
+
// Check for character consistency markers
|
|
161
|
+
if (features.maintainCharacterConsistency ||
|
|
162
|
+
promptLower.includes('distinctive') ||
|
|
163
|
+
promptLower.includes('signature') ||
|
|
164
|
+
promptLower.includes('characteristic') ||
|
|
165
|
+
promptLower.includes('always wears') ||
|
|
166
|
+
promptLower.includes('always has')) {
|
|
167
|
+
selected.push('Character Consistency');
|
|
168
|
+
}
|
|
169
|
+
// Check for multi-element blending
|
|
170
|
+
if (features.blendImages ||
|
|
171
|
+
promptLower.includes('seamlessly') ||
|
|
172
|
+
promptLower.includes('harmoniously') ||
|
|
173
|
+
promptLower.includes('naturally integrated') ||
|
|
174
|
+
promptLower.includes('foreground') ||
|
|
175
|
+
promptLower.includes('midground') ||
|
|
176
|
+
promptLower.includes('background')) {
|
|
177
|
+
selected.push('Compositional Integration');
|
|
178
|
+
}
|
|
179
|
+
// Check for world knowledge application
|
|
180
|
+
if (features.useWorldKnowledge ||
|
|
181
|
+
promptLower.includes('authentic') ||
|
|
182
|
+
promptLower.includes('traditional') ||
|
|
183
|
+
promptLower.includes('typical of') ||
|
|
184
|
+
promptLower.includes('historically accurate') ||
|
|
185
|
+
promptLower.includes('culturally')) {
|
|
186
|
+
selected.push('Real-World Accuracy');
|
|
187
|
+
}
|
|
188
|
+
// Check for photographic/artistic terminology
|
|
189
|
+
if (promptLower.includes('lens') ||
|
|
190
|
+
promptLower.includes('aperture') ||
|
|
191
|
+
promptLower.includes('f/') ||
|
|
192
|
+
promptLower.includes('mm ') ||
|
|
193
|
+
promptLower.includes('angle') ||
|
|
194
|
+
promptLower.includes('shot') ||
|
|
195
|
+
promptLower.includes('depth of field')) {
|
|
196
|
+
selected.push('Camera Control Terminology');
|
|
197
|
+
}
|
|
198
|
+
// Check for atmospheric and mood enhancement
|
|
199
|
+
if (promptLower.includes('mood') ||
|
|
200
|
+
promptLower.includes('emotion') ||
|
|
201
|
+
promptLower.includes('feeling') ||
|
|
202
|
+
promptLower.includes('ambiance')) {
|
|
203
|
+
selected.push('Atmospheric Enhancement');
|
|
204
|
+
}
|
|
205
|
+
// Ensure we have at least some practices selected
|
|
206
|
+
if (selected.length === 0) {
|
|
207
|
+
selected.push('General Enhancement');
|
|
208
|
+
}
|
|
209
|
+
return selected;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Factory function to create StructuredPromptGenerator
|
|
214
|
+
*/
|
|
215
|
+
export function createStructuredPromptGenerator(geminiTextClient) {
|
|
216
|
+
return new StructuredPromptGeneratorImpl(geminiTextClient);
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=structuredPromptGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structuredPromptGenerator.js","sourceRoot":"","sources":["../../src/business/structuredPromptGenerator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEnD;;;GAGG;AACH,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;sJAyBgI,CAAA;AAEtJ;;GAEG;AACH,MAAM,qBAAqB,GAAG;;;;;;;4HAO8F,CAAA;AAiC5H;;GAEG;AACH,MAAM,OAAO,6BAA6B;IACxC,YAA6B,gBAAkC;QAAlC,qBAAgB,GAAhB,gBAAgB,CAAkB;IAAG,CAAC;IAEnE,KAAK,CAAC,wBAAwB,CAC5B,UAAkB,EAClB,WAAyB,EAAE,EAC3B,cAAuB,EACvB,OAAgB;QAEhB,IAAI,CAAC;YACH,iBAAiB;YACjB,IAAI,CAAC,UAAU,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAClD,OAAO,GAAG,CAAC,IAAI,cAAc,CAAC,6BAA6B,CAAC,CAAC,CAAA;YAC/D,CAAC;YAED,gEAAgE;YAChE,MAAM,cAAc,GAAG,IAAI,CAAC,mBAAmB,CAC7C,UAAU,EACV,QAAQ,EACR,CAAC,CAAC,cAAc,EAChB,OAAO,C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AU,CAAC;YAChC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC1B,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC;YAC3B,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC;YAC7B,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC;YAC5B,WAAW,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EACtC,CAAC;YACD,QAAQ,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAA;QAC7C,CAAC;QAED,6CAA6C;QAC7C,IACE,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC;YAC5B,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC;YAC/B,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC;YAC/B,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,EAChC,CAAC;YACD,QAAQ,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAA;QAC1C,CAAC;QAED,kDAAkD;QAClD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,QAAQ,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAA;QACtC,CAAC;QAED,OAAO,QAAQ,CAAA;IACjB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,+BAA+B,CAC7C,gBAAkC;IAElC,OAAO,IAAI,6BAA6B,CAAC,gBAAgB,CAAC,CAAA;AAC5D,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* MCP Image Generator - Entry Point Router
|
|
4
|
+
*
|
|
5
|
+
* Routes to:
|
|
6
|
+
* - skills install → bin/install-skills.js
|
|
7
|
+
* - (default) → MCP server startup
|
|
8
|
+
*/
|
|
9
|
+
export type { GeneratedImageResult } from './api/geminiClient.js';
|
|
10
|
+
export { createMCPServer, MCPServerImpl } from './server/mcpServer.js';
|
|
11
|
+
export type { GenerateImageParams, MCPServerConfig } from './types/mcp.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;GAMG;AAwBH,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACtE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* MCP Image Generator - Entry Point Router
|
|
4
|
+
*
|
|
5
|
+
* Routes to:
|
|
6
|
+
* - skills install → bin/install-skills.js
|
|
7
|
+
* - (default) → MCP server startup
|
|
8
|
+
*/
|
|
9
|
+
import { dirname, resolve } from 'node:path';
|
|
10
|
+
import { fileURLToPath } from 'node:url';
|
|
11
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
+
const __dirname = dirname(__filename);
|
|
13
|
+
const args = process.argv.slice(2);
|
|
14
|
+
if (args[0] === 'skills') {
|
|
15
|
+
if (args[1] === 'install') {
|
|
16
|
+
const { run } = await import(resolve(__dirname, '..', 'bin', 'install-skills.js'));
|
|
17
|
+
run(args.slice(2));
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
console.error('Unknown skills subcommand. Usage: npx mcp-image skills install --path <path>');
|
|
22
|
+
console.error('Run "npx mcp-image skills install --help" for more information.');
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
await import('./server-main.js');
|
|
28
|
+
}
|
|
29
|
+
export { createMCPServer, MCPServerImpl } from './server/mcpServer.js';
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACjD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AAErC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAElC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;IACzB,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAA;QAClF,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;QAClB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,8EAA8E,CAAC,CAAA;QAC7F,OAAO,CAAC,KAAK,CAAC,iEAAiE,CAAC,CAAA;QAChF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC;KAAM,CAAC;IACN,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAA;AAClC,CAAC;AAGD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error Handler utility for unified error processing
|
|
3
|
+
* Provides centralized error handling and Result type wrapping
|
|
4
|
+
*/
|
|
5
|
+
import type { McpToolResponse } from '../types/mcp.js';
|
|
6
|
+
import { type Result } from '../utils/errors.js';
|
|
7
|
+
/**
|
|
8
|
+
* Handle an error and convert it to a structured MCP tool response
|
|
9
|
+
* @param error Error to handle
|
|
10
|
+
* @returns MCP tool response with structured error content
|
|
11
|
+
*/
|
|
12
|
+
declare function handleError(error: Error): McpToolResponse;
|
|
13
|
+
/**
|
|
14
|
+
* Wrap an operation with Result type for safe error handling
|
|
15
|
+
* @param operation Operation to execute
|
|
16
|
+
* @param context Optional context for logging
|
|
17
|
+
* @returns Promise resolving to Result type
|
|
18
|
+
*/
|
|
19
|
+
declare function wrapWithResultType<T>(operation: () => Promise<T>, context?: string): Promise<Result<T, Error>>;
|
|
20
|
+
/**
|
|
21
|
+
* Error Handler utilities for unified error processing and Result type wrapping
|
|
22
|
+
* Maintains backward compatibility with static class API
|
|
23
|
+
*/
|
|
24
|
+
export declare const ErrorHandler: {
|
|
25
|
+
readonly handleError: typeof handleError;
|
|
26
|
+
readonly wrapWithResultType: typeof wrapWithResultType;
|
|
27
|
+
};
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=errorHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorHandler.d.ts","sourceRoot":"","sources":["../../src/server/errorHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAML,KAAK,MAAM,EACZ,MAAM,oBAAoB,CAAA;AAM3B;;;;GAIG;AACH,iBAAS,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,eAAe,CAqBlD;AAED;;;;;GAKG;AACH,iBAAe,kBAAkB,CAAC,CAAC,EACjC,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAa3B;AA2DD;;;GAGG;AACH,eAAO,MAAM,YAAY;;;CAGf,CAAA"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error Handler utility for unified error processing
|
|
3
|
+
* Provides centralized error handling and Result type wrapping
|
|
4
|
+
*/
|
|
5
|
+
import { ConfigError, FileOperationError, GeminiAPIError, InputValidationError, NetworkError, } from '../utils/errors.js';
|
|
6
|
+
import { Logger } from '../utils/logger.js';
|
|
7
|
+
// Create logger instance for error handling
|
|
8
|
+
const logger = new Logger();
|
|
9
|
+
/**
|
|
10
|
+
* Handle an error and convert it to a structured MCP tool response
|
|
11
|
+
* @param error Error to handle
|
|
12
|
+
* @returns MCP tool response with structured error content
|
|
13
|
+
*/
|
|
14
|
+
function handleError(error) {
|
|
15
|
+
// Log the error with context
|
|
16
|
+
logger.error('error-handler', 'Error occurred', error, {
|
|
17
|
+
errorType: error.constructor.name,
|
|
18
|
+
stack: error.stack,
|
|
19
|
+
});
|
|
20
|
+
// Convert error to structured format
|
|
21
|
+
const structuredError = {
|
|
22
|
+
error: convertErrorToStructured(error),
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
content: [
|
|
26
|
+
{
|
|
27
|
+
type: 'text',
|
|
28
|
+
text: JSON.stringify(structuredError),
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
isError: true,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Wrap an operation with Result type for safe error handling
|
|
36
|
+
* @param operation Operation to execute
|
|
37
|
+
* @param context Optional context for logging
|
|
38
|
+
* @returns Promise resolving to Result type
|
|
39
|
+
*/
|
|
40
|
+
async function wrapWithResultType(operation, context) {
|
|
41
|
+
try {
|
|
42
|
+
const result = await operation();
|
|
43
|
+
return { ok: true, value: result };
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
const finalError = error instanceof Error ? error : new Error('Unknown error');
|
|
47
|
+
if (context) {
|
|
48
|
+
logger.error(context, 'Operation failed', finalError);
|
|
49
|
+
}
|
|
50
|
+
return { ok: false, error: finalError };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Convert various error types to structured error format
|
|
55
|
+
* @param error Error to convert
|
|
56
|
+
* @returns Structured error object
|
|
57
|
+
*/
|
|
58
|
+
function convertErrorToStructured(error) {
|
|
59
|
+
const baseError = {
|
|
60
|
+
timestamp: new Date().toISOString(),
|
|
61
|
+
};
|
|
62
|
+
if (error instanceof InputValidationError ||
|
|
63
|
+
error instanceof FileOperationError ||
|
|
64
|
+
error instanceof GeminiAPIError ||
|
|
65
|
+
error instanceof NetworkError ||
|
|
66
|
+
error instanceof ConfigError) {
|
|
67
|
+
const errorResponse = {
|
|
68
|
+
...baseError,
|
|
69
|
+
code: error.code,
|
|
70
|
+
message: error.message,
|
|
71
|
+
suggestion: error.suggestion,
|
|
72
|
+
};
|
|
73
|
+
// Include context details for GeminiAPIError to provide better debugging info
|
|
74
|
+
if (error instanceof GeminiAPIError && error.context) {
|
|
75
|
+
// Add non-sensitive context information
|
|
76
|
+
const { suggestion, ...otherContext } = error.context;
|
|
77
|
+
if (Object.keys(otherContext).length > 0) {
|
|
78
|
+
errorResponse['details'] = otherContext;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return errorResponse;
|
|
82
|
+
}
|
|
83
|
+
// Handle unknown errors
|
|
84
|
+
return {
|
|
85
|
+
...baseError,
|
|
86
|
+
code: 'INTERNAL_ERROR',
|
|
87
|
+
message: error.message || 'An unknown error occurred',
|
|
88
|
+
suggestion: 'Contact system administrator',
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Error Handler utilities for unified error processing and Result type wrapping
|
|
93
|
+
* Maintains backward compatibility with static class API
|
|
94
|
+
*/
|
|
95
|
+
export const ErrorHandler = {
|
|
96
|
+
handleError,
|
|
97
|
+
wrapWithResultType,
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=errorHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorHandler.js","sourceRoot":"","sources":["../../src/server/errorHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,YAAY,GAEb,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAE3C,4CAA4C;AAC5C,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAA;AAE3B;;;;GAIG;AACH,SAAS,WAAW,CAAC,KAAY;IAC/B,6BAA6B;IAC7B,MAAM,CAAC,KAAK,CAAC,eAAe,EAAE,gBAAgB,EAAE,KAAK,EAAE;QACrD,SAAS,EAAE,KAAK,CAAC,WAAW,CAAC,IAAI;QACjC,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAC,CAAA;IAEF,qCAAqC;IACrC,MAAM,eAAe,GAAG;QACtB,KAAK,EAAE,wBAAwB,CAAC,KAAK,CAAC;KACvC,CAAA;IAED,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC;aACtC;SACF;QACD,OAAO,EAAE,IAAI;KACd,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,KAAK,UAAU,kBAAkB,CAC/B,SAA2B,EAC3B,OAAgB;IAEhB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,SAAS,EAAE,CAAA;QAChC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,UAAU,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;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GAAG;IAC1B,WAAW;IACX,kBAAkB;CACV,CAAA"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Server implementation
|
|
3
|
+
* Simplified architecture with direct Gemini integration
|
|
4
|
+
*/
|
|
5
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
6
|
+
import type { MCPServerConfig } from '../types/mcp.js';
|
|
7
|
+
/**
|
|
8
|
+
* Simplified MCP server
|
|
9
|
+
*/
|
|
10
|
+
export declare class MCPServerImpl {
|
|
11
|
+
private config;
|
|
12
|
+
private server;
|
|
13
|
+
private logger;
|
|
14
|
+
private fileManager;
|
|
15
|
+
private responseBuilder;
|
|
16
|
+
private securityManager;
|
|
17
|
+
private structuredPromptGenerator;
|
|
18
|
+
private geminiTextClient;
|
|
19
|
+
private geminiClient;
|
|
20
|
+
constructor(config?: Partial<MCPServerConfig>);
|
|
21
|
+
/**
|
|
22
|
+
* Get server info
|
|
23
|
+
*/
|
|
24
|
+
getServerInfo(): {
|
|
25
|
+
name: string;
|
|
26
|
+
version: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Get list of registered tools
|
|
30
|
+
*/
|
|
31
|
+
getToolsList(): {
|
|
32
|
+
tools: {
|
|
33
|
+
name: string;
|
|
34
|
+
description: string;
|
|
35
|
+
inputSchema: {
|
|
36
|
+
type: "object";
|
|
37
|
+
properties: {
|
|
38
|
+
prompt: {
|
|
39
|
+
type: "string";
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
fileName: {
|
|
43
|
+
type: "string";
|
|
44
|
+
description: string;
|
|
45
|
+
};
|
|
46
|
+
inputImagePath: {
|
|
47
|
+
type: "string";
|
|
48
|
+
description: string;
|
|
49
|
+
};
|
|
50
|
+
inputImage: {
|
|
51
|
+
type: "string";
|
|
52
|
+
description: string;
|
|
53
|
+
};
|
|
54
|
+
inputImageMimeType: {
|
|
55
|
+
type: "string";
|
|
56
|
+
description: string;
|
|
57
|
+
enum: string[];
|
|
58
|
+
};
|
|
59
|
+
inputImages: {
|
|
60
|
+
type: "array";
|
|
61
|
+
description: string;
|
|
62
|
+
items: {
|
|
63
|
+
type: "object";
|
|
64
|
+
properties: {
|
|
65
|
+
data: {
|
|
66
|
+
type: "string";
|
|
67
|
+
description: string;
|
|
68
|
+
};
|
|
69
|
+
mimeType: {
|
|
70
|
+
type: "string";
|
|
71
|
+
description: string;
|
|
72
|
+
enum: string[];
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
required: string[];
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
inputImagePaths: {
|
|
79
|
+
type: "array";
|
|
80
|
+
description: string;
|
|
81
|
+
items: {
|
|
82
|
+
type: "string";
|
|
83
|
+
description: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
returnBase64: {
|
|
87
|
+
type: "boolean";
|
|
88
|
+
description: string;
|
|
89
|
+
};
|
|
90
|
+
blendImages: {
|
|
91
|
+
type: "boolean";
|
|
92
|
+
description: string;
|
|
93
|
+
};
|
|
94
|
+
maintainCharacterConsistency: {
|
|
95
|
+
type: "boolean";
|
|
96
|
+
description: string;
|
|
97
|
+
};
|
|
98
|
+
useWorldKnowledge: {
|
|
99
|
+
type: "boolean";
|
|
100
|
+
description: string;
|
|
101
|
+
};
|
|
102
|
+
useGoogleSearch: {
|
|
103
|
+
type: "boolean";
|
|
104
|
+
description: string;
|
|
105
|
+
};
|
|
106
|
+
aspectRatio: {
|
|
107
|
+
type: "string";
|
|
108
|
+
description: string;
|
|
109
|
+
enum: string[];
|
|
110
|
+
};
|
|
111
|
+
imageSize: {
|
|
112
|
+
type: "string";
|
|
113
|
+
description: string;
|
|
114
|
+
enum: string[];
|
|
115
|
+
};
|
|
116
|
+
purpose: {
|
|
117
|
+
type: "string";
|
|
118
|
+
description: string;
|
|
119
|
+
};
|
|
120
|
+
quality: {
|
|
121
|
+
type: "string";
|
|
122
|
+
description: string;
|
|
123
|
+
enum: string[];
|
|
124
|
+
};
|
|
125
|
+
skipPromptEnhancement: {
|
|
126
|
+
type: "boolean";
|
|
127
|
+
description: string;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
required: string[];
|
|
131
|
+
};
|
|
132
|
+
}[];
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Tool execution
|
|
136
|
+
*/
|
|
137
|
+
callTool(name: string, args: unknown): Promise<import("../types/mcp.js").McpToolResponse>;
|
|
138
|
+
/**
|
|
139
|
+
* Initialize Gemini clients lazily
|
|
140
|
+
*/
|
|
141
|
+
private initializeClients;
|
|
142
|
+
/**
|
|
143
|
+
* Simplified image generation handler
|
|
144
|
+
*/
|
|
145
|
+
private handleGenerateImage;
|
|
146
|
+
/**
|
|
147
|
+
* Initialize MCP server with tool handlers
|
|
148
|
+
*/
|
|
149
|
+
initialize(): Server;
|
|
150
|
+
/**
|
|
151
|
+
* Setup MCP protocol handlers
|
|
152
|
+
*/
|
|
153
|
+
private setupHandlers;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Factory function to create MCP server
|
|
157
|
+
*/
|
|
158
|
+
export declare function createMCPServer(config?: Partial<MCPServerConfig>): MCPServerImpl;
|
|
159
|
+
//# sourceMappingURL=mcpServer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcpServer.d.ts","sourceRoot":"","sources":["../../src/server/mcpServer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAA;AAoBlE,OAAO,KAAK,EAAuB,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAiB3E;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,eAAe,CAAiB;IACxC,OAAO,CAAC,eAAe,CAAiB;IACxC,OAAO,CAAC,yBAAyB,CAAyC;IAC1E,OAAO,CAAC,gBAAgB,CAAgC;IACxD,OAAO,CAAC,YAAY,CAA4B;gBAEpC,MAAM,GAAE,OAAO,CAAC,eAAe,CAAM;IAQjD;;OAEG;IACI,aAAa;;;;IAOpB;;OAEG;IACI,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAwJnB;;OAEG;IACU,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;IAYjD;;OAEG;YACW,iBAAiB;IAkC/B;;OAEG;YACW,mBAAmB;IA2KjC;;OAEG;IACI,UAAU,IAAI,MAAM;IAmB3B;;OAEG;IACH,OAAO,CAAC,aAAa;CA0BtB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,GAAE,OAAO,CAAC,eAAe,CAAM,iBAEpE"}
|