@veolab/discoverylab 0.1.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/.claude-plugin/marketplace.json +15 -0
- package/.claude-plugin/plugin.json +12 -0
- package/.mcp.json +6 -0
- package/README.md +214 -0
- package/assets/applab-discovery.jpeg +0 -0
- package/assets/backgrounds/abstract-colorful-gradient-orange-background.jpg +0 -0
- package/assets/backgrounds/blurred-colorful-luxury-gradient-rainbow-abstract.jpg +0 -0
- package/assets/backgrounds/glowing-neon-moving-continuously-looking-bright.jpg +0 -0
- package/assets/backgrounds/glowing-neon-moving-continuously-looking-bright2.jpg +0 -0
- package/assets/backgrounds/macos-big-sur-apple-layers-fluidic-colorful-wwdc-stock-4096x2304-1455.jpg +0 -0
- package/assets/backgrounds/macos-sierra-mountain-peak-sunset-evening-stock-5k-5120x3684-3987.jpg +0 -0
- package/assets/backgrounds/macos-tahoe-26-5120x2880-22674.jpg +0 -0
- package/assets/backgrounds/macos-tahoe-26-5120x2880-22675.jpg +0 -0
- package/assets/backgrounds/view-of-the-sea-from-the-window-of-an-airplane-2024-10-21-11-25-30-utc.jpg +0 -0
- package/assets/cursor/cursor-blue.png +0 -0
- package/assets/icons/android-head_3D.png +0 -0
- package/assets/icons/apple-logo.png +0 -0
- package/assets/icons/apple-logo.svg +4 -0
- package/assets/icons/claude-ai-icon.svg +1 -0
- package/assets/icons/icons8-apple-intelligence-48.png +0 -0
- package/assets/icons/icons8-apple-intelligence-96.png +0 -0
- package/dist/chunk-7IDQLLBW.js +311 -0
- package/dist/chunk-MLKGABMK.js +9 -0
- package/dist/chunk-MN6LCZHZ.js +1320 -0
- package/dist/chunk-PBHUHSC3.js +6002 -0
- package/dist/chunk-QJXXHOV7.js +205 -0
- package/dist/chunk-SSRXIO2V.js +6822 -0
- package/dist/chunk-VY3BLXBW.js +329 -0
- package/dist/chunk-W3WJGYR6.js +354 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +120 -0
- package/dist/db-IWIL65EX.js +33 -0
- package/dist/gridCompositor-ENKLFPWR.js +409 -0
- package/dist/index.d.ts +1648 -0
- package/dist/index.js +869 -0
- package/dist/ocr-UTWC7537.js +21 -0
- package/dist/server-3FBHBA7L.js +15 -0
- package/dist/server-NM5CKDUU.js +13 -0
- package/dist/setup-27CQAX6K.js +17 -0
- package/dist/tools-75BAPCUM.js +177 -0
- package/package.json +84 -0
- package/skills/generate-assets/SKILL.md +44 -0
- package/skills/mobile-test/SKILL.md +33 -0
- package/skills/open-ui/SKILL.md +24 -0
- package/skills/quick-capture/SKILL.md +28 -0
- package/skills/task-hub/SKILL.md +44 -0
- package/skills/web-test/SKILL.md +41 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
// src/mcp/server.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var MCPServer = class {
|
|
4
|
+
tools = /* @__PURE__ */ new Map();
|
|
5
|
+
serverInfo = {
|
|
6
|
+
name: "discoverylab",
|
|
7
|
+
version: "0.1.0"
|
|
8
|
+
};
|
|
9
|
+
registerTool(tool) {
|
|
10
|
+
this.tools.set(tool.name, tool);
|
|
11
|
+
}
|
|
12
|
+
registerTools(tools) {
|
|
13
|
+
for (const tool of tools) {
|
|
14
|
+
this.registerTool(tool);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
async handleRequest(request) {
|
|
18
|
+
const { id, method, params } = request;
|
|
19
|
+
try {
|
|
20
|
+
switch (method) {
|
|
21
|
+
case "initialize":
|
|
22
|
+
return this.handleInitialize(id, params);
|
|
23
|
+
case "tools/list":
|
|
24
|
+
return this.handleToolsList(id);
|
|
25
|
+
case "tools/call":
|
|
26
|
+
return this.handleToolCall(id, params);
|
|
27
|
+
case "ping":
|
|
28
|
+
return { jsonrpc: "2.0", id, result: { pong: true } };
|
|
29
|
+
default:
|
|
30
|
+
return {
|
|
31
|
+
jsonrpc: "2.0",
|
|
32
|
+
id,
|
|
33
|
+
error: { code: -32601, message: `Method not found: ${method}` }
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
} catch (error) {
|
|
37
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
38
|
+
return {
|
|
39
|
+
jsonrpc: "2.0",
|
|
40
|
+
id,
|
|
41
|
+
error: { code: -32603, message }
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
handleInitialize(id, params) {
|
|
46
|
+
return {
|
|
47
|
+
jsonrpc: "2.0",
|
|
48
|
+
id,
|
|
49
|
+
result: {
|
|
50
|
+
protocolVersion: "2024-11-05",
|
|
51
|
+
serverInfo: this.serverInfo,
|
|
52
|
+
capabilities: {
|
|
53
|
+
tools: {}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
handleToolsList(id) {
|
|
59
|
+
const tools = Array.from(this.tools.values()).map((tool) => ({
|
|
60
|
+
name: tool.name,
|
|
61
|
+
description: tool.description,
|
|
62
|
+
inputSchema: this.zodToJsonSchema(tool.inputSchema)
|
|
63
|
+
}));
|
|
64
|
+
return {
|
|
65
|
+
jsonrpc: "2.0",
|
|
66
|
+
id,
|
|
67
|
+
result: { tools }
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
async handleToolCall(id, params) {
|
|
71
|
+
const { name, arguments: args } = params;
|
|
72
|
+
const tool = this.tools.get(name);
|
|
73
|
+
if (!tool) {
|
|
74
|
+
return {
|
|
75
|
+
jsonrpc: "2.0",
|
|
76
|
+
id,
|
|
77
|
+
error: { code: -32602, message: `Tool not found: ${name}` }
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
const validatedArgs = tool.inputSchema.parse(args || {});
|
|
82
|
+
const result = await tool.handler(validatedArgs);
|
|
83
|
+
return {
|
|
84
|
+
jsonrpc: "2.0",
|
|
85
|
+
id,
|
|
86
|
+
result
|
|
87
|
+
};
|
|
88
|
+
} catch (error) {
|
|
89
|
+
if (error instanceof z.ZodError) {
|
|
90
|
+
return {
|
|
91
|
+
jsonrpc: "2.0",
|
|
92
|
+
id,
|
|
93
|
+
error: {
|
|
94
|
+
code: -32602,
|
|
95
|
+
message: "Invalid parameters",
|
|
96
|
+
data: error.errors
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
const message = error instanceof Error ? error.message : "Tool execution failed";
|
|
101
|
+
return {
|
|
102
|
+
jsonrpc: "2.0",
|
|
103
|
+
id,
|
|
104
|
+
result: {
|
|
105
|
+
content: [{ type: "text", text: `Error: ${message}` }],
|
|
106
|
+
isError: true
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
zodToJsonSchema(schema) {
|
|
112
|
+
if (schema instanceof z.ZodObject) {
|
|
113
|
+
const shape = schema.shape;
|
|
114
|
+
const properties = {};
|
|
115
|
+
const required = [];
|
|
116
|
+
for (const [key, value] of Object.entries(shape)) {
|
|
117
|
+
properties[key] = this.zodToJsonSchema(value);
|
|
118
|
+
if (!value.isOptional()) {
|
|
119
|
+
required.push(key);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
type: "object",
|
|
124
|
+
properties,
|
|
125
|
+
required: required.length > 0 ? required : void 0
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
if (schema instanceof z.ZodString) {
|
|
129
|
+
return { type: "string" };
|
|
130
|
+
}
|
|
131
|
+
if (schema instanceof z.ZodNumber) {
|
|
132
|
+
return { type: "number" };
|
|
133
|
+
}
|
|
134
|
+
if (schema instanceof z.ZodBoolean) {
|
|
135
|
+
return { type: "boolean" };
|
|
136
|
+
}
|
|
137
|
+
if (schema instanceof z.ZodArray) {
|
|
138
|
+
return {
|
|
139
|
+
type: "array",
|
|
140
|
+
items: this.zodToJsonSchema(schema.element)
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
if (schema instanceof z.ZodOptional) {
|
|
144
|
+
return this.zodToJsonSchema(schema.unwrap());
|
|
145
|
+
}
|
|
146
|
+
if (schema instanceof z.ZodEnum) {
|
|
147
|
+
return {
|
|
148
|
+
type: "string",
|
|
149
|
+
enum: schema.options
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
return { type: "object" };
|
|
153
|
+
}
|
|
154
|
+
// STDIO transport
|
|
155
|
+
async runStdio() {
|
|
156
|
+
const readline = await import("readline");
|
|
157
|
+
const rl = readline.createInterface({
|
|
158
|
+
input: process.stdin,
|
|
159
|
+
output: process.stdout,
|
|
160
|
+
terminal: false
|
|
161
|
+
});
|
|
162
|
+
rl.on("line", async (line) => {
|
|
163
|
+
try {
|
|
164
|
+
const request = JSON.parse(line);
|
|
165
|
+
const response = await this.handleRequest(request);
|
|
166
|
+
console.log(JSON.stringify(response));
|
|
167
|
+
} catch (error) {
|
|
168
|
+
const errorResponse = {
|
|
169
|
+
jsonrpc: "2.0",
|
|
170
|
+
id: 0,
|
|
171
|
+
error: { code: -32700, message: "Parse error" }
|
|
172
|
+
};
|
|
173
|
+
console.log(JSON.stringify(errorResponse));
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
rl.on("close", () => {
|
|
177
|
+
process.exit(0);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
function createTextResult(text) {
|
|
182
|
+
return {
|
|
183
|
+
content: [{ type: "text", text }]
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
function createErrorResult(message) {
|
|
187
|
+
return {
|
|
188
|
+
content: [{ type: "text", text: `Error: ${message}` }],
|
|
189
|
+
isError: true
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function createJsonResult(data) {
|
|
193
|
+
return {
|
|
194
|
+
content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
var mcpServer = new MCPServer();
|
|
198
|
+
|
|
199
|
+
export {
|
|
200
|
+
MCPServer,
|
|
201
|
+
createTextResult,
|
|
202
|
+
createErrorResult,
|
|
203
|
+
createJsonResult,
|
|
204
|
+
mcpServer
|
|
205
|
+
};
|