mimi-seed 0.2.3 → 0.2.4

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.
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/mcp-client.ts
4
+ async function mcpCall(endpoint, token, name, args) {
5
+ const res = await fetch(endpoint, {
6
+ method: "POST",
7
+ headers: {
8
+ "Content-Type": "application/json",
9
+ Accept: "application/json, text/event-stream",
10
+ Authorization: `Bearer ${token}`
11
+ },
12
+ body: JSON.stringify({
13
+ jsonrpc: "2.0",
14
+ id: 1,
15
+ method: "tools/call",
16
+ params: { name, arguments: args }
17
+ })
18
+ });
19
+ const contentType = res.headers.get("content-type") ?? "";
20
+ let payload;
21
+ if (contentType.includes("text/event-stream")) {
22
+ const text2 = await res.text();
23
+ const line = text2.split("\n").map((l) => l.trim()).find((l) => l.startsWith("data:"));
24
+ if (!line) throw new Error("MCP SSE \uC751\uB2F5\uC5D0 data \uC5C6\uC74C");
25
+ payload = JSON.parse(line.slice(5).trim());
26
+ } else {
27
+ payload = await res.json();
28
+ }
29
+ if (payload.error) {
30
+ return { text: payload.error.message, isError: true };
31
+ }
32
+ const content = payload.result?.content ?? [];
33
+ const text = content.filter((c) => c.type === "text").map((c) => c.text ?? "").join("\n");
34
+ return { text, isError: payload.result?.isError ?? false };
35
+ }
36
+
37
+ export {
38
+ mcpCall
39
+ };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  mcpCall
4
- } from "./chunk-FW4DVFZD.js";
4
+ } from "./chunk-Q5YGYAFK.js";
5
5
 
6
6
  // src/index.ts
7
7
  import os2 from "os";
@@ -1058,7 +1058,7 @@ async function cmdDeploy(argv) {
1058
1058
  }
1059
1059
  let appId = args.appId;
1060
1060
  if (!appId) {
1061
- const { mcpCall: mcpCall2 } = await import("./mcp-client-U3CS5OZN.js");
1061
+ const { mcpCall: mcpCall2 } = await import("./mcp-client-26VCPY4L.js");
1062
1062
  const r = await mcpCall2(cfg.endpoint, cfg.token, "list_apps", {});
1063
1063
  if (!r.isError) {
1064
1064
  try {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  mcpCall
4
- } from "./chunk-FW4DVFZD.js";
4
+ } from "./chunk-Q5YGYAFK.js";
5
5
  export {
6
6
  mcpCall
7
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mimi-seed",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Mimi Seed CLI — Claude Code에서 앱 출시 운영을 관리합니다.",
5
5
  "bin": {
6
6
  "mimi-seed": "dist/index.js"
@@ -1,57 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/mcp-client.ts
4
- async function postMcp(endpoint, token, body, sessionId) {
5
- const headers = {
6
- "Content-Type": "application/json",
7
- Accept: "application/json, text/event-stream",
8
- Authorization: `Bearer ${token}`
9
- };
10
- if (sessionId) headers["Mcp-Session-Id"] = sessionId;
11
- const res = await fetch(endpoint, { method: "POST", headers, body: JSON.stringify(body) });
12
- const newSession = res.headers.get("Mcp-Session-Id") ?? sessionId ?? null;
13
- const contentType = res.headers.get("content-type") ?? "";
14
- let payload;
15
- if (contentType.includes("text/event-stream")) {
16
- const text = await res.text();
17
- const line = text.split("\n").map((l) => l.trim()).find((l) => l.startsWith("data:"));
18
- if (!line) throw new Error("MCP SSE \uC751\uB2F5\uC5D0 data \uC5C6\uC74C");
19
- payload = JSON.parse(line.slice(5).trim());
20
- } else {
21
- payload = await res.json();
22
- }
23
- return { payload, sessionId: newSession };
24
- }
25
- async function mcpCall(endpoint, token, name, args) {
26
- const { payload: initPayload, sessionId } = await postMcp(endpoint, token, {
27
- jsonrpc: "2.0",
28
- id: 1,
29
- method: "initialize",
30
- params: {
31
- protocolVersion: "2024-11-05",
32
- capabilities: {},
33
- clientInfo: { name: "mimi-seed-cli", version: "1.0.0" }
34
- }
35
- });
36
- if (initPayload.error) throw new Error(`MCP init \uC2E4\uD328: ${initPayload.error.message}`);
37
- await postMcp(endpoint, token, {
38
- jsonrpc: "2.0",
39
- method: "notifications/initialized"
40
- }, sessionId ?? void 0).catch(() => null);
41
- const { payload } = await postMcp(endpoint, token, {
42
- jsonrpc: "2.0",
43
- id: 2,
44
- method: "tools/call",
45
- params: { name, arguments: args }
46
- }, sessionId ?? void 0);
47
- if (payload.error) {
48
- return { text: payload.error.message, isError: true };
49
- }
50
- const content = payload.result?.content ?? [];
51
- const text = content.filter((c) => c.type === "text").map((c) => c.text ?? "").join("\n");
52
- return { text, isError: payload.result?.isError ?? false };
53
- }
54
-
55
- export {
56
- mcpCall
57
- };