gencow 0.1.131 → 0.1.132
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/bin/gencow-mcp.mjs +94 -83
- package/bin/gencow.mjs +5791 -4866
- package/core/index.js +540 -31
- package/dashboard/assets/index-CYN7QmGd.css +1 -0
- package/dashboard/assets/{index-C1WhUSu8.js → index-D2uOdJCM.js} +77 -72
- package/dashboard/index.html +10 -4
- package/lib/__tests__/api-codegen.test.mjs +87 -0
- package/lib/__tests__/deploy-auditor.test.ts +276 -169
- package/lib/__tests__/env-parser.test.ts +113 -117
- package/lib/__tests__/project-validator.test.ts +104 -112
- package/lib/__tests__/readme-codegen.test.ts +393 -385
- package/lib/api-codegen.mjs +91 -0
- package/lib/deploy-auditor.mjs +340 -150
- package/lib/env-parser.mjs +32 -33
- package/lib/project-validator.mjs +44 -58
- package/lib/readme-codegen.mjs +548 -536
- package/package.json +31 -31
- package/scripts/bundle-server.mjs +111 -78
- package/scripts/pre-publish-check.mjs +80 -80
- package/server/index.js +2345 -498
- package/server/index.js.map +4 -4
- package/templates/SECURITY.md +32 -0
- package/templates/admin-tool/items.ts +1 -1
- package/templates/admin-tool/schema.ts +7 -11
- package/templates/agent.ts +100 -0
- package/templates/ai-chat/ai.ts +416 -402
- package/templates/ai-chat/chat.ts +107 -113
- package/templates/ai-chat/schema.ts +14 -14
- package/templates/ai.ts +416 -402
- package/templates/auth-schema.ts +38 -34
- package/templates/auth.ts +15 -15
- package/templates/fullstack/ai.ts +416 -402
- package/templates/fullstack/files.ts +20 -20
- package/templates/fullstack/schema.ts +16 -14
- package/templates/fullstack/tasks.ts +76 -78
- package/templates/guardrails.ts +110 -110
- package/templates/memory.ts +162 -165
- package/templates/parsers.ts +85 -87
- package/templates/prompts.ts +20 -20
- package/templates/rag.ts +267 -272
- package/templates/reranker.ts +68 -66
- package/templates/schema-memory.ts +13 -12
- package/templates/schema-rag.ts +13 -20
- package/templates/task-app/files.ts +20 -20
- package/templates/task-app/schema.ts +16 -14
- package/templates/task-app/tasks.ts +76 -78
- package/templates/tools.ts +18 -15
- package/dashboard/assets/index-DoG4z4Kv.css +0 -1
package/bin/gencow-mcp.mjs
CHANGED
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
23
23
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
24
24
|
import {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
ListToolsRequestSchema,
|
|
26
|
+
CallToolRequestSchema,
|
|
27
|
+
ListResourcesRequestSchema,
|
|
28
|
+
ReadResourceRequestSchema,
|
|
29
29
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
30
30
|
|
|
31
31
|
const BASE_URL = `http://localhost:${process.env.GENCOW_PORT || 5456}`;
|
|
@@ -33,119 +33,130 @@ const BASE_URL = `http://localhost:${process.env.GENCOW_PORT || 5456}`;
|
|
|
33
33
|
// ─── Helpers ────────────────────────────────────────────
|
|
34
34
|
|
|
35
35
|
async function fetchJSON(path) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
const res = await fetch(`${BASE_URL}${path}`);
|
|
37
|
+
if (!res.ok) throw new Error(`Gencow API error: ${res.status} ${await res.text()}`);
|
|
38
|
+
return res.json();
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
async function postJSON(path, body) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
const res = await fetch(`${BASE_URL}${path}`, {
|
|
43
|
+
method: "POST",
|
|
44
|
+
headers: { "Content-Type": "application/json" },
|
|
45
|
+
body: JSON.stringify(body),
|
|
46
|
+
});
|
|
47
|
+
const data = await res.json();
|
|
48
|
+
return { status: res.status, data };
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
// ─── MCP Server ─────────────────────────────────────────
|
|
52
52
|
|
|
53
53
|
const server = new Server(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
{ name: "gencow", version: "0.1.0" },
|
|
55
|
+
{
|
|
56
|
+
capabilities: {
|
|
57
|
+
tools: {},
|
|
58
|
+
resources: {},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
61
|
);
|
|
62
62
|
|
|
63
63
|
// ── Tools ───────────────────────────────────────────────
|
|
64
64
|
|
|
65
65
|
const TOOLS = [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
66
|
+
{
|
|
67
|
+
name: "list_apis",
|
|
68
|
+
description: "등록된 전체 API 목록을 조회합니다. 각 API의 이름과 타입(query/mutation)을 반환합니다.",
|
|
69
|
+
inputSchema: { type: "object", properties: {} },
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "call_query",
|
|
73
|
+
description: "Gencow query를 호출합니다. 예: name='tasks.list', args={}. RPC 방식: POST /api/query",
|
|
74
|
+
inputSchema: {
|
|
75
|
+
type: "object",
|
|
76
|
+
required: ["name"],
|
|
77
|
+
properties: {
|
|
78
|
+
name: {
|
|
79
|
+
type: "string",
|
|
80
|
+
description: "Query name (dot notation), e.g. 'tasks.list', 'tasks.get', 'files.list'",
|
|
81
81
|
},
|
|
82
|
+
args: { type: "object", description: "Query arguments as JSON object", additionalProperties: true },
|
|
83
|
+
},
|
|
82
84
|
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: "call_mutation",
|
|
88
|
+
description:
|
|
89
|
+
"Gencow mutation을 호출합니다. 예: name='tasks.create', args={ title: '새 태스크' }. RPC 방식: POST /api/mutation",
|
|
90
|
+
inputSchema: {
|
|
91
|
+
type: "object",
|
|
92
|
+
required: ["name"],
|
|
93
|
+
properties: {
|
|
94
|
+
name: {
|
|
95
|
+
type: "string",
|
|
96
|
+
description: "Mutation name (dot notation), e.g. 'tasks.create', 'tasks.update', 'tasks.delete'",
|
|
93
97
|
},
|
|
98
|
+
args: {
|
|
99
|
+
type: "object",
|
|
100
|
+
description: "Mutation arguments as JSON object",
|
|
101
|
+
additionalProperties: true,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
94
104
|
},
|
|
105
|
+
},
|
|
95
106
|
];
|
|
96
107
|
|
|
97
108
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));
|
|
98
109
|
|
|
99
110
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
} catch (err) {
|
|
121
|
-
return { content: [{ type: "text", text: `Error: ${err.message}` }], isError: true };
|
|
111
|
+
const { name: toolName, arguments: toolArgs } = request.params;
|
|
112
|
+
|
|
113
|
+
try {
|
|
114
|
+
switch (toolName) {
|
|
115
|
+
case "list_apis": {
|
|
116
|
+
// Use the health endpoint which returns queries list
|
|
117
|
+
const info = await fetchJSON("/");
|
|
118
|
+
return { content: [{ type: "text", text: JSON.stringify(info, null, 2) }] };
|
|
119
|
+
}
|
|
120
|
+
case "call_query": {
|
|
121
|
+
const result = await postJSON("/api/query", { name: toolArgs.name, args: toolArgs.args || {} });
|
|
122
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
123
|
+
}
|
|
124
|
+
case "call_mutation": {
|
|
125
|
+
const result = await postJSON("/api/mutation", { name: toolArgs.name, args: toolArgs.args || {} });
|
|
126
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
127
|
+
}
|
|
128
|
+
default:
|
|
129
|
+
return { content: [{ type: "text", text: `Unknown tool: ${toolName}` }], isError: true };
|
|
122
130
|
}
|
|
131
|
+
} catch (err) {
|
|
132
|
+
return { content: [{ type: "text", text: `Error: ${err.message}` }], isError: true };
|
|
133
|
+
}
|
|
123
134
|
});
|
|
124
135
|
|
|
125
136
|
// ── Resources ───────────────────────────────────────────
|
|
126
137
|
|
|
127
138
|
const RESOURCES = [
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
139
|
+
{
|
|
140
|
+
uri: "gencow://api-list",
|
|
141
|
+
name: "api-list",
|
|
142
|
+
description: "List of all registered API queries and server information",
|
|
143
|
+
mimeType: "application/json",
|
|
144
|
+
},
|
|
134
145
|
];
|
|
135
146
|
|
|
136
147
|
server.setRequestHandler(ListResourcesRequestSchema, async () => ({ resources: RESOURCES }));
|
|
137
148
|
|
|
138
149
|
server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
default:
|
|
147
|
-
throw new Error(`Unknown resource: ${uri}`);
|
|
150
|
+
const { uri } = request.params;
|
|
151
|
+
|
|
152
|
+
switch (uri) {
|
|
153
|
+
case "gencow://api-list": {
|
|
154
|
+
const info = await fetchJSON("/");
|
|
155
|
+
return { contents: [{ uri, mimeType: "application/json", text: JSON.stringify(info, null, 2) }] };
|
|
148
156
|
}
|
|
157
|
+
default:
|
|
158
|
+
throw new Error(`Unknown resource: ${uri}`);
|
|
159
|
+
}
|
|
149
160
|
});
|
|
150
161
|
|
|
151
162
|
// ── Start ───────────────────────────────────────────────
|