@fastcoder/vision-mcp-server 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/README.md +263 -0
- package/README.zh-CN.md +210 -0
- package/build/core/api-common.d.ts +89 -0
- package/build/core/api-common.d.ts.map +1 -0
- package/build/core/api-common.js +119 -0
- package/build/core/api-common.js.map +1 -0
- package/build/core/base-image-service.d.ts +38 -0
- package/build/core/base-image-service.d.ts.map +1 -0
- package/build/core/base-image-service.js +92 -0
- package/build/core/base-image-service.js.map +1 -0
- package/build/core/chat-service.d.ts +42 -0
- package/build/core/chat-service.d.ts.map +1 -0
- package/build/core/chat-service.js +97 -0
- package/build/core/chat-service.js.map +1 -0
- package/build/core/environment.d.ts +76 -0
- package/build/core/environment.d.ts.map +1 -0
- package/build/core/environment.js +132 -0
- package/build/core/environment.js.map +1 -0
- package/build/core/error-handler.d.ts +124 -0
- package/build/core/error-handler.d.ts.map +1 -0
- package/build/core/error-handler.js +248 -0
- package/build/core/error-handler.js.map +1 -0
- package/build/core/file-service.d.ts +36 -0
- package/build/core/file-service.d.ts.map +1 -0
- package/build/core/file-service.js +141 -0
- package/build/core/file-service.js.map +1 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +119 -0
- package/build/index.js.map +1 -0
- package/build/prompts/data-viz.d.ts +5 -0
- package/build/prompts/data-viz.d.ts.map +1 -0
- package/build/prompts/data-viz.js +98 -0
- package/build/prompts/data-viz.js.map +1 -0
- package/build/prompts/diagram-analysis.d.ts +5 -0
- package/build/prompts/diagram-analysis.d.ts.map +1 -0
- package/build/prompts/diagram-analysis.js +102 -0
- package/build/prompts/diagram-analysis.js.map +1 -0
- package/build/prompts/error-diagnosis.d.ts +5 -0
- package/build/prompts/error-diagnosis.d.ts.map +1 -0
- package/build/prompts/error-diagnosis.js +69 -0
- package/build/prompts/error-diagnosis.js.map +1 -0
- package/build/prompts/general-image.d.ts +5 -0
- package/build/prompts/general-image.d.ts.map +1 -0
- package/build/prompts/general-image.js +45 -0
- package/build/prompts/general-image.js.map +1 -0
- package/build/prompts/index.d.ts +8 -0
- package/build/prompts/index.d.ts.map +1 -0
- package/build/prompts/index.js +8 -0
- package/build/prompts/index.js.map +1 -0
- package/build/prompts/text-extraction.d.ts +5 -0
- package/build/prompts/text-extraction.d.ts.map +1 -0
- package/build/prompts/text-extraction.js +45 -0
- package/build/prompts/text-extraction.js.map +1 -0
- package/build/prompts/ui-diff.d.ts +5 -0
- package/build/prompts/ui-diff.d.ts.map +1 -0
- package/build/prompts/ui-diff.js +190 -0
- package/build/prompts/ui-diff.js.map +1 -0
- package/build/prompts/ui-to-artifact.d.ts +10 -0
- package/build/prompts/ui-to-artifact.d.ts.map +1 -0
- package/build/prompts/ui-to-artifact.js +89 -0
- package/build/prompts/ui-to-artifact.js.map +1 -0
- package/build/tools/data-viz.d.ts +5 -0
- package/build/tools/data-viz.d.ts.map +1 -0
- package/build/tools/data-viz.js +93 -0
- package/build/tools/data-viz.js.map +1 -0
- package/build/tools/diagram-analysis.d.ts +5 -0
- package/build/tools/diagram-analysis.d.ts.map +1 -0
- package/build/tools/diagram-analysis.js +93 -0
- package/build/tools/diagram-analysis.js.map +1 -0
- package/build/tools/error-diagnosis.d.ts +5 -0
- package/build/tools/error-diagnosis.d.ts.map +1 -0
- package/build/tools/error-diagnosis.js +93 -0
- package/build/tools/error-diagnosis.js.map +1 -0
- package/build/tools/general-image.d.ts +5 -0
- package/build/tools/general-image.d.ts.map +1 -0
- package/build/tools/general-image.js +81 -0
- package/build/tools/general-image.js.map +1 -0
- package/build/tools/index.d.ts +8 -0
- package/build/tools/index.d.ts.map +1 -0
- package/build/tools/index.js +9 -0
- package/build/tools/index.js.map +1 -0
- package/build/tools/text-extraction.d.ts +5 -0
- package/build/tools/text-extraction.d.ts.map +1 -0
- package/build/tools/text-extraction.js +93 -0
- package/build/tools/text-extraction.js.map +1 -0
- package/build/tools/ui-diff.d.ts +5 -0
- package/build/tools/ui-diff.d.ts.map +1 -0
- package/build/tools/ui-diff.js +98 -0
- package/build/tools/ui-diff.js.map +1 -0
- package/build/tools/ui-to-artifact.d.ts +5 -0
- package/build/tools/ui-to-artifact.d.ts.map +1 -0
- package/build/tools/ui-to-artifact.js +117 -0
- package/build/tools/ui-to-artifact.js.map +1 -0
- package/build/types/index.d.ts +26 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/index.js +43 -0
- package/build/types/index.js.map +1 -0
- package/build/utils/logger.d.ts +24 -0
- package/build/utils/logger.d.ts.map +1 -0
- package/build/utils/logger.js +119 -0
- package/build/utils/logger.js.map +1 -0
- package/build/utils/validation.d.ts +87 -0
- package/build/utils/validation.d.ts.map +1 -0
- package/build/utils/validation.js +155 -0
- package/build/utils/validation.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import * as os from 'os';
|
|
4
|
+
/**
|
|
5
|
+
* Logger utility that writes to stderr and a log file.
|
|
6
|
+
* Stderr keeps MCP JSON on stdout clean; file provides persistent logs.
|
|
7
|
+
*/
|
|
8
|
+
class Logger {
|
|
9
|
+
logStream;
|
|
10
|
+
constructor(logFilePath) {
|
|
11
|
+
if (logFilePath) {
|
|
12
|
+
this.setLogFile(logFilePath);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
setLogFile(logFilePath) {
|
|
16
|
+
try {
|
|
17
|
+
const dir = path.dirname(logFilePath);
|
|
18
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
19
|
+
if (this.logStream) {
|
|
20
|
+
this.logStream.end();
|
|
21
|
+
}
|
|
22
|
+
this.logStream = fs.createWriteStream(logFilePath, { flags: 'a' });
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
const timestamp = new Date().toISOString();
|
|
26
|
+
const msg = `[${timestamp}] ERROR: Failed to initialize log file '${logFilePath}': ${String(err)}`;
|
|
27
|
+
process.stderr.write(msg + '\n');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
safeStringify(obj) {
|
|
31
|
+
// Serialize Error objects so that message/stack and custom fields are visible
|
|
32
|
+
const replacer = (_key, value) => {
|
|
33
|
+
if (value instanceof Error) {
|
|
34
|
+
const base = {
|
|
35
|
+
name: value.name,
|
|
36
|
+
message: value.message,
|
|
37
|
+
stack: value.stack
|
|
38
|
+
};
|
|
39
|
+
// Include enumerable own properties (e.g., code, statusCode, details, context)
|
|
40
|
+
for (const k of Object.keys(value)) {
|
|
41
|
+
if (!(k in base)) {
|
|
42
|
+
base[k] = value[k];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return base;
|
|
46
|
+
}
|
|
47
|
+
return value;
|
|
48
|
+
};
|
|
49
|
+
try {
|
|
50
|
+
return JSON.stringify(obj, replacer);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
try {
|
|
54
|
+
return String(obj);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return '[Unserializable]';
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
write(level, message, ...args) {
|
|
62
|
+
const timestamp = new Date().toISOString();
|
|
63
|
+
const serializedArgs = args.length > 0 ? ` ${this.safeStringify(args)}` : '';
|
|
64
|
+
const logMessage = `[${timestamp}] ${level.toUpperCase()}: ${message}${serializedArgs}`;
|
|
65
|
+
// Write to stderr (visible console output without polluting stdout)
|
|
66
|
+
process.stderr.write(logMessage + '\n');
|
|
67
|
+
// Write to log file if configured
|
|
68
|
+
if (this.logStream) {
|
|
69
|
+
this.logStream.write(logMessage + '\n');
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
info(message, ...args) {
|
|
73
|
+
this.write('info', message, ...args);
|
|
74
|
+
}
|
|
75
|
+
error(message, ...args) {
|
|
76
|
+
this.write('error', message, ...args);
|
|
77
|
+
}
|
|
78
|
+
warn(message, ...args) {
|
|
79
|
+
this.write('warn', message, ...args);
|
|
80
|
+
}
|
|
81
|
+
debug(message, ...args) {
|
|
82
|
+
this.write('debug', message, ...args);
|
|
83
|
+
}
|
|
84
|
+
log(message, ...args) {
|
|
85
|
+
this.write('info', message, ...args);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export const logger = new Logger();
|
|
89
|
+
/**
|
|
90
|
+
* Override global console to redirect to stderr
|
|
91
|
+
* This prevents console output from interfering with MCP JSON protocol
|
|
92
|
+
*/
|
|
93
|
+
export function setupConsoleRedirection() {
|
|
94
|
+
const originalConsole = { ...console };
|
|
95
|
+
// Cross-platform log file path:
|
|
96
|
+
// - If env VISION_MCP_LOG_PATH is set, use it
|
|
97
|
+
// - Otherwise use user home directory: ~/.vision/vision-mcp-YYYY-MM-DD.log (Windows/macOS/Linux)
|
|
98
|
+
const resolveLogFilePath = () => {
|
|
99
|
+
const envPath = process.env.VISION_MCP_LOG_PATH;
|
|
100
|
+
if (envPath && envPath.trim().length > 0) {
|
|
101
|
+
return path.resolve(envPath);
|
|
102
|
+
}
|
|
103
|
+
const homeDir = os.homedir();
|
|
104
|
+
const now = new Date();
|
|
105
|
+
const yyyy = now.getFullYear();
|
|
106
|
+
const mm = String(now.getMonth() + 1).padStart(2, '0');
|
|
107
|
+
const dd = String(now.getDate()).padStart(2, '0');
|
|
108
|
+
const dateStr = `${yyyy}-${mm}-${dd}`;
|
|
109
|
+
return path.join(homeDir, '.vision', `vision-mcp-${dateStr}.log`);
|
|
110
|
+
};
|
|
111
|
+
logger.setLogFile(resolveLogFilePath());
|
|
112
|
+
console.info = logger.info.bind(logger);
|
|
113
|
+
console.error = logger.error.bind(logger);
|
|
114
|
+
console.warn = logger.warn.bind(logger);
|
|
115
|
+
console.debug = logger.debug.bind(logger);
|
|
116
|
+
console.log = logger.log.bind(logger);
|
|
117
|
+
return originalConsole;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|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ator {
|
|
6
|
+
/**
|
|
7
|
+
* Validate data against specified Zod schema
|
|
8
|
+
*/
|
|
9
|
+
static validate<T>(data: unknown, schema: z.ZodSchema<T>, options?: {
|
|
10
|
+
throwOnError?: boolean;
|
|
11
|
+
customMessage?: string;
|
|
12
|
+
logErrors?: boolean;
|
|
13
|
+
}): {
|
|
14
|
+
success: boolean;
|
|
15
|
+
data?: T;
|
|
16
|
+
error?: {
|
|
17
|
+
message: string;
|
|
18
|
+
code: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Safe validation, does not throw exceptions
|
|
23
|
+
*/
|
|
24
|
+
static safeValidate<T>(data: unknown, schema: z.ZodSchema<T>): ReturnType<typeof RuntimeValidator.validate<T>>;
|
|
25
|
+
/**
|
|
26
|
+
* Parse Zod error to standard validation error format
|
|
27
|
+
*/
|
|
28
|
+
static parseZodError(error: z.ZodError): Array<{
|
|
29
|
+
message: string;
|
|
30
|
+
field: string;
|
|
31
|
+
code: string;
|
|
32
|
+
expected: string;
|
|
33
|
+
received: string;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Get expected type description
|
|
37
|
+
*/
|
|
38
|
+
static getExpectedType(issue: z.ZodIssue): string;
|
|
39
|
+
/**
|
|
40
|
+
* Sanitize sensitive data for logging
|
|
41
|
+
*/
|
|
42
|
+
static sanitizeData(data: unknown): unknown;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Common validation schemas
|
|
46
|
+
*/
|
|
47
|
+
export declare const CommonSchemas: {
|
|
48
|
+
/** Non-empty string */
|
|
49
|
+
nonEmptyString: z.ZodString;
|
|
50
|
+
/** Positive integer */
|
|
51
|
+
positiveInteger: z.ZodNumber;
|
|
52
|
+
/** Non-negative integer */
|
|
53
|
+
nonNegativeInteger: z.ZodNumber;
|
|
54
|
+
/** URL format */
|
|
55
|
+
url: z.ZodString;
|
|
56
|
+
/** Email format */
|
|
57
|
+
email: z.ZodString;
|
|
58
|
+
/** UUID format */
|
|
59
|
+
uuid: z.ZodString;
|
|
60
|
+
/** File path */
|
|
61
|
+
filePath: z.ZodEffects<z.ZodString, string, string>;
|
|
62
|
+
/** Tool name */
|
|
63
|
+
toolName: z.ZodString;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Tool parameter validation schema builder
|
|
67
|
+
*/
|
|
68
|
+
export declare class ToolSchemaBuilder<T extends Record<string, z.ZodTypeAny>> {
|
|
69
|
+
private schema;
|
|
70
|
+
/**
|
|
71
|
+
* Add required field
|
|
72
|
+
*/
|
|
73
|
+
required<K extends keyof T>(name: K, schema: z.ZodTypeAny): ToolSchemaBuilder<T>;
|
|
74
|
+
/**
|
|
75
|
+
* Add optional field
|
|
76
|
+
*/
|
|
77
|
+
optional<K extends keyof T>(name: K, schema: z.ZodTypeAny): ToolSchemaBuilder<T>;
|
|
78
|
+
/**
|
|
79
|
+
* Add field with default value
|
|
80
|
+
*/
|
|
81
|
+
withDefault<K extends keyof T>(name: K, schema: z.ZodTypeAny, defaultValue: z.input<z.ZodTypeAny>): ToolSchemaBuilder<T>;
|
|
82
|
+
/**
|
|
83
|
+
* Build final validation schema
|
|
84
|
+
*/
|
|
85
|
+
build(): z.ZodObject<Record<keyof T, z.ZodTypeAny>>;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;GAEG;AACH,qBAAa,gBAAgB;IAC3B;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,CAAC,EACf,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EACtB,OAAO,GAAE;QACP,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,aAAa,CAAC,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CAAC,EACP,MAAM,EAAE,CAAC,CAAC,UAAU,GACnB,iBAAiB,CAAC,CAAC,CAAC;IAKvB;;OAEG;IACH,QAAQ,CAAC,CAAC,SAAS,MAAM,CAAC,EACxB,IAAI,EAAE,CAAC,EACP,MAAM,EAAE,CAAC,CAAC,UAAU,GACnB,iBAAiB,CAAC,CAAC,CAAC;IAKvB;;OAEG;IACH,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,EAC3B,IAAI,EAAE,CAAC,EACP,MAAM,EAAE,CAAC,CAAC,UAAU,EACpB,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,GAClC,iBAAiB,CAAC,CAAC,CAAC;IAKvB;;OAEG;IACH,KAAK,IAAI,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC;CAGpD"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ValidationError } from '../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Runtime type validator
|
|
5
|
+
*/
|
|
6
|
+
export class RuntimeValidator {
|
|
7
|
+
/**
|
|
8
|
+
* Validate data against specified Zod schema
|
|
9
|
+
*/
|
|
10
|
+
static validate(data, schema, options = {}) {
|
|
11
|
+
const { throwOnError = true, customMessage, logErrors = true } = options;
|
|
12
|
+
try {
|
|
13
|
+
const result = schema.parse(data);
|
|
14
|
+
return {
|
|
15
|
+
success: true,
|
|
16
|
+
data: result
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
const validationErrors = this.parseZodError(error);
|
|
21
|
+
if (logErrors) {
|
|
22
|
+
console.warn('Validation failed', {
|
|
23
|
+
errors: validationErrors,
|
|
24
|
+
data: this.sanitizeData(data)
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (throwOnError) {
|
|
28
|
+
const message = customMessage ||
|
|
29
|
+
`Validation failed: ${validationErrors.map(e => e.message).join(', ')}`;
|
|
30
|
+
throw new ValidationError(message, { errors: validationErrors });
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
success: false,
|
|
34
|
+
error: {
|
|
35
|
+
message: validationErrors.map(e => e.message).join(', '),
|
|
36
|
+
code: 'VALIDATION_ERROR'
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Safe validation, does not throw exceptions
|
|
43
|
+
*/
|
|
44
|
+
static safeValidate(data, schema) {
|
|
45
|
+
return this.validate(data, schema, { throwOnError: false });
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Parse Zod error to standard validation error format
|
|
49
|
+
*/
|
|
50
|
+
static parseZodError(error) {
|
|
51
|
+
return error.issues.map(issue => ({
|
|
52
|
+
message: issue.message,
|
|
53
|
+
field: issue.path.join('.'),
|
|
54
|
+
code: issue.code,
|
|
55
|
+
expected: this.getExpectedType(issue),
|
|
56
|
+
received: 'received' in issue
|
|
57
|
+
? String(issue.received)
|
|
58
|
+
: 'unknown'
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get expected type description
|
|
63
|
+
*/
|
|
64
|
+
static getExpectedType(issue) {
|
|
65
|
+
switch (issue.code) {
|
|
66
|
+
case 'invalid_type':
|
|
67
|
+
return issue.expected;
|
|
68
|
+
case 'too_small':
|
|
69
|
+
return `minimum ${issue.minimum}`;
|
|
70
|
+
case 'too_big':
|
|
71
|
+
return `maximum ${issue.maximum}`;
|
|
72
|
+
default:
|
|
73
|
+
return 'valid value';
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Sanitize sensitive data for logging
|
|
78
|
+
*/
|
|
79
|
+
static sanitizeData(data) {
|
|
80
|
+
if (typeof data !== 'object' || data === null) {
|
|
81
|
+
return data;
|
|
82
|
+
}
|
|
83
|
+
const sensitiveKeys = ['password', 'token', 'secret', 'key', 'auth'];
|
|
84
|
+
const sanitized = { ...data };
|
|
85
|
+
for (const key of Object.keys(sanitized)) {
|
|
86
|
+
if (sensitiveKeys.some(sensitive => key.toLowerCase().includes(sensitive))) {
|
|
87
|
+
sanitized[key] = '[REDACTED]';
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return sanitized;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Common validation schemas
|
|
95
|
+
*/
|
|
96
|
+
export const CommonSchemas = {
|
|
97
|
+
/** Non-empty string */
|
|
98
|
+
nonEmptyString: z.string().min(1, 'String cannot be empty'),
|
|
99
|
+
/** Positive integer */
|
|
100
|
+
positiveInteger: z.number().int().positive('Must be a positive integer'),
|
|
101
|
+
/** Non-negative integer */
|
|
102
|
+
nonNegativeInteger: z
|
|
103
|
+
.number()
|
|
104
|
+
.int()
|
|
105
|
+
.min(0, 'Must be a non-negative integer'),
|
|
106
|
+
/** URL format */
|
|
107
|
+
url: z.string().url('Must be a valid URL'),
|
|
108
|
+
/** Email format */
|
|
109
|
+
email: z.string().email('Must be a valid email address'),
|
|
110
|
+
/** UUID format */
|
|
111
|
+
uuid: z.string().uuid('Must be a valid UUID'),
|
|
112
|
+
/** File path */
|
|
113
|
+
filePath: z
|
|
114
|
+
.string()
|
|
115
|
+
.min(1)
|
|
116
|
+
.refine(path => !path.includes('..'), 'File path cannot contain ".."'),
|
|
117
|
+
/** Tool name */
|
|
118
|
+
toolName: z
|
|
119
|
+
.string()
|
|
120
|
+
.regex(/^[a-z][a-z0-9-]*[a-z0-9]$/, 'Tool name must be lowercase, start with letter, and contain only letters, numbers, and hyphens')
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Tool parameter validation schema builder
|
|
124
|
+
*/
|
|
125
|
+
export class ToolSchemaBuilder {
|
|
126
|
+
schema = {};
|
|
127
|
+
/**
|
|
128
|
+
* Add required field
|
|
129
|
+
*/
|
|
130
|
+
required(name, schema) {
|
|
131
|
+
this.schema[name] = schema;
|
|
132
|
+
return this;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Add optional field
|
|
136
|
+
*/
|
|
137
|
+
optional(name, schema) {
|
|
138
|
+
this.schema[name] = schema.optional();
|
|
139
|
+
return this;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Add field with default value
|
|
143
|
+
*/
|
|
144
|
+
withDefault(name, schema, defaultValue) {
|
|
145
|
+
this.schema[name] = schema.default(() => defaultValue);
|
|
146
|
+
return this;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Build final validation schema
|
|
150
|
+
*/
|
|
151
|
+
build() {
|
|
152
|
+
return z.object(this.schema);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAC3B;;OAEG;IACH,MAAM,CAAC,QAAQ,CACb,IAAa,EACb,MAAsB,EACtB,UAII,EAAE;QASN,MAAM,EAAE,YAAY,GAAG,IAAI,EAAE,aAAa,EAAE,SAAS,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;QAEzE,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAClC,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,MAAM;aACb,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,gBAAgB,GAAG,IAAI,CAAC,aAAa,CAAC,KAAmB,CAAC,CAAC;YAEjE,IAAI,SAAS,EAAE,CAAC;gB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B,EACpB,YAAmC;QAEnC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC;QACvD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,KAAK;QACH,OAAO,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAuC,CAAC,CAAC;IAChE,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fastcoder/vision-mcp-server",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "MCP Server for Vision Analysis - A Model Context Protocol server that provides image analysis capabilities using OpenAI API",
|
|
5
|
+
"main": "build/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"types": "build/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./build/index.d.ts",
|
|
11
|
+
"default": "./build/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"vision-mcp-server": "./build/index.js"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/calandnong/vision-mcp-server.git"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/calandnong/vision-mcp-server/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/calandnong/vision-mcp-server#readme",
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsc && chmod 755 build/index.js",
|
|
27
|
+
"start": "node build/index.js",
|
|
28
|
+
"dev": "tsx watch src/index.ts",
|
|
29
|
+
"inspector": "npx @modelcontextprotocol/inspector --transport stdio node build/index.js",
|
|
30
|
+
"inspector:dev": "npx @modelcontextprotocol/inspector --transport stdio tsx src/index.ts",
|
|
31
|
+
"test": "vitest",
|
|
32
|
+
"test:run": "vitest run",
|
|
33
|
+
"test:coverage": "vitest run --coverage",
|
|
34
|
+
"prepare": "npm run build",
|
|
35
|
+
"clean": "rm -rf build"
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"vision",
|
|
39
|
+
"mcp",
|
|
40
|
+
"openai",
|
|
41
|
+
"image-analysis",
|
|
42
|
+
"ocr",
|
|
43
|
+
"ui-analysis"
|
|
44
|
+
],
|
|
45
|
+
"author": "Vision MCP Team",
|
|
46
|
+
"license": "Apache-2.0",
|
|
47
|
+
"files": [
|
|
48
|
+
"build",
|
|
49
|
+
"README.md",
|
|
50
|
+
"README.zh-CN.md"
|
|
51
|
+
],
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=18.0.0"
|
|
54
|
+
},
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"access": "public"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@modelcontextprotocol/sdk": "^1.17.5",
|
|
60
|
+
"zod": "^3.23.8"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@modelcontextprotocol/inspector": "^0.18.0",
|
|
64
|
+
"@types/node": "^24.3.1",
|
|
65
|
+
"@vitest/coverage-v8": "^2.1.0",
|
|
66
|
+
"tsx": "^4.19.0",
|
|
67
|
+
"typescript": "^5.9.2",
|
|
68
|
+
"vitest": "^2.1.0"
|
|
69
|
+
}
|
|
70
|
+
}
|